LS.ShaderBlock Class
A ShaderBlock represents a block of GLSL code that could be requested by a shader in order to obtain a functionality. SBs are registered and given a number, then if a shader wants that functionality it could use #pragma shaderblock "sb_name" it will be inserted in the material in the line of the pragma
Constructor
LS.ShaderBlock
()
Item Index
Methods
Methods
addCode
-
shader_type
-
enabled_code
-
disabled_code
-
macros
register a shaderblock with the given id shader_type: vertex or fragment shader
Parameters:
-
shader_type
Enumcould be GL.VERTEX_SHADER or GL.FRAGMENT_SHADER
-
enabled_code
Stringthe code to insert if the shaderblock is enabled
-
disabled_code
Stringthe code to insert if the shaderblock is disabled
-
macros
Object[optional] a set of macros to use when compiling this shader codes
getFinalCode
-
shader_type
-
block_flags
-
context
Returns the full code of a shaderblock resolving all includes, shaderblocks, etc shadertype: GL.VERTEX_SHADER = 35633, GL.FRAGMENT_SHADER = 35632
Parameters:
-
shader_type
Enumcould be GL.VERTEX_SHADER or GL.FRAGMENT_SHADER
-
block_flags
Numbera number containing the mask (every bit is a flag for a shaderblock) with all the enabled shader blocks
-
context
Stringan object with variable that could be fetched by the shaderblocks
Returns:
the final code ready to be compiled
register
()
Registers this shaderblock in the global LS.Shaders container