|
Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
|
Entity identifier with packed index + generation. More...
#include <Types.hpp>
Public Types | |
| using | Layout = PackedId<22, 10> |
Public Member Functions | |
| constexpr | Entity () |
| constexpr | Entity (u32 r) |
| constexpr | operator u32 () const |
| constexpr u32 | index () const |
| Gets the entity index. | |
| constexpr u32 | generation () const |
| Gets the generation number. | |
| constexpr bool | isValid () const |
| Checks if this is not the invalid sentinel. | |
| constexpr u32 | id () const |
| Returns the raw packed value for FFI serialization. | |
| constexpr bool | operator== (Entity other) const |
| constexpr bool | operator!= (Entity other) const |
Static Public Member Functions | |
| static constexpr Entity | fromRaw (u32 v) |
| Reconstructs an Entity from a raw packed value. | |
| static constexpr Entity | make (u32 idx, u32 gen) |
| Creates an Entity from index and generation. | |
Public Attributes | |
| u32 | raw |
Static Public Attributes | |
| static constexpr u32 | INDEX_BITS = Layout::INDEX_BITS |
| static constexpr u32 | GEN_BITS = Layout::GEN_BITS |
| static constexpr u32 | INDEX_MASK = Layout::INDEX_MASK |
| static constexpr u32 | GEN_MASK = Layout::GEN_MASK |
| static constexpr u32 | INVALID_RAW = 0xFFFFFFFF |
Entity identifier with packed index + generation.
Entities pack a 22-bit index and 10-bit generation into a single u32. The generation detects stale references after an entity is destroyed and its index recycled (ABA problem). The bit-packing math lives once in PackedId; this just wires Entity to it.
Layout: [generation(10) | index(22)]
The split is u32 (4 bytes) on purpose — see PackedId.hpp for why (FFI as a plain JS number, box2d 32-bit user-data, dense-array cache behaviour). PackedId's static_assert enforces it.
| using esengine::Entity::Layout = PackedId<22, 10> |
|
inlineconstexpr |
Definition at line 145 of file Types.hpp.
References INVALID_RAW, and raw.
Referenced by fromRaw(), make(), operator!=(), and operator==().
|
inlineexplicitconstexpr |
Reconstructs an Entity from a raw packed value.
Definition at line 162 of file Types.hpp.
References Entity().
Referenced by esengine::anim_cancelAllTweens(), esengine::anim_cancelTween(), esengine::anim_createTween(), esengine::anim_getTweenState(), esengine::anim_pauseTween(), esengine::anim_resumeTween(), esengine::anim_setSequenceNext(), esengine::anim_setTweenBezier(), esengine::aot::applyCommands(), esengine::ecs::ExclusiveRelation::eachSource(), esengine::aot::engineComponentAt(), esengine::ecs::ExclusiveRelation::first(), esengine::getUINodeAlphaInTree(), esengine::getUINodeComputedHeight(), esengine::getUINodeComputedWidth(), esengine::getUINodeHiddenInTree(), esengine::ecs::ExclusiveRelation::isDescendantOf(), esengine::ecs::UISystem::isScreenDomain(), esengine::ecs::ExclusiveRelation::last(), esengine::ecs::ExclusiveRelation::link(), esengine::meshInstances_set(), esengine::meshRenderer_setGeometry(), esengine::ecs::ExclusiveRelation::next(), esengine::ecs::ExclusiveRelation::onDestroy(), esengine::ecs::ExclusiveRelation::prev(), esengine::registry_batchSyncPhysicsTransforms(), esengine::registry_getGeneration(), esengine::registry_markComponentsChanged(), esengine::registry_readWorldPoses2D(), esengine::renderer_clusterInspect(), esengine::renderer_entityVisibleToCamera(), esengine::renderer_lightStatus(), esengine::renderer_lodInspect(), esengine::renderer_retainedTextStale(), esengine::renderer_setEntityDrawOrder(), esengine::renderer_setImpostorAtlas(), esengine::renderer_setLodPreview(), esengine::renderer_setViewSkinWeights(), esengine::renderer_shadowStatus(), esengine::renderer_submitSkeletalBatchByEntityEx(), esengine::renderer_submitTextBatch(), esengine::particle::ParticleSystem::resolveCollisions(), esengine::ecs::UISystem::screenRootOf(), esengine::ecs::ExclusiveRelation::sortSources(), esengine::springbone_release(), esengine::springbone_reset(), esengine::springbone_snapshot(), esengine::RenderFrame::submitRetainedText(), esengine::ecs::ExclusiveRelation::takeRetargeted(), esengine::ecs::ExclusiveRelation::target(), esengine::trail_clear(), esengine::transform_copyFlatRenderMatrix(), esengine::ui_getCullBit(), esengine::ui_getRenderOrder(), esengine::uiNode_computedHeight(), esengine::uiNode_computedWidth(), and esengine::particle::ParticleSystem::update().
|
inlineconstexpr |
Gets the generation number.
Definition at line 153 of file Types.hpp.
References esengine::PackedId< 22, 10 >::generationOf(), and raw.
Referenced by esengine::ecs::Registry::destructionPending(), esengine::registry_getGeneration(), esengine::ecs::Registry::releaseDestruction(), and esengine::ecs::Registry::valid().
|
inlineconstexpr |
Returns the raw packed value for FFI serialization.
Definition at line 159 of file Types.hpp.
References raw.
Referenced by esengine::RenderCollectContext::accepts(), esengine::ClipState::applyTo(), esengine::ecs::assignRenderOrder(), esengine::batchEntityVisible(), esengine::RenderFrame::clusterInspect(), esengine::MeshPlugin::collect(), esengine::ecs::UISystem::hitTestUpdate(), esengine::ClipState::isEmptyScissor(), esengine::ClipState::isStencilMask(), esengine::pushBatchDraw(), esengine::ecs::Registry::recordEntityChange(), esengine::ecs::setParent(), esengine::RenderFrame::submitSkeletalBatch(), esengine::RenderCollectContext::treeLayer(), and esengine::RenderFrame::uiTreeHolds().
|
inlineconstexpr |
Gets the entity index.
Definition at line 150 of file Types.hpp.
References esengine::PackedId< 22, 10 >::indexOf(), and raw.
Referenced by esengine::RenderCollectContext::accepts(), esengine::ecs::assignRenderOrder(), esengine::ecs::Registry::buildEntityRank(), esengine::ecs::ExclusiveRelation::cascadeAt(), esengine::ecs::ExclusiveRelation::depth(), esengine::ecs::Registry::destroy(), esengine::ecs::Registry::destructionPending(), esengine::ecs::ExclusiveRelation::eachSource(), esengine::ecs::Registry::emplace(), esengine::ecs::SparseSet< T >::emplace(), esengine::ecs::Registry::emplaceOrReplace(), esengine::ecs::Registry::getOrEmplace(), esengine::ecs::Registry::isEntityActive(), esengine::ecs::Registry::isEntityEnabled(), esengine::ecs::ExclusiveRelation::link(), esengine::ecs::ExclusiveRelation::onDestroy(), esengine::ecs::Registry::releaseDestruction(), esengine::ecs::Registry::remove(), esengine::ecs::SparseSet< T >::remove(), esengine::ecs::Registry::reserveDestruction(), esengine::ecs::UISystem::screenRootOf(), esengine::ecs::Registry::setEntityEnabled(), esengine::ecs::ExclusiveRelation::sortSources(), esengine::DrawList::treeSequenceOf(), and esengine::ecs::Registry::valid().
|
inlineconstexpr |
Checks if this is not the invalid sentinel.
Definition at line 156 of file Types.hpp.
References INVALID_RAW, and raw.
Referenced by esengine::ecs::destroyWithChildren(), esengine::ecs::setParent(), and esengine::ecs::syncHierarchyComponents().
Creates an Entity from index and generation.
Definition at line 165 of file Types.hpp.
References Entity(), and esengine::PackedId< 22, 10 >::pack().
Referenced by esengine::ecs::Registry::forEachEntity().
|
inlineexplicitconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
staticconstexpr |
|
staticconstexpr |
Definition at line 142 of file Types.hpp.
Referenced by esengine::ecs::Registry::destroy().
|
staticconstexpr |
|
staticconstexpr |
Definition at line 141 of file Types.hpp.
Referenced by esengine::ecs::Registry::restore().
|
staticconstexpr |
| u32 esengine::Entity::raw |
Definition at line 136 of file Types.hpp.
Referenced by Entity(), Entity(), esengine::SkinCache::bufferFor(), esengine::ecs::Registry::destroy(), generation(), esengine::ShadowPlanReport::grantFor(), id(), esengine::RenderFrame::impostorAtlas(), index(), esengine::ecs::ExclusiveRelation::isDescendantOf(), isValid(), esengine::ecs::ExclusiveRelation::link(), operator u32(), operator!=(), operator<<(), operator==(), esengine::LightCapReport::refusalFor(), esengine::SkinCache::schedule(), esengine::RenderFrame::setImpostorAtlas(), and esengine::ecs::ExclusiveRelation::unlink().