class_decal.rst 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  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/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. .. rst-class:: classref-reftable-group
  19. Properties
  20. ----------
  21. .. table::
  22. :widths: auto
  23. +-----------------------------------+--------------------------------------------------------------------------+-----------------------+
  24. | :ref:`float<class_float>` | :ref:`albedo_mix<class_Decal_property_albedo_mix>` | ``1.0`` |
  25. +-----------------------------------+--------------------------------------------------------------------------+-----------------------+
  26. | :ref:`int<class_int>` | :ref:`cull_mask<class_Decal_property_cull_mask>` | ``1048575`` |
  27. +-----------------------------------+--------------------------------------------------------------------------+-----------------------+
  28. | :ref:`float<class_float>` | :ref:`distance_fade_begin<class_Decal_property_distance_fade_begin>` | ``40.0`` |
  29. +-----------------------------------+--------------------------------------------------------------------------+-----------------------+
  30. | :ref:`bool<class_bool>` | :ref:`distance_fade_enabled<class_Decal_property_distance_fade_enabled>` | ``false`` |
  31. +-----------------------------------+--------------------------------------------------------------------------+-----------------------+
  32. | :ref:`float<class_float>` | :ref:`distance_fade_length<class_Decal_property_distance_fade_length>` | ``10.0`` |
  33. +-----------------------------------+--------------------------------------------------------------------------+-----------------------+
  34. | :ref:`float<class_float>` | :ref:`emission_energy<class_Decal_property_emission_energy>` | ``1.0`` |
  35. +-----------------------------------+--------------------------------------------------------------------------+-----------------------+
  36. | :ref:`Vector3<class_Vector3>` | :ref:`extents<class_Decal_property_extents>` | ``Vector3(1, 1, 1)`` |
  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:`Texture2D<class_Texture2D>` | :ref:`texture_albedo<class_Decal_property_texture_albedo>` | |
  45. +-----------------------------------+--------------------------------------------------------------------------+-----------------------+
  46. | :ref:`Texture2D<class_Texture2D>` | :ref:`texture_emission<class_Decal_property_texture_emission>` | |
  47. +-----------------------------------+--------------------------------------------------------------------------+-----------------------+
  48. | :ref:`Texture2D<class_Texture2D>` | :ref:`texture_normal<class_Decal_property_texture_normal>` | |
  49. +-----------------------------------+--------------------------------------------------------------------------+-----------------------+
  50. | :ref:`Texture2D<class_Texture2D>` | :ref:`texture_orm<class_Decal_property_texture_orm>` | |
  51. +-----------------------------------+--------------------------------------------------------------------------+-----------------------+
  52. | :ref:`float<class_float>` | :ref:`upper_fade<class_Decal_property_upper_fade>` | ``0.3`` |
  53. +-----------------------------------+--------------------------------------------------------------------------+-----------------------+
  54. .. rst-class:: classref-reftable-group
  55. Methods
  56. -------
  57. .. table::
  58. :widths: auto
  59. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | :ref:`Texture2D<class_Texture2D>` | :ref:`get_texture<class_Decal_method_get_texture>` **(** :ref:`DecalTexture<enum_Decal_DecalTexture>` type **)** |const| |
  61. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | void | :ref:`set_texture<class_Decal_method_set_texture>` **(** :ref:`DecalTexture<enum_Decal_DecalTexture>` type, :ref:`Texture2D<class_Texture2D>` texture **)** |
  63. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. .. rst-class:: classref-section-separator
  65. ----
  66. .. rst-class:: classref-descriptions-group
  67. Enumerations
  68. ------------
  69. .. _enum_Decal_DecalTexture:
  70. .. rst-class:: classref-enumeration
  71. enum **DecalTexture**:
  72. .. _class_Decal_constant_TEXTURE_ALBEDO:
  73. .. rst-class:: classref-enumeration-constant
  74. :ref:`DecalTexture<enum_Decal_DecalTexture>` **TEXTURE_ALBEDO** = ``0``
  75. :ref:`Texture2D<class_Texture2D>` corresponding to :ref:`texture_albedo<class_Decal_property_texture_albedo>`.
  76. .. _class_Decal_constant_TEXTURE_NORMAL:
  77. .. rst-class:: classref-enumeration-constant
  78. :ref:`DecalTexture<enum_Decal_DecalTexture>` **TEXTURE_NORMAL** = ``1``
  79. :ref:`Texture2D<class_Texture2D>` corresponding to :ref:`texture_normal<class_Decal_property_texture_normal>`.
  80. .. _class_Decal_constant_TEXTURE_ORM:
  81. .. rst-class:: classref-enumeration-constant
  82. :ref:`DecalTexture<enum_Decal_DecalTexture>` **TEXTURE_ORM** = ``2``
  83. :ref:`Texture2D<class_Texture2D>` corresponding to :ref:`texture_orm<class_Decal_property_texture_orm>`.
  84. .. _class_Decal_constant_TEXTURE_EMISSION:
  85. .. rst-class:: classref-enumeration-constant
  86. :ref:`DecalTexture<enum_Decal_DecalTexture>` **TEXTURE_EMISSION** = ``3``
  87. :ref:`Texture2D<class_Texture2D>` corresponding to :ref:`texture_emission<class_Decal_property_texture_emission>`.
  88. .. _class_Decal_constant_TEXTURE_MAX:
  89. .. rst-class:: classref-enumeration-constant
  90. :ref:`DecalTexture<enum_Decal_DecalTexture>` **TEXTURE_MAX** = ``4``
  91. Max size of :ref:`DecalTexture<enum_Decal_DecalTexture>` enum.
  92. .. rst-class:: classref-section-separator
  93. ----
  94. .. rst-class:: classref-descriptions-group
  95. Property Descriptions
  96. ---------------------
  97. .. _class_Decal_property_albedo_mix:
  98. .. rst-class:: classref-property
  99. :ref:`float<class_float>` **albedo_mix** = ``1.0``
  100. .. rst-class:: classref-property-setget
  101. - void **set_albedo_mix** **(** :ref:`float<class_float>` value **)**
  102. - :ref:`float<class_float>` **get_albedo_mix** **(** **)**
  103. 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>`.
  104. .. rst-class:: classref-item-separator
  105. ----
  106. .. _class_Decal_property_cull_mask:
  107. .. rst-class:: classref-property
  108. :ref:`int<class_int>` **cull_mask** = ``1048575``
  109. .. rst-class:: classref-property-setget
  110. - void **set_cull_mask** **(** :ref:`int<class_int>` value **)**
  111. - :ref:`int<class_int>` **get_cull_mask** **(** **)**
  112. 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.
  113. .. rst-class:: classref-item-separator
  114. ----
  115. .. _class_Decal_property_distance_fade_begin:
  116. .. rst-class:: classref-property
  117. :ref:`float<class_float>` **distance_fade_begin** = ``40.0``
  118. .. rst-class:: classref-property-setget
  119. - void **set_distance_fade_begin** **(** :ref:`float<class_float>` value **)**
  120. - :ref:`float<class_float>` **get_distance_fade_begin** **(** **)**
  121. The distance from the camera at which the Decal begins to fade away (in 3D units).
  122. .. rst-class:: classref-item-separator
  123. ----
  124. .. _class_Decal_property_distance_fade_enabled:
  125. .. rst-class:: classref-property
  126. :ref:`bool<class_bool>` **distance_fade_enabled** = ``false``
  127. .. rst-class:: classref-property-setget
  128. - void **set_enable_distance_fade** **(** :ref:`bool<class_bool>` value **)**
  129. - :ref:`bool<class_bool>` **is_distance_fade_enabled** **(** **)**
  130. 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.
  131. .. rst-class:: classref-item-separator
  132. ----
  133. .. _class_Decal_property_distance_fade_length:
  134. .. rst-class:: classref-property
  135. :ref:`float<class_float>` **distance_fade_length** = ``10.0``
  136. .. rst-class:: classref-property-setget
  137. - void **set_distance_fade_length** **(** :ref:`float<class_float>` value **)**
  138. - :ref:`float<class_float>` **get_distance_fade_length** **(** **)**
  139. 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.
  140. .. rst-class:: classref-item-separator
  141. ----
  142. .. _class_Decal_property_emission_energy:
  143. .. rst-class:: classref-property
  144. :ref:`float<class_float>` **emission_energy** = ``1.0``
  145. .. rst-class:: classref-property-setget
  146. - void **set_emission_energy** **(** :ref:`float<class_float>` value **)**
  147. - :ref:`float<class_float>` **get_emission_energy** **(** **)**
  148. 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>`.
  149. .. rst-class:: classref-item-separator
  150. ----
  151. .. _class_Decal_property_extents:
  152. .. rst-class:: classref-property
  153. :ref:`Vector3<class_Vector3>` **extents** = ``Vector3(1, 1, 1)``
  154. .. rst-class:: classref-property-setget
  155. - void **set_extents** **(** :ref:`Vector3<class_Vector3>` value **)**
  156. - :ref:`Vector3<class_Vector3>` **get_extents** **(** **)**
  157. Sets the size of the :ref:`AABB<class_AABB>` used by the decal. The AABB goes from ``-extents`` to ``extents``.
  158. .. rst-class:: classref-item-separator
  159. ----
  160. .. _class_Decal_property_lower_fade:
  161. .. rst-class:: classref-property
  162. :ref:`float<class_float>` **lower_fade** = ``0.3``
  163. .. rst-class:: classref-property-setget
  164. - void **set_lower_fade** **(** :ref:`float<class_float>` value **)**
  165. - :ref:`float<class_float>` **get_lower_fade** **(** **)**
  166. 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>`.
  167. .. rst-class:: classref-item-separator
  168. ----
  169. .. _class_Decal_property_modulate:
  170. .. rst-class:: classref-property
  171. :ref:`Color<class_Color>` **modulate** = ``Color(1, 1, 1, 1)``
  172. .. rst-class:: classref-property-setget
  173. - void **set_modulate** **(** :ref:`Color<class_Color>` value **)**
  174. - :ref:`Color<class_Color>` **get_modulate** **(** **)**
  175. 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.
  176. .. rst-class:: classref-item-separator
  177. ----
  178. .. _class_Decal_property_normal_fade:
  179. .. rst-class:: classref-property
  180. :ref:`float<class_float>` **normal_fade** = ``0.0``
  181. .. rst-class:: classref-property-setget
  182. - void **set_normal_fade** **(** :ref:`float<class_float>` value **)**
  183. - :ref:`float<class_float>` **get_normal_fade** **(** **)**
  184. 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.
  185. \ **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.
  186. .. rst-class:: classref-item-separator
  187. ----
  188. .. _class_Decal_property_texture_albedo:
  189. .. rst-class:: classref-property
  190. :ref:`Texture2D<class_Texture2D>` **texture_albedo**
  191. .. rst-class:: classref-property-setget
  192. - void **set_texture** **(** :ref:`DecalTexture<enum_Decal_DecalTexture>` type, :ref:`Texture2D<class_Texture2D>` texture **)**
  193. - :ref:`Texture2D<class_Texture2D>` **get_texture** **(** :ref:`DecalTexture<enum_Decal_DecalTexture>` type **)** |const|
  194. :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.
  195. \ **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>`.
  196. .. rst-class:: classref-item-separator
  197. ----
  198. .. _class_Decal_property_texture_emission:
  199. .. rst-class:: classref-property
  200. :ref:`Texture2D<class_Texture2D>` **texture_emission**
  201. .. rst-class:: classref-property-setget
  202. - void **set_texture** **(** :ref:`DecalTexture<enum_Decal_DecalTexture>` type, :ref:`Texture2D<class_Texture2D>` texture **)**
  203. - :ref:`Texture2D<class_Texture2D>` **get_texture** **(** :ref:`DecalTexture<enum_Decal_DecalTexture>` type **)** |const|
  204. :ref:`Texture2D<class_Texture2D>` with the emission :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.
  205. \ **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>`.
  206. .. rst-class:: classref-item-separator
  207. ----
  208. .. _class_Decal_property_texture_normal:
  209. .. rst-class:: classref-property
  210. :ref:`Texture2D<class_Texture2D>` **texture_normal**
  211. .. rst-class:: classref-property-setget
  212. - void **set_texture** **(** :ref:`DecalTexture<enum_Decal_DecalTexture>` type, :ref:`Texture2D<class_Texture2D>` texture **)**
  213. - :ref:`Texture2D<class_Texture2D>` **get_texture** **(** :ref:`DecalTexture<enum_Decal_DecalTexture>` type **)** |const|
  214. :ref:`Texture2D<class_Texture2D>` with the per-pixel normal map for the decal. Use this to add extra detail to decals.
  215. \ **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>`.
  216. \ **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).
  217. .. rst-class:: classref-item-separator
  218. ----
  219. .. _class_Decal_property_texture_orm:
  220. .. rst-class:: classref-property
  221. :ref:`Texture2D<class_Texture2D>` **texture_orm**
  222. .. rst-class:: classref-property-setget
  223. - void **set_texture** **(** :ref:`DecalTexture<enum_Decal_DecalTexture>` type, :ref:`Texture2D<class_Texture2D>` texture **)**
  224. - :ref:`Texture2D<class_Texture2D>` **get_texture** **(** :ref:`DecalTexture<enum_Decal_DecalTexture>` type **)** |const|
  225. :ref:`Texture2D<class_Texture2D>` storing ambient occlusion, roughness, and metallic for the decal. Use this to add extra detail to decals.
  226. \ **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>`.
  227. \ **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 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).
  228. .. rst-class:: classref-item-separator
  229. ----
  230. .. _class_Decal_property_upper_fade:
  231. .. rst-class:: classref-property
  232. :ref:`float<class_float>` **upper_fade** = ``0.3``
  233. .. rst-class:: classref-property-setget
  234. - void **set_upper_fade** **(** :ref:`float<class_float>` value **)**
  235. - :ref:`float<class_float>` **get_upper_fade** **(** **)**
  236. 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>`.
  237. .. rst-class:: classref-section-separator
  238. ----
  239. .. rst-class:: classref-descriptions-group
  240. Method Descriptions
  241. -------------------
  242. .. _class_Decal_method_get_texture:
  243. .. rst-class:: classref-method
  244. :ref:`Texture2D<class_Texture2D>` **get_texture** **(** :ref:`DecalTexture<enum_Decal_DecalTexture>` type **)** |const|
  245. 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.
  246. For example, instead of ``albedo_tex = $Decal.get_texture(Decal.TEXTURE_ALBEDO)``, use ``albedo_tex = $Decal.texture_albedo``.
  247. 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:
  248. .. tabs::
  249. .. code-tab:: gdscript
  250. for i in Decal.TEXTURE_MAX:
  251. $NewDecal.set_texture(i, $OldDecal.get_texture(i))
  252. .. code-tab:: csharp
  253. for (int i = 0; i < (int)Decal.DecalTexture.Max; i++)
  254. {
  255. GetNode<Decal>("NewDecal").SetTexture(i, GetNode<Decal>("OldDecal").GetTexture(i));
  256. }
  257. .. rst-class:: classref-item-separator
  258. ----
  259. .. _class_Decal_method_set_texture:
  260. .. rst-class:: classref-method
  261. void **set_texture** **(** :ref:`DecalTexture<enum_Decal_DecalTexture>` type, :ref:`Texture2D<class_Texture2D>` texture **)**
  262. 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.
  263. For example, instead of ``$Decal.set_texture(Decal.TEXTURE_ALBEDO, albedo_tex)``, use ``$Decal.texture_albedo = albedo_tex``.
  264. 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:
  265. .. tabs::
  266. .. code-tab:: gdscript
  267. for i in Decal.TEXTURE_MAX:
  268. $NewDecal.set_texture(i, $OldDecal.get_texture(i))
  269. .. code-tab:: csharp
  270. for (int i = 0; i < (int)Decal.DecalTexture.Max; i++)
  271. {
  272. GetNode<Decal>("NewDecal").SetTexture(i, GetNode<Decal>("OldDecal").GetTexture(i));
  273. }
  274. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  275. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  276. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  277. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  278. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  279. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`