Fixed-capacity particle pool with O(1) swap-remove.
Definition ParticlePool.hpp:22
const T * rawData() const
Pointer to the contiguous live data for GPU upload.
Definition ParticlePool.hpp:48
std::array< T, MaxN > data
Definition ParticlePool.hpp:23
T * spawn()
Allocate a new slot (zero-initialised). Returns nullptr when full.
Definition ParticlePool.hpp:27
void update(auto fn)
Iterate all live particles.
Definition ParticlePool.hpp:40
bool full() const
Definition ParticlePool.hpp:51
uint32_t liveCount() const
Definition ParticlePool.hpp:49
bool empty() const
Definition ParticlePool.hpp:50
void kill(uint32_t i)
O(1) swap-remove. Does NOT preserve order.
Definition ParticlePool.hpp:36
uint32_t count
Definition ParticlePool.hpp:24