Shader.xml 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Shader" inherits="Resource" version="4.0">
  3. <brief_description>
  4. A custom shader program.
  5. </brief_description>
  6. <description>
  7. 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.
  8. </description>
  9. <tutorials>
  10. <link title="Shaders documentation index">https://docs.godotengine.org/en/latest/tutorials/shaders/index.html</link>
  11. </tutorials>
  12. <methods>
  13. <method name="get_default_texture_param" qualifiers="const">
  14. <return type="Texture2D" />
  15. <argument index="0" name="param" type="StringName" />
  16. <description>
  17. Returns the texture that is set as default for the specified parameter.
  18. [b]Note:[/b] [code]param[/code] must match the name of the uniform in the code exactly.
  19. </description>
  20. </method>
  21. <method name="get_mode" qualifiers="const">
  22. <return type="int" enum="Shader.Mode" />
  23. <description>
  24. Returns the shader mode for the shader, either [constant MODE_CANVAS_ITEM], [constant MODE_SPATIAL] or [constant MODE_PARTICLES].
  25. </description>
  26. </method>
  27. <method name="has_param" qualifiers="const">
  28. <return type="bool" />
  29. <argument index="0" name="name" type="StringName" />
  30. <description>
  31. Returns [code]true[/code] if the shader has this param defined as a uniform in its code.
  32. [b]Note:[/b] [code]param[/code] must match the name of the uniform in the code exactly.
  33. </description>
  34. </method>
  35. <method name="set_default_texture_param">
  36. <return type="void" />
  37. <argument index="0" name="param" type="StringName" />
  38. <argument index="1" name="texture" type="Texture2D" />
  39. <description>
  40. Sets the default texture to be used with a texture uniform. The default is used if a texture is not set in the [ShaderMaterial].
  41. [b]Note:[/b] [code]param[/code] must match the name of the uniform in the code exactly.
  42. </description>
  43. </method>
  44. </methods>
  45. <members>
  46. <member name="code" type="String" setter="set_code" getter="get_code" default="&quot;&quot;">
  47. Returns the shader's code as the user has written it, not the full generated code used internally.
  48. </member>
  49. </members>
  50. <constants>
  51. <constant name="MODE_SPATIAL" value="0" enum="Mode">
  52. Mode used to draw all 3D objects.
  53. </constant>
  54. <constant name="MODE_CANVAS_ITEM" value="1" enum="Mode">
  55. Mode used to draw all 2D objects.
  56. </constant>
  57. <constant name="MODE_PARTICLES" value="2" enum="Mode">
  58. Mode used to calculate particle information on a per-particle basis. Not used for drawing.
  59. </constant>
  60. <constant name="MODE_SKY" value="3" enum="Mode">
  61. Mode used for drawing skies. Only works with shaders attached to [Sky] objects.
  62. </constant>
  63. <constant name="MODE_FOG" value="4" enum="Mode">
  64. Mode used for setting the color and density of volumetric fog effect.
  65. </constant>
  66. </constants>
  67. </class>