Struct Shader

A custom shader program.

struct Shader ;

This class allows you to define a custom shader program that can be used by a ShaderMaterial. Shaders allow you to write your own custom behavior for rendering objects or updating particle information. For a detailed explanation and usage, please see the tutorials linked below.

Properties

NameTypeDescription
code[get, set] StringReturns the shader's code as the user has written it, not the full generated code used internally.

Methods

NameDescription
getCode
getDefaultTextureParam Returns the texture that is set as default for the specified parameter. Note: param must match the name of the uniform in the code exactly.
getMode Returns the shader mode for the shader, either constant MODE_CANVAS_ITEM, constant MODE_SPATIAL or constant MODE_PARTICLES.
hasParam Returns true if the shader has this param defined as a uniform in its code. Note: param must match the name of the uniform in the code exactly.
setCode
setDefaultTextureParam Sets the default texture to be used with a texture uniform. The default is used if a texture is not set in the ShaderMaterial. Note: param must match the name of the uniform in the code exactly.

Enums

NameDescription
Constants
Mode