new ShaderCombiner( [options])
Creates a new ShaderCombiner instance.
Parameters:
Name | Type | Argument | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
Configuration options Properties
|
- Source:
Fires:
Extends
Methods
-
addFilter(filter)
-
Adds a filter to the shader pipeline.
Parameters:
Name Type Description filter
Object Filter to add
- Inherited From:
- Overrides:
- Source:
Fires:
-
allUniforms()
-
Returns all uniform variables associated with the shader and its filters. Combines uniforms from both the base shader and all active filters into a single object.
- Inherited From:
- Overrides:
- Source:
Returns:
Combined uniform variables
- Type
- Object.<string, Object>
-
clearFilters()
-
Clears all filters from the shader pipeline.
- Inherited From:
- Overrides:
- Source:
Fires:
-
getUniform(name)
-
Gets a uniform variable by name. Searches both shader uniforms and filter uniforms.
Parameters:
Name Type Description name
string Uniform variable name
- Inherited From:
- Overrides:
- Source:
Returns:
Uniform object if found
- Type
- Object | undefined
-
removeFilter(name)
-
Removes a filter from the pipeline by name.
Parameters:
Name Type Description name
string Name of filter to remove
- Inherited From:
- Overrides:
- Source:
Fires:
-
setMode(mode)
-
Sets the current shader mode.
Parameters:
Name Type Description mode
string Mode identifier (must be in options.modes)
- Inherited From:
- Overrides:
- Source:
Throws:
-
If mode is not recognized
- Type
- Error
-
setTileSize(size)
-
Sets tile dimensions for shader calculations.
Parameters:
Name Type Description size
Array.<number> [width, height] of tile
- Inherited From:
- Overrides:
- Source:
-
setUniform(name, value)
-
Sets a uniform variable value.
Parameters:
Name Type Description name
string Uniform variable name
value
number | boolean | Array Value to set
- Inherited From:
- Overrides:
- Source:
Fires:
Throws:
-
If uniform doesn't exist
- Type
- Error
Type Definitions
-
Operation
-
A shader operation that combines two textures.
Type:
- Object
- Source:
Properties:
Name Type Description first
string Assigns first texture as output (cout = c1)
second
string Assigns second texture as output (cout = c2)
mean
string Calculates average of textures (cout = (c1 + c2)/2.0)
diff
string Calculates difference between textures (cout = c2.rgb - c1.rgb)
Events
-
update
-
Fired when shader combination mode changes.
Type: Object
- Overrides:
- Source:
Properties:
Name Type Description mode
string New combination mode
previousMode
string Previous combination mode