update macos/ios to Filament v1.51.2
This commit is contained in:
@@ -17,12 +17,13 @@
|
||||
#ifndef TNT_UTILS_ENTITYMANAGER_H
|
||||
#define TNT_UTILS_ENTITYMANAGER_H
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <utils/Entity.h>
|
||||
#include <utils/compiler.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef FILAMENT_UTILS_TRACK_ENTITIES
|
||||
#define FILAMENT_UTILS_TRACK_ENTITIES false
|
||||
#endif
|
||||
@@ -44,23 +45,25 @@ public:
|
||||
public:
|
||||
virtual void onEntitiesDestroyed(size_t n, Entity const* entities) noexcept = 0;
|
||||
protected:
|
||||
~Listener() noexcept;
|
||||
virtual ~Listener() noexcept;
|
||||
};
|
||||
|
||||
|
||||
// maximum number of entities that can exist at the same time
|
||||
static size_t getMaxEntityCount() noexcept {
|
||||
// because index 0 is reserved, we only have 2^GENERATION_SHIFT - 1 valid indices
|
||||
return RAW_INDEX_COUNT - 1;
|
||||
}
|
||||
|
||||
// create n entities. Thread safe.
|
||||
// number of active Entities
|
||||
size_t getEntityCount() const noexcept;
|
||||
|
||||
// Create n entities. Thread safe.
|
||||
void create(size_t n, Entity* entities);
|
||||
|
||||
// destroys n entities. Thread safe.
|
||||
void destroy(size_t n, Entity* entities) noexcept;
|
||||
|
||||
// create a new Entity. Thread safe.
|
||||
// Create a new Entity. Thread safe.
|
||||
// Return Entity.isNull() if the entity cannot be allocated.
|
||||
Entity create() {
|
||||
Entity e;
|
||||
@@ -68,20 +71,20 @@ public:
|
||||
return e;
|
||||
}
|
||||
|
||||
// destroys an Entity. Thread safe.
|
||||
// Destroys an Entity. Thread safe.
|
||||
void destroy(Entity e) noexcept {
|
||||
destroy(1, &e);
|
||||
}
|
||||
|
||||
// return whether the given Entity has been destroyed (false) or not (true).
|
||||
// Return whether the given Entity has been destroyed (false) or not (true).
|
||||
// Thread safe.
|
||||
bool isAlive(Entity e) const noexcept {
|
||||
assert(getIndex(e) < RAW_INDEX_COUNT);
|
||||
return (!e.isNull()) && (getGeneration(e) == mGens[getIndex(e)]);
|
||||
}
|
||||
|
||||
// registers a listener to be called when an entity is destroyed. thread safe.
|
||||
// if the listener is already register, this method has no effect.
|
||||
// Registers a listener to be called when an entity is destroyed. Thread safe.
|
||||
// If the listener is already registered, this method has no effect.
|
||||
void registerListener(Listener* l) noexcept;
|
||||
|
||||
// unregisters a listener.
|
||||
@@ -94,6 +97,7 @@ public:
|
||||
uint8_t getGenerationForIndex(size_t index) const noexcept {
|
||||
return mGens[index];
|
||||
}
|
||||
|
||||
// singleton, can't be copied
|
||||
EntityManager(const EntityManager& rhs) = delete;
|
||||
EntityManager& operator=(const EntityManager& rhs) = delete;
|
||||
|
||||
Reference in New Issue
Block a user