class_rdpipelinecolorblendstateattachment.rst 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  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/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/RDPipelineColorBlendStateAttachment.xml.
  6. .. _class_RDPipelineColorBlendStateAttachment:
  7. RDPipelineColorBlendStateAttachment
  8. ===================================
  9. **Inherits:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. Pipeline color blend state attachment (used by :ref:`RenderingDevice<class_RenderingDevice>`).
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Controls how blending between source and destination fragments is performed when using :ref:`RenderingDevice<class_RenderingDevice>`.
  15. For reference, this is how common user-facing blend modes are implemented in Godot's 2D renderer:
  16. \ **Mix:**\
  17. ::
  18. var attachment = RDPipelineColorBlendStateAttachment.new()
  19. attachment.enable_blend = true
  20. attachment.color_blend_op = RenderingDevice.BLEND_OP_ADD
  21. attachment.src_color_blend_factor = RenderingDevice.BLEND_FACTOR_SRC_ALPHA
  22. attachment.dst_color_blend_factor = RenderingDevice.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
  23. attachment.alpha_blend_op = RenderingDevice.BLEND_OP_ADD
  24. attachment.src_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ONE
  25. attachment.dst_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
  26. \ **Add:**\
  27. ::
  28. var attachment = RDPipelineColorBlendStateAttachment.new()
  29. attachment.enable_blend = true
  30. attachment.alpha_blend_op = RenderingDevice.BLEND_OP_ADD
  31. attachment.color_blend_op = RenderingDevice.BLEND_OP_ADD
  32. attachment.src_color_blend_factor = RenderingDevice.BLEND_FACTOR_SRC_ALPHA
  33. attachment.dst_color_blend_factor = RenderingDevice.BLEND_FACTOR_ONE
  34. attachment.src_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_SRC_ALPHA
  35. attachment.dst_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ONE
  36. \ **Subtract:**\
  37. ::
  38. var attachment = RDPipelineColorBlendStateAttachment.new()
  39. attachment.enable_blend = true
  40. attachment.alpha_blend_op = RenderingDevice.BLEND_OP_REVERSE_SUBTRACT
  41. attachment.color_blend_op = RenderingDevice.BLEND_OP_REVERSE_SUBTRACT
  42. attachment.src_color_blend_factor = RenderingDevice.BLEND_FACTOR_SRC_ALPHA
  43. attachment.dst_color_blend_factor = RenderingDevice.BLEND_FACTOR_ONE
  44. attachment.src_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_SRC_ALPHA
  45. attachment.dst_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ONE
  46. \ **Multiply:**\
  47. ::
  48. var attachment = RDPipelineColorBlendStateAttachment.new()
  49. attachment.enable_blend = true
  50. attachment.alpha_blend_op = RenderingDevice.BLEND_OP_ADD
  51. attachment.color_blend_op = RenderingDevice.BLEND_OP_ADD
  52. attachment.src_color_blend_factor = RenderingDevice.BLEND_FACTOR_DST_COLOR
  53. attachment.dst_color_blend_factor = RenderingDevice.BLEND_FACTOR_ZERO
  54. attachment.src_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_DST_ALPHA
  55. attachment.dst_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ZERO
  56. \ **Pre-multiplied alpha:**\
  57. ::
  58. var attachment = RDPipelineColorBlendStateAttachment.new()
  59. attachment.enable_blend = true
  60. attachment.alpha_blend_op = RenderingDevice.BLEND_OP_ADD
  61. attachment.color_blend_op = RenderingDevice.BLEND_OP_ADD
  62. attachment.src_color_blend_factor = RenderingDevice.BLEND_FACTOR_ONE
  63. attachment.dst_color_blend_factor = RenderingDevice.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
  64. attachment.src_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ONE
  65. attachment.dst_alpha_blend_factor = RenderingDevice.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA
  66. .. rst-class:: classref-reftable-group
  67. Properties
  68. ----------
  69. .. table::
  70. :widths: auto
  71. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+-----------+
  72. | :ref:`BlendOperation<enum_RenderingDevice_BlendOperation>` | :ref:`alpha_blend_op<class_RDPipelineColorBlendStateAttachment_property_alpha_blend_op>` | ``0`` |
  73. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+-----------+
  74. | :ref:`BlendOperation<enum_RenderingDevice_BlendOperation>` | :ref:`color_blend_op<class_RDPipelineColorBlendStateAttachment_property_color_blend_op>` | ``0`` |
  75. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+-----------+
  76. | :ref:`BlendFactor<enum_RenderingDevice_BlendFactor>` | :ref:`dst_alpha_blend_factor<class_RDPipelineColorBlendStateAttachment_property_dst_alpha_blend_factor>` | ``0`` |
  77. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+-----------+
  78. | :ref:`BlendFactor<enum_RenderingDevice_BlendFactor>` | :ref:`dst_color_blend_factor<class_RDPipelineColorBlendStateAttachment_property_dst_color_blend_factor>` | ``0`` |
  79. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+-----------+
  80. | :ref:`bool<class_bool>` | :ref:`enable_blend<class_RDPipelineColorBlendStateAttachment_property_enable_blend>` | ``false`` |
  81. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+-----------+
  82. | :ref:`BlendFactor<enum_RenderingDevice_BlendFactor>` | :ref:`src_alpha_blend_factor<class_RDPipelineColorBlendStateAttachment_property_src_alpha_blend_factor>` | ``0`` |
  83. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+-----------+
  84. | :ref:`BlendFactor<enum_RenderingDevice_BlendFactor>` | :ref:`src_color_blend_factor<class_RDPipelineColorBlendStateAttachment_property_src_color_blend_factor>` | ``0`` |
  85. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+-----------+
  86. | :ref:`bool<class_bool>` | :ref:`write_a<class_RDPipelineColorBlendStateAttachment_property_write_a>` | ``true`` |
  87. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+-----------+
  88. | :ref:`bool<class_bool>` | :ref:`write_b<class_RDPipelineColorBlendStateAttachment_property_write_b>` | ``true`` |
  89. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+-----------+
  90. | :ref:`bool<class_bool>` | :ref:`write_g<class_RDPipelineColorBlendStateAttachment_property_write_g>` | ``true`` |
  91. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+-----------+
  92. | :ref:`bool<class_bool>` | :ref:`write_r<class_RDPipelineColorBlendStateAttachment_property_write_r>` | ``true`` |
  93. +------------------------------------------------------------+----------------------------------------------------------------------------------------------------------+-----------+
  94. .. rst-class:: classref-reftable-group
  95. Methods
  96. -------
  97. .. table::
  98. :widths: auto
  99. +--------+--------------------------------------------------------------------------------------+
  100. | |void| | :ref:`set_as_mix<class_RDPipelineColorBlendStateAttachment_method_set_as_mix>`\ (\ ) |
  101. +--------+--------------------------------------------------------------------------------------+
  102. .. rst-class:: classref-section-separator
  103. ----
  104. .. rst-class:: classref-descriptions-group
  105. Property Descriptions
  106. ---------------------
  107. .. _class_RDPipelineColorBlendStateAttachment_property_alpha_blend_op:
  108. .. rst-class:: classref-property
  109. :ref:`BlendOperation<enum_RenderingDevice_BlendOperation>` **alpha_blend_op** = ``0`` :ref:`🔗<class_RDPipelineColorBlendStateAttachment_property_alpha_blend_op>`
  110. .. rst-class:: classref-property-setget
  111. - |void| **set_alpha_blend_op**\ (\ value\: :ref:`BlendOperation<enum_RenderingDevice_BlendOperation>`\ )
  112. - :ref:`BlendOperation<enum_RenderingDevice_BlendOperation>` **get_alpha_blend_op**\ (\ )
  113. The blend mode to use for the alpha channel.
  114. .. rst-class:: classref-item-separator
  115. ----
  116. .. _class_RDPipelineColorBlendStateAttachment_property_color_blend_op:
  117. .. rst-class:: classref-property
  118. :ref:`BlendOperation<enum_RenderingDevice_BlendOperation>` **color_blend_op** = ``0`` :ref:`🔗<class_RDPipelineColorBlendStateAttachment_property_color_blend_op>`
  119. .. rst-class:: classref-property-setget
  120. - |void| **set_color_blend_op**\ (\ value\: :ref:`BlendOperation<enum_RenderingDevice_BlendOperation>`\ )
  121. - :ref:`BlendOperation<enum_RenderingDevice_BlendOperation>` **get_color_blend_op**\ (\ )
  122. The blend mode to use for the red/green/blue color channels.
  123. .. rst-class:: classref-item-separator
  124. ----
  125. .. _class_RDPipelineColorBlendStateAttachment_property_dst_alpha_blend_factor:
  126. .. rst-class:: classref-property
  127. :ref:`BlendFactor<enum_RenderingDevice_BlendFactor>` **dst_alpha_blend_factor** = ``0`` :ref:`🔗<class_RDPipelineColorBlendStateAttachment_property_dst_alpha_blend_factor>`
  128. .. rst-class:: classref-property-setget
  129. - |void| **set_dst_alpha_blend_factor**\ (\ value\: :ref:`BlendFactor<enum_RenderingDevice_BlendFactor>`\ )
  130. - :ref:`BlendFactor<enum_RenderingDevice_BlendFactor>` **get_dst_alpha_blend_factor**\ (\ )
  131. Controls how the blend factor for the alpha channel is determined based on the destination's fragments.
  132. .. rst-class:: classref-item-separator
  133. ----
  134. .. _class_RDPipelineColorBlendStateAttachment_property_dst_color_blend_factor:
  135. .. rst-class:: classref-property
  136. :ref:`BlendFactor<enum_RenderingDevice_BlendFactor>` **dst_color_blend_factor** = ``0`` :ref:`🔗<class_RDPipelineColorBlendStateAttachment_property_dst_color_blend_factor>`
  137. .. rst-class:: classref-property-setget
  138. - |void| **set_dst_color_blend_factor**\ (\ value\: :ref:`BlendFactor<enum_RenderingDevice_BlendFactor>`\ )
  139. - :ref:`BlendFactor<enum_RenderingDevice_BlendFactor>` **get_dst_color_blend_factor**\ (\ )
  140. Controls how the blend factor for the color channels is determined based on the destination's fragments.
  141. .. rst-class:: classref-item-separator
  142. ----
  143. .. _class_RDPipelineColorBlendStateAttachment_property_enable_blend:
  144. .. rst-class:: classref-property
  145. :ref:`bool<class_bool>` **enable_blend** = ``false`` :ref:`🔗<class_RDPipelineColorBlendStateAttachment_property_enable_blend>`
  146. .. rst-class:: classref-property-setget
  147. - |void| **set_enable_blend**\ (\ value\: :ref:`bool<class_bool>`\ )
  148. - :ref:`bool<class_bool>` **get_enable_blend**\ (\ )
  149. If ``true``, performs blending between the source and destination according to the factors defined in :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>` and :ref:`dst_alpha_blend_factor<class_RDPipelineColorBlendStateAttachment_property_dst_alpha_blend_factor>`. The blend modes :ref:`color_blend_op<class_RDPipelineColorBlendStateAttachment_property_color_blend_op>` and :ref:`alpha_blend_op<class_RDPipelineColorBlendStateAttachment_property_alpha_blend_op>` are also taken into account, with :ref:`write_r<class_RDPipelineColorBlendStateAttachment_property_write_r>`, :ref:`write_g<class_RDPipelineColorBlendStateAttachment_property_write_g>`, :ref:`write_b<class_RDPipelineColorBlendStateAttachment_property_write_b>` and :ref:`write_a<class_RDPipelineColorBlendStateAttachment_property_write_a>` controlling the output.
  150. .. rst-class:: classref-item-separator
  151. ----
  152. .. _class_RDPipelineColorBlendStateAttachment_property_src_alpha_blend_factor:
  153. .. rst-class:: classref-property
  154. :ref:`BlendFactor<enum_RenderingDevice_BlendFactor>` **src_alpha_blend_factor** = ``0`` :ref:`🔗<class_RDPipelineColorBlendStateAttachment_property_src_alpha_blend_factor>`
  155. .. rst-class:: classref-property-setget
  156. - |void| **set_src_alpha_blend_factor**\ (\ value\: :ref:`BlendFactor<enum_RenderingDevice_BlendFactor>`\ )
  157. - :ref:`BlendFactor<enum_RenderingDevice_BlendFactor>` **get_src_alpha_blend_factor**\ (\ )
  158. Controls how the blend factor for the alpha channel is determined based on the source's fragments.
  159. .. rst-class:: classref-item-separator
  160. ----
  161. .. _class_RDPipelineColorBlendStateAttachment_property_src_color_blend_factor:
  162. .. rst-class:: classref-property
  163. :ref:`BlendFactor<enum_RenderingDevice_BlendFactor>` **src_color_blend_factor** = ``0`` :ref:`🔗<class_RDPipelineColorBlendStateAttachment_property_src_color_blend_factor>`
  164. .. rst-class:: classref-property-setget
  165. - |void| **set_src_color_blend_factor**\ (\ value\: :ref:`BlendFactor<enum_RenderingDevice_BlendFactor>`\ )
  166. - :ref:`BlendFactor<enum_RenderingDevice_BlendFactor>` **get_src_color_blend_factor**\ (\ )
  167. Controls how the blend factor for the color channels is determined based on the source's fragments.
  168. .. rst-class:: classref-item-separator
  169. ----
  170. .. _class_RDPipelineColorBlendStateAttachment_property_write_a:
  171. .. rst-class:: classref-property
  172. :ref:`bool<class_bool>` **write_a** = ``true`` :ref:`🔗<class_RDPipelineColorBlendStateAttachment_property_write_a>`
  173. .. rst-class:: classref-property-setget
  174. - |void| **set_write_a**\ (\ value\: :ref:`bool<class_bool>`\ )
  175. - :ref:`bool<class_bool>` **get_write_a**\ (\ )
  176. If ``true``, writes the new alpha channel to the final result.
  177. .. rst-class:: classref-item-separator
  178. ----
  179. .. _class_RDPipelineColorBlendStateAttachment_property_write_b:
  180. .. rst-class:: classref-property
  181. :ref:`bool<class_bool>` **write_b** = ``true`` :ref:`🔗<class_RDPipelineColorBlendStateAttachment_property_write_b>`
  182. .. rst-class:: classref-property-setget
  183. - |void| **set_write_b**\ (\ value\: :ref:`bool<class_bool>`\ )
  184. - :ref:`bool<class_bool>` **get_write_b**\ (\ )
  185. If ``true``, writes the new blue color channel to the final result.
  186. .. rst-class:: classref-item-separator
  187. ----
  188. .. _class_RDPipelineColorBlendStateAttachment_property_write_g:
  189. .. rst-class:: classref-property
  190. :ref:`bool<class_bool>` **write_g** = ``true`` :ref:`🔗<class_RDPipelineColorBlendStateAttachment_property_write_g>`
  191. .. rst-class:: classref-property-setget
  192. - |void| **set_write_g**\ (\ value\: :ref:`bool<class_bool>`\ )
  193. - :ref:`bool<class_bool>` **get_write_g**\ (\ )
  194. If ``true``, writes the new green color channel to the final result.
  195. .. rst-class:: classref-item-separator
  196. ----
  197. .. _class_RDPipelineColorBlendStateAttachment_property_write_r:
  198. .. rst-class:: classref-property
  199. :ref:`bool<class_bool>` **write_r** = ``true`` :ref:`🔗<class_RDPipelineColorBlendStateAttachment_property_write_r>`
  200. .. rst-class:: classref-property-setget
  201. - |void| **set_write_r**\ (\ value\: :ref:`bool<class_bool>`\ )
  202. - :ref:`bool<class_bool>` **get_write_r**\ (\ )
  203. If ``true``, writes the new red color channel to the final result.
  204. .. rst-class:: classref-section-separator
  205. ----
  206. .. rst-class:: classref-descriptions-group
  207. Method Descriptions
  208. -------------------
  209. .. _class_RDPipelineColorBlendStateAttachment_method_set_as_mix:
  210. .. rst-class:: classref-method
  211. |void| **set_as_mix**\ (\ ) :ref:`🔗<class_RDPipelineColorBlendStateAttachment_method_set_as_mix>`
  212. Convenience method to perform standard mix blending with straight (non-premultiplied) alpha. This sets :ref:`enable_blend<class_RDPipelineColorBlendStateAttachment_property_enable_blend>` to ``true``, :ref:`src_color_blend_factor<class_RDPipelineColorBlendStateAttachment_property_src_color_blend_factor>` to :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>` to :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>` to :ref:`RenderingDevice.BLEND_FACTOR_SRC_ALPHA<class_RenderingDevice_constant_BLEND_FACTOR_SRC_ALPHA>` and :ref:`dst_alpha_blend_factor<class_RDPipelineColorBlendStateAttachment_property_dst_alpha_blend_factor>` to :ref:`RenderingDevice.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA<class_RenderingDevice_constant_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA>`.
  213. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  214. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  215. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  216. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  217. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  218. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  219. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  220. .. |void| replace:: :abbr:`void (No return value.)`