class_visualshadernodecolorfunc.rst 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the VisualShaderNodeColorFunc.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_VisualShaderNodeColorFunc:
  6. VisualShaderNodeColorFunc
  7. =========================
  8. **Inherits:** :ref:`VisualShaderNode<class_VisualShaderNode>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  9. A :ref:`Color<class_Color>` function to be used within the visual shader graph.
  10. Description
  11. -----------
  12. Accept a :ref:`Color<class_Color>` to the input port and transform it according to :ref:`function<class_VisualShaderNodeColorFunc_property_function>`.
  13. Properties
  14. ----------
  15. +----------------------------------------------------------+--------------------------------------------------------------------+-------+
  16. | :ref:`Function<enum_VisualShaderNodeColorFunc_Function>` | :ref:`function<class_VisualShaderNodeColorFunc_property_function>` | ``0`` |
  17. +----------------------------------------------------------+--------------------------------------------------------------------+-------+
  18. Enumerations
  19. ------------
  20. .. _enum_VisualShaderNodeColorFunc_Function:
  21. .. _class_VisualShaderNodeColorFunc_constant_FUNC_GRAYSCALE:
  22. .. _class_VisualShaderNodeColorFunc_constant_FUNC_SEPIA:
  23. .. _class_VisualShaderNodeColorFunc_constant_FUNC_MAX:
  24. enum **Function**:
  25. - **FUNC_GRAYSCALE** = **0** --- Converts the color to grayscale using the following formula:
  26. ::
  27. vec3 c = input;
  28. float max1 = max(c.r, c.g);
  29. float max2 = max(max1, c.b);
  30. float max3 = max(max1, max2);
  31. return vec3(max3, max3, max3);
  32. - **FUNC_SEPIA** = **1** --- Applies sepia tone effect using the following formula:
  33. ::
  34. vec3 c = input;
  35. float r = (c.r * 0.393) + (c.g * 0.769) + (c.b * 0.189);
  36. float g = (c.r * 0.349) + (c.g * 0.686) + (c.b * 0.168);
  37. float b = (c.r * 0.272) + (c.g * 0.534) + (c.b * 0.131);
  38. return vec3(r, g, b);
  39. - **FUNC_MAX** = **2** --- Represents the size of the :ref:`Function<enum_VisualShaderNodeColorFunc_Function>` enum.
  40. Property Descriptions
  41. ---------------------
  42. .. _class_VisualShaderNodeColorFunc_property_function:
  43. - :ref:`Function<enum_VisualShaderNodeColorFunc_Function>` **function**
  44. +-----------+---------------------+
  45. | *Default* | ``0`` |
  46. +-----------+---------------------+
  47. | *Setter* | set_function(value) |
  48. +-----------+---------------------+
  49. | *Getter* | get_function() |
  50. +-----------+---------------------+
  51. A function to be applied to the input color. See :ref:`Function<enum_VisualShaderNodeColorFunc_Function>` for options.
  52. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  53. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  54. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  55. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  56. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  57. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`