LS.ShaderMaterial Class
ShaderMaterial allows to use your own shader from scratch
Constructor
LS.ShaderMaterial
-
object
Parameters:
-
object
Object[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_texture
Texture -
output_texture
Texture[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:
-
name
Stringthe property name as it should be shown
-
value
the default value
-
type
Stringthe data type (use LS.TYPES)
-
options
Objectan 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:
-
name
Stringthe property name as it should be shown
-
uniform
Stringthe uniform name in the shader
-
options
Objectan object containing all the possible options (used mostly for widgets)
-
value
Stringdefault 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:
-
name
Stringthe property name as it should be shown
-
uniform
Stringthe uniform name in the shader
-
type
Stringthe var type in case we want to edit it (use LS.TYPES)
-
value
-
options
Objectan object containing all the possible options (used mostly for widgets)
getResources
-
resources
Collects all the resources needed by this material (textures)
Parameters:
-
resources
Objectobject where all the resources are stored
Returns:
onResourceRenamed
-
resources
Event used to inform if one resource has changed its name
Parameters:
-
resources
Objectobject where all the resources are stored
Returns:
true if something was modified