class
ecs::EntitySparseSet
Storage used for storing only entities.
Provides helper functionality to create new unique entities.
Public
Constructors
EntitySparseSet
Methods
~EntitySparseSet
Create
Creates a brand new entity with a unique identifier.
Create
Creates a new entity while attempting to re-use an invalid entity identifier as provided by .
Clear
Removes everything from the set and clears the internal arrays.
Each
Allows easy iteration over all components using a range for loop.
Each
ReverseEach
Allows easy iteration over all components using a range for loop, in reverse order.
ReverseEach
~TSparseSet<DeletePolicy>
ClearInvalid
Removes all invalid entities from the set.
Only relevant for sets using in-place deletion policy.
Swap
Swaps the location of the provided entities in the packed array, as well as the relevant payload (data associated with the entities), if any.
GetDeletePolicy
Returns the current delete policy.
GetFirstFreeElementPackedIndex
When using in-place deletion policy returns the packed index to the first invalid element.
When using swap-only deletion policy returns the number of valid entities in the set. Not relevant if using swap-and-erase deletion policy.
Protected
Methods
EraseInternal
Removed an entity from the sparse set.
Entity must be a part of the sparse set.
ClearInternal
Same as SparseSet::ClearInternal but also resets the free list head.
Private
Methods
AddInternal
Adds a new entity to the set.
- hint
- Entity to add.
- forceAddAtEnd
- Only relevant when using in-place deletion policy. When true it will add an entity at the end of the packaged data array, rather than re-using the first available invalid entity entry.
Returns: Iterator to the added entity.
CreateEntity
Creates a new entity with a unique index, and increments the next index to assign.