Hierarchy

  • Shader

Constructors

Properties

attributes: {
    [variableName: string]: VertexAttributeDefinition;
} = {}

Type declaration

fragmentSource: string
program: WebGLProgram
uniforms: {
    [variableName: string]: UniformDefinition;
} = {}

Type declaration

vertexSource: string

Accessors

Methods

  • Set a texture in a gpu texture slot

    Parameters

    • slotNumber: number
    • texture: WebGLTexture

    Returns void

  • Set any available uniform type in webgl

    For example setUniform('uniformMatrix2fv', 'u_my2x2_mat`, ...);

    Type Parameters

    Parameters

    • uniformType: TUniformType
    • name: string
    • Rest ...value: RemoveFirstFromTuple<Parameters<WebGLRenderingContext[TUniformType]>>

    Returns void

  • Set a boolean uniform for the current shader

    Important Must call ex.Shader.use() before setting a uniform!

    Parameters

    • name: string
    • value: boolean

    Returns void

  • Set a float uniform for the current shader

    Important Must call ex.Shader.use() before setting a uniform!

    Parameters

    • name: string
    • value: number

    Returns void

  • Set a float array uniform for the current shader

    Important Must call ex.Shader.use() before setting a uniform!

    Parameters

    • name: string
    • value: number[]

    Returns void

  • Set a Color uniform for the current shader

    Important Must call ex.Shader.use() before setting a uniform!

    Parameters

    • name: string
    • value: Color

    Returns void

  • Set a Vector uniform for the current shader

    Important Must call ex.Shader.use() before setting a uniform!

    Parameters

    Returns void

  • Set an integer uniform for the current shader

    Important Must call ex.Shader.use() before setting a uniform!

    Parameters

    • name: string
    • value: number

    Returns void

  • Set an integer array uniform for the current shader

    Important Must call ex.Shader.use() before setting a uniform!

    Parameters

    • name: string
    • value: number[]

    Returns void

  • Set an Matrix uniform for the current shader

    Important Must call ex.Shader.use() before setting a uniform!

    Parameters

    Returns void

  • Set any available uniform type in webgl. Will try to set the uniform, will return false if the uniform didn't exist, true if it was set.

    WILL NOT THROW on error

    For example setUniform('uniformMatrix2fv', 'u_my2x2_mat`, ...);

    Type Parameters

    Parameters

    • uniformType: TUniformType
    • name: string
    • Rest ...value: RemoveFirstFromTuple<Parameters<WebGLRenderingContext[TUniformType]>>

    Returns boolean

  • Set a boolean uniform for the current shader, WILL NOT THROW on error.

    Important Must call ex.Shader.use() before setting a uniform!

    Parameters

    • name: string
    • value: boolean

    Returns boolean

  • Set a float uniform for the current shader, WILL NOT THROW on error.

    Important Must call ex.Shader.use() before setting a uniform!

    Parameters

    • name: string
    • value: number

    Returns boolean

  • Set a float array uniform for the current shader, WILL NOT THROW on error.

    Important Must call ex.Shader.use() before setting a uniform!

    Parameters

    • name: string
    • value: number[]

    Returns boolean

  • Set a Color uniform for the current shader, WILL NOT THROW on error.

    Important Must call ex.Shader.use() before setting a uniform!

    Parameters

    • name: string
    • value: Color

    Returns boolean

  • Set a Vector uniform for the current shader, WILL NOT THROW on error.

    Important Must call ex.Shader.use() before setting a uniform!

    Parameters

    Returns boolean

  • Set an integer uniform for the current shader, WILL NOT THROW on error.

    Important Must call ex.Shader.use() before setting a uniform!

    Parameters

    • name: string
    • value: number

    Returns boolean

  • Set an integer array uniform for the current shader, WILL NOT THROW on error.

    Important Must call ex.Shader.use() before setting a uniform!

    Parameters

    • name: string
    • value: number[]

    Returns boolean

  • Set an Matrix uniform for the current shader, WILL NOT THROW on error.

    Important Must call ex.Shader.use() before setting a uniform!

    Parameters

    Returns boolean