spawn method

int spawn()

Activates one particle slot and returns its index, or -1 when the buffer is full. The caller is responsible for initializing every field at the returned index.

Implementation

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