class_gradienttexture2d.rst 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/4.0/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.0/doc/classes/GradientTexture2D.xml.
  6. .. _class_GradientTexture2D:
  7. GradientTexture2D
  8. =================
  9. **Inherits:** :ref:`Texture2D<class_Texture2D>` **<** :ref:`Texture<class_Texture>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. Gradient-filled 2D texture.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. The texture uses a :ref:`Gradient<class_Gradient>` to fill the texture data in 2D space. The gradient is filled according to the specified :ref:`fill<class_GradientTexture2D_property_fill>` and :ref:`repeat<class_GradientTexture2D_property_repeat>` types using colors obtained from the gradient. The texture does not necessarily represent an exact copy of the gradient, but instead an interpolation of samples obtained from the gradient at fixed steps (see :ref:`width<class_GradientTexture2D_property_width>` and :ref:`height<class_GradientTexture2D_property_height>`). See also :ref:`GradientTexture1D<class_GradientTexture1D>`, :ref:`CurveTexture<class_CurveTexture>` and :ref:`CurveXYZTexture<class_CurveXYZTexture>`.
  15. .. rst-class:: classref-reftable-group
  16. Properties
  17. ----------
  18. .. table::
  19. :widths: auto
  20. +----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
  21. | :ref:`Fill<enum_GradientTexture2D_Fill>` | :ref:`fill<class_GradientTexture2D_property_fill>` | ``0`` |
  22. +----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
  23. | :ref:`Vector2<class_Vector2>` | :ref:`fill_from<class_GradientTexture2D_property_fill_from>` | ``Vector2(0, 0)`` |
  24. +----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
  25. | :ref:`Vector2<class_Vector2>` | :ref:`fill_to<class_GradientTexture2D_property_fill_to>` | ``Vector2(1, 0)`` |
  26. +----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
  27. | :ref:`Gradient<class_Gradient>` | :ref:`gradient<class_GradientTexture2D_property_gradient>` | |
  28. +----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
  29. | :ref:`int<class_int>` | :ref:`height<class_GradientTexture2D_property_height>` | ``64`` |
  30. +----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
  31. | :ref:`Repeat<enum_GradientTexture2D_Repeat>` | :ref:`repeat<class_GradientTexture2D_property_repeat>` | ``0`` |
  32. +----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
  33. | :ref:`bool<class_bool>` | resource_local_to_scene | ``false`` (overrides :ref:`Resource<class_Resource_property_resource_local_to_scene>`) |
  34. +----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
  35. | :ref:`bool<class_bool>` | :ref:`use_hdr<class_GradientTexture2D_property_use_hdr>` | ``false`` |
  36. +----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
  37. | :ref:`int<class_int>` | :ref:`width<class_GradientTexture2D_property_width>` | ``64`` |
  38. +----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
  39. .. rst-class:: classref-section-separator
  40. ----
  41. .. rst-class:: classref-descriptions-group
  42. Enumerations
  43. ------------
  44. .. _enum_GradientTexture2D_Fill:
  45. .. rst-class:: classref-enumeration
  46. enum **Fill**:
  47. .. _class_GradientTexture2D_constant_FILL_LINEAR:
  48. .. rst-class:: classref-enumeration-constant
  49. :ref:`Fill<enum_GradientTexture2D_Fill>` **FILL_LINEAR** = ``0``
  50. The colors are linearly interpolated in a straight line.
  51. .. _class_GradientTexture2D_constant_FILL_RADIAL:
  52. .. rst-class:: classref-enumeration-constant
  53. :ref:`Fill<enum_GradientTexture2D_Fill>` **FILL_RADIAL** = ``1``
  54. The colors are linearly interpolated in a circular pattern.
  55. .. rst-class:: classref-item-separator
  56. ----
  57. .. _enum_GradientTexture2D_Repeat:
  58. .. rst-class:: classref-enumeration
  59. enum **Repeat**:
  60. .. _class_GradientTexture2D_constant_REPEAT_NONE:
  61. .. rst-class:: classref-enumeration-constant
  62. :ref:`Repeat<enum_GradientTexture2D_Repeat>` **REPEAT_NONE** = ``0``
  63. The gradient fill is restricted to the range defined by :ref:`fill_from<class_GradientTexture2D_property_fill_from>` to :ref:`fill_to<class_GradientTexture2D_property_fill_to>` offsets.
  64. .. _class_GradientTexture2D_constant_REPEAT:
  65. .. rst-class:: classref-enumeration-constant
  66. :ref:`Repeat<enum_GradientTexture2D_Repeat>` **REPEAT** = ``1``
  67. The texture is filled starting from :ref:`fill_from<class_GradientTexture2D_property_fill_from>` to :ref:`fill_to<class_GradientTexture2D_property_fill_to>` offsets, repeating the same pattern in both directions.
  68. .. _class_GradientTexture2D_constant_REPEAT_MIRROR:
  69. .. rst-class:: classref-enumeration-constant
  70. :ref:`Repeat<enum_GradientTexture2D_Repeat>` **REPEAT_MIRROR** = ``2``
  71. The texture is filled starting from :ref:`fill_from<class_GradientTexture2D_property_fill_from>` to :ref:`fill_to<class_GradientTexture2D_property_fill_to>` offsets, mirroring the pattern in both directions.
  72. .. rst-class:: classref-section-separator
  73. ----
  74. .. rst-class:: classref-descriptions-group
  75. Property Descriptions
  76. ---------------------
  77. .. _class_GradientTexture2D_property_fill:
  78. .. rst-class:: classref-property
  79. :ref:`Fill<enum_GradientTexture2D_Fill>` **fill** = ``0``
  80. .. rst-class:: classref-property-setget
  81. - void **set_fill** **(** :ref:`Fill<enum_GradientTexture2D_Fill>` value **)**
  82. - :ref:`Fill<enum_GradientTexture2D_Fill>` **get_fill** **(** **)**
  83. The gradient fill type, one of the :ref:`Fill<enum_GradientTexture2D_Fill>` values. The texture is filled by interpolating colors starting from :ref:`fill_from<class_GradientTexture2D_property_fill_from>` to :ref:`fill_to<class_GradientTexture2D_property_fill_to>` offsets.
  84. .. rst-class:: classref-item-separator
  85. ----
  86. .. _class_GradientTexture2D_property_fill_from:
  87. .. rst-class:: classref-property
  88. :ref:`Vector2<class_Vector2>` **fill_from** = ``Vector2(0, 0)``
  89. .. rst-class:: classref-property-setget
  90. - void **set_fill_from** **(** :ref:`Vector2<class_Vector2>` value **)**
  91. - :ref:`Vector2<class_Vector2>` **get_fill_from** **(** **)**
  92. The initial offset used to fill the texture specified in UV coordinates.
  93. .. rst-class:: classref-item-separator
  94. ----
  95. .. _class_GradientTexture2D_property_fill_to:
  96. .. rst-class:: classref-property
  97. :ref:`Vector2<class_Vector2>` **fill_to** = ``Vector2(1, 0)``
  98. .. rst-class:: classref-property-setget
  99. - void **set_fill_to** **(** :ref:`Vector2<class_Vector2>` value **)**
  100. - :ref:`Vector2<class_Vector2>` **get_fill_to** **(** **)**
  101. The final offset used to fill the texture specified in UV coordinates.
  102. .. rst-class:: classref-item-separator
  103. ----
  104. .. _class_GradientTexture2D_property_gradient:
  105. .. rst-class:: classref-property
  106. :ref:`Gradient<class_Gradient>` **gradient**
  107. .. rst-class:: classref-property-setget
  108. - void **set_gradient** **(** :ref:`Gradient<class_Gradient>` value **)**
  109. - :ref:`Gradient<class_Gradient>` **get_gradient** **(** **)**
  110. The :ref:`Gradient<class_Gradient>` used to fill the texture.
  111. .. rst-class:: classref-item-separator
  112. ----
  113. .. _class_GradientTexture2D_property_height:
  114. .. rst-class:: classref-property
  115. :ref:`int<class_int>` **height** = ``64``
  116. .. rst-class:: classref-property-setget
  117. - void **set_height** **(** :ref:`int<class_int>` value **)**
  118. - :ref:`int<class_int>` **get_height** **(** **)**
  119. The number of vertical color samples that will be obtained from the :ref:`Gradient<class_Gradient>`, which also represents the texture's height.
  120. .. rst-class:: classref-item-separator
  121. ----
  122. .. _class_GradientTexture2D_property_repeat:
  123. .. rst-class:: classref-property
  124. :ref:`Repeat<enum_GradientTexture2D_Repeat>` **repeat** = ``0``
  125. .. rst-class:: classref-property-setget
  126. - void **set_repeat** **(** :ref:`Repeat<enum_GradientTexture2D_Repeat>` value **)**
  127. - :ref:`Repeat<enum_GradientTexture2D_Repeat>` **get_repeat** **(** **)**
  128. The gradient repeat type, one of the :ref:`Repeat<enum_GradientTexture2D_Repeat>` values. The texture is filled starting from :ref:`fill_from<class_GradientTexture2D_property_fill_from>` to :ref:`fill_to<class_GradientTexture2D_property_fill_to>` offsets by default, but the gradient fill can be repeated to cover the entire texture.
  129. .. rst-class:: classref-item-separator
  130. ----
  131. .. _class_GradientTexture2D_property_use_hdr:
  132. .. rst-class:: classref-property
  133. :ref:`bool<class_bool>` **use_hdr** = ``false``
  134. .. rst-class:: classref-property-setget
  135. - void **set_use_hdr** **(** :ref:`bool<class_bool>` value **)**
  136. - :ref:`bool<class_bool>` **is_using_hdr** **(** **)**
  137. If ``true``, the generated texture will support high dynamic range (:ref:`Image.FORMAT_RGBAF<class_Image_constant_FORMAT_RGBAF>` format). This allows for glow effects to work if :ref:`Environment.glow_enabled<class_Environment_property_glow_enabled>` is ``true``. If ``false``, the generated texture will use low dynamic range; overbright colors will be clamped (:ref:`Image.FORMAT_RGBA8<class_Image_constant_FORMAT_RGBA8>` format).
  138. .. rst-class:: classref-item-separator
  139. ----
  140. .. _class_GradientTexture2D_property_width:
  141. .. rst-class:: classref-property
  142. :ref:`int<class_int>` **width** = ``64``
  143. .. rst-class:: classref-property-setget
  144. - void **set_width** **(** :ref:`int<class_int>` value **)**
  145. - :ref:`int<class_int>` **get_width** **(** **)**
  146. The number of horizontal color samples that will be obtained from the :ref:`Gradient<class_Gradient>`, which also represents the texture's width.
  147. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  148. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  149. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  150. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  151. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  152. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`