Shader
Shader program and shared-settings resource.
For a text Shader, Code stores source text and shader_type determines its mode/stages. GetMode is not compilation validation. Materials can share the Shader; default textures are shared while individual values belong to ShaderMaterial.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
ShaderConstructor
public Shader();Creates an empty text Shader defaulting to Spatial mode. Assign Code containing shader_type before use. GetMode on an empty resource does not prove a working shader exists.
Properties1
CodeProperty
public string Code { get; set; }Shader-resource source text in Reckfell shading language. Declares shader_type and stage functions; it is neither C# nor a complete OpenGL/Vulkan shader file. Reading the string or GetMode does not establish successful compilation: inspect diagnostics and actual output.
Methods9
GetCodestring
public string GetCode();Returns the original shader text with preprocessor directives. This is not expanded backend source or GPU bytecode.
stringOriginal source text assigned to the Shader resource.
GetDefaultTextureParameterTexture
public Texture GetDefaultTextureParameter(StringName name, int index = 0);Reads the default texture assigned on Shader for a name and index. It is neither a particular ShaderMaterial value nor the built-in hint_default_white fallback texture. It does not prove that the current code declares the uniform.
| Name | Type | Default |
|---|---|---|
name | StringName | — |
index | int | 0 |
nameSampler uniform name without the shader_parameter/ prefix.
indexSampler-array element index; normally 0 for a single sampler.
TextureAssigned Texture, or null when the name/index has no entry.
GetModeShader.Mode
public Shader.Mode GetMode();Returns the shader-resource mode, such as Spatial for 3D, CanvasItem for 2D or Fog for volumetric fog. Mode follows shader_type after preprocessing; the result alone does not validate error-free code.
Shader.ModeA Shader.Mode value. Terrain.reckfellshader with shader_type spatial is verified as Spatial.
GetShaderUniformListReckfell.Collections.Array
public Reckfell.Collections.Array GetShaderUniformList(bool getGroups = false);Returns regular material-uniform metadata for checking names and types. The current rendering path excludes instance/global uniforms from this list; it does not read current material values.
| Name | Type | Default |
|---|---|---|
getGroups | bool | false |
getGroupsIf true, includes group/subgroup records. Defaults to false, which skips them. Do not treat a group record as a regular uniform.
Reckfell.Collections.ArrayArray of Dictionary records containing PropertyInfo metadata, including name and type. The example reads names with entry.AsReckfellDictionary()["name"].AsString(). Read uniform values separately.
InspectNativeShaderCodevoid
public void InspectNativeShaderCode();Requests driver-code inspection through a deferred editor-viewer call when available. It returns no string and is distinct from GetCode, which contains resource text rather than native code. Do not expect a viewer window in an ordinary game run without that viewer.
SetCodevoid
public void SetCode(string code);Replaces source and processes directives and include dependencies. For relative paths on a resource without ResourcePath, set SetIncludePath first; source changes affect materials sharing this Shader.
| Name | Type | Default |
|---|---|---|
code | string | — |
codeComplete engine shading-language source with a suitable shader_type, not arbitrary raw GLSL compute source.
SetDefaultTextureParameter2 overloads
public void SetDefaultTextureParameter(StringName name, Texture texture, int index = 0);Assigns a shared default texture on Shader. Materials without their own value use it. null removes this index entry, not material overrides. Current GetShaderUniformList hides a uniform while any such assignment exists. Use the Texture overload for the general texture type.
| Name | Type | Default |
|---|---|---|
name | StringName | — |
texture | Texture | — |
index | int | 0 |
nameExact sampler uniform name, such as source_texture.
textureAppropriate texture, or null to clear. This configures Shader, not one material.
indexExisting sampler-array element; 0 for an ordinary sampler.
public void SetDefaultTextureParameter(StringName name, Texture2D texture, int index);Texture2D-typed default assignment forwarding to the same implementation. Materials without their own value use it. null removes this index entry, not material overrides. Current GetShaderUniformList hides a uniform while any such assignment exists. Use the Texture overload for the general texture type.
| Name | Type | Default |
|---|---|---|
name | StringName | — |
texture | Texture2D | — |
index | int | — |
nameExact sampler uniform name, such as source_texture.
textureAppropriate texture, or null to clear. This configures Shader, not one material.
indexExisting sampler-array element; 0 for an ordinary sampler.
SetIncludePathvoid
public void SetIncludePath(string path);Sets the fallback base filename for relative includes when Shader has no ResourcePath. Supply a full file path before SetCode; this call alone does not reprocess the source.
| Name | Type | Default |
|---|---|---|
path | string | — |
pathFull base shader filename, such as asset://effects/Main.reckfellshader, not only a directory.
Shader.Mode
| Value | Description |
|---|---|
CanvasItem = 1 | Mode used to draw all 2D objects. |
Fog = 4 | Mode used for setting the color and density of volumetric fog effect. |
Particles = 2 | Mode used to calculate particle information on a per-particle basis. Not used for drawing. |
Sky = 3 | Mode used for drawing skies. Only works with shaders attached to |
Spatial = 0 | Mode used to draw all 3D objects. |
TextureBlit = 5 | Mode used for drawing to DrawableTexture resources via blit calls. |