Gaia-ECS v0.9.3
A simple and powerful entity component system
Loading...
Searching...
No Matches
gaia::ecs::ChunkHeader Struct Referencefinal

Public Member Functions

 ChunkHeader (const World &wld, const ComponentCache &compCache, uint32_t chunkIndex, uint16_t cap, uint8_t genEntitiesCnt, uint32_t &version)
 
bool has_disabled_entities () const
 
bool has_enabled_entities () const
 

Public Attributes

const Worldworld
 Parent world.
 
const ComponentCachecc
 Component cache reference.
 
uint32_t index
 Chunk index in its archetype list.
 
uint16_t count
 Total number of entities in the chunk.
 
uint16_t countEnabled
 Number of enabled entities in the chunk.
 
uint16_t capacity
 Capacity (copied from the owner archetype).
 
uint16_t rowFirstEnabledEntity: MAX_CHUNK_ENTITIES_BITS
 Index of the first enabled entity in the chunk.
 
uint16_t hasAnyCustomGenCtor: 1
 True if there's any generic component that requires custom construction.
 
uint16_t hasAnyCustomUniCtor: 1
 True if there's any unique component that requires custom construction.
 
uint16_t hasAnyCustomGenDtor: 1
 True if there's any generic component that requires custom destruction.
 
uint16_t hasAnyCustomUniDtor: 1
 True if there's any unique component that requires custom destruction.
 
uint16_t lifespanCountdown: CHUNK_LIFESPAN_BITS
 When it hits 0 the chunk is scheduled for deletion.
 
uint16_t dead: 1
 True if deleted, false otherwise.
 
uint16_t unused: 11
 Empty space for future use.
 
uint8_t genEntities
 Number of generic entities/components.
 
uint8_t cntEntities
 Number of components on the archetype.
 
uint32_t & worldVersion
 Version of the world (stable pointer to parent world's world version)
 

Static Public Attributes

static constexpr uint32_t MAX_COMPONENTS_BITS = 5U
 
static constexpr uint32_t MAX_COMPONENTS = 1U << MAX_COMPONENTS_BITS
 Maximum number of components on archetype.
 
static constexpr uint16_t MAX_CHUNK_ENTITIES = (mem_block_size(2) - 64) / sizeof(Entity)
 Maximum number of entities per chunk. Defined as sizeof(big_chunk) / sizeof(entity)
 
static constexpr uint16_t MAX_CHUNK_ENTITIES_BITS = (uint16_t)core::count_bits(MAX_CHUNK_ENTITIES)
 
static constexpr uint16_t CHUNK_LIFESPAN_BITS = 4
 
static constexpr uint16_t MAX_CHUNK_LIFESPAN = (1 << CHUNK_LIFESPAN_BITS) - 1
 Number of ticks before empty chunks are removed.
 
static uint32_t s_worldVersionDummy = 0
 

The documentation for this struct was generated from the following file: