Owning detached bitmap plus a non-owning, stale-safe dynamic body link. 更多...
#include <PixelWorldPhysics.h>
Public 成员函数 | |
| ~PixelFragmentBody ()=default | |
| Pixel fragment body. | |
| PixelFragmentBody (PixelFragmentBody &&) noexcept=default | |
| Pixel fragment body. | |
| PixelFragmentBody & | operator= (PixelFragmentBody &&) noexcept=default |
| Operator =. | |
| PixelFragmentBody (const PixelFragmentBody &)=delete | |
| PixelFragmentBody & | operator= (const PixelFragmentBody &)=delete |
| const std::vector< FragmentCollisionRect > & | collisionRects () const noexcept |
| Borrow deterministic collision rectangles for diagnostics until adapter mutation/destruction. | |
| std::uint64_t | fragmentId () const noexcept |
| Detached bitmap id retained by this adapter. | |
| eve::physics::PhysicsLink | physicsLink () const noexcept |
| Process-local physics relationship; resolve it before every use. | |
| bool | isRasterized () const noexcept |
| Whether the bitmap has already returned to authoritative terrain. | |
| eve::Result< FragmentSettleReceipt > | settleIfSleeping (eve::physics::World &physicsWorld, eve::pixelworld::PixelWorld &pixelWorld) |
| If the body sleeps, snap its bitmap to the nearest quarter turn and rasterize it. | |
| eve::Result< void > | releasePhysics (eve::physics::World &physicsWorld) |
| Explicitly destroy a still-live physics body without rasterizing its bitmap. | |
静态 Public 成员函数 | |
| static eve::Result< std::unique_ptr< PixelFragmentBody > > | create (eve::physics::World &world, eve::pixelworld::PixelFragment fragment, FragmentBodyConfig config={}) |
| Create one dynamic Box2D body using deterministic greedy rectangle decomposition. | |
详细描述
Owning detached bitmap plus a non-owning, stale-safe dynamic body link.
PixelWorld remains the only owner of live terrain. This adapter owns the detached bitmap while Physics World owns the body and fixtures. It stores no World/Body raw pointer across calls; every operation resolves PhysicsLink against a caller-borrowed world on the owning simulation thread. No method invokes scripts or unknown callbacks.
在文件 PixelWorldPhysics.h 第 110 行定义.
构造及析构函数说明
◆ ~PixelFragmentBody()
|
default |
Pixel fragment body.
◆ PixelFragmentBody() [1/2]
|
defaultnoexcept |
Pixel fragment body.
◆ PixelFragmentBody() [2/2]
|
delete |
成员函数说明
◆ collisionRects()
|
noexcept |
Borrow deterministic collision rectangles for diagnostics until adapter mutation/destruction.
在文件 PixelWorldPhysics.cpp 第 444 行定义.
◆ create()
|
static |
Create one dynamic Box2D body using deterministic greedy rectangle decomposition.
- 参数
-
world Borrowed Physics world; it owns the created body and fixtures. fragment Owning detached bitmap transferred into the adapter on success. config Finite fixture properties and a positive fixture budget.
- 返回
- Owning adapter; failure destroys any partially created body.
在文件 PixelWorldPhysics.cpp 第 397 行定义.
引用了 body, eve::pixelworld::PixelFragment::cells, eve::pixelworld_physics::FragmentBodyConfig::density, error, eve::Diagnostic::error(), eve::Failed, eve::pixelworld_physics::FragmentBodyConfig::friction, eve::physics::PhysicsLink::fromBody(), eve::pixelworld::PixelFragment::height, eve::pixelworld::PixelFragment::id, eve::InvalidArgument, eve::pixelworld_physics::FragmentBodyConfig::maximumFixtures, eve::physics::Body::newRectangleFixtureAt(), offsetX, offsetY, eve::pixelworld::PixelFragment::originX, eve::pixelworld::PixelFragment::originY, eve::PreconditionViolation, eve::pixelworld_physics::FragmentBodyConfig::restitution, eve::pixelworld::PixelFragment::width , 以及 world.
◆ fragmentId()
|
noexcept |
Detached bitmap id retained by this adapter.
在文件 PixelWorldPhysics.cpp 第 448 行定义.
◆ isRasterized()
|
noexcept |
Whether the bitmap has already returned to authoritative terrain.
在文件 PixelWorldPhysics.cpp 第 450 行定义.
◆ operator=() [1/2]
|
delete |
◆ operator=() [2/2]
|
defaultnoexcept |
Operator =.
◆ physicsLink()
|
noexcept |
Process-local physics relationship; resolve it before every use.
在文件 PixelWorldPhysics.cpp 第 449 行定义.
◆ releasePhysics()
| eve::Result< void > eve::pixelworld_physics::PixelFragmentBody::releasePhysics | ( | eve::physics::World & | physicsWorld | ) |
Explicitly destroy a still-live physics body without rasterizing its bitmap.
- 返回
- Success if already released; stale/foreign world links are reported.
在文件 PixelWorldPhysics.cpp 第 480 行定义.
引用了 eve::Result< T >::failure() , 以及 eve::Result< T >::success().
◆ settleIfSleeping()
| eve::Result< FragmentSettleReceipt > eve::pixelworld_physics::PixelFragmentBody::settleIfSleeping | ( | eve::physics::World & | physicsWorld, |
| eve::pixelworld::PixelWorld & | pixelWorld | ||
| ) |
If the body sleeps, snap its bitmap to the nearest quarter turn and rasterize it.
- 备注
- Physics body destruction occurs only after PixelWorld accepts the entire bitmap. A stale physics/world link or terrain conflict returns failure without changing ownership.
在文件 PixelWorldPhysics.cpp 第 452 行定义.
引用了 body, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::PreconditionViolation, eve::pixelworld::PixelWorld::rasterizeFragment(), eve::Result< T >::success() , 以及 turns.
该类的文档由以下文件生成:
- src/modules/pixelworld/physics/PixelWorldPhysics.h
- src/modules/pixelworld/physics/PixelWorldPhysics.cpp