class_shadermaterial.rst 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the ShaderMaterial.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_ShaderMaterial:
  6. ShaderMaterial
  7. ==============
  8. **Inherits:** :ref:`Material<class_Material>` **<** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  9. A material that uses a custom :ref:`Shader<class_Shader>` program.
  10. Description
  11. -----------
  12. A material that uses a custom :ref:`Shader<class_Shader>` program to render either items to screen or process particles. You can create multiple materials for the same shader but configure different values for the uniforms defined in the shader.
  13. Tutorials
  14. ---------
  15. - :doc:`../tutorials/shading/index`
  16. Properties
  17. ----------
  18. +-----------------------------+-----------------------------------------------------+
  19. | :ref:`Shader<class_Shader>` | :ref:`shader<class_ShaderMaterial_property_shader>` |
  20. +-----------------------------+-----------------------------------------------------+
  21. Methods
  22. -------
  23. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`Variant<class_Variant>` | :ref:`get_shader_param<class_ShaderMaterial_method_get_shader_param>` **(** :ref:`String<class_String>` param **)** const |
  25. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`bool<class_bool>` | :ref:`property_can_revert<class_ShaderMaterial_method_property_can_revert>` **(** :ref:`String<class_String>` name **)** |
  27. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`Variant<class_Variant>` | :ref:`property_get_revert<class_ShaderMaterial_method_property_get_revert>` **(** :ref:`String<class_String>` name **)** |
  29. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | void | :ref:`set_shader_param<class_ShaderMaterial_method_set_shader_param>` **(** :ref:`String<class_String>` param, :ref:`Variant<class_Variant>` value **)** |
  31. +-------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. Property Descriptions
  33. ---------------------
  34. .. _class_ShaderMaterial_property_shader:
  35. - :ref:`Shader<class_Shader>` **shader**
  36. +----------+-------------------+
  37. | *Setter* | set_shader(value) |
  38. +----------+-------------------+
  39. | *Getter* | get_shader() |
  40. +----------+-------------------+
  41. The :ref:`Shader<class_Shader>` program used to render this material.
  42. Method Descriptions
  43. -------------------
  44. .. _class_ShaderMaterial_method_get_shader_param:
  45. - :ref:`Variant<class_Variant>` **get_shader_param** **(** :ref:`String<class_String>` param **)** const
  46. Returns the current value set for this material of a uniform in the shader.
  47. ----
  48. .. _class_ShaderMaterial_method_property_can_revert:
  49. - :ref:`bool<class_bool>` **property_can_revert** **(** :ref:`String<class_String>` name **)**
  50. Returns ``true`` if the property identified by ``name`` can be reverted to a default value.
  51. ----
  52. .. _class_ShaderMaterial_method_property_get_revert:
  53. - :ref:`Variant<class_Variant>` **property_get_revert** **(** :ref:`String<class_String>` name **)**
  54. Returns the default value of the material property with given ``name``.
  55. ----
  56. .. _class_ShaderMaterial_method_set_shader_param:
  57. - void **set_shader_param** **(** :ref:`String<class_String>` param, :ref:`Variant<class_Variant>` value **)**
  58. Changes the value set for this material of a uniform in the shader. **Note:** ``param`` must match the name of the uniform in the code exactly.