mirror of
https://github.com/godotengine/godot-docs.git
synced 2025-12-31 17:49:03 +03:00
274 lines
13 KiB
ReStructuredText
274 lines
13 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. DO NOT EDIT THIS FILE!!!
|
|
.. Generated automatically from Godot engine sources.
|
|
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
|
|
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/GradientTexture2D.xml.
|
|
|
|
.. _class_GradientTexture2D:
|
|
|
|
GradientTexture2D
|
|
=================
|
|
|
|
**Inherits:** :ref:`Texture2D<class_Texture2D>` **<** :ref:`Texture<class_Texture>` **<** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
|
|
|
|
A 2D texture that creates a pattern with colors obtained from a :ref:`Gradient<class_Gradient>`.
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
Description
|
|
-----------
|
|
|
|
A 2D texture that obtains colors from a :ref:`Gradient<class_Gradient>` to fill the texture data. This texture is able to transform a color transition into different patterns such as a linear or a radial gradient. The gradient is sampled individually for each pixel so it does not necessarily represent an exact copy of the gradient(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>`.
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
Properties
|
|
----------
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
|
|
| :ref:`Fill<enum_GradientTexture2D_Fill>` | :ref:`fill<class_GradientTexture2D_property_fill>` | ``0`` |
|
|
+----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
|
|
| :ref:`Vector2<class_Vector2>` | :ref:`fill_from<class_GradientTexture2D_property_fill_from>` | ``Vector2(0, 0)`` |
|
|
+----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
|
|
| :ref:`Vector2<class_Vector2>` | :ref:`fill_to<class_GradientTexture2D_property_fill_to>` | ``Vector2(1, 0)`` |
|
|
+----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
|
|
| :ref:`Gradient<class_Gradient>` | :ref:`gradient<class_GradientTexture2D_property_gradient>` | |
|
|
+----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`height<class_GradientTexture2D_property_height>` | ``64`` |
|
|
+----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
|
|
| :ref:`Repeat<enum_GradientTexture2D_Repeat>` | :ref:`repeat<class_GradientTexture2D_property_repeat>` | ``0`` |
|
|
+----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | resource_local_to_scene | ``false`` (overrides :ref:`Resource<class_Resource_property_resource_local_to_scene>`) |
|
|
+----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`use_hdr<class_GradientTexture2D_property_use_hdr>` | ``false`` |
|
|
+----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
|
|
| :ref:`int<class_int>` | :ref:`width<class_GradientTexture2D_property_width>` | ``64`` |
|
|
+----------------------------------------------+--------------------------------------------------------------+----------------------------------------------------------------------------------------+
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Enumerations
|
|
------------
|
|
|
|
.. _enum_GradientTexture2D_Fill:
|
|
|
|
.. rst-class:: classref-enumeration
|
|
|
|
enum **Fill**: :ref:`🔗<enum_GradientTexture2D_Fill>`
|
|
|
|
.. _class_GradientTexture2D_constant_FILL_LINEAR:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`Fill<enum_GradientTexture2D_Fill>` **FILL_LINEAR** = ``0``
|
|
|
|
The colors are linearly interpolated in a straight line.
|
|
|
|
.. _class_GradientTexture2D_constant_FILL_RADIAL:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`Fill<enum_GradientTexture2D_Fill>` **FILL_RADIAL** = ``1``
|
|
|
|
The colors are linearly interpolated in a circular pattern.
|
|
|
|
.. _class_GradientTexture2D_constant_FILL_SQUARE:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`Fill<enum_GradientTexture2D_Fill>` **FILL_SQUARE** = ``2``
|
|
|
|
The colors are linearly interpolated in a square pattern.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _enum_GradientTexture2D_Repeat:
|
|
|
|
.. rst-class:: classref-enumeration
|
|
|
|
enum **Repeat**: :ref:`🔗<enum_GradientTexture2D_Repeat>`
|
|
|
|
.. _class_GradientTexture2D_constant_REPEAT_NONE:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`Repeat<enum_GradientTexture2D_Repeat>` **REPEAT_NONE** = ``0``
|
|
|
|
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.
|
|
|
|
.. _class_GradientTexture2D_constant_REPEAT:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`Repeat<enum_GradientTexture2D_Repeat>` **REPEAT** = ``1``
|
|
|
|
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.
|
|
|
|
.. _class_GradientTexture2D_constant_REPEAT_MIRROR:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`Repeat<enum_GradientTexture2D_Repeat>` **REPEAT_MIRROR** = ``2``
|
|
|
|
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.
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Property Descriptions
|
|
---------------------
|
|
|
|
.. _class_GradientTexture2D_property_fill:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Fill<enum_GradientTexture2D_Fill>` **fill** = ``0`` :ref:`🔗<class_GradientTexture2D_property_fill>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_fill**\ (\ value\: :ref:`Fill<enum_GradientTexture2D_Fill>`\ )
|
|
- :ref:`Fill<enum_GradientTexture2D_Fill>` **get_fill**\ (\ )
|
|
|
|
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.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GradientTexture2D_property_fill_from:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Vector2<class_Vector2>` **fill_from** = ``Vector2(0, 0)`` :ref:`🔗<class_GradientTexture2D_property_fill_from>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_fill_from**\ (\ value\: :ref:`Vector2<class_Vector2>`\ )
|
|
- :ref:`Vector2<class_Vector2>` **get_fill_from**\ (\ )
|
|
|
|
The initial offset used to fill the texture specified in UV coordinates.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GradientTexture2D_property_fill_to:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Vector2<class_Vector2>` **fill_to** = ``Vector2(1, 0)`` :ref:`🔗<class_GradientTexture2D_property_fill_to>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_fill_to**\ (\ value\: :ref:`Vector2<class_Vector2>`\ )
|
|
- :ref:`Vector2<class_Vector2>` **get_fill_to**\ (\ )
|
|
|
|
The final offset used to fill the texture specified in UV coordinates.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GradientTexture2D_property_gradient:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Gradient<class_Gradient>` **gradient** :ref:`🔗<class_GradientTexture2D_property_gradient>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_gradient**\ (\ value\: :ref:`Gradient<class_Gradient>`\ )
|
|
- :ref:`Gradient<class_Gradient>` **get_gradient**\ (\ )
|
|
|
|
The :ref:`Gradient<class_Gradient>` used to fill the texture.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GradientTexture2D_property_height:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`int<class_int>` **height** = ``64`` :ref:`🔗<class_GradientTexture2D_property_height>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_height**\ (\ value\: :ref:`int<class_int>`\ )
|
|
- :ref:`int<class_int>` **get_height**\ (\ )
|
|
|
|
The number of vertical color samples that will be obtained from the :ref:`Gradient<class_Gradient>`, which also represents the texture's height.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GradientTexture2D_property_repeat:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Repeat<enum_GradientTexture2D_Repeat>` **repeat** = ``0`` :ref:`🔗<class_GradientTexture2D_property_repeat>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_repeat**\ (\ value\: :ref:`Repeat<enum_GradientTexture2D_Repeat>`\ )
|
|
- :ref:`Repeat<enum_GradientTexture2D_Repeat>` **get_repeat**\ (\ )
|
|
|
|
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.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GradientTexture2D_property_use_hdr:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`bool<class_bool>` **use_hdr** = ``false`` :ref:`🔗<class_GradientTexture2D_property_use_hdr>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_use_hdr**\ (\ value\: :ref:`bool<class_bool>`\ )
|
|
- :ref:`bool<class_bool>` **is_using_hdr**\ (\ )
|
|
|
|
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).
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GradientTexture2D_property_width:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`int<class_int>` **width** = ``64`` :ref:`🔗<class_GradientTexture2D_property_width>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_width**\ (\ value\: :ref:`int<class_int>`\ )
|
|
- :ref:`int<class_int>` **get_width**\ (\ )
|
|
|
|
The number of horizontal color samples that will be obtained from the :ref:`Gradient<class_Gradient>`, which also represents the texture's width.
|
|
|
|
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
|
|
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
|
|
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
|
|
.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
|
|
.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
|
|
.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
|
|
.. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
|
|
.. |void| replace:: :abbr:`void (No return value.)`
|