LS.Shaders Class
Shaders is the static class in charge of loading, compiling and storing shaders for reuse.
Constructor
LS.Shaders
()
Item Index
Methods
compileShader
-
vs_code
-
fs_code
-
name
Compiles a shader, the vertex and fragment shader are cached indepently to speed up compilations but a unique name must be provided
Parameters:
-
vs_code
Stringthe final source code for the vertex shader
-
fs_code
Stringthe final source code for the fragment shader
-
name
Stringan unique name that should be associated with this shader
Returns:
shader
getShaderBlock
-
id
register a shaderblock with the given id
Parameters:
-
id
String | Number
Returns:
shader_block
getSnippet
-
id
Returns the code of a snipper
Parameters:
-
id
String
Returns:
code
init
-
url
Initializes the shader manager
Parameters:
-
url
Stringa url to a shaders.xml can be specified to load the shaders
registerShaderBlock
-
id
-
shader_block
register a shaderblock in the global container so it can be used by shadermaterials
Parameters:
-
id
String -
shader_block
LS.ShaderBlock
registerSnippet
-
id
-
code
Register a code snippet ready to be used by the #import clause in the shader
Parameters:
-
id
String -
code
String
reloadShaders
-
on_complete
Reloads the XML file with the shaders, useful when editing the file
Parameters:
-
on_complete
Functioncall when the shaders have been reloaded