LS.ShaderMaterial Class
ShaderMaterial allows to use your own shader from scratch, but you loose some of the benefits of using the dynamic shader system of LS
Constructor
LS.ShaderMaterial
-
object
Parameters:
-
objectObject[optional] to configure from
Item Index
Methods
applyToTexture
-
input_texture -
output_texture
Takes an input texture and applies the ShaderMaterial, the result is shown on the viewport or stored in the output_texture The ShaderCode must contain a "fx" method. Similar to the method BlitTexture in Unity
Parameters:
-
input_textureTexture -
output_textureTexture[optional] where to store the result, if omitted it will be shown in the viewport
createProperty
-
name -
value -
type -
options
Creates a property for this material, this property wont be passed to the shader but can be used from source code. You must used this function if you want the data to be stored when serializing or changing the ShaderCode
Parameters:
-
nameStringthe property name as it should be shown
-
valuethe default value
-
typeStringthe data type (use LS.TYPES)
-
optionsObjectan object containing all the possible options (used mostly for widgets)
createSampler
-
name -
uniform -
options -
value
Similar to createUniform but for textures, it helps specifying sampler options
Parameters:
-
nameStringthe property name as it should be shown
-
uniformStringthe uniform name in the shader
-
optionsObjectan object containing all the possible options (used mostly for widgets)
-
valueStringdefault value (texture name)
createUniform
-
name -
uniform -
type -
value -
options
Makes one shader variable (uniform) public so it can be assigned from the engine (or edited from the editor)
Parameters:
-
nameStringthe property name as it should be shown
-
uniformStringthe uniform name in the shader
-
typeStringthe var type in case we want to edit it (use LS.TYPES)
-
value -
optionsObjectan object containing all the possible options (used mostly for widgets)
getResources
-
resources
Collects all the resources needed by this material (textures)
Parameters:
-
resourcesObjectobject where all the resources are stored
