class_decal.rst 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  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/Decal.xml.
  6. .. _class_Decal:
  7. Decal
  8. =====
  9. **Inherits:** :ref:`VisualInstance3D<class_VisualInstance3D>` **<** :ref:`Node3D<class_Node3D>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. Node that projects a texture onto a :ref:`MeshInstance3D<class_MeshInstance3D>`.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. **Decal**\ s are used to project a texture onto a :ref:`Mesh<class_Mesh>` in the scene. Use Decals to add detail to a scene without affecting the underlying :ref:`Mesh<class_Mesh>`. They are often used to add weathering to building, add dirt or mud to the ground, or add variety to props. Decals can be moved at any time, making them suitable for things like blob shadows or laser sight dots.
  15. They are made of an :ref:`AABB<class_AABB>` and a group of :ref:`Texture2D<class_Texture2D>`\ s specifying :ref:`Color<class_Color>`, normal, ORM (ambient occlusion, roughness, metallic), and emission. Decals are projected within their :ref:`AABB<class_AABB>` so altering the orientation of the Decal affects the direction in which they are projected. By default, Decals are projected down (i.e. from positive Y to negative Y).
  16. The :ref:`Texture2D<class_Texture2D>`\ s associated with the Decal are automatically stored in a texture atlas which is used for drawing the decals so all decals can be drawn at once. Godot uses clustered decals, meaning they are stored in cluster data and drawn when the mesh is drawn, they are not drawn as a post-processing effect after.
  17. \ **Note:** Decals cannot affect an underlying material's transparency, regardless of its transparency mode (alpha blend, alpha scissor, alpha hash, opaque pre-pass). This means translucent or transparent areas of a material will remain translucent or transparent even if an opaque decal is applied on them.
  18. \ **Note:** Decals are only supported in the Forward+ and Mobile rendering methods, not Compatibility. When using the Mobile rendering method, only 8 decals can be displayed on each mesh resource. Attempting to display more than 8 decals on a single mesh resource will result in decals flickering in and out as the camera moves.
  19. \ **Note:** When using the Mobile rendering method, decals will only correctly affect meshes whose visibility AABB intersects with the decal's AABB. If using a shader to deform the mesh in a way that makes it go outside its AABB, :ref:`GeometryInstance3D.extra_cull_margin<class_GeometryInstance3D_property_extra_cull_margin>` must be increased on the mesh. Otherwise, the decal may not be visible on the mesh.
  20. .. rst-class:: classref-reftable-group
  21. Properties
  22. ----------
  23. .. table::
  24. :widths: auto
  25. +-----------------------------------+--------------------------------------------------------------------------+-----------------------+
  26. | :ref:`float<class_float>` | :ref:`albedo_mix<class_Decal_property_albedo_mix>` | ``1.0`` |
  27. +-----------------------------------+--------------------------------------------------------------------------+-----------------------+
  28. | :ref:`int<class_int>` | :ref:`cull_mask<class_Decal_property_cull_mask>` | ``1048575`` |
  29. +-----------------------------------+--------------------------------------------------------------------------+-----------------------+
  30. | :ref:`float<class_float>` | :ref:`distance_fade_begin<class_Decal_property_distance_fade_begin>` | ``40.0`` |
  31. +-----------------------------------+--------------------------------------------------------------------------+-----------------------+
  32. | :ref:`bool<class_bool>` | :ref:`distance_fade_enabled<class_Decal_property_distance_fade_enabled>` | ``false`` |
  33. +-----------------------------------+--------------------------------------------------------------------------+-----------------------+
  34. | :ref:`float<class_float>` | :ref:`distance_fade_length<class_Decal_property_distance_fade_length>` | ``10.0`` |
  35. +-----------------------------------+--------------------------------------------------------------------------+-----------------------+
  36. | :ref:`float<class_float>` | :ref:`emission_energy<class_Decal_property_emission_energy>` | ``1.0`` |
  37. +-----------------------------------+--------------------------------------------------------------------------+-----------------------+
  38. | :ref:`float<class_float>` | :ref:`lower_fade<class_Decal_property_lower_fade>` | ``0.3`` |
  39. +-----------------------------------+--------------------------------------------------------------------------+-----------------------+
  40. | :ref:`Color<class_Color>` | :ref:`modulate<class_Decal_property_modulate>` | ``Color(1, 1, 1, 1)`` |
  41. +-----------------------------------+--------------------------------------------------------------------------+-----------------------+
  42. | :ref:`float<class_float>` | :ref:`normal_fade<class_Decal_property_normal_fade>` | ``0.0`` |
  43. +-----------------------------------+--------------------------------------------------------------------------+-----------------------+
  44. | :ref:`Vector3<class_Vector3>` | :ref:`size<class_Decal_property_size>` | ``Vector3(2, 2, 2)`` |
  45. +-----------------------------------+--------------------------------------------------------------------------+-----------------------+
  46. | :ref:`Texture2D<class_Texture2D>` | :ref:`texture_albedo<class_Decal_property_texture_albedo>` | |
  47. +-----------------------------------+--------------------------------------------------------------------------+-----------------------+
  48. | :ref:`Texture2D<class_Texture2D>` | :ref:`texture_emission<class_Decal_property_texture_emission>` | |
  49. +-----------------------------------+--------------------------------------------------------------------------+-----------------------+
  50. | :ref:`Texture2D<class_Texture2D>` | :ref:`texture_normal<class_Decal_property_texture_normal>` | |
  51. +-----------------------------------+--------------------------------------------------------------------------+-----------------------+
  52. | :ref:`Texture2D<class_Texture2D>` | :ref:`texture_orm<class_Decal_property_texture_orm>` | |
  53. +-----------------------------------+--------------------------------------------------------------------------+-----------------------+
  54. | :ref:`float<class_float>` | :ref:`upper_fade<class_Decal_property_upper_fade>` | ``0.3`` |
  55. +-----------------------------------+--------------------------------------------------------------------------+-----------------------+
  56. .. rst-class:: classref-reftable-group
  57. Methods
  58. -------
  59. .. table::
  60. :widths: auto
  61. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | :ref:`Texture2D<class_Texture2D>` | :ref:`get_texture<class_Decal_method_get_texture>` **(** :ref:`DecalTexture<enum_Decal_DecalTexture>` type **)** |const| |
  63. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | void | :ref:`set_texture<class_Decal_method_set_texture>` **(** :ref:`DecalTexture<enum_Decal_DecalTexture>` type, :ref:`Texture2D<class_Texture2D>` texture **)** |
  65. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. .. rst-class:: classref-section-separator
  67. ----
  68. .. rst-class:: classref-descriptions-group
  69. Enumerations
  70. ------------
  71. .. _enum_Decal_DecalTexture:
  72. .. rst-class:: classref-enumeration
  73. enum **DecalTexture**:
  74. .. _class_Decal_constant_TEXTURE_ALBEDO:
  75. .. rst-class:: classref-enumeration-constant
  76. :ref:`DecalTexture<enum_Decal_DecalTexture>` **TEXTURE_ALBEDO** = ``0``
  77. :ref:`Texture2D<class_Texture2D>` corresponding to :ref:`texture_albedo<class_Decal_property_texture_albedo>`.
  78. .. _class_Decal_constant_TEXTURE_NORMAL:
  79. .. rst-class:: classref-enumeration-constant
  80. :ref:`DecalTexture<enum_Decal_DecalTexture>` **TEXTURE_NORMAL** = ``1``
  81. :ref:`Texture2D<class_Texture2D>` corresponding to :ref:`texture_normal<class_Decal_property_texture_normal>`.
  82. .. _class_Decal_constant_TEXTURE_ORM:
  83. .. rst-class:: classref-enumeration-constant
  84. :ref:`DecalTexture<enum_Decal_DecalTexture>` **TEXTURE_ORM** = ``2``
  85. :ref:`Texture2D<class_Texture2D>` corresponding to :ref:`texture_orm<class_Decal_property_texture_orm>`.
  86. .. _class_Decal_constant_TEXTURE_EMISSION:
  87. .. rst-class:: classref-enumeration-constant
  88. :ref:`DecalTexture<enum_Decal_DecalTexture>` **TEXTURE_EMISSION** = ``3``
  89. :ref:`Texture2D<class_Texture2D>` corresponding to :ref:`texture_emission<class_Decal_property_texture_emission>`.
  90. .. _class_Decal_constant_TEXTURE_MAX:
  91. .. rst-class:: classref-enumeration-constant
  92. :ref:`DecalTexture<enum_Decal_DecalTexture>` **TEXTURE_MAX** = ``4``
  93. Max size of :ref:`DecalTexture<enum_Decal_DecalTexture>` enum.
  94. .. rst-class:: classref-section-separator
  95. ----
  96. .. rst-class:: classref-descriptions-group
  97. Property Descriptions
  98. ---------------------
  99. .. _class_Decal_property_albedo_mix:
  100. .. rst-class:: classref-property
  101. :ref:`float<class_float>` **albedo_mix** = ``1.0``
  102. .. rst-class:: classref-property-setget
  103. - void **set_albedo_mix** **(** :ref:`float<class_float>` value **)**
  104. - :ref:`float<class_float>` **get_albedo_mix** **(** **)**
  105. Blends the albedo :ref:`Color<class_Color>` of the decal with albedo :ref:`Color<class_Color>` of the underlying mesh. This can be set to ``0.0`` to create a decal that only affects normal or ORM. In this case, an albedo texture is still required as its alpha channel will determine where the normal and ORM will be overridden. See also :ref:`modulate<class_Decal_property_modulate>`.
  106. .. rst-class:: classref-item-separator
  107. ----
  108. .. _class_Decal_property_cull_mask:
  109. .. rst-class:: classref-property
  110. :ref:`int<class_int>` **cull_mask** = ``1048575``
  111. .. rst-class:: classref-property-setget
  112. - void **set_cull_mask** **(** :ref:`int<class_int>` value **)**
  113. - :ref:`int<class_int>` **get_cull_mask** **(** **)**
  114. Specifies which :ref:`VisualInstance3D.layers<class_VisualInstance3D_property_layers>` this decal will project on. By default, Decals affect all layers. This is used so you can specify which types of objects receive the Decal and which do not. This is especially useful so you can ensure that dynamic objects don't accidentally receive a Decal intended for the terrain under them.
  115. .. rst-class:: classref-item-separator
  116. ----
  117. .. _class_Decal_property_distance_fade_begin:
  118. .. rst-class:: classref-property
  119. :ref:`float<class_float>` **distance_fade_begin** = ``40.0``
  120. .. rst-class:: classref-property-setget
  121. - void **set_distance_fade_begin** **(** :ref:`float<class_float>` value **)**
  122. - :ref:`float<class_float>` **get_distance_fade_begin** **(** **)**
  123. The distance from the camera at which the Decal begins to fade away (in 3D units).
  124. .. rst-class:: classref-item-separator
  125. ----
  126. .. _class_Decal_property_distance_fade_enabled:
  127. .. rst-class:: classref-property
  128. :ref:`bool<class_bool>` **distance_fade_enabled** = ``false``
  129. .. rst-class:: classref-property-setget
  130. - void **set_enable_distance_fade** **(** :ref:`bool<class_bool>` value **)**
  131. - :ref:`bool<class_bool>` **is_distance_fade_enabled** **(** **)**
  132. If ``true``, decals will smoothly fade away when far from the active :ref:`Camera3D<class_Camera3D>` starting at :ref:`distance_fade_begin<class_Decal_property_distance_fade_begin>`. The Decal will fade out over :ref:`distance_fade_begin<class_Decal_property_distance_fade_begin>` + :ref:`distance_fade_length<class_Decal_property_distance_fade_length>`, after which it will be culled and not sent to the shader at all. Use this to reduce the number of active Decals in a scene and thus improve performance.
  133. .. rst-class:: classref-item-separator
  134. ----
  135. .. _class_Decal_property_distance_fade_length:
  136. .. rst-class:: classref-property
  137. :ref:`float<class_float>` **distance_fade_length** = ``10.0``
  138. .. rst-class:: classref-property-setget
  139. - void **set_distance_fade_length** **(** :ref:`float<class_float>` value **)**
  140. - :ref:`float<class_float>` **get_distance_fade_length** **(** **)**
  141. The distance over which the Decal fades (in 3D units). The Decal becomes slowly more transparent over this distance and is completely invisible at the end. Higher values result in a smoother fade-out transition, which is more suited when the camera moves fast.
  142. .. rst-class:: classref-item-separator
  143. ----
  144. .. _class_Decal_property_emission_energy:
  145. .. rst-class:: classref-property
  146. :ref:`float<class_float>` **emission_energy** = ``1.0``
  147. .. rst-class:: classref-property-setget
  148. - void **set_emission_energy** **(** :ref:`float<class_float>` value **)**
  149. - :ref:`float<class_float>` **get_emission_energy** **(** **)**
  150. Energy multiplier for the emission texture. This will make the decal emit light at a higher or lower intensity, independently of the albedo color. See also :ref:`modulate<class_Decal_property_modulate>`.
  151. .. rst-class:: classref-item-separator
  152. ----
  153. .. _class_Decal_property_lower_fade:
  154. .. rst-class:: classref-property
  155. :ref:`float<class_float>` **lower_fade** = ``0.3``
  156. .. rst-class:: classref-property-setget
  157. - void **set_lower_fade** **(** :ref:`float<class_float>` value **)**
  158. - :ref:`float<class_float>` **get_lower_fade** **(** **)**
  159. Sets the curve over which the decal will fade as the surface gets further from the center of the :ref:`AABB<class_AABB>`. Only positive values are valid (negative values will be clamped to ``0.0``). See also :ref:`upper_fade<class_Decal_property_upper_fade>`.
  160. .. rst-class:: classref-item-separator
  161. ----
  162. .. _class_Decal_property_modulate:
  163. .. rst-class:: classref-property
  164. :ref:`Color<class_Color>` **modulate** = ``Color(1, 1, 1, 1)``
  165. .. rst-class:: classref-property-setget
  166. - void **set_modulate** **(** :ref:`Color<class_Color>` value **)**
  167. - :ref:`Color<class_Color>` **get_modulate** **(** **)**
  168. Changes the :ref:`Color<class_Color>` of the Decal by multiplying the albedo and emission colors with this value. The alpha component is only taken into account when multiplying the albedo color, not the emission color. See also :ref:`emission_energy<class_Decal_property_emission_energy>` and :ref:`albedo_mix<class_Decal_property_albedo_mix>` to change the emission and albedo intensity independently of each other.
  169. .. rst-class:: classref-item-separator
  170. ----
  171. .. _class_Decal_property_normal_fade:
  172. .. rst-class:: classref-property
  173. :ref:`float<class_float>` **normal_fade** = ``0.0``
  174. .. rst-class:: classref-property-setget
  175. - void **set_normal_fade** **(** :ref:`float<class_float>` value **)**
  176. - :ref:`float<class_float>` **get_normal_fade** **(** **)**
  177. Fades the Decal if the angle between the Decal's :ref:`AABB<class_AABB>` and the target surface becomes too large. A value of ``0`` projects the Decal regardless of angle, a value of ``1`` limits the Decal to surfaces that are nearly perpendicular.
  178. \ **Note:** Setting :ref:`normal_fade<class_Decal_property_normal_fade>` to a value greater than ``0.0`` has a small performance cost due to the added normal angle computations.
  179. .. rst-class:: classref-item-separator
  180. ----
  181. .. _class_Decal_property_size:
  182. .. rst-class:: classref-property
  183. :ref:`Vector3<class_Vector3>` **size** = ``Vector3(2, 2, 2)``
  184. .. rst-class:: classref-property-setget
  185. - void **set_size** **(** :ref:`Vector3<class_Vector3>` value **)**
  186. - :ref:`Vector3<class_Vector3>` **get_size** **(** **)**
  187. Sets the size of the :ref:`AABB<class_AABB>` used by the decal. All dimensions must be set to a value greater than zero (they will be clamped to ``0.001`` if this is not the case). The AABB goes from ``-size/2`` to ``size/2``.
  188. \ **Note:** To improve culling efficiency of "hard surface" decals, set their :ref:`upper_fade<class_Decal_property_upper_fade>` and :ref:`lower_fade<class_Decal_property_lower_fade>` to ``0.0`` and set the Y component of the :ref:`size<class_Decal_property_size>` as low as possible. This will reduce the decals' AABB size without affecting their appearance.
  189. .. rst-class:: classref-item-separator
  190. ----
  191. .. _class_Decal_property_texture_albedo:
  192. .. rst-class:: classref-property
  193. :ref:`Texture2D<class_Texture2D>` **texture_albedo**
  194. .. rst-class:: classref-property-setget
  195. - void **set_texture** **(** :ref:`DecalTexture<enum_Decal_DecalTexture>` type, :ref:`Texture2D<class_Texture2D>` texture **)**
  196. - :ref:`Texture2D<class_Texture2D>` **get_texture** **(** :ref:`DecalTexture<enum_Decal_DecalTexture>` type **)** |const|
  197. :ref:`Texture2D<class_Texture2D>` with the base :ref:`Color<class_Color>` of the Decal. Either this or the :ref:`texture_emission<class_Decal_property_texture_emission>` must be set for the Decal to be visible. Use the alpha channel like a mask to smoothly blend the edges of the decal with the underlying object.
  198. \ **Note:** Unlike :ref:`BaseMaterial3D<class_BaseMaterial3D>` whose filter mode can be adjusted on a per-material basis, the filter mode for **Decal** textures is set globally with :ref:`ProjectSettings.rendering/textures/decals/filter<class_ProjectSettings_property_rendering/textures/decals/filter>`.
  199. .. rst-class:: classref-item-separator
  200. ----
  201. .. _class_Decal_property_texture_emission:
  202. .. rst-class:: classref-property
  203. :ref:`Texture2D<class_Texture2D>` **texture_emission**
  204. .. rst-class:: classref-property-setget
  205. - void **set_texture** **(** :ref:`DecalTexture<enum_Decal_DecalTexture>` type, :ref:`Texture2D<class_Texture2D>` texture **)**
  206. - :ref:`Texture2D<class_Texture2D>` **get_texture** **(** :ref:`DecalTexture<enum_Decal_DecalTexture>` type **)** |const|
  207. :ref:`Texture2D<class_Texture2D>` with the emission :ref:`Color<class_Color>` of the Decal. Either this or the :ref:`texture_albedo<class_Decal_property_texture_albedo>` must be set for the Decal to be visible. Use the alpha channel like a mask to smoothly blend the edges of the decal with the underlying object.
  208. \ **Note:** Unlike :ref:`BaseMaterial3D<class_BaseMaterial3D>` whose filter mode can be adjusted on a per-material basis, the filter mode for **Decal** textures is set globally with :ref:`ProjectSettings.rendering/textures/decals/filter<class_ProjectSettings_property_rendering/textures/decals/filter>`.
  209. .. rst-class:: classref-item-separator
  210. ----
  211. .. _class_Decal_property_texture_normal:
  212. .. rst-class:: classref-property
  213. :ref:`Texture2D<class_Texture2D>` **texture_normal**
  214. .. rst-class:: classref-property-setget
  215. - void **set_texture** **(** :ref:`DecalTexture<enum_Decal_DecalTexture>` type, :ref:`Texture2D<class_Texture2D>` texture **)**
  216. - :ref:`Texture2D<class_Texture2D>` **get_texture** **(** :ref:`DecalTexture<enum_Decal_DecalTexture>` type **)** |const|
  217. :ref:`Texture2D<class_Texture2D>` with the per-pixel normal map for the decal. Use this to add extra detail to decals.
  218. \ **Note:** Unlike :ref:`BaseMaterial3D<class_BaseMaterial3D>` whose filter mode can be adjusted on a per-material basis, the filter mode for **Decal** textures is set globally with :ref:`ProjectSettings.rendering/textures/decals/filter<class_ProjectSettings_property_rendering/textures/decals/filter>`.
  219. \ **Note:** Setting this texture alone will not result in a visible decal, as :ref:`texture_albedo<class_Decal_property_texture_albedo>` must also be set. To create a normal-only decal, load an albedo texture into :ref:`texture_albedo<class_Decal_property_texture_albedo>` and set :ref:`albedo_mix<class_Decal_property_albedo_mix>` to ``0.0``. The albedo texture's alpha channel will be used to determine where the underlying surface's normal map should be overridden (and its intensity).
  220. .. rst-class:: classref-item-separator
  221. ----
  222. .. _class_Decal_property_texture_orm:
  223. .. rst-class:: classref-property
  224. :ref:`Texture2D<class_Texture2D>` **texture_orm**
  225. .. rst-class:: classref-property-setget
  226. - void **set_texture** **(** :ref:`DecalTexture<enum_Decal_DecalTexture>` type, :ref:`Texture2D<class_Texture2D>` texture **)**
  227. - :ref:`Texture2D<class_Texture2D>` **get_texture** **(** :ref:`DecalTexture<enum_Decal_DecalTexture>` type **)** |const|
  228. :ref:`Texture2D<class_Texture2D>` storing ambient occlusion, roughness, and metallic for the decal. Use this to add extra detail to decals.
  229. \ **Note:** Unlike :ref:`BaseMaterial3D<class_BaseMaterial3D>` whose filter mode can be adjusted on a per-material basis, the filter mode for **Decal** textures is set globally with :ref:`ProjectSettings.rendering/textures/decals/filter<class_ProjectSettings_property_rendering/textures/decals/filter>`.
  230. \ **Note:** Setting this texture alone will not result in a visible decal, as :ref:`texture_albedo<class_Decal_property_texture_albedo>` must also be set. To create an ORM-only decal, load an albedo texture into :ref:`texture_albedo<class_Decal_property_texture_albedo>` and set :ref:`albedo_mix<class_Decal_property_albedo_mix>` to ``0.0``. The albedo texture's alpha channel will be used to determine where the underlying surface's ORM map should be overridden (and its intensity).
  231. .. rst-class:: classref-item-separator
  232. ----
  233. .. _class_Decal_property_upper_fade:
  234. .. rst-class:: classref-property
  235. :ref:`float<class_float>` **upper_fade** = ``0.3``
  236. .. rst-class:: classref-property-setget
  237. - void **set_upper_fade** **(** :ref:`float<class_float>` value **)**
  238. - :ref:`float<class_float>` **get_upper_fade** **(** **)**
  239. Sets the curve over which the decal will fade as the surface gets further from the center of the :ref:`AABB<class_AABB>`. Only positive values are valid (negative values will be clamped to ``0.0``). See also :ref:`lower_fade<class_Decal_property_lower_fade>`.
  240. .. rst-class:: classref-section-separator
  241. ----
  242. .. rst-class:: classref-descriptions-group
  243. Method Descriptions
  244. -------------------
  245. .. _class_Decal_method_get_texture:
  246. .. rst-class:: classref-method
  247. :ref:`Texture2D<class_Texture2D>` **get_texture** **(** :ref:`DecalTexture<enum_Decal_DecalTexture>` type **)** |const|
  248. Returns the :ref:`Texture2D<class_Texture2D>` associated with the specified :ref:`DecalTexture<enum_Decal_DecalTexture>`. This is a convenience method, in most cases you should access the texture directly.
  249. For example, instead of ``albedo_tex = $Decal.get_texture(Decal.TEXTURE_ALBEDO)``, use ``albedo_tex = $Decal.texture_albedo``.
  250. One case where this is better than accessing the texture directly is when you want to copy one Decal's textures to another. For example:
  251. .. tabs::
  252. .. code-tab:: gdscript
  253. for i in Decal.TEXTURE_MAX:
  254. $NewDecal.set_texture(i, $OldDecal.get_texture(i))
  255. .. code-tab:: csharp
  256. for (int i = 0; i < (int)Decal.DecalTexture.Max; i++)
  257. {
  258. GetNode<Decal>("NewDecal").SetTexture(i, GetNode<Decal>("OldDecal").GetTexture(i));
  259. }
  260. .. rst-class:: classref-item-separator
  261. ----
  262. .. _class_Decal_method_set_texture:
  263. .. rst-class:: classref-method
  264. void **set_texture** **(** :ref:`DecalTexture<enum_Decal_DecalTexture>` type, :ref:`Texture2D<class_Texture2D>` texture **)**
  265. Sets the :ref:`Texture2D<class_Texture2D>` associated with the specified :ref:`DecalTexture<enum_Decal_DecalTexture>`. This is a convenience method, in most cases you should access the texture directly.
  266. For example, instead of ``$Decal.set_texture(Decal.TEXTURE_ALBEDO, albedo_tex)``, use ``$Decal.texture_albedo = albedo_tex``.
  267. One case where this is better than accessing the texture directly is when you want to copy one Decal's textures to another. For example:
  268. .. tabs::
  269. .. code-tab:: gdscript
  270. for i in Decal.TEXTURE_MAX:
  271. $NewDecal.set_texture(i, $OldDecal.get_texture(i))
  272. .. code-tab:: csharp
  273. for (int i = 0; i < (int)Decal.DecalTexture.Max; i++)
  274. {
  275. GetNode<Decal>("NewDecal").SetTexture(i, GetNode<Decal>("OldDecal").GetTexture(i));
  276. }
  277. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  278. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  279. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  280. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  281. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  282. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`