|
| | CommandBuffer (World &world) |
| | Creates a command buffer bound to world.
|
| |
|
| CommandBuffer (CommandBuffer &&)=delete |
| |
|
| CommandBuffer (const CommandBuffer &)=delete |
| |
|
CommandBuffer & | operator= (CommandBuffer &&)=delete |
| |
|
CommandBuffer & | operator= (const CommandBuffer &)=delete |
| |
| GAIA_NODISCARD Entity | add () |
| | Requests a new entity to be created.
|
| |
| GAIA_NODISCARD Entity | copy (Entity entityFrom) |
| | Requests a new entity to be created by cloning an already existing entity.
|
| |
| GAIA_NODISCARD Entity | instantiate (Entity prefabEntity) |
| | Requests a prefab to be instantiated as a normal entity. Commit replays through World::instantiate, including Prefab removal, the direct Pair(Is, prefab) edge, skipped names, OnInstantiate policies, and recursive prefab children. Non-prefab sources fall back to copy. Exact pair records are a valid source.
|
| |
| GAIA_NODISCARD Entity | instantiate (Entity prefabEntity, Entity parentInstance) |
| | Requests a prefab to be instantiated as a normal entity parented under parentInstance. Commit replays through World::instantiate. Pair(Parent, parentInstance) is attached to the spawned root. Non-prefab sources fall back to a parented copy. Exact pair records are a valid source.
|
| |
| void | instantiate_n (Entity prefabEntity, uint32_t count) |
| | Requests count prefab instantiations. Optimizing buffers group matching records through World::instantiate_n; plain buffers replay each instance.
|
| |
| void | instantiate_n (Entity prefabEntity, Entity parentInstance, uint32_t count) |
| | Requests count prefab instantiations parented under parentInstance.
|
| |
| template<typename Func > |
| void | instantiate_n (Entity prefabEntity, uint32_t count, Func func) |
| | Requests count prefab instantiations and records per-instance commands. The callback runs immediately while recording and receives temporary entity handles, matching add and copy. CopyIter callbacks are World-only.
|
| |
| template<typename Func > |
| void | instantiate_n (Entity prefabEntity, Entity parentInstance, uint32_t count, Func func) |
| | Requests count prefab instantiations parented under parentInstance and records per-instance commands. The callback runs immediately while recording and receives temporary entity handles, matching add and copy. CopyIter callbacks are World-only.
|
| |
| template<typename T > |
| void | add (Entity entity) |
| | Requests a component T to be added to entity.
|
| |
| void | add (Entity entity, Entity other) |
| | Requests an entity other to be added to entity entity.
|
| |
| void | add (Entity entity, const Pair &pair) |
| | Requests a relationship pair to be added to entity entity.
|
| |
| template<typename T > |
| void | add (Entity entity, Entity object, T &&value) |
| | Requests a component identified by object to be added to entity. Also sets its value.
|
| |
| template<typename T > |
| void | add (Entity entity, const Pair &pair, T &&value) |
| | Requests a relationship pair to be added to entity. Also sets its payload.
|
| |
| template<typename T , std::enable_if_t<!is_pair< std::remove_cv_t< std::remove_reference_t< T > > >::value, int > = 0> |
| void | add (Entity entity, T &&value) |
| | Requests a component T to be added to entity. Also sets its value.
|
| |
| template<typename T > |
| void | set (Entity entity, T &&value) |
| | Requests component data to be set to given values for a given entity.
|
| |
| template<typename T > |
| void | set (Entity entity, Entity object, T &&value) |
| | Requests component data identified by object to be set on entity.
|
| |
| template<typename T > |
| void | set (Entity entity, const Pair &pair, T &&value) |
| | Requests relationship payload identified by pair to be set on entity.
|
| |
| void | del (Entity entity) |
| | Requests an existing entity to be removed.
|
| |
| template<typename T > |
| void | del (Entity entity) |
| | Requests removal of component T from entity.
|
| |
| void | del (Entity entity, Entity object) |
| | Requests removal of entity object from entity entity.
|
| |
| void | del (Entity entity, const Pair &pair) |
| | Requests removal of a relationship pair from entity entity.
|
| |
|
void | commit () |
| | Commits all queued changes. Plain buffers replay every request in recorded order, including entity creation and deletion. In optimizing buffers, entity create, copy, and instantiate records are allocated first, then component operations are merged and replayed, then entity deletions are applied. Component groups containing a delete reduce in recorded order from initial membership. Independent table-component groups can share one entity-builder commit before payload replay. Observable or policy-sensitive groups replay through World. Groups with only adds and sets merge using the last payload. Relationship operations retain their order per entity and merge only consecutive requests for the same pair. Optimizing commit does not promise global replay order across entities and components.
|
| |
template<typename AccessContext, bool Optimize>
class gaia::ecs::detail::CommandBuffer< AccessContext, Optimize >
Buffer for deferred execution of some operations on entities.
Adding, removing, copying, or instantiating entities inside World::each can result in changes of archetypes or chunk structure. This would lead to an undefined behavior. Therefore, such operations have to be executed after the loop is done.
- Template Parameters
-
| AccessContext | Access guard. AccessContextST for single-threaded recording, AccessContextMT when multiple threads record into the same buffer. |
| Optimize | Merge and batch operations when true; replay each request in recorded order when false. |