Skip to content
0.2.0-dev Download ZIP
88 lines ·4.3 KB Raw
1<?xml version="1.0" encoding="UTF-8" ?>
2<class name="Shader" inherits="Resource" api_type="core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
3 <brief_description>
4 A shader implemented in the Godot shading language.
5 </brief_description>
6 <description>
7 A custom shader program implemented in the Godot shading language, saved with the [code].gdshader[/code] extension.
8 This class is used by a [ShaderMaterial] and allows you to write your own custom behavior for rendering visual items or updating particle information. For a detailed explanation and usage, please see the tutorials linked below.
9 </description>
10 <tutorials>
11 <link title="Shaders documentation index">$DOCS_URL/tutorials/shaders/index.html</link>
12 </tutorials>
13 <methods>
14 <method name="get_default_texture_parameter" qualifiers="const">
15 <return type="Texture" />
16 <param index="0" name="name" type="StringName" />
17 <param index="1" name="index" type="int" default="0" />
18 <description>
19 Returns the texture that is set as default for the specified parameter.
20 [b]Note:[/b] [param name] must match the name of the uniform in the code exactly.
21 [b]Note:[/b] If the sampler array is used use [param index] to access the specified texture.
22 </description>
23 </method>
24 <method name="get_mode" qualifiers="const">
25 <return type="int" enum="Shader.Mode" />
26 <description>
27 Returns the shader mode for the shader.
28 </description>
29 </method>
30 <method name="get_shader_uniform_list">
31 <return type="Array" />
32 <param index="0" name="get_groups" type="bool" default="false" />
33 <description>
34 Returns the list of shader uniforms that can be assigned to a [ShaderMaterial], for use with [method ShaderMaterial.set_shader_parameter] and [method ShaderMaterial.get_shader_parameter]. The parameters returned are contained in dictionaries in a similar format to the ones returned by [method Object.get_property_list].
35 If argument [param get_groups] is [code]true[/code], parameter grouping hints are also included in the list.
36 </description>
37 </method>
38 <method name="inspect_native_shader_code">
39 <return type="void" />
40 <description>
41 Only available when running in the editor. Opens a popup that visualizes the generated shader code, including all variants and internal shader code. See also [method Material.inspect_native_shader_code].
42 </description>
43 </method>
44 <method name="set_default_texture_parameter">
45 <return type="void" />
46 <param index="0" name="name" type="StringName" />
47 <param index="1" name="texture" type="Texture" />
48 <param index="2" name="index" type="int" default="0" />
49 <description>
50 Sets the default texture to be used with a texture uniform. The default is used if a texture is not set in the [ShaderMaterial].
51 [b]Note:[/b] [param name] must match the name of the uniform in the code exactly.
52 [b]Note:[/b] If the sampler array is used use [param index] to access the specified texture.
53 </description>
54 </method>
55 <method name="set_include_path">
56 <return type="void" />
57 <param index="0" name="path" type="String" />
58 <description>
59 Sets the include path for this shader. Used only if the shader does not have a resource path set, for example when created by code.
60 </description>
61 </method>
62 </methods>
63 <members>
64 <member name="code" type="String" setter="set_code" getter="get_code" default="&quot;&quot;">
65 Returns the shader's code as the user has written it, not the full generated code used internally.
66 </member>
67 </members>
68 <constants>
69 <constant name="MODE_SPATIAL" value="0" enum="Mode">
70 Mode used to draw all 3D objects.
71 </constant>
72 <constant name="MODE_CANVAS_ITEM" value="1" enum="Mode">
73 Mode used to draw all 2D objects.
74 </constant>
75 <constant name="MODE_PARTICLES" value="2" enum="Mode">
76 Mode used to calculate particle information on a per-particle basis. Not used for drawing.
77 </constant>
78 <constant name="MODE_SKY" value="3" enum="Mode">
79 Mode used for drawing skies. Only works with shaders attached to [Sky] objects.
80 </constant>
81 <constant name="MODE_FOG" value="4" enum="Mode">
82 Mode used for setting the color and density of volumetric fog effect.
83 </constant>
84 <constant name="MODE_TEXTURE_BLIT" value="5" enum="Mode">
85 Mode used for drawing to DrawableTexture resources via blit calls.
86 </constant>
87 </constants>
88</class>