Shader¶
Inherits: Resource < Reference < Object
Inherited By: VisualShader
A custom shader program.
Description¶
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.
Tutorials¶
Properties¶
String | code | "" |
String | custom_defines | "#define MAX_LIGHT_DATA_STRUCTS 409#define MAX_FORWARD_LIGHTS 8#define MAX_REFLECTION_DATA_STRUCTS 455#define MAX_SKELETON_BONES 1365" |
Methods¶
Texture | get_default_texture_param ( String param ) const |
Mode | get_mode ( ) const |
bool | has_param ( String name ) const |
void | set_default_texture_param ( String param, Texture texture ) |
Enumerations¶
Property Descriptions¶
- String code
Default | "" |
Setter | set_code(value) |
Getter | get_code() |
Returns the shader’s code as the user has written it, not the full generated code used internally.
- String custom_defines
Default | "#define MAX_LIGHT_DATA_STRUCTS 409#define MAX_FORWARD_LIGHTS 8#define MAX_REFLECTION_DATA_STRUCTS 455#define MAX_SKELETON_BONES 1365" |
Setter | set_custom_defines(value) |
Getter | get_custom_defines() |
Returns the shader’s custom defines. Custom defines can be used in Godot to add GLSL preprocessor directives (e.g: extensions) required for the shader logic.
Note: Custom defines are not validated by the Godot shader parser, so care should be taken when using them.
Method Descriptions¶
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.
- Mode get_mode ( ) const
Returns the shader mode for the shader, either MODE_CANVAS_ITEM, MODE_SPATIAL or MODE_PARTICLES.
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.
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.