ShaderPipeline
Index
Constructors
Properties
Methods
- bind
- draw
- flagDirty
- redirectDraw
- resize
- setTexture
- setUniform
- setUniformAffineMatrix
- setUniformBoolean
- setUniformFloat
- setUniformFloatArray
- setUniformFloatColor
- setUniformFloatVector
- setUniformInt
- setUniformIntArray
- setUniformMatrix
- trySetUniform
- trySetUniformBoolean
- trySetUniformFloat
- trySetUniformFloatArray
- trySetUniformFloatColor
- trySetUniformFloatVector
- trySetUniformInt
- trySetUniformIntArray
- trySetUniformMatrix
- unbind
Constructors
constructor
Parameters
options: ShaderPipelineOptions
Returns ShaderPipeline
Properties
cache
framebuffers
graphicsContext
height
pipeline
width
Methods
bind
Returns void
draw
If a texture is provided run the pipeline on that texture, otherwise run on the currently bound frame buffer
Returns a final texture that is the result of the pipeline
Parameters
optionalinputTexture: WebGLTexture
Returns WebGLTexture
flagDirty
Returns void
redirectDraw
Redirects a provided draw function
Parameters
draw: () => any
Returns WebGLTexture
resize
Parameters
width: number
height: number
Returns void
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: UniformParameters<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
unbind
Returns void
Apply multiple shaders in succession