|
| template<bool WorldVersionUpdateWanted> |
| GAIA_NODISCARD GAIA_FORCEINLINE auto | comp_ptr_mut_gen (uint32_t compIdx, uint32_t row) |
| | Returns a read-write span of the component data. Also updates the world version for the component.
|
| |
|
void | finish_write (uint32_t compIdx, uint16_t from, uint16_t to) |
| | Finishes a raw write over a chunk range by updating versions, running set hooks once, and notifying OnSet observers after the callback completed.
|
| |
|
| Chunk (const Chunk &chunk)=delete |
| |
|
| Chunk (Chunk &&chunk)=delete |
| |
|
Chunk & | operator= (const Chunk &chunk)=delete |
| |
|
Chunk & | operator= (Chunk &&chunk)=delete |
| |
|
void | save (ser::serializer &s) |
| |
|
void | load (ser::serializer &s) |
| |
|
void | remove_last_entity () |
| | Remove the last entity from a chunk. If as a result the chunk becomes empty it is scheduled for deletion.
|
| |
|
void | update_versions () |
| | Updates the version numbers for this chunk.
|
| |
| template<typename T > |
| GAIA_NODISCARD decltype(auto) | view (uint16_t from, uint16_t to) const |
| | Returns a read-only entity or component view.
|
| |
|
template<typename T > |
| GAIA_NODISCARD decltype(auto) | view () const |
| |
|
template<typename T > |
| GAIA_NODISCARD decltype(auto) | view_raw (const void *ptr, uint32_t size) const |
| |
| template<typename T > |
| GAIA_NODISCARD decltype(auto) | view_mut (uint16_t from, uint16_t to) |
| | Returns a mutable entity or component view.
|
| |
|
template<typename T > |
| GAIA_NODISCARD decltype(auto) | view_mut () |
| |
|
template<typename T > |
| GAIA_NODISCARD decltype(auto) | view_mut_raw (void *ptr, uint32_t size) const |
| |
| template<typename T > |
| GAIA_NODISCARD decltype(auto) | sview_mut (uint16_t from, uint16_t to) |
| | Returns a mutable component view. Doesn't update the world version when the access is acquired.
|
| |
|
template<typename T > |
| GAIA_NODISCARD decltype(auto) | sview_mut_raw (void *ptr, uint32_t size) const |
| |
|
template<typename T > |
| GAIA_NODISCARD decltype(auto) | sview_mut () |
| |
| template<typename T > |
| GAIA_FORCEINLINE void | modify () |
| | Marks the component.
|
| |
| template<typename T > |
| GAIA_NODISCARD decltype(auto) | view_auto (uint16_t from, uint16_t to) |
| | Returns either a mutable or immutable entity/component view based on the requested type. Value and const types are considered immutable. Anything else is mutable.
|
| |
|
template<typename T > |
| GAIA_NODISCARD decltype(auto) | view_auto () |
| |
| template<typename T > |
| GAIA_NODISCARD decltype(auto) | sview_auto (uint16_t from, uint16_t to) |
| | Returns either a mutable or immutable entity/component view based on the requested type. Value and const types are considered immutable. Anything else is mutable. Doesn't update the world version when read-write access is acquired.
|
| |
|
template<typename T > |
| GAIA_NODISCARD decltype(auto) | sview_auto () |
| |
|
GAIA_NODISCARD EntitySpan | entity_view () const |
| |
|
GAIA_NODISCARD World & | world () |
| |
|
GAIA_NODISCARD const World & | world () const |
| |
|
GAIA_NODISCARD EntitySpan | ids_view () const |
| |
|
GAIA_NODISCARD std::span< const ComponentRecord > | comp_rec_view () const |
| |
|
GAIA_NODISCARD uint8_t * | comp_ptr_mut (uint32_t compIdx) |
| |
|
GAIA_NODISCARD uint8_t * | comp_ptr_mut (uint32_t compIdx, uint32_t offset) |
| |
|
GAIA_NODISCARD const uint8_t * | comp_ptr (uint32_t compIdx) const |
| |
|
GAIA_NODISCARD const uint8_t * | comp_ptr (uint32_t compIdx, uint32_t offset) const |
| |
| GAIA_NODISCARD uint16_t | add_entity (Entity entity) |
| | Make.
|
| |
| void | move_entity_data (Entity entity, uint16_t row, EntityContainers &recs) |
| | Moves all data associated with entity into the chunk so that it is stored at the row row.
|
| |
| void | remove_entity_inter (uint16_t row, EntityContainers &recs) |
| | Tries to remove the entity at row. Removal is done via swapping with last entity in chunk. Upon removal, all associated data is also removed. If the entity at the given row already is the last chunk entity, it is removed directly.
|
| |
| void | remove_entity (uint16_t row, EntityContainers &recs) |
| | Tries to remove the entity at row row. Removal is done via swapping with last entity in chunk. Upon removal, all associated data is also removed. If the entity at the given row already is the last chunk entity, it is removed directly.
|
| |
| void | swap_chunk_entities (uint16_t rowA, uint16_t rowB, EntityContainers &recs) |
| | Tries to swap the entity at row rowA with the one at the row rowB. When swapping, all data associated with the two entities is swapped as well. If rowA equals rowB no swapping is performed.
|
| |
| void | enable_entity (uint16_t row, bool enableEntity, EntityContainers &recs) |
| | Enables or disables the entity on a given row in the chunk.
|
| |
| bool | enabled (uint16_t row) const |
| | Checks if the entity is enabled.
|
| |
| uint8_t & | data (uint32_t offset) |
| | Returns a mutable pointer to chunk data.
|
| |
| const uint8_t & | data (uint32_t offset) const |
| | Returns an immutable pointer to chunk data.
|
| |
|
void | call_ctor (uint32_t entIdx, const ComponentCacheItem &item) |
| |
|
void | call_gen_ctors (uint32_t entIdx, uint32_t entCnt) |
| |
|
void | call_all_dtors () |
| |
| GAIA_NODISCARD bool | has (Entity entity) const |
| | Checks if a component/entity entity is present in the chunk.
|
| |
| template<typename T > |
| GAIA_NODISCARD bool | has () const |
| | Checks if component T is present in the chunk.
|
| |
| template<typename T > |
| decltype(auto) | set (uint16_t row) |
| | Sets the value of the unique component T on row in the chunk.
|
| |
| template<typename T > |
| decltype(auto) | set_idx (uint16_t row, uint32_t compIdx) |
| | Sets the value of a generic component using a pre-resolved component column.
|
| |
| template<typename T > |
| decltype(auto) | set_idx (uint32_t compIdx) |
| | Sets the value of a unique component using a pre-resolved component column.
|
| |
| template<typename T > |
| decltype(auto) | set (uint16_t row, Entity type) |
| | Sets the value of a generic entity type at the position row in the chunk.
|
| |
| template<typename T > |
| decltype(auto) | sset (uint16_t row) |
| | Sets the value of the unique component T on row in the chunk.
|
| |
| template<typename T > |
| decltype(auto) | sset_idx (uint16_t row, uint32_t compIdx) |
| | Sets the value of a generic component using a pre-resolved component column.
|
| |
| template<typename T > |
| decltype(auto) | sset_idx (uint32_t compIdx) |
| | Sets the value of a unique component using a pre-resolved component column.
|
| |
| template<typename T > |
| decltype(auto) | sset (uint16_t row, Entity type) |
| | Sets the value of a generic entity type at the position row in the chunk.
|
| |
| template<typename T > |
| GAIA_NODISCARD decltype(auto) | get (uint16_t row) const |
| | Returns the value stored in the generic component T on row in the chunk.
|
| |
| template<typename T > |
| GAIA_NODISCARD decltype(auto) | get_idx (uint16_t row, uint32_t compIdx) const |
| | Returns the value stored in the generic component T using a pre-resolved component column.
|
| |
| template<typename T > |
| GAIA_NODISCARD decltype(auto) | get (uint16_t row, Entity type) const |
| | Returns the value stored in the generic component type on row in the chunk.
|
| |
| template<typename T > |
| GAIA_NODISCARD decltype(auto) | get () const |
| | Returns the value stored in the unique component T.
|
| |
| template<typename T > |
| GAIA_NODISCARD decltype(auto) | get_idx (uint32_t compIdx) const |
| | Returns the value stored in the unique component T using a pre-resolved component column.
|
| |
|
template<typename T > |
| GAIA_NODISCARD Entity | comp_entity () const |
| |
| GAIA_NODISCARD uint32_t | comp_idx (Entity entity) const |
| | Returns the internal index of a component based on the provided entity.
|
| |
| GAIA_NODISCARD uint32_t | comp_idx (Entity entity, uint32_t offset) const |
| | Returns the internal index of a component based on the provided entity.
|
| |
|
void | set_idx (uint32_t value) |
| | Sets the index of this chunk in its archetype's storage.
|
| |
|
GAIA_NODISCARD uint32_t | idx () const |
| | Returns the index of this chunk in its archetype's storage.
|
| |
|
GAIA_NODISCARD bool | has_enabled_entities () const |
| | Checks is this chunk has any enabled entities.
|
| |
|
GAIA_NODISCARD bool | has_disabled_entities () const |
| | Checks is this chunk has any disabled entities.
|
| |
|
GAIA_NODISCARD bool | dying () const |
| | Checks is this chunk is dying.
|
| |
|
GAIA_NODISCARD bool | queued_for_deletion () const |
| | Returns true when the chunk is currently queued for deferred deletion.
|
| |
|
GAIA_NODISCARD uint32_t | delete_queue_index () const |
| | Returns the index inside World's deferred chunk-delete queue.
|
| |
|
void | delete_queue_index (uint32_t idx) |
| | Stores the index inside World's deferred chunk-delete queue.
|
| |
|
void | clear_delete_queue_index () |
| | Clears the deferred chunk-delete queue index.
|
| |
|
void | die () |
| | Marks the chunk as dead (ready to delete)
|
| |
|
GAIA_NODISCARD bool | dead () const |
| | Checks is this chunk is dead (ready to delete)
|
| |
|
void | start_dying () |
| | Starts the process of dying (not yet ready to delete, can be revived)
|
| |
|
void | revive () |
| | Makes a dying chunk alive again.
|
| |
| bool | progress_death () |
| | Updates internal lifespan.
|
| |
|
GAIA_NODISCARD bool | full () const |
| | Checks is the full capacity of the has has been reached.
|
| |
|
GAIA_NODISCARD bool | is_semi () const |
| | Checks is the chunk is semi-full.
|
| |
|
GAIA_NODISCARD uint16_t | size () const |
| | Returns the total number of entities in the chunk (both enabled and disabled)
|
| |
|
GAIA_NODISCARD bool | empty () const |
| | Checks is there are any entities in the chunk.
|
| |
|
GAIA_NODISCARD uint16_t | size_enabled () const |
| | Return the number of entities in the chunk which are enabled.
|
| |
|
GAIA_NODISCARD uint16_t | size_disabled () const |
| | Return the number of entities in the chunk which are enabled.
|
| |
|
GAIA_NODISCARD uint16_t | capacity () const |
| | Returns the number of entities in the chunk.
|
| |
|
GAIA_NODISCARD uint8_t | size_generic () const |
| | Returns the total number of generic entities/components in the chunk.
|
| |
|
GAIA_NODISCARD bool | changed (uint32_t requiredVersion) const |
| | Returns true if the provided version is newer than the one stored internally. Use when checking if there was a movement in data in the world. E.g. if an entity was added, removed or moved in its archetype.
|
| |
|
GAIA_NODISCARD bool | changed (uint32_t requiredVersion, uint32_t compIdx) const |
| | Returns true if the provided version is newer than the one stored internally.
|
| |
|
GAIA_NODISCARD bool | entity_order_changed (uint32_t requiredVersion) const |
| | Returns true if entity order changed since requiredVersion. This is narrower than changed(requiredVersion): unrelated component writes do not affect it.
|
| |
| GAIA_FORCEINLINE void | update_world_version (uint32_t compIdx) |
| | Update the version of a component at the index.
|
| |
|
GAIA_FORCEINLINE void | update_entity_order_version () |
| | Updates the entity-order version after rows were added, removed, or reordered.
|
| |
|
GAIA_FORCEINLINE void | update_world_version () |
| | Update the version of all components.
|
| |
|
GAIA_FORCEINLINE void | update_world_version_init () |
| | Update the version of all components on chunk init.
|
| |
|
void | diag () const |
| |
|
|
static constexpr uint16_t | chunk_header_size () |
| |
|
static constexpr uint16_t | chunk_total_bytes (uint16_t dataSize) |
| |
|
static constexpr uint16_t | chunk_data_bytes (uint16_t totalSize) |
| |
|
static uintptr_t | chunk_data_area_offset () |
| | Returns the relative offset of m_data in Chunk.
|
| |
| static Chunk * | create (const World &wld, const ComponentCache &cc, uint32_t chunkIndex, uint16_t capacity, uint8_t cntEntities, uint8_t genEntities, uint16_t dataBytes, uint32_t &worldVersion, const ChunkDataOffsets &offsets, const Entity *ids, const Component *comps, const ChunkDataOffset *compOffs) |
| | Allocates memory for a new chunk.
|
| |
| static void | free (Chunk *pChunk) |
| | Releases all memory allocated by pChunk.
|
| |
| static void | copy_entity_data (Entity srcEntity, Entity dstEntity, EntityContainers &recs) |
| | Copies all data associated with srcEntity into dstEntity.
|
| |
| static void | copy_entity_data_n_same_chunk (Chunk *pSrcChunk, uint32_t srcRow, Chunk *pDstChunk, uint32_t dstRow, uint32_t dstCount) |
| | Copies all data associated with srcRow into dstCount consecutive rows in the same-archetype chunk.
|
| |
| static void | copy_foreign_entity_data_n (Chunk *pSrcChunk, uint32_t srcRow, Chunk *pDstChunk, uint32_t dstRow, uint32_t dstCount) |
| | Copies all data associated with srcRow into dstCount consecutive rows in a foreign chunk.
|
| |
| static void | copy_foreign_entity_data (Chunk *pSrcChunk, uint32_t srcRow, Chunk *pDstChunk, uint32_t dstRow) |
| | Copies all data associated with entity into the chunk so that it is stored at the row row.
|
| |
| static void | move_foreign_entity_data (Chunk *pSrcChunk, uint32_t srcRow, Chunk *pDstChunk, uint32_t dstRow) |
| | Moves all data associated with entity into the chunk so that it is stored at the row row.
|
| |
| static void | swap_chunk_entities (World &world, Entity entityA, Entity entityB) |
| | Tries to swap entityA with entityB. When swapping, all data associated with the two entities is swapped as well. If entityA and entityB are the same entity no swapping is performed.
|
| |