Shader

A custom shader program.

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.

Members

Aliases

BaseClasses
alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses)
Undocumented in source.

Enums

Constants
enum Constants
Mode
enum Mode

Functions

getCode
String getCode()
getCustomDefines
String getCustomDefines()
getDefaultTextureParam
Ref!Texture getDefaultTextureParam(String param)

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
Shader.Mode getMode()

Returns the shader mode for the shader, either constant MODE_CANVAS_ITEM, constant MODE_SPATIAL or constant MODE_PARTICLES.

hasParam
bool hasParam(String name)

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.

opAssign
typeof(null) opAssign(typeof(null) n)
opEquals
bool opEquals(Shader other)
opEquals
bool opEquals(typeof(null) n)
setCode
void setCode(String code)
setCustomDefines
void setCustomDefines(String custom_defines)
setDefaultTextureParam
void setDefaultTextureParam(String param, Texture texture)

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.

toHash
size_t toHash()

Mixins

__anonymous
mixin baseCasts
Undocumented in source.

Properties

code
String code [@property getter]
String code [@property setter]

Returns the shader's code as the user has written it, not the full generated code used internally.

customDefines
String customDefines [@property getter]
String customDefines [@property setter]

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.

Static functions

_new
Shader _new()

Construct a new instance of Shader. Note: use memnew!Shader instead.

Static variables

_classBindingInitialized
bool _classBindingInitialized;
Undocumented in source.

Structs

GDNativeClassBinding
struct GDNativeClassBinding
Undocumented in source.

Unions

__anonymous
union __anonymous
Undocumented in source.

Variables

_GODOT_internal_name
enum string _GODOT_internal_name;
Undocumented in source.

Mixed In Members

From mixin baseCasts

as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(ToRef) as()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(ToRef)
Undocumented in source.
opCast
void* opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
godot_object opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
bool opCast()
Undocumented in source. Be warned that the author may not have intended to support it.

Meta