new ShaderNeural( [options])
Creates a new neural network shader
Parameters:
| Name | Type | Argument | Description | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
Configuration options Properties
|
- Source:
Extends
Methods
-
addFilter(filter)
-
Adds a filter to the shader pipeline.
Parameters:
Name Type Description filterObject 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 namestring Uniform variable name
- Inherited From:
- Overrides:
- Source:
Returns:
Uniform object if found
- Type
- Object | undefined
-
init()
-
Initializes default weights
- Source:
-
removeFilter(name)
-
Removes a filter from the pipeline by name.
Parameters:
Name Type Description namestring Name of filter to remove
- Inherited From:
- Overrides:
- Source:
Fires:
-
setLight(light)
-
Sets the light direction for relighting
Parameters:
Name Type Description lightArray.<number> Light direction vector [x, y]
- Source:
-
setMode(mode)
-
Sets the current shader mode.
Parameters:
Name Type Description modestring Mode identifier (must be in options.modes)
- Inherited From:
- Overrides:
- Source:
Throws:
-
If mode is not recognized
- Type
- Error
-
setShaderInfo(samples, planes, n, c, colorspace)
-
Configures shader for specific network architecture
Parameters:
Name Type Description samplesArray.<number> Input samples
planesnumber Number of coefficient planes
nnumber Neurons per layer
cnumber Input channels
colorspacestring Color space for processing
- Source:
-
setTileSize(size)
-
Sets tile dimensions for shader calculations.
Parameters:
Name Type Description sizeArray.<number> [width, height] of tile in pixels
- Inherited From:
- Overrides:
- Source:
Fires:
-
setUniform(name, value)
-
Sets a uniform variable value.
Parameters:
Name Type Description namestring Uniform variable name
valuenumber | boolean | Array Value to set
- Inherited From:
- Overrides:
- Source:
Fires:
Throws:
-
If uniform doesn't exist
- Type
- Error
Type Definitions
-
NetworkConfig
-
Configuration for neural network weights and parameters
Type:
- Object
- Source:
Properties:
Name Type Description nnumber Number of neurons per layer (padded to multiple of 4)
cnumber Number of input channels (padded to multiple of 4)
colorspacestring Color space for processing ('rgb'|'xyz'|etc)
nplanesnumber Number of coefficient planes
scalenumber Dequantization scale factor
biasnumber Dequantization bias
Events
-
update
-
Fired when shader state changes (uniforms, filters, etc).
- Inherited From:
- Overrides:
- Source: