Shader.xml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Shader" inherits="Resource" 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. Get 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 true, parameter grouping hints will be provided.
  36. </description>
  37. </method>
  38. <method name="set_default_texture_parameter">
  39. <return type="void" />
  40. <param index="0" name="name" type="StringName" />
  41. <param index="1" name="texture" type="Texture" />
  42. <param index="2" name="index" type="int" default="0" />
  43. <description>
  44. Sets the default texture to be used with a texture uniform. The default is used if a texture is not set in the [ShaderMaterial].
  45. [b]Note:[/b] [param name] must match the name of the uniform in the code exactly.
  46. [b]Note:[/b] If the sampler array is used use [param index] to access the specified texture.
  47. </description>
  48. </method>
  49. </methods>
  50. <members>
  51. <member name="code" type="String" setter="set_code" getter="get_code" default="&quot;&quot;">
  52. Returns the shader's code as the user has written it, not the full generated code used internally.
  53. </member>
  54. </members>
  55. <constants>
  56. <constant name="MODE_SPATIAL" value="0" enum="Mode">
  57. Mode used to draw all 3D objects.
  58. </constant>
  59. <constant name="MODE_CANVAS_ITEM" value="1" enum="Mode">
  60. Mode used to draw all 2D objects.
  61. </constant>
  62. <constant name="MODE_PARTICLES" value="2" enum="Mode">
  63. Mode used to calculate particle information on a per-particle basis. Not used for drawing.
  64. </constant>
  65. <constant name="MODE_SKY" value="3" enum="Mode">
  66. Mode used for drawing skies. Only works with shaders attached to [Sky] objects.
  67. </constant>
  68. <constant name="MODE_FOG" value="4" enum="Mode">
  69. Mode used for setting the color and density of volumetric fog effect.
  70. </constant>
  71. </constants>
  72. </class>