mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2025-12-31 09:49:22 +03:00
348 lines
20 KiB
ReStructuredText
348 lines
20 KiB
ReStructuredText
:github_url: hide
|
||
|
||
.. _class_RDPipelineColorBlendStateAttachment:
|
||
|
||
RDPipelineColorBlendStateAttachment
|
||
===================================
|
||
|
||
**Наследует:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
|
||
|
||
Присоединение состояния смешивания цветов конвейера (используется :ref:`RenderingDevice<class_RenderingDevice>`).
|
||
|
||
.. rst-class:: classref-introduction-group
|
||
|
||
Описание
|
||
----------------
|
||
|
||
Управляет тем, как выполняется смешивание между исходными и целевыми фрагментами при использовании :ref:`RenderingDevice<class_RenderingDevice>`.
|
||
|
||
Для справки, вот как реализованы общие пользовательские режимы смешивания в 2D-рендерере Godot:
|
||
|
||
\ **Mix:**\
|
||
|
||
::
|
||
|
||
var attachment = RDPipelineColorBlendStateAttachment.new()
|
||
attachment.enable_blend = true
|
||
attachment.color_blend_op = RenderingDevice.BLEND_OP_ADD
|
||
attachment.src_color_blend_factor = RenderingDevice.BLEND_FACTOR_SRC_ALPHA
|
||
attachment.dst_color_blend_factor = RenderingDevice.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
|
||
attachment.alpha_blend_op = RenderingDevice.BLEND_OP_ADD
|
||
attachment.src_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ONE
|
||
attachment.dst_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
|
||
|
||
\ **Add:**\
|
||
|
||
::
|
||
|
||
var attachment = RDPipelineColorBlendStateAttachment.new()
|
||
attachment.enable_blend = true
|
||
attachment.alpha_blend_op = RenderingDevice.BLEND_OP_ADD
|
||
attachment.color_blend_op = RenderingDevice.BLEND_OP_ADD
|
||
attachment.src_color_blend_factor = RenderingDevice.BLEND_FACTOR_SRC_ALPHA
|
||
attachment.dst_color_blend_factor = RenderingDevice.BLEND_FACTOR_ONE
|
||
attachment.src_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_SRC_ALPHA
|
||
attachment.dst_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ONE
|
||
|
||
\ **Subtract:**\
|
||
|
||
::
|
||
|
||
var attachment = RDPipelineColorBlendStateAttachment.new()
|
||
attachment.enable_blend = true
|
||
attachment.alpha_blend_op = RenderingDevice.BLEND_OP_REVERSE_SUBTRACT
|
||
attachment.color_blend_op = RenderingDevice.BLEND_OP_REVERSE_SUBTRACT
|
||
attachment.src_color_blend_factor = RenderingDevice.BLEND_FACTOR_SRC_ALPHA
|
||
attachment.dst_color_blend_factor = RenderingDevice.BLEND_FACTOR_ONE
|
||
attachment.src_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_SRC_ALPHA
|
||
attachment.dst_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ONE
|
||
|
||
\ **Multiply:**\
|
||
|
||
::
|
||
|
||
var attachment = RDPipelineColorBlendStateAttachment.new()
|
||
attachment.enable_blend = true
|
||
attachment.alpha_blend_op = RenderingDevice.BLEND_OP_ADD
|
||
attachment.color_blend_op = RenderingDevice.BLEND_OP_ADD
|
||
attachment.src_color_blend_factor = RenderingDevice.BLEND_FACTOR_DST_COLOR
|
||
attachment.dst_color_blend_factor = RenderingDevice.BLEND_FACTOR_ZERO
|
||
attachment.src_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_DST_ALPHA
|
||
attachment.dst_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ZERO
|
||
|
||
\ **Pre-multiplied alpha:**\
|
||
|
||
::
|
||
|
||
var attachment = RDPipelineColorBlendStateAttachment.new()
|
||
attachment.enable_blend = true
|
||
attachment.alpha_blend_op = RenderingDevice.BLEND_OP_ADD
|
||
attachment.color_blend_op = RenderingDevice.BLEND_OP_ADD
|
||
attachment.src_color_blend_factor = RenderingDevice.BLEND_FACTOR_ONE
|
||
attachment.dst_color_blend_factor = RenderingDevice.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
|
||
attachment.src_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ONE
|
||
attachment.dst_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
|
||
|
||
.. rst-class:: classref-reftable-group
|
||
|
||
Свойства
|
||
----------------
|
||
|
||
.. table::
|
||
:widths: auto
|
||
|
||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+-----------+
|
||
| :ref:`BlendOperation<enum_RenderingDevice_BlendOperation>` | :ref:`alpha_blend_op<class_RDPipelineColorBlendStateAttachment_property_alpha_blend_op>` | ``0`` |
|
||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+-----------+
|
||
| :ref:`BlendOperation<enum_RenderingDevice_BlendOperation>` | :ref:`color_blend_op<class_RDPipelineColorBlendStateAttachment_property_color_blend_op>` | ``0`` |
|
||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+-----------+
|
||
| :ref:`BlendFactor<enum_RenderingDevice_BlendFactor>` | :ref:`dst_alpha_blend_factor<class_RDPipelineColorBlendStateAttachment_property_dst_alpha_blend_factor>` | ``0`` |
|
||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+-----------+
|
||
| :ref:`BlendFactor<enum_RenderingDevice_BlendFactor>` | :ref:`dst_color_blend_factor<class_RDPipelineColorBlendStateAttachment_property_dst_color_blend_factor>` | ``0`` |
|
||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+-----------+
|
||
| :ref:`bool<class_bool>` | :ref:`enable_blend<class_RDPipelineColorBlendStateAttachment_property_enable_blend>` | ``false`` |
|
||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+-----------+
|
||
| :ref:`BlendFactor<enum_RenderingDevice_BlendFactor>` | :ref:`src_alpha_blend_factor<class_RDPipelineColorBlendStateAttachment_property_src_alpha_blend_factor>` | ``0`` |
|
||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+-----------+
|
||
| :ref:`BlendFactor<enum_RenderingDevice_BlendFactor>` | :ref:`src_color_blend_factor<class_RDPipelineColorBlendStateAttachment_property_src_color_blend_factor>` | ``0`` |
|
||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+-----------+
|
||
| :ref:`bool<class_bool>` | :ref:`write_a<class_RDPipelineColorBlendStateAttachment_property_write_a>` | ``true`` |
|
||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+-----------+
|
||
| :ref:`bool<class_bool>` | :ref:`write_b<class_RDPipelineColorBlendStateAttachment_property_write_b>` | ``true`` |
|
||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+-----------+
|
||
| :ref:`bool<class_bool>` | :ref:`write_g<class_RDPipelineColorBlendStateAttachment_property_write_g>` | ``true`` |
|
||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+-----------+
|
||
| :ref:`bool<class_bool>` | :ref:`write_r<class_RDPipelineColorBlendStateAttachment_property_write_r>` | ``true`` |
|
||
+------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+-----------+
|
||
|
||
.. rst-class:: classref-reftable-group
|
||
|
||
Методы
|
||
------------
|
||
|
||
.. table::
|
||
:widths: auto
|
||
|
||
+--------+--------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`set_as_mix<class_RDPipelineColorBlendStateAttachment_method_set_as_mix>`\ (\ ) |
|
||
+--------+--------------------------------------------------------------------------------------+
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
Описания свойств
|
||
--------------------------------
|
||
|
||
.. _class_RDPipelineColorBlendStateAttachment_property_alpha_blend_op:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`BlendOperation<enum_RenderingDevice_BlendOperation>` **alpha_blend_op** = ``0`` :ref:`🔗<class_RDPipelineColorBlendStateAttachment_property_alpha_blend_op>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_alpha_blend_op**\ (\ value\: :ref:`BlendOperation<enum_RenderingDevice_BlendOperation>`\ )
|
||
- :ref:`BlendOperation<enum_RenderingDevice_BlendOperation>` **get_alpha_blend_op**\ (\ )
|
||
|
||
Режим смешивания, используемый для альфа-канала.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_RDPipelineColorBlendStateAttachment_property_color_blend_op:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`BlendOperation<enum_RenderingDevice_BlendOperation>` **color_blend_op** = ``0`` :ref:`🔗<class_RDPipelineColorBlendStateAttachment_property_color_blend_op>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_color_blend_op**\ (\ value\: :ref:`BlendOperation<enum_RenderingDevice_BlendOperation>`\ )
|
||
- :ref:`BlendOperation<enum_RenderingDevice_BlendOperation>` **get_color_blend_op**\ (\ )
|
||
|
||
Режим смешивания, используемый для цветовых каналов красного/зеленого/синего.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_RDPipelineColorBlendStateAttachment_property_dst_alpha_blend_factor:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`BlendFactor<enum_RenderingDevice_BlendFactor>` **dst_alpha_blend_factor** = ``0`` :ref:`🔗<class_RDPipelineColorBlendStateAttachment_property_dst_alpha_blend_factor>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_dst_alpha_blend_factor**\ (\ value\: :ref:`BlendFactor<enum_RenderingDevice_BlendFactor>`\ )
|
||
- :ref:`BlendFactor<enum_RenderingDevice_BlendFactor>` **get_dst_alpha_blend_factor**\ (\ )
|
||
|
||
Управляет тем, как определяется коэффициент смешивания для альфа-канала на основе фрагментов назначения.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_RDPipelineColorBlendStateAttachment_property_dst_color_blend_factor:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`BlendFactor<enum_RenderingDevice_BlendFactor>` **dst_color_blend_factor** = ``0`` :ref:`🔗<class_RDPipelineColorBlendStateAttachment_property_dst_color_blend_factor>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_dst_color_blend_factor**\ (\ value\: :ref:`BlendFactor<enum_RenderingDevice_BlendFactor>`\ )
|
||
- :ref:`BlendFactor<enum_RenderingDevice_BlendFactor>` **get_dst_color_blend_factor**\ (\ )
|
||
|
||
Управляет тем, как определяется коэффициент смешивания для цветовых каналов на основе фрагментов назначения.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_RDPipelineColorBlendStateAttachment_property_enable_blend:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **enable_blend** = ``false`` :ref:`🔗<class_RDPipelineColorBlendStateAttachment_property_enable_blend>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_enable_blend**\ (\ value\: :ref:`bool<class_bool>`\ )
|
||
- :ref:`bool<class_bool>` **get_enable_blend**\ (\ )
|
||
|
||
Если ``true``, выполняет смешивание между источником и назначением в соответствии с факторами, определенными в :ref:`src_color_blend_factor<class_RDPipelineColorBlendStateAttachment_property_src_color_blend_factor>`, :ref:`dst_color_blend_factor<class_RDPipelineColorBlendStateAttachment_property_dst_color_blend_factor>`, :ref:`src_alpha_blend_factor<class_RDPipelineColorBlendStateAttachment_property_src_alpha_blend_factor>` и :ref:`dst_alpha_blend_factor<class_RDPipelineColorBlendStateAttachment_property_dst_alpha_blend_factor>`. Режимы смешивания :ref:`color_blend_op<class_RDPipelineColorBlendStateAttachment_property_color_blend_op>` и :ref:`alpha_blend_op<class_RDPipelineColorBlendStateAttachment_property_alpha_blend_op>` также учитываются, при этом :ref:`write_r<class_RDPipelineColorBlendStateAttachment_property_write_r>`, :ref:`write_g<class_RDPipelineColorBlendStateAttachment_property_write_g>`, :ref:`write_b<class_RDPipelineColorBlendStateAttachment_property_write_b>` и :ref:`write_a<class_RDPipelineColorBlendStateAttachment_property_write_a>` управляют выводом.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_RDPipelineColorBlendStateAttachment_property_src_alpha_blend_factor:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`BlendFactor<enum_RenderingDevice_BlendFactor>` **src_alpha_blend_factor** = ``0`` :ref:`🔗<class_RDPipelineColorBlendStateAttachment_property_src_alpha_blend_factor>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_src_alpha_blend_factor**\ (\ value\: :ref:`BlendFactor<enum_RenderingDevice_BlendFactor>`\ )
|
||
- :ref:`BlendFactor<enum_RenderingDevice_BlendFactor>` **get_src_alpha_blend_factor**\ (\ )
|
||
|
||
Управляет тем, как определяется коэффициент смешивания для альфа-канала на основе фрагментов источника.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_RDPipelineColorBlendStateAttachment_property_src_color_blend_factor:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`BlendFactor<enum_RenderingDevice_BlendFactor>` **src_color_blend_factor** = ``0`` :ref:`🔗<class_RDPipelineColorBlendStateAttachment_property_src_color_blend_factor>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_src_color_blend_factor**\ (\ value\: :ref:`BlendFactor<enum_RenderingDevice_BlendFactor>`\ )
|
||
- :ref:`BlendFactor<enum_RenderingDevice_BlendFactor>` **get_src_color_blend_factor**\ (\ )
|
||
|
||
Управляет тем, как определяется коэффициент смешивания цветовых каналов на основе фрагментов источника.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_RDPipelineColorBlendStateAttachment_property_write_a:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **write_a** = ``true`` :ref:`🔗<class_RDPipelineColorBlendStateAttachment_property_write_a>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_write_a**\ (\ value\: :ref:`bool<class_bool>`\ )
|
||
- :ref:`bool<class_bool>` **get_write_a**\ (\ )
|
||
|
||
Если ``true``, записывает новый альфа-канал в конечный результат.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_RDPipelineColorBlendStateAttachment_property_write_b:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **write_b** = ``true`` :ref:`🔗<class_RDPipelineColorBlendStateAttachment_property_write_b>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_write_b**\ (\ value\: :ref:`bool<class_bool>`\ )
|
||
- :ref:`bool<class_bool>` **get_write_b**\ (\ )
|
||
|
||
Если ``true``, записывает новый канал синего цвета в конечный результат.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_RDPipelineColorBlendStateAttachment_property_write_g:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **write_g** = ``true`` :ref:`🔗<class_RDPipelineColorBlendStateAttachment_property_write_g>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_write_g**\ (\ value\: :ref:`bool<class_bool>`\ )
|
||
- :ref:`bool<class_bool>` **get_write_g**\ (\ )
|
||
|
||
Если ``true``, записывает новый канал зеленого цвета в конечный результат.
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_RDPipelineColorBlendStateAttachment_property_write_r:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **write_r** = ``true`` :ref:`🔗<class_RDPipelineColorBlendStateAttachment_property_write_r>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_write_r**\ (\ value\: :ref:`bool<class_bool>`\ )
|
||
- :ref:`bool<class_bool>` **get_write_r**\ (\ )
|
||
|
||
Если ``true``, записывает новый канал красного цвета в конечный результат.
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
Описания метода
|
||
------------------------------
|
||
|
||
.. _class_RDPipelineColorBlendStateAttachment_method_set_as_mix:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **set_as_mix**\ (\ ) :ref:`🔗<class_RDPipelineColorBlendStateAttachment_method_set_as_mix>`
|
||
|
||
Удобный метод для выполнения стандартного смешивания с прямой (не предварительно умноженной) альфой. Это устанавливает :ref:`enable_blend<class_RDPipelineColorBlendStateAttachment_property_enable_blend>` в ``true``, :ref:`src_color_blend_factor<class_RDPipelineColorBlendStateAttachment_property_src_color_blend_factor>` в :ref:`RenderingDevice.BLEND_FACTOR_SRC_ALPHA<class_RenderingDevice_constant_BLEND_FACTOR_SRC_ALPHA>`, :ref:`dst_color_blend_factor<class_RDPipelineColorBlendStateAttachment_property_dst_color_blend_factor>` в :ref:`RenderingDevice.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA<class_RenderingDevice_constant_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA>`, :ref:`src_alpha_blend_factor<class_RDPipelineColorBlendStateAttachment_property_src_alpha_blend_factor>` в :ref:`RenderingDevice.BLEND_FACTOR_SRC_ALPHA<class_RenderingDevice_constant_BLEND_FACTOR_SRC_ALPHA>` и :ref:`dst_alpha_blend_factor<class_RDPipelineColorBlendStateAttachment_property_dst_alpha_blend_factor>` в :ref:`RenderingDevice.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA<class_RenderingDevice_constant_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA>`.
|
||
|
||
.. |virtual| replace:: :abbr:`virtual (Этот метод обычно должен быть переопределен пользователем, чтобы иметь какой-либо эффект.)`
|
||
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
|
||
.. |const| replace:: :abbr:`const (Этот метод не имеет побочных эффектов. Он не изменяет ни одну из переменных-членов экземпляра.)`
|
||
.. |vararg| replace:: :abbr:`vararg (Этот метод принимает любое количество аргументов после описанных здесь.)`
|
||
.. |constructor| replace:: :abbr:`constructor (Этот метод используется для создания типа.)`
|
||
.. |static| replace:: :abbr:`static (Этот метод не нуждается в вызове экземпляра, поэтому его можно вызвать напрямую, используя имя класса.)`
|
||
.. |operator| replace:: :abbr:`operator (Этот метод описывает допустимый оператор для использования с этим типом в качестве левого операнда.)`
|
||
.. |bitfield| replace:: :abbr:`BitField (Это значение является целым числом, составленным как битовая маска следующих флагов.)`
|
||
.. |void| replace:: :abbr:`void (Нет возвращаемого значения.)`
|