Options
All
  • Public
  • Public/Protected
  • All
Menu

Provides static methods for working with WebGL.

Hierarchy

  • GLUtils

Index

Methods

Static get2DProjectionMatrix

  • get2DProjectionMatrix(width: number, height: number): number[]
  • Gets a simple 2D flat projection matrix from the provided dimensions.

    Parameters

    • width: number

      Width of view in pixels.

    • height: number

      Height of view in pixels.

    Returns number[]

Static getCameraTranslation

  • getCameraTranslation(camera: any): number[]
  • Gets a translation matrix based upon camera position.

    Parameters

    • camera: any

      Camera object to translate.

    Returns number[]

Static getRotation

  • getRotation(angle: number): number[]
  • Gets a rotation matrix from the provided angle.

    Parameters

    • angle: number

      Angle in radians.

    Returns number[]

Static getScale

  • getScale(x: number, y: number): number[]
  • Gets a scale matrix based upon provided sizes.

    Parameters

    • x: number

      Size to scale to in x dimension.

    • y: number

      Size to scale to in y dimension.

    Returns number[]

Static getScaleMatrix

  • Gets a scale matrix based upon entity scale.

    Parameters

    • sprite: Sprite | TileSprite | Rect

      Entity with scale property.

    • width: number

      Width of the entity in pixels.

    • height: number

      Height of the entity in pixels.

    Returns number[]

Static getTranslation

  • getTranslation(x: number, y: number): number[]
  • Gets a translation matrix from the provided coordinates.

    Parameters

    • x: number

      Translation for the x dimension.

    • y: number

      Translation for the y dimension.

    Returns number[]

Static multiplyMatrices

  • multiplyMatrices(a: number[], b: number[]): number[]
  • Multiplies two matrices together.

    Parameters

    • a: number[]

      The first matrix for multiplication.

    • b: number[]

      The second matrix for multiplication.

    Returns number[]