The circular buffer class can be used to cache objects that don't need to be created every frame.
This structure is used for e.g. Vector3 or Quaternion objects in the engine when calling getTempVector3 or getTempQuaternion.

const buffer = new CircularBuffer(() => new Vector3(), 10);
const vec = buffer.get();
const buffer = new CircularBuffer(() => new Quaternion(), 1000);
const quat = buffer.get();

Type Parameters

  • T

Constructors

Methods

Constructors

Methods

  • Returns T