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_codeStringthe final source code for the vertex shader
-
fs_codeStringthe final source code for the fragment shader
-
nameStringan unique name that should be associated with this shader
Returns:
shader
getShaderBlock
-
id
register a shaderblock with the given id
Parameters:
-
idString | Number
Returns:
shader_block
getSnippet
-
id
Returns the code of a snipper
Parameters:
-
idString
Returns:
code
init
-
url
Initializes the shader manager
Parameters:
-
urlStringa 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:
-
idString -
shader_blockLS.ShaderBlock
registerSnippet
-
id -
code
Register a code snippet ready to be used by the #import clause in the shader
Parameters:
-
idString -
codeString
reloadShaders
-
on_complete
Reloads the XML file with the shaders, useful when editing the file
Parameters:
-
on_completeFunctioncall when the shaders have been reloaded
