UniformBuffer

Hierarchy

  • UniformBuffer

Index

Constructors

constructor

Properties

isSync

isSync: boolean

Indicates if the WebGL underlying uniform buffer is in sync with the javascript cache data.

updateColor3

updateColor3: function

Wrapper for updateUniform.

param

Name of the uniform, as used in the uniform block in the shader.

param
param

Suffix to add to the uniform name.

Type declaration

    • (name: string, color: Color3, suffix?: string): void
    • Parameters

      • name: string
      • color: Color3
      • Optional suffix: string

      Returns void

updateColor4

updateColor4: function

Wrapper for updateUniform.

param

Name of the uniform, as used in the uniform block in the shader.

param
param
param

Suffix to add to the uniform name.

Type declaration

    • (name: string, color: Color3, alpha: number, suffix?: string): void
    • Parameters

      • name: string
      • color: Color3
      • alpha: number
      • Optional suffix: string

      Returns void

updateFloat

updateFloat: function

Wrapper for updateUniform.

param

Name of the uniform, as used in the uniform block in the shader.

param

Type declaration

    • (name: string, x: number): void
    • Parameters

      • name: string
      • x: number

      Returns void

updateFloat2

updateFloat2: function

Wrapper for updateUniform.

param

Name of the uniform, as used in the uniform block in the shader.

param
param
param

Suffix to add to the uniform name.

Type declaration

    • (name: string, x: number, y: number, suffix?: string): void
    • Parameters

      • name: string
      • x: number
      • y: number
      • Optional suffix: string

      Returns void

updateFloat3

updateFloat3: function

Wrapper for updateUniform.

param

Name of the uniform, as used in the uniform block in the shader.

param
param
param
param

Suffix to add to the uniform name.

Type declaration

    • (name: string, x: number, y: number, z: number, suffix?: string): void
    • Parameters

      • name: string
      • x: number
      • y: number
      • z: number
      • Optional suffix: string

      Returns void

updateFloat4

updateFloat4: function

Wrapper for updateUniform.

param

Name of the uniform, as used in the uniform block in the shader.

param
param
param
param
param

Suffix to add to the uniform name.

Type declaration

    • (name: string, x: number, y: number, z: number, w: number, suffix?: string): void
    • Parameters

      • name: string
      • x: number
      • y: number
      • z: number
      • w: number
      • Optional suffix: string

      Returns void

updateMatrix

updateMatrix: function

Wrapper for updateUniform.

param

Name of the uniform, as used in the uniform block in the shader.

param

4x4 matrix.

Type declaration

    • (name: string, mat: Matrix): void
    • Parameters

      Returns void

updateMatrix2x2

updateMatrix2x2: function

Wrapper for updateUniform.

param

Name of the uniform, as used in the uniform block in the shader.

param

Type declaration

    • (name: string, matrix: Float32Array): void
    • Parameters

      • name: string
      • matrix: Float32Array

      Returns void

updateMatrix3x3

updateMatrix3x3: function

Wrapper for updateUniform.

method

updateMatrix3x3

param

Name of the uniform, as used in the uniform block in the shader.

param

Type declaration

    • (name: string, matrix: Float32Array): void
    • Parameters

      • name: string
      • matrix: Float32Array

      Returns void

updateVector3

updateVector3: function

Wrapper for updateUniform.

param

Name of the uniform, as used in the uniform block in the shader.

param

Type declaration

    • (name: string, vector: Vector3): void
    • Parameters

      Returns void

updateVector4

updateVector4: function

Wrapper for updateUniform.

param

Name of the uniform, as used in the uniform block in the shader.

param

Type declaration

    • (name: string, vector: Vector4): void
    • Parameters

      Returns void

useUbo

useUbo: boolean

Indicates if the buffer is using the WebGL2 UBO implementation, or just falling back on setUniformXXX calls.

Methods

addColor3

  • addColor3(name: string, color: Color3): void
  • Wrapper for addUniform.

    Parameters

    • name: string

      Name of the uniform, as used in the uniform block in the shader.

    • color: Color3

    Returns void

addColor4

  • addColor4(name: string, color: Color3, alpha: number): void
  • Wrapper for addUniform.

    Parameters

    • name: string

      Name of the uniform, as used in the uniform block in the shader.

    • color: Color3
    • alpha: number

    Returns void

addFloat2

  • addFloat2(name: string, x: number, y: number): void
  • Wrapper for addUniform.

    Parameters

    • name: string

      Name of the uniform, as used in the uniform block in the shader.

    • x: number
    • y: number

    Returns void

addFloat3

  • addFloat3(name: string, x: number, y: number, z: number): void
  • Wrapper for addUniform.

    Parameters

    • name: string

      Name of the uniform, as used in the uniform block in the shader.

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

    Returns void

addMatrix

  • addMatrix(name: string, mat: Matrix): void
  • Wrapper for addUniform.

    Parameters

    • name: string

      Name of the uniform, as used in the uniform block in the shader.

    • mat: Matrix

      A 4x4 matrix.

    Returns void

addMatrix2x2

  • addMatrix2x2(name: string): void
  • Wrapper for addUniform.

    Parameters

    • name: string

      Name of the uniform, as used in the uniform block in the shader.

    Returns void

addMatrix3x3

  • addMatrix3x3(name: string): void
  • Wrapper for addUniform.

    Parameters

    • name: string

      Name of the uniform, as used in the uniform block in the shader.

    Returns void

addUniform

  • addUniform(name: string, size: number | number[]): void
  • Adds an uniform in the buffer. Warning : the subsequents calls of this function must be in the same order as declared in the shader for the layout to be correct !

    Parameters

    • name: string

      Name of the uniform, as used in the uniform block in the shader.

    • size: number | number[]

      Data size, or data directly.

    Returns void

addVector3

  • addVector3(name: string, vector: Vector3): void
  • Wrapper for addUniform.

    Parameters

    • name: string

      Name of the uniform, as used in the uniform block in the shader.

    • vector: Vector3

    Returns void

bindToEffect

  • bindToEffect(effect: Effect, name: string): void
  • Binds this uniform buffer to an effect.

    Parameters

    • effect: Effect
    • name: string

      Name of the uniform block in the shader.

    Returns void

create

  • create(): void
  • Effectively creates the WebGL Uniform Buffer, once layout is completed with addUniform.

    Returns void

dispose

  • dispose(): void
  • Disposes the uniform buffer.

    Returns void

getBuffer

  • The underlying WebGL Uniform buffer.

    Returns Nullable<WebGLBuffer>

getData

  • getData(): Float32Array
  • The data cache on JS side.

    Returns Float32Array

isDynamic

  • isDynamic(): boolean
  • Indicates if the WebGL underlying uniform buffer is dynamic. Also, a dynamic UniformBuffer will disable cache verification and always update the underlying WebGL uniform buffer to the GPU.

    Returns boolean

setTexture

  • Sets a sampler uniform on the effect.

    Parameters

    Returns void

update

  • update(): void
  • Updates the WebGL Uniform Buffer on the GPU. If the dynamic flag is set to true, no cache comparison is done. Otherwise, the buffer will be updated only if the cache differs.

    Returns void

updateUniform

  • updateUniform(uniformName: string, data: FloatArray, size: number): void
  • Updates the value of an uniform. The update method must be called afterwards to make it effective in the GPU.

    Parameters

    • uniformName: string

      Name of the uniform, as used in the uniform block in the shader.

    • data: FloatArray

      Flattened data

    • size: number

      Size of the data.

    Returns void

updateUniformDirectly

  • updateUniformDirectly(uniformName: string, data: FloatArray): void
  • Directly updates the value of the uniform in the cache AND on the GPU.

    Parameters

    • uniformName: string

      Name of the uniform, as used in the uniform block in the shader.

    • data: FloatArray

      Flattened data

    Returns void

Generated using TypeDoc