Shader
Index
Constructors
Properties
Accessors
Methods
- compile
- dispose
- getAttributes
- getUniforms
- isCurrentlyBound
- setTexture
- setUniform
- setUniformAffineMatrix
- setUniformBoolean
- setUniformFloat
- setUniformFloatArray
- setUniformFloatColor
- setUniformFloatVector
- setUniformInt
- setUniformIntArray
- setUniformMatrix
- trySetUniform
- trySetUniformBoolean
- trySetUniformFloat
- trySetUniformFloatArray
- trySetUniformFloatColor
- trySetUniformFloatVector
- trySetUniformInt
- trySetUniformIntArray
- trySetUniformMatrix
- use
Constructors
constructor
Parameters
options: ShaderOptions
specify shader vertex and fragment source
Returns Shader
Properties
publicattributes
Type declaration
[variableName string]: VertexAttributeDefinition
publicreadonlyfragmentSource
publicprogram
publicuniforms
Type declaration
[variableName string]: UniformDefinition
publicreadonlyvertexSource
Accessors
publiccompiled
Returns boolean
Methods
compile
Compile the current shader against a webgl context
Returns WebGLProgram
dispose
Returns void
getAttributes
Returns VertexAttributeDefinition[]
getUniforms
Returns UniformDefinition[]
isCurrentlyBound
Returns boolean
setTexture
Set a texture in a gpu texture slot
Parameters
slotNumber: number
texture: WebGLTexture
Returns void
setUniform
Set any available uniform type in webgl
For example setUniform('uniformMatrix2fv', 'u_my2x2_mat`, ...);
Type parameters
- TUniformType: UniformTypeNames
Parameters
uniformType: TUniformType
name: string
rest...value: RemoveFirstFromTuple<Parameters<WebGLRenderingContext[TUniformType]>>
Returns void
setUniformAffineMatrix
Parameters
name: string
value: AffineMatrix
Returns void
setUniformBoolean
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
setUniformFloat
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
setUniformFloatArray
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
setUniformFloatColor
setUniformFloatVector
setUniformInt
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
setUniformIntArray
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
setUniformMatrix
trySetUniform
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
- TUniformType: UniformTypeNames
Parameters
uniformType: TUniformType
name: string
rest...value: RemoveFirstFromTuple<Parameters<WebGLRenderingContext[TUniformType]>>
Returns boolean
trySetUniformBoolean
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
trySetUniformFloat
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
trySetUniformFloatArray
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
trySetUniformFloatColor
trySetUniformFloatVector
trySetUniformInt
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
trySetUniformIntArray
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
trySetUniformMatrix
use
Binds the shader program
Returns void
Create a shader program in excalibur