|
Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
|
Central container for all entities and components. More...
#include <Registry.hpp>
Public Types | |
| using | DestroyCallback = std::function<void(Entity)> |
Public Member Functions | |
| Registry ()=default | |
| ~Registry ()=default | |
| Registry (const Registry &)=delete | |
| Registry & | operator= (const Registry &)=delete |
| Registry (Registry &&) noexcept=default | |
| Registry & | operator= (Registry &&) noexcept=default |
| u64 | instanceId () const |
| Which registry this is — unique for the process, never reused. | |
| bool | setEntityEnabled (Entity e, bool enabled) |
| bool | isEntityEnabled (Entity e) const |
| bool | isEntityActive (Entity e) const |
| bool | hasInactiveEntities () const |
| u32 | activityEpoch () const |
| void | invalidateActivityHierarchy (Entity root=INVALID_ENTITY) |
| u32 | watchEntityChanges () |
| void | unwatchEntityChanges (u32 reader) |
| double | entityChangeSequence () const |
| double | entityChangeResetEpoch () const |
| double | componentMutationRevision (u32 component, bool topology) const |
| i32 | readEntityChanges (double after, std::span< EntityChangeRow > output) const |
| void | recordEntityChange (Entity entity, u32 flags=0, u32 component=ENTITY_CHANGE_NO_COMPONENT) |
| u32 | changeTick () const |
| The tick a write made now is stamped with. | |
| u64 | identity () const |
| Which registry this is, never shared with another made in this process (a registry assigned over this one brings its own). Ticks and entities are each registry's own, so a reader that keeps what it derived from one asks this before trusting a tick or an entity it kept. | |
| u32 | beginChangeRead () |
| For a reader about to look: the tick it is looking at, after which the clock moves on. | |
| template<typename T> | |
| T & | patch (Entity entity) |
Mutable access that says it writes: entity's T, stamped. Fatal where it has none, as get<T>() is. | |
| template<typename T> | |
| void | markChanged (Entity entity) |
Says entity's T was written, through a reference held from before. | |
| void | markChangedById (u32 typeId, Entity entity) |
| markChanged by a component type id (componentTypeId): for a writer that names the type at run time, a script. | |
| template<typename T> | |
| bool | changedSince (Entity entity, u32 tick) const |
Whether entity's T was written, added or replaced after tick (an answer of beginChangeRead). | |
| bool | changedSinceById (u32 typeId, Entity entity, u32 tick) const |
| changedSince by a component type id (componentTypeId), for a reader that names the type at run time. | |
| template<typename T> | |
| bool | anyChangedSince (u32 tick) const |
Whether any T was written, added or removed after tick: the question a frame that may skip its walk asks first. | |
| template<typename T, typename Visit> | |
| bool | anyChangedSinceWhere (u32 tick, Visit &&visit) const |
Calls visit(entity) for each T written or added after tick, until it returns true; returns whether one did. | |
| template<typename Visit> | |
| bool | anyComponentChangedSinceWhere (u32 tick, Visit &&visit) const |
anyChangedSinceWhere over every component type: calls visit(entity) for each component written or added after tick, whatever its type, until it returns true. A removal leaves nothing to visit; the entity change journal has it. | |
| template<typename T> | |
| u32 | poolVersion () const |
| T's pool version: moves when a T is removed or the pool's storage moves (SparseSetBase::version). 0 with no pool. | |
| template<typename T, typename Visit> | |
| void | eachChangedSince (u32 tick, Visit &&visit) |
Calls visit(entity, component) for each T written, added or replaced after tick, in storage order. | |
| template<typename T> | |
| usize | countOf () const |
| How many entities have a T. | |
| template<typename T> | |
| u32 | lastChangedTick () const |
| The tick of the latest write, addition or removal of any T; 0 when there has been none. | |
| void | setChangeAudit (bool enabled) |
| Turns the change audit on or off. On, auditChanges() compares every auditable component with the copy it kept and reports each one whose bytes changed with no stamp to say so — a write some consumer will never see. | |
| bool | changeAuditEnabled () const |
| u32 | auditChanges () |
| Compares, reports, and keeps a new copy. | |
| u32 | changeAuditTotal () const |
| Unstamped writes the audit has found since it was turned on. | |
| template<class... C> | |
| auto | activeView () |
| Entity | create () |
| Creates a new entity. | |
| std::vector< Entity > | create (usize count) |
| Creates multiple entities at once. | |
| Entity | restore (u32 index) |
| Restores an entity at a specific index. | |
| bool | reserveDestruction (Entity entity) |
| void | releaseDestruction (Entity entity) |
| bool | destructionPending (Entity entity) const |
| void | destroy (Entity entity) |
| Destroys an entity and removes all its components. | |
| Connection | onDestroy (DestroyCallback callback) |
| Subscribe to entity destruction. | |
| bool | valid (Entity entity) const |
| Checks if an entity is currently valid. | |
| usize | entityCount () const |
| const ExclusiveRelation & | childOf () const |
| The (ChildOf, parent) relation: each entity's parent, and each parent's children in order. | |
| ExclusiveRelation & | childOf () |
| u32 | retiredSlots () const |
| Slots permanently out of circulation, their generation spent. | |
| template<typename Func> | |
| void | forEachEntity (Func &&func) const |
| Executes a function for each valid entity. | |
| template<typename T, typename... Args> | |
| T & | emplace (Entity entity, Args &&... args) |
| Adds a component to an entity with in-place construction. | |
| template<typename T, typename... Args> | |
| T & | emplaceOrReplace (Entity entity, Args &&... args) |
| Adds or replaces a component on an entity. | |
| template<typename T> | |
| void | remove (Entity entity) |
| Removes a component from an entity. | |
| template<typename T> | |
| T & | get (Entity entity) |
| Gets a component from an entity (must exist). | |
| template<typename T> | |
| const T & | get (Entity entity) const |
| Gets a component from an entity (must exist). | |
| template<typename T> | |
| T * | tryGet (Entity entity) |
| Tries to get a component from an entity. | |
| template<typename T> | |
| const T * | tryGet (Entity entity) const |
| Tries to get a component from an entity. | |
| template<typename T, typename... Args> | |
| T & | getOrEmplace (Entity entity, Args &&... args) |
| Gets an existing component or creates a new one. | |
| template<typename T> | |
| bool | has (Entity entity) const |
| Checks if an entity has a specific component. | |
| template<typename... Ts> | |
| bool | hasAll (Entity entity) const |
| Checks if an entity has all specified components. | |
| template<typename... Ts> | |
| bool | hasAny (Entity entity) const |
| Checks if an entity has any of the specified components. | |
| template<typename... Components> | |
| View< Components... > | view () |
| Creates a view for iterating entities with specific components. | |
| void | clear () |
| Clears all entities and components. | |
| void | applyEntityOrder (const Entity *order, usize count) |
| Reorders every component pool to follow the given entity order. | |
| std::vector< u32 > | buildEntityRank (const Entity *order, usize count) const |
| Rank table (by Entity::index()) for an ordered entity list. | |
| double | layoutEpoch () const |
| Sum of every pool's version — one number for "did anything move". | |
| void | applyEntityRank (const std::vector< u32 > &rank) |
| Reorders every component pool by a rank table from buildEntityRank. | |
| template<typename... Components, typename Func> | |
| void | each (Func &&func) |
| Executes a function for each entity with specified components. | |
| template<typename... Components, typename Func> | |
| void | eachLive (Func &&func) |
| each() without the per-call snapshot copy, for read-only passes. | |
| template<typename T, typename Compare> | |
| void | sort (Compare compare) |
| Sorts components by a comparison function. | |
| template<typename T> | |
| std::span< const Entity > | entitiesWith () const |
| The entities that carry T, densely. | |
Central container for all entities and components.
The Registry provides:
Definition at line 73 of file Registry.hpp.
| using esengine::ecs::Registry::DestroyCallback = std::function<void(Entity)> |
Definition at line 499 of file Registry.hpp.
|
default |
Referenced by Registry(), Registry(), activeView(), auditChanges(), operator=(), and operator=().
|
default |
|
delete |
References Registry().
|
defaultnoexcept |
References Registry().
|
inline |
Definition at line 355 of file Registry.hpp.
References Registry(), and view().
Referenced by esengine::RenderFrame::processMasks(), esengine::registry_getCanvasEntity(), esengine::particle::ParticleSystem::update(), esengine::springbone::SpringBoneSystem::update(), and esengine::trail::TrailSystem::update().
|
inline |
Definition at line 122 of file Registry.hpp.
Referenced by esengine::MeshPlugin::castInputs(), EMSCRIPTEN_BINDINGS(), and esengine::ecs::UISystem::hitInputsChanged().
|
inline |
Whether any T was written, added or removed after tick: the question a frame that may skip its walk asks first.
Definition at line 220 of file Registry.hpp.
References esengine::ecs::tickAfter().
Referenced by esengine::MeshPlugin::castInputs(), and esengine::ecs::UISystem::hitInputsChanged().
|
inline |
Calls visit(entity) for each T written or added after tick, until it returns true; returns whether one did.
A pass over the stamps alone, which sit in one array beside the components: the answer to "did any of the many that changed matter to me" without a lookup per component. A removal leaves nothing to visit (anyChangedSince sees it).
Definition at line 232 of file Registry.hpp.
References esengine::ecs::tickAfter().
Referenced by esengine::MeshPlugin::castInputs().
|
inline |
anyChangedSinceWhere over every component type: calls visit(entity) for each component written or added after tick, whatever its type, until it returns true. A removal leaves nothing to visit; the entity change journal has it.
Definition at line 248 of file Registry.hpp.
References esengine::ecs::tickAfter().
Reorders every component pool to follow the given entity order.
| order | Entities in the desired iteration order (first iterates first) |
| count | How many entries order holds |
Component storage order IS iteration order, and iteration order is the renderer's painter order within a sorting layer — so a scene's authored entity order only reaches the draw list because a load happens to spawn in that order. This applies an order to a registry that is already populated: the same picture, without respawning anything (entity ids, component values, and every subsystem keyed on them survive untouched).
Entities absent from order keep their relative order after the listed ones. Pools already in the requested order are left alone, so a redundant call costs a scan and bumps no pool version.
Definition at line 818 of file Registry.hpp.
References applyEntityRank(), and buildEntityRank().
|
inline |
Reorders every component pool by a rank table from buildEntityRank.
Definition at line 862 of file Registry.hpp.
Referenced by applyEntityOrder(), and esengine::ecs::applySceneEntityOrder().
|
inline |
Compares, reports, and keeps a new copy.
Each component type is named in the log the first time one of its writes goes unstamped, with the entity; every one is counted. A type that can be neither copied as bytes nor compared is named once, at the first audit, as unchecked.
Definition at line 314 of file Registry.hpp.
References Registry(), beginChangeRead(), ES_LOG_INFO, ES_LOG_WARN, esengine::INVALID_ENTITY, and esengine::sink().
Referenced by EMSCRIPTEN_BINDINGS(), and setChangeAudit().
|
inline |
For a reader about to look: the tick it is looking at, after which the clock moves on.
Keep the answer; next time, changedSince(it) is what was written since this look. Stamps older than half the counter's range are lifted on the way, so an untouched component never reads as newer once the tick wraps.
Definition at line 173 of file Registry.hpp.
Referenced by auditChanges(), esengine::MeshPlugin::castInputs(), EMSCRIPTEN_BINDINGS(), esengine::ecs::UISystem::hitInputsChanged(), esengine::RenderFrame::keepScreenOverlay(), and esengine::RenderFrame::submitScreenOverlay().
|
inline |
Rank table (by Entity::index()) for an ordered entity list.
Split out of applyEntityOrder so a caller that ranks other entity lists too — child lists, in applySceneEntityOrder — builds it once. Unlisted entities read SparseSetBase::UNRANKED.
Definition at line 829 of file Registry.hpp.
References esengine::Entity::index(), and esengine::ecs::SparseSetBase::UNRANKED.
Referenced by applyEntityOrder(), and esengine::ecs::applySceneEntityOrder().
|
inline |
Definition at line 307 of file Registry.hpp.
Referenced by esengine::RenderFrame::keepScreenOverlay().
|
inline |
Unstamped writes the audit has found since it was turned on.
Definition at line 353 of file Registry.hpp.
Referenced by EMSCRIPTEN_BINDINGS().
|
inline |
Whether entity's T was written, added or replaced after tick (an answer of beginChangeRead).
Definition at line 207 of file Registry.hpp.
References esengine::ecs::tickAfter().
Referenced by esengine::ecs::UISystem::hitInputsChanged().
changedSince by a component type id (componentTypeId), for a reader that names the type at run time.
Definition at line 213 of file Registry.hpp.
References esengine::ecs::tickAfter().
Referenced by EMSCRIPTEN_BINDINGS().
|
inline |
The tick a write made now is stamped with.
Definition at line 159 of file Registry.hpp.
Referenced by EMSCRIPTEN_BINDINGS().
|
inline |
Definition at line 535 of file Registry.hpp.
|
inline |
The (ChildOf, parent) relation: each entity's parent, and each parent's children in order.
The authority on the hierarchy. Edit it through setParent / destroyWithChildren / applySceneEntityOrder, which also keep the Parent and Children components that scripts and scene files read.
Definition at line 534 of file Registry.hpp.
Referenced by esengine::ecs::applySceneEntityOrder(), esengine::ecs::destroyWithChildren(), esengine::ecs::getRoot(), esengine::ecs::isDescendantOf(), esengine::ecs::setParent(), and esengine::ecs::syncHierarchyComponents().
|
inline |
Clears all entities and components.
Resets the registry to its initial empty state.
Definition at line 778 of file Registry.hpp.
References esengine::ecs::ENTITY_CHANGE_RESET, esengine::INVALID_ENTITY, and recordEntityChange().
|
inline |
Definition at line 134 of file Registry.hpp.
Referenced by esengine::registry_componentMutationRevision().
|
inline |
How many entities have a T.
Definition at line 284 of file Registry.hpp.
Referenced by esengine::MeshPlugin::castInputs().
|
inline |
Creates a new entity.
Recycles previously destroyed entities when available. New entities are allocated sequentially when no recycled entities exist.
Definition at line 371 of file Registry.hpp.
Referenced by create(), esengine::animation::TweenSystem::createTween(), EMSCRIPTEN_BINDINGS(), esengine::renderer_renderMaterialPreview(), and esengine::renderer_renderMeshPreview().
Creates multiple entities at once.
| count | Number of entities to create |
Definition at line 390 of file Registry.hpp.
References create().
|
inline |
Destroys an entity and removes all its components.
| entity | The entity to destroy |
The entity ID is recycled for future use. All components attached to the entity are removed.
Definition at line 449 of file Registry.hpp.
References esengine::ecs::ENTITY_CHANGE_SUBTREE, ES_LOG_TRACE, esengine::Entity::GEN_MASK, esengine::Entity::index(), esengine::ecs::invalidateTransformComposition(), esengine::Entity::raw, recordEntityChange(), and valid().
Referenced by esengine::aot::applyCommands(), esengine::ecs::destroyWithChildren(), EMSCRIPTEN_BINDINGS(), and esengine::animation::TweenSystem::update().
|
inline |
Definition at line 436 of file Registry.hpp.
References esengine::Entity::generation(), and esengine::Entity::index().
Referenced by esengine::ecs::destroyWithChildren(), EMSCRIPTEN_BINDINGS(), and esengine::ecs::setParent().
|
inline |
Executes a function for each entity with specified components.
| Components | The required component types |
| Func | The callback type |
| func | Callback receiving (Entity, Component&...) |
Definition at line 881 of file Registry.hpp.
References each(), and view().
Referenced by esengine::ecs::canvasRoots(), each(), and esengine::RenderFrame::keepScreenOverlay().
|
inline |
Calls visit(entity, component) for each T written, added or replaced after tick, in storage order.
One pass down the pool's dense arrays (entities, components, stamps side by side), so a visit is handed its component without a lookup. visit must not add or remove a T.
Definition at line 271 of file Registry.hpp.
References esengine::ecs::tickAfter().
|
inline |
each() without the per-call snapshot copy, for read-only passes.
Definition at line 890 of file Registry.hpp.
References eachLive(), and view().
Referenced by esengine::ecs::applySceneEntityOrder(), eachLive(), and esengine::ecs::UISystem::hitInputsChanged().
|
inline |
Adds a component to an entity with in-place construction.
| T | The component type |
| Args | Constructor argument types |
| entity | The target entity |
| args | Arguments forwarded to T's constructor |
Definition at line 576 of file Registry.hpp.
References esengine::componentTypeId(), ES_VERIFY_FATAL, esengine::Entity::index(), and valid().
Referenced by esengine::animation::TweenSystem::createTween(), esengine::renderer_renderMaterialPreview(), esengine::renderer_renderMeshPreview(), esengine::ecs::setParent(), and esengine::ecs::syncHierarchyComponents().
|
inline |
Adds or replaces a component on an entity.
| T | The component type |
| Args | Constructor argument types |
| entity | The target entity |
| args | Arguments forwarded to T's constructor |
If the entity already has the component, it is replaced.
Definition at line 599 of file Registry.hpp.
References esengine::componentTypeId(), esengine::ecs::ENTITY_CHANGE_REPLACED, ES_VERIFY_FATAL, esengine::Entity::index(), and valid().
Referenced by EMSCRIPTEN_BINDINGS().
|
inline |
The entities that carry T, densely.
What View narrows to internally, opened for a caller that assembles its query at run time from NAMES, as the AOT host does. Empty means nobody has it — never "ask everybody".
Definition at line 931 of file Registry.hpp.
Referenced by esengine::aot::engineComponentCandidates().
|
inline |
Definition at line 131 of file Registry.hpp.
Referenced by esengine::registry_entityChangeResetEpoch().
|
inline |
Definition at line 130 of file Registry.hpp.
Referenced by esengine::RenderFrame::keepScreenOverlay(), and esengine::registry_entityChangeSequence().
|
inline |
Definition at line 525 of file Registry.hpp.
Referenced by EMSCRIPTEN_BINDINGS().
|
inline |
Executes a function for each valid entity.
| Func | The callback type |
| func | Callback receiving Entity |
Definition at line 552 of file Registry.hpp.
References esengine::Entity::make().
|
inline |
Gets a component from an entity (must exist).
| T | The component type |
| entity | The target entity |
Definition at line 649 of file Registry.hpp.
References ES_VERIFY_FATAL.
Referenced by esengine::anim_createTween(), esengine::ecs::assignRenderOrder(), esengine::animation::TweenSystem::cancelAllTweens(), esengine::ecs::destroyWithChildren(), esengine::particle::ParticleSystem::emitAt(), EMSCRIPTEN_BINDINGS(), esengine::ecs::UISystem::hitTestUpdate(), esengine::ecs::isClippedByMask(), esengine::ecs::UISystem::pickAll(), esengine::RenderFrame::processMasks(), esengine::registry_batchSyncPhysicsTransforms(), esengine::registry_readWorldPoses2D(), esengine::renderer_entityVisibleToCamera(), esengine::renderer_renderMaterialPreview(), esengine::renderer_submitSkeletalBatchByEntityEx(), esengine::particle::ParticleSystem::resolveCollisions(), esengine::ecs::syncHierarchyComponents(), esengine::ecs::uiRenderOrderUpdate(), esengine::animation::TweenSystem::update(), and esengine::springbone::SpringBoneSystem::update().
|
inline |
Gets a component from an entity (must exist).
| T | The component type |
| entity | The target entity |
Definition at line 657 of file Registry.hpp.
References ES_VERIFY_FATAL.
|
inline |
Gets an existing component or creates a new one.
| T | The component type |
| Args | Constructor argument types (for new component) |
| entity | The target entity |
| args | Arguments forwarded to T's constructor if creating |
Definition at line 691 of file Registry.hpp.
References esengine::componentTypeId(), ES_VERIFY_FATAL, esengine::Entity::index(), and valid().
|
inline |
Checks if an entity has a specific component.
| T | The component type to check |
| entity | The entity to check |
Definition at line 711 of file Registry.hpp.
Referenced by esengine::ecs::assignRenderOrder(), esengine::ecs::canvasRoots(), esengine::MeshPlugin::castInputs(), esengine::ecs::copyFlatRenderMatrix(), esengine::ecs::destroyWithChildren(), esengine::particle::ParticleSystem::emitAt(), EMSCRIPTEN_BINDINGS(), hasAll(), hasAny(), esengine::ecs::hasFlatGeometryArea(), esengine::ecs::UISystem::hitTestUpdate(), esengine::ecs::isClippedByMask(), esengine::ecs::UISystem::pickAll(), esengine::ecs::pointInTransformedBox(), esengine::registry_batchSyncPhysicsTransforms(), esengine::registry_readWorldPoses2D(), esengine::renderer_entityVisibleToCamera(), esengine::renderer_submitSkeletalBatchByEntityEx(), esengine::particle::ParticleSystem::resolveCollisions(), esengine::ecs::setParent(), and esengine::ecs::syncHierarchyComponents().
|
inline |
Checks if an entity has all specified components.
| Ts | The component types to check |
| entity | The entity to check |
Definition at line 723 of file Registry.hpp.
References has().
|
inline |
Checks if an entity has any of the specified components.
| Ts | The component types to check |
| entity | The entity to check |
Definition at line 734 of file Registry.hpp.
References has().
|
inline |
Definition at line 121 of file Registry.hpp.
Referenced by EMSCRIPTEN_BINDINGS().
|
inline |
Which registry this is, never shared with another made in this process (a registry assigned over this one brings its own). Ticks and entities are each registry's own, so a reader that keeps what it derived from one asks this before trusting a tick or an entity it kept.
Definition at line 166 of file Registry.hpp.
Referenced by esengine::MeshPlugin::castInputs(), esengine::ecs::UISystem::hitInputsChanged(), and esengine::RenderFrame::keepScreenOverlay().
|
inline |
Which registry this is — unique for the process, never reused.
Entity ids are only meaningful WITHIN a registry: a fresh one hands out 1, 2, 3 again, so anything caching per entity across registries (a scene reload, an editor play/stop) would silently serve the previous world's data for the new world's entities. Comparing addresses cannot answer this — a destroyed registry's storage is routinely reused by the next one. Systems that keep per-entity state hold this alongside it and drop the lot when it changes; see UISystem's retained Yoga nodes.
Definition at line 96 of file Registry.hpp.
References instanceId().
Referenced by esengine::ecs::TransformSystem::ensureComposed(), instanceId(), esengine::ecs::UISystem::isScreenDomain(), and esengine::ecs::UISystem::layoutUpdate().
|
inline |
Definition at line 123 of file Registry.hpp.
References esengine::ecs::ENTITY_CHANGE_RESET, esengine::ecs::ENTITY_CHANGE_SUBTREE, esengine::INVALID_ENTITY, and recordEntityChange().
Referenced by esengine::ecs::setParent().
|
inline |
Definition at line 115 of file Registry.hpp.
References esengine::Entity::index(), and valid().
Referenced by EMSCRIPTEN_BINDINGS(), esengine::ecs::UISystem::hitTestUpdate(), esengine::ecs::UISystem::pickAll(), esengine::registry_readWorldPoses2D(), esengine::renderer_submitSkeletalBatchByEntityEx(), and esengine::animation::TweenSystem::update().
|
inline |
Definition at line 111 of file Registry.hpp.
References esengine::Entity::index(), and valid().
Referenced by EMSCRIPTEN_BINDINGS().
|
inline |
The tick of the latest write, addition or removal of any T; 0 when there has been none.
Definition at line 291 of file Registry.hpp.
|
inline |
Sum of every pool's version — one number for "did anything move".
A holder of RAW ADDRESSES (the AOT row table) needs one cheap question, and one that covers pools it never asked about: a C++ insert moves that pool with no JS call in it. u64 so it cannot wrap onto a value already seen; double because JS takes that.
Definition at line 853 of file Registry.hpp.
Referenced by esengine::registryLayoutEpoch().
|
inline |
Says entity's T was written, through a reference held from before.
Definition at line 196 of file Registry.hpp.
Referenced by esengine::animation::applyTweenValue(), esengine::animation::TweenSystem::cancelAllTweens(), esengine::animation::TweenSystem::cancelTween(), esengine::animation::markUIAnimOverride(), esengine::meshInstances_set(), esengine::animation::TweenSystem::pauseTween(), esengine::registry_batchSyncPhysicsTransforms(), esengine::animation::TweenSystem::resumeTween(), esengine::animation::TweenSystem::update(), and esengine::springbone::SpringBoneSystem::update().
markChanged by a component type id (componentTypeId): for a writer that names the type at run time, a script.
Definition at line 201 of file Registry.hpp.
Referenced by EMSCRIPTEN_BINDINGS(), and esengine::registry_markComponentsChanged().
|
inlinenodiscard |
Subscribe to entity destruction.
Definition at line 509 of file Registry.hpp.
References esengine::sink().
Referenced by esengine::particle::ParticleSystem::update(), esengine::springbone::SpringBoneSystem::update(), and esengine::trail::TrailSystem::update().
References Registry().
References Registry().
|
inline |
Mutable access that says it writes: entity's T, stamped. Fatal where it has none, as get<T>() is.
Definition at line 186 of file Registry.hpp.
References ES_VERIFY_FATAL.
Referenced by esengine::ecs::syncHierarchyComponents().
|
inline |
T's pool version: moves when a T is removed or the pool's storage moves (SparseSetBase::version). 0 with no pool.
Definition at line 260 of file Registry.hpp.
|
inline |
Definition at line 137 of file Registry.hpp.
Referenced by esengine::registry_readEntityChanges().
|
inline |
Definition at line 142 of file Registry.hpp.
References esengine::ecs::ENTITY_CHANGE_NO_COMPONENT, and esengine::Entity::id().
Referenced by clear(), destroy(), invalidateActivityHierarchy(), and setEntityEnabled().
|
inline |
Definition at line 428 of file Registry.hpp.
References esengine::Entity::generation(), and esengine::Entity::index().
Referenced by esengine::ecs::destroyWithChildren(), and EMSCRIPTEN_BINDINGS().
|
inline |
Removes a component from an entity.
| T | The component type to remove |
| entity | The target entity |
No-op if the entity doesn't have the component.
Definition at line 625 of file Registry.hpp.
References esengine::componentTypeId(), and esengine::Entity::index().
Referenced by EMSCRIPTEN_BINDINGS(), and esengine::ecs::syncHierarchyComponents().
|
inline |
Internal subtree ownership. Components remain readable for callbacks, but a pending entity cannot receive links or be reserved a second time.
Definition at line 423 of file Registry.hpp.
References esengine::Entity::index(), and valid().
Referenced by esengine::ecs::destroyWithChildren(), and EMSCRIPTEN_BINDINGS().
Restores an entity at a specific index.
| index | The entity index to restore |
Definition at line 404 of file Registry.hpp.
References ES_VERIFY, esengine::Entity::INDEX_MASK, and esengine::INVALID_ENTITY.
|
inline |
Slots permanently out of circulation, their generation spent.
Zero for anything but sustained create/destroy on the same indices. Rising steadily is the signal that churn is eating index space — the price paid so a destroyed entity's handle can never come back as a live one.
Definition at line 544 of file Registry.hpp.
|
inline |
Turns the change audit on or off. On, auditChanges() compares every auditable component with the copy it kept and reports each one whose bytes changed with no stamp to say so — a write some consumer will never see.
A check for tests and gates: it copies every component once per audit.
Definition at line 301 of file Registry.hpp.
References auditChanges().
Referenced by EMSCRIPTEN_BINDINGS().
|
inline |
Definition at line 101 of file Registry.hpp.
References esengine::ecs::ENTITY_CHANGE_SUBTREE, esengine::Entity::index(), recordEntityChange(), and valid().
Referenced by EMSCRIPTEN_BINDINGS().
|
inline |
Sorts components by a comparison function.
| T | The component type to sort |
| Compare | The comparison function type |
| compare | Comparison function returning true if first < second |
Sorts the component pool so iteration order matches the comparison result.
Definition at line 904 of file Registry.hpp.
|
inline |
Tries to get a component from an entity.
| T | The component type |
| entity | The target entity |
Definition at line 670 of file Registry.hpp.
Referenced by esengine::anim_getTweenState(), esengine::anim_setSequenceNext(), esengine::anim_setTweenBezier(), esengine::animation::applyTweenValue(), esengine::ecs::assignRenderOrder(), esengine::animation::TweenSystem::cancelTween(), esengine::ecs::canvasRoots(), esengine::ecs::copyFlatRenderMatrix(), EMSCRIPTEN_BINDINGS(), EMSCRIPTEN_BINDINGS(), esengine::aot::engineComponentAt(), esengine::getUINodeAlphaInTree(), esengine::getUINodeComputedHeight(), esengine::getUINodeComputedWidth(), esengine::getUINodeHiddenInTree(), esengine::ecs::UISystem::hitTestUpdate(), esengine::ecs::isClippedByMask(), esengine::animation::markUIAnimOverride(), esengine::meshInstances_set(), esengine::meshRenderer_makeAllResident(), esengine::meshRenderer_setGeometry(), esengine::meshRenderer_setMaterialAll(), esengine::meshRenderer_setMeshAll(), esengine::animation::TweenSystem::pauseTween(), esengine::ecs::UISystem::pickAll(), esengine::MeshPlugin::prewarm(), esengine::renderer_retainedTextStale(), esengine::renderer_submitSkeletalBatchByEntityEx(), esengine::animation::TweenSystem::resumeTween(), esengine::RenderFrame::submitRetainedText(), esengine::ecs::syncHierarchyComponents(), esengine::ui_getCullBit(), esengine::ui_getRenderOrder(), esengine::uiNode_computedHeight(), esengine::uiNode_computedWidth(), esengine::animation::TweenSystem::update(), and esengine::springbone::SpringBoneSystem::update().
|
inline |
Tries to get a component from an entity.
| T | The component type |
| entity | The target entity |
Definition at line 677 of file Registry.hpp.
|
inline |
Definition at line 129 of file Registry.hpp.
Referenced by esengine::registry_unwatchEntityChanges().
|
inline |
Checks if an entity is currently valid.
| entity | The entity to check |
Definition at line 518 of file Registry.hpp.
References esengine::Entity::generation(), and esengine::Entity::index().
Referenced by esengine::ecs::assignRenderOrder(), esengine::ecs::canvasRoots(), destroy(), esengine::ecs::destroyWithChildren(), esengine::particle::ParticleSystem::emitAt(), emplace(), emplaceOrReplace(), EMSCRIPTEN_BINDINGS(), getOrEmplace(), esengine::ecs::isClippedByMask(), isEntityActive(), isEntityEnabled(), esengine::ecs::UISystem::isScreenDomain(), esengine::ecs::UISystem::pickAll(), esengine::registry_batchSyncPhysicsTransforms(), esengine::registry_readWorldPoses2D(), esengine::renderer_retainedTextStale(), esengine::renderer_submitSkeletalBatchByEntityEx(), reserveDestruction(), esengine::particle::ParticleSystem::resolveCollisions(), setEntityEnabled(), esengine::ecs::setParent(), esengine::RenderFrame::submitRetainedText(), esengine::ecs::syncHierarchyComponents(), and esengine::springbone::SpringBoneSystem::update().
|
inline |
Creates a view for iterating entities with specific components.
| Components | The component types to query |
Definition at line 761 of file Registry.hpp.
Referenced by esengine::ecs::GroupOpacityLookup::GroupOpacityLookup(), activeView(), esengine::animation::TweenSystem::cancelAllTweens(), each(), eachLive(), esengine::ecs::UISystem::layoutUpdate(), esengine::meshRenderer_makeAllResident(), esengine::meshRenderer_setMaterialAll(), esengine::meshRenderer_setMeshAll(), and esengine::animation::TweenSystem::update().
|
inline |
Definition at line 128 of file Registry.hpp.
Referenced by esengine::RenderFrame::keepScreenOverlay(), and esengine::registry_watchEntityChanges().