new ShaderDstretch( [options])
Creates a new ShaderDStretch instance
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
options |
Object |
<optional> |
Configuration options (inherited from Shader) |
- Source:
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
-
init(json)
-
Initializes the shader with configuration data
Parameters:
Name Type Description json
ShaderDStretch~Config Configuration data
- Source:
Properties:
Name Type Description json.samples
Array.<Array.<number>> Color samples for statistics
-
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
-
updateRotationMatrix(eulerRotation)
-
Updates the color transformation matrix based on Euler angles
Parameters:
Name Type Description eulerRotation
Array.<number> Rotation angles [x,y,z] in radians
- Source:
-
vertShaderSrc(gl)
-
Gets vertex shader source code. Default implementation provides basic vertex transformation and texture coordinate passing.
Parameters:
Name Type Description gl
WebGLRenderingContext WebGL context
- Inherited From:
- Overrides:
- Source:
Returns:
Vertex shader source code
- Type
- string
Events
-
update
-
Fired when shader state changes (uniforms, filters, etc).
- Inherited From:
- Overrides:
- Source: