spawn method

int spawn()

Reserves a slot for a new particle and returns its index, or -1 when the pool is full. The caller initializes the columns at that index (including random01).

Implementation

int spawn() {
  if (_aliveCount >= capacity) return -1;
  return _aliveCount++;
}