载入中...
搜索中...
未找到
eve::pixelworld_physics::PixelFragmentBody类 参考

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()

eve::pixelworld_physics::PixelFragmentBody::~PixelFragmentBody ( )
default

Pixel fragment body.

◆ PixelFragmentBody() [1/2]

eve::pixelworld_physics::PixelFragmentBody::PixelFragmentBody ( PixelFragmentBody &&  )
defaultnoexcept

Pixel fragment body.

◆ PixelFragmentBody() [2/2]

eve::pixelworld_physics::PixelFragmentBody::PixelFragmentBody ( const PixelFragmentBody &  )
delete

成员函数说明

◆ collisionRects()

const std::vector< FragmentCollisionRect > & eve::pixelworld_physics::PixelFragmentBody::collisionRects ( ) const
noexcept

Borrow deterministic collision rectangles for diagnostics until adapter mutation/destruction.

在文件 PixelWorldPhysics.cpp 第 444 行定义.

◆ create()

eve::Result< std::unique_ptr< PixelFragmentBody > > eve::pixelworld_physics::PixelFragmentBody::create ( eve::physics::World &  world,
eve::pixelworld::PixelFragment  fragment,
FragmentBodyConfig  config = {} 
)
static

Create one dynamic Box2D body using deterministic greedy rectangle decomposition.

参数
worldBorrowed Physics world; it owns the created body and fixtures.
fragmentOwning detached bitmap transferred into the adapter on success.
configFinite 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()

std::uint64_t eve::pixelworld_physics::PixelFragmentBody::fragmentId ( ) const
noexcept

Detached bitmap id retained by this adapter.

在文件 PixelWorldPhysics.cpp 第 448 行定义.

◆ isRasterized()

bool eve::pixelworld_physics::PixelFragmentBody::isRasterized ( ) const
noexcept

Whether the bitmap has already returned to authoritative terrain.

在文件 PixelWorldPhysics.cpp 第 450 行定义.

◆ operator=() [1/2]

PixelFragmentBody & eve::pixelworld_physics::PixelFragmentBody::operator= ( const PixelFragmentBody &  )
delete

◆ operator=() [2/2]

PixelFragmentBody & eve::pixelworld_physics::PixelFragmentBody::operator= ( PixelFragmentBody &&  )
defaultnoexcept

Operator =.

◆ physicsLink()

eve::physics::PhysicsLink eve::pixelworld_physics::PixelFragmentBody::physicsLink ( ) const
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.


该类的文档由以下文件生成: