class_geometryinstance.rst 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the GeometryInstance.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_GeometryInstance:
  6. GeometryInstance
  7. ================
  8. **Inherits:** :ref:`VisualInstance<class_VisualInstance>` **<** :ref:`CullInstance<class_CullInstance>` **<** :ref:`Spatial<class_Spatial>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. **Inherited By:** :ref:`CPUParticles<class_CPUParticles>`, :ref:`CSGShape<class_CSGShape>`, :ref:`ImmediateGeometry<class_ImmediateGeometry>`, :ref:`MeshInstance<class_MeshInstance>`, :ref:`MultiMeshInstance<class_MultiMeshInstance>`, :ref:`Particles<class_Particles>`, :ref:`SpriteBase3D<class_SpriteBase3D>`
  10. Base node for geometry-based visual instances.
  11. Description
  12. -----------
  13. Base node for geometry-based visual instances. Shares some common functionality like visibility and custom materials.
  14. Properties
  15. ----------
  16. +-------------------------------------------------------------------------+-------------------------------------------------------------------------------+-----------+
  17. | :ref:`ShadowCastingSetting<enum_GeometryInstance_ShadowCastingSetting>` | :ref:`cast_shadow<class_GeometryInstance_property_cast_shadow>` | ``1`` |
  18. +-------------------------------------------------------------------------+-------------------------------------------------------------------------------+-----------+
  19. | :ref:`float<class_float>` | :ref:`extra_cull_margin<class_GeometryInstance_property_extra_cull_margin>` | ``0.0`` |
  20. +-------------------------------------------------------------------------+-------------------------------------------------------------------------------+-----------+
  21. | :ref:`bool<class_bool>` | :ref:`generate_lightmap<class_GeometryInstance_property_generate_lightmap>` | ``true`` |
  22. +-------------------------------------------------------------------------+-------------------------------------------------------------------------------+-----------+
  23. | :ref:`LightmapScale<enum_GeometryInstance_LightmapScale>` | :ref:`lightmap_scale<class_GeometryInstance_property_lightmap_scale>` | ``0`` |
  24. +-------------------------------------------------------------------------+-------------------------------------------------------------------------------+-----------+
  25. | :ref:`float<class_float>` | :ref:`lod_max_distance<class_GeometryInstance_property_lod_max_distance>` | ``0.0`` |
  26. +-------------------------------------------------------------------------+-------------------------------------------------------------------------------+-----------+
  27. | :ref:`float<class_float>` | :ref:`lod_max_hysteresis<class_GeometryInstance_property_lod_max_hysteresis>` | ``0.0`` |
  28. +-------------------------------------------------------------------------+-------------------------------------------------------------------------------+-----------+
  29. | :ref:`float<class_float>` | :ref:`lod_min_distance<class_GeometryInstance_property_lod_min_distance>` | ``0.0`` |
  30. +-------------------------------------------------------------------------+-------------------------------------------------------------------------------+-----------+
  31. | :ref:`float<class_float>` | :ref:`lod_min_hysteresis<class_GeometryInstance_property_lod_min_hysteresis>` | ``0.0`` |
  32. +-------------------------------------------------------------------------+-------------------------------------------------------------------------------+-----------+
  33. | :ref:`Material<class_Material>` | :ref:`material_override<class_GeometryInstance_property_material_override>` | |
  34. +-------------------------------------------------------------------------+-------------------------------------------------------------------------------+-----------+
  35. | :ref:`bool<class_bool>` | :ref:`use_in_baked_light<class_GeometryInstance_property_use_in_baked_light>` | ``false`` |
  36. +-------------------------------------------------------------------------+-------------------------------------------------------------------------------+-----------+
  37. Methods
  38. -------
  39. +-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`bool<class_bool>` | :ref:`get_flag<class_GeometryInstance_method_get_flag>` **(** :ref:`Flags<enum_GeometryInstance_Flags>` flag **)** |const| |
  41. +-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | void | :ref:`set_custom_aabb<class_GeometryInstance_method_set_custom_aabb>` **(** :ref:`AABB<class_AABB>` aabb **)** |
  43. +-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | void | :ref:`set_flag<class_GeometryInstance_method_set_flag>` **(** :ref:`Flags<enum_GeometryInstance_Flags>` flag, :ref:`bool<class_bool>` value **)** |
  45. +-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
  46. Enumerations
  47. ------------
  48. .. _enum_GeometryInstance_LightmapScale:
  49. .. _class_GeometryInstance_constant_LIGHTMAP_SCALE_1X:
  50. .. _class_GeometryInstance_constant_LIGHTMAP_SCALE_2X:
  51. .. _class_GeometryInstance_constant_LIGHTMAP_SCALE_4X:
  52. .. _class_GeometryInstance_constant_LIGHTMAP_SCALE_8X:
  53. .. _class_GeometryInstance_constant_LIGHTMAP_SCALE_MAX:
  54. enum **LightmapScale**:
  55. - **LIGHTMAP_SCALE_1X** = **0** --- The generated lightmap texture will have the original size.
  56. - **LIGHTMAP_SCALE_2X** = **1** --- The generated lightmap texture will be twice as large, on each axis.
  57. - **LIGHTMAP_SCALE_4X** = **2** --- The generated lightmap texture will be 4 times as large, on each axis.
  58. - **LIGHTMAP_SCALE_8X** = **3** --- The generated lightmap texture will be 8 times as large, on each axis.
  59. - **LIGHTMAP_SCALE_MAX** = **4**
  60. ----
  61. .. _enum_GeometryInstance_ShadowCastingSetting:
  62. .. _class_GeometryInstance_constant_SHADOW_CASTING_SETTING_OFF:
  63. .. _class_GeometryInstance_constant_SHADOW_CASTING_SETTING_ON:
  64. .. _class_GeometryInstance_constant_SHADOW_CASTING_SETTING_DOUBLE_SIDED:
  65. .. _class_GeometryInstance_constant_SHADOW_CASTING_SETTING_SHADOWS_ONLY:
  66. enum **ShadowCastingSetting**:
  67. - **SHADOW_CASTING_SETTING_OFF** = **0** --- Will not cast any shadows.
  68. - **SHADOW_CASTING_SETTING_ON** = **1** --- Will cast shadows from all visible faces in the GeometryInstance.
  69. Will take culling into account, so faces not being rendered will not be taken into account when shadow casting.
  70. - **SHADOW_CASTING_SETTING_DOUBLE_SIDED** = **2** --- Will cast shadows from all visible faces in the GeometryInstance.
  71. Will not take culling into account, so all faces will be taken into account when shadow casting.
  72. - **SHADOW_CASTING_SETTING_SHADOWS_ONLY** = **3** --- Will only show the shadows casted from this object.
  73. In other words, the actual mesh will not be visible, only the shadows casted from the mesh will be.
  74. ----
  75. .. _enum_GeometryInstance_Flags:
  76. .. _class_GeometryInstance_constant_FLAG_USE_BAKED_LIGHT:
  77. .. _class_GeometryInstance_constant_FLAG_DRAW_NEXT_FRAME_IF_VISIBLE:
  78. .. _class_GeometryInstance_constant_FLAG_MAX:
  79. enum **Flags**:
  80. - **FLAG_USE_BAKED_LIGHT** = **0** --- Will allow the GeometryInstance to be used when baking lights using a :ref:`GIProbe<class_GIProbe>` or :ref:`BakedLightmap<class_BakedLightmap>`.
  81. - **FLAG_DRAW_NEXT_FRAME_IF_VISIBLE** = **1** --- Unused in this class, exposed for consistency with :ref:`InstanceFlags<enum_VisualServer_InstanceFlags>`.
  82. - **FLAG_MAX** = **2** --- Represents the size of the :ref:`Flags<enum_GeometryInstance_Flags>` enum.
  83. Property Descriptions
  84. ---------------------
  85. .. _class_GeometryInstance_property_cast_shadow:
  86. - :ref:`ShadowCastingSetting<enum_GeometryInstance_ShadowCastingSetting>` **cast_shadow**
  87. +-----------+---------------------------------+
  88. | *Default* | ``1`` |
  89. +-----------+---------------------------------+
  90. | *Setter* | set_cast_shadows_setting(value) |
  91. +-----------+---------------------------------+
  92. | *Getter* | get_cast_shadows_setting() |
  93. +-----------+---------------------------------+
  94. The selected shadow casting flag. See :ref:`ShadowCastingSetting<enum_GeometryInstance_ShadowCastingSetting>` for possible values.
  95. ----
  96. .. _class_GeometryInstance_property_extra_cull_margin:
  97. - :ref:`float<class_float>` **extra_cull_margin**
  98. +-----------+------------------------------+
  99. | *Default* | ``0.0`` |
  100. +-----------+------------------------------+
  101. | *Setter* | set_extra_cull_margin(value) |
  102. +-----------+------------------------------+
  103. | *Getter* | get_extra_cull_margin() |
  104. +-----------+------------------------------+
  105. The extra distance added to the GeometryInstance's bounding box (:ref:`AABB<class_AABB>`) to increase its cull box.
  106. ----
  107. .. _class_GeometryInstance_property_generate_lightmap:
  108. - :ref:`bool<class_bool>` **generate_lightmap**
  109. +-----------+------------------------------+
  110. | *Default* | ``true`` |
  111. +-----------+------------------------------+
  112. | *Setter* | set_generate_lightmap(value) |
  113. +-----------+------------------------------+
  114. | *Getter* | get_generate_lightmap() |
  115. +-----------+------------------------------+
  116. When disabled, the mesh will be taken into account when computing indirect lighting, but the resulting lightmap will not be saved. Useful for emissive only materials or shadow casters.
  117. ----
  118. .. _class_GeometryInstance_property_lightmap_scale:
  119. - :ref:`LightmapScale<enum_GeometryInstance_LightmapScale>` **lightmap_scale**
  120. +-----------+---------------------------+
  121. | *Default* | ``0`` |
  122. +-----------+---------------------------+
  123. | *Setter* | set_lightmap_scale(value) |
  124. +-----------+---------------------------+
  125. | *Getter* | get_lightmap_scale() |
  126. +-----------+---------------------------+
  127. Scale factor for the generated baked lightmap. Useful for adding detail to certain mesh instances.
  128. ----
  129. .. _class_GeometryInstance_property_lod_max_distance:
  130. - :ref:`float<class_float>` **lod_max_distance**
  131. +-----------+-----------------------------+
  132. | *Default* | ``0.0`` |
  133. +-----------+-----------------------------+
  134. | *Setter* | set_lod_max_distance(value) |
  135. +-----------+-----------------------------+
  136. | *Getter* | get_lod_max_distance() |
  137. +-----------+-----------------------------+
  138. The GeometryInstance's max LOD distance.
  139. **Note:** This property currently has no effect.
  140. ----
  141. .. _class_GeometryInstance_property_lod_max_hysteresis:
  142. - :ref:`float<class_float>` **lod_max_hysteresis**
  143. +-----------+-------------------------------+
  144. | *Default* | ``0.0`` |
  145. +-----------+-------------------------------+
  146. | *Setter* | set_lod_max_hysteresis(value) |
  147. +-----------+-------------------------------+
  148. | *Getter* | get_lod_max_hysteresis() |
  149. +-----------+-------------------------------+
  150. The GeometryInstance's max LOD margin.
  151. **Note:** This property currently has no effect.
  152. ----
  153. .. _class_GeometryInstance_property_lod_min_distance:
  154. - :ref:`float<class_float>` **lod_min_distance**
  155. +-----------+-----------------------------+
  156. | *Default* | ``0.0`` |
  157. +-----------+-----------------------------+
  158. | *Setter* | set_lod_min_distance(value) |
  159. +-----------+-----------------------------+
  160. | *Getter* | get_lod_min_distance() |
  161. +-----------+-----------------------------+
  162. The GeometryInstance's min LOD distance.
  163. **Note:** This property currently has no effect.
  164. ----
  165. .. _class_GeometryInstance_property_lod_min_hysteresis:
  166. - :ref:`float<class_float>` **lod_min_hysteresis**
  167. +-----------+-------------------------------+
  168. | *Default* | ``0.0`` |
  169. +-----------+-------------------------------+
  170. | *Setter* | set_lod_min_hysteresis(value) |
  171. +-----------+-------------------------------+
  172. | *Getter* | get_lod_min_hysteresis() |
  173. +-----------+-------------------------------+
  174. The GeometryInstance's min LOD margin.
  175. **Note:** This property currently has no effect.
  176. ----
  177. .. _class_GeometryInstance_property_material_override:
  178. - :ref:`Material<class_Material>` **material_override**
  179. +----------+------------------------------+
  180. | *Setter* | set_material_override(value) |
  181. +----------+------------------------------+
  182. | *Getter* | get_material_override() |
  183. +----------+------------------------------+
  184. The material override for the whole geometry.
  185. If a material is assigned to this property, it will be used instead of any material set in any material slot of the mesh.
  186. ----
  187. .. _class_GeometryInstance_property_use_in_baked_light:
  188. - :ref:`bool<class_bool>` **use_in_baked_light**
  189. +-----------+-----------------+
  190. | *Default* | ``false`` |
  191. +-----------+-----------------+
  192. | *Setter* | set_flag(value) |
  193. +-----------+-----------------+
  194. | *Getter* | get_flag() |
  195. +-----------+-----------------+
  196. If ``true``, this GeometryInstance will be used when baking lights using a :ref:`GIProbe<class_GIProbe>` or :ref:`BakedLightmap<class_BakedLightmap>`.
  197. Method Descriptions
  198. -------------------
  199. .. _class_GeometryInstance_method_get_flag:
  200. - :ref:`bool<class_bool>` **get_flag** **(** :ref:`Flags<enum_GeometryInstance_Flags>` flag **)** |const|
  201. Returns the :ref:`Flags<enum_GeometryInstance_Flags>` that have been set for this object.
  202. ----
  203. .. _class_GeometryInstance_method_set_custom_aabb:
  204. - void **set_custom_aabb** **(** :ref:`AABB<class_AABB>` aabb **)**
  205. Overrides the bounding box of this node with a custom one. To remove it, set an :ref:`AABB<class_AABB>` with all fields set to zero.
  206. ----
  207. .. _class_GeometryInstance_method_set_flag:
  208. - void **set_flag** **(** :ref:`Flags<enum_GeometryInstance_Flags>` flag, :ref:`bool<class_bool>` value **)**
  209. Sets the :ref:`Flags<enum_GeometryInstance_Flags>` specified. See :ref:`Flags<enum_GeometryInstance_Flags>` for options.
  210. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  211. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  212. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`