Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Pool

A simple object pool supporting the most basic utility objects.

If you want to retrieve an object, but the pool does not contain any more instances, it will silently create a new one.

It's important that you use the pool in a balanced way, i.e. don't just "get" or "put" alone! Always make the calls in pairs; whenever you get an object, be sure to put it back later, and the other way round. Otherwise, the pool will empty or (even worse) grow in size uncontrolled.

Hierarchy

  • Pool

Index

Methods

Static getMatrix

  • getMatrix(a?: number, b?: number, c?: number, d?: number, tx?: number, ty?: number): Matrix
  • Retrieves a Matrix instance from the pool.

    Parameters

    • Optional a: number
    • Optional b: number
    • Optional c: number
    • Optional d: number
    • Optional tx: number
    • Optional ty: number

    Returns Matrix

Static getMatrix3D

  • getMatrix3D(identity?: boolean): Matrix3D
  • Retrieves a Matrix3D instance from the pool.

    @param identity If enabled, the matrix will be reset to the identity. Otherwise, its contents is undefined.

    Parameters

    • Optional identity: boolean

    Returns Matrix3D

Static getPoint

  • getPoint(x?: number, y?: number): Point

Static getPoint3D

  • getPoint3D(x?: number, y?: number, z?: number): Vector3D
  • Retrieves a Vector3D instance from the pool.

    Parameters

    • Optional x: number
    • Optional y: number
    • Optional z: number

    Returns Vector3D

Static getRectangle

  • getRectangle(x?: number, y?: number, width?: number, height?: number): Rectangle
  • Retrieves a Rectangle instance from the pool.

    Parameters

    • Optional x: number
    • Optional y: number
    • Optional width: number
    • Optional height: number

    Returns Rectangle

Static putMatrix

  • putMatrix(matrix: Matrix): void
  • Stores a Matrix instance in the pool. Don't keep any references to the object after moving it to the pool!

    Parameters

    • matrix: Matrix

    Returns void

Static putMatrix3D

  • putMatrix3D(matrix: Matrix3D): void
  • Stores a Matrix3D instance in the pool. Don't keep any references to the object after moving it to the pool!

    Parameters

    • matrix: Matrix3D

    Returns void

Static putPoint

  • putPoint(point: Point): void
  • Stores a Point instance in the pool. Don't keep any references to the object after moving it to the pool!

    Parameters

    • point: Point

    Returns void

Static putPoint3D

  • putPoint3D(point: Vector3D): void
  • Stores a Vector3D instance in the pool. Don't keep any references to the object after moving it to the pool!

    Parameters

    • point: Vector3D

    Returns void

Static putRectangle

  • putRectangle(rectangle: Rectangle): void
  • Stores a Rectangle instance in the pool. Don't keep any references to the object after moving it to the pool!

    Parameters

    • rectangle: Rectangle

    Returns void

Generated using TypeDoc