class_mesh.rst 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987
  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/Mesh.xml.
  6. .. _class_Mesh:
  7. Mesh
  8. ====
  9. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. **Inherited By:** :ref:`ArrayMesh<class_ArrayMesh>`, :ref:`ImmediateMesh<class_ImmediateMesh>`, :ref:`PlaceholderMesh<class_PlaceholderMesh>`, :ref:`PrimitiveMesh<class_PrimitiveMesh>`
  11. A :ref:`Resource<class_Resource>` that contains vertex array-based geometry.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. Mesh is a type of :ref:`Resource<class_Resource>` that contains vertex array-based geometry, divided in *surfaces*. Each surface contains a completely separate array and a material used to draw it. Design wise, a mesh with multiple surfaces is preferred to a single surface, because objects created in 3D editing software commonly contain multiple materials. The maximum number of surfaces per mesh is :ref:`RenderingServer.MAX_MESH_SURFACES<class_RenderingServer_constant_MAX_MESH_SURFACES>`.
  16. .. rst-class:: classref-introduction-group
  17. Tutorials
  18. ---------
  19. - `3D Material Testers Demo <https://godotengine.org/asset-library/asset/2742>`__
  20. - `3D Kinematic Character Demo <https://godotengine.org/asset-library/asset/2739>`__
  21. - `3D Platformer Demo <https://godotengine.org/asset-library/asset/2748>`__
  22. - `Third Person Shooter (TPS) Demo <https://godotengine.org/asset-library/asset/2710>`__
  23. .. rst-class:: classref-reftable-group
  24. Properties
  25. ----------
  26. .. table::
  27. :widths: auto
  28. +---------------------------------+-------------------------------------------------------------------+--------------------+
  29. | :ref:`Vector2i<class_Vector2i>` | :ref:`lightmap_size_hint<class_Mesh_property_lightmap_size_hint>` | ``Vector2i(0, 0)`` |
  30. +---------------------------------+-------------------------------------------------------------------+--------------------+
  31. .. rst-class:: classref-reftable-group
  32. Methods
  33. -------
  34. .. table::
  35. :widths: auto
  36. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`AABB<class_AABB>` | :ref:`_get_aabb<class_Mesh_private_method__get_aabb>`\ (\ ) |virtual| |const| |
  38. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`int<class_int>` | :ref:`_get_blend_shape_count<class_Mesh_private_method__get_blend_shape_count>`\ (\ ) |virtual| |const| |
  40. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`StringName<class_StringName>` | :ref:`_get_blend_shape_name<class_Mesh_private_method__get_blend_shape_name>`\ (\ index\: :ref:`int<class_int>`\ ) |virtual| |const| |
  42. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`int<class_int>` | :ref:`_get_surface_count<class_Mesh_private_method__get_surface_count>`\ (\ ) |virtual| |const| |
  44. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | |void| | :ref:`_set_blend_shape_name<class_Mesh_private_method__set_blend_shape_name>`\ (\ index\: :ref:`int<class_int>`, name\: :ref:`StringName<class_StringName>`\ ) |virtual| |
  46. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`int<class_int>` | :ref:`_surface_get_array_index_len<class_Mesh_private_method__surface_get_array_index_len>`\ (\ index\: :ref:`int<class_int>`\ ) |virtual| |const| |
  48. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`int<class_int>` | :ref:`_surface_get_array_len<class_Mesh_private_method__surface_get_array_len>`\ (\ index\: :ref:`int<class_int>`\ ) |virtual| |const| |
  50. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`Array<class_Array>` | :ref:`_surface_get_arrays<class_Mesh_private_method__surface_get_arrays>`\ (\ index\: :ref:`int<class_int>`\ ) |virtual| |const| |
  52. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`Array<class_Array>`\[:ref:`Array<class_Array>`\] | :ref:`_surface_get_blend_shape_arrays<class_Mesh_private_method__surface_get_blend_shape_arrays>`\ (\ index\: :ref:`int<class_int>`\ ) |virtual| |const| |
  54. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | :ref:`int<class_int>` | :ref:`_surface_get_format<class_Mesh_private_method__surface_get_format>`\ (\ index\: :ref:`int<class_int>`\ ) |virtual| |const| |
  56. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | :ref:`Dictionary<class_Dictionary>` | :ref:`_surface_get_lods<class_Mesh_private_method__surface_get_lods>`\ (\ index\: :ref:`int<class_int>`\ ) |virtual| |const| |
  58. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | :ref:`Material<class_Material>` | :ref:`_surface_get_material<class_Mesh_private_method__surface_get_material>`\ (\ index\: :ref:`int<class_int>`\ ) |virtual| |const| |
  60. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | :ref:`int<class_int>` | :ref:`_surface_get_primitive_type<class_Mesh_private_method__surface_get_primitive_type>`\ (\ index\: :ref:`int<class_int>`\ ) |virtual| |const| |
  62. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | |void| | :ref:`_surface_set_material<class_Mesh_private_method__surface_set_material>`\ (\ index\: :ref:`int<class_int>`, material\: :ref:`Material<class_Material>`\ ) |virtual| |
  64. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | :ref:`ConvexPolygonShape3D<class_ConvexPolygonShape3D>` | :ref:`create_convex_shape<class_Mesh_method_create_convex_shape>`\ (\ clean\: :ref:`bool<class_bool>` = true, simplify\: :ref:`bool<class_bool>` = false\ ) |const| |
  66. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | :ref:`Mesh<class_Mesh>` | :ref:`create_outline<class_Mesh_method_create_outline>`\ (\ margin\: :ref:`float<class_float>`\ ) |const| |
  68. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | :ref:`Resource<class_Resource>` | :ref:`create_placeholder<class_Mesh_method_create_placeholder>`\ (\ ) |const| |
  70. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | :ref:`ConcavePolygonShape3D<class_ConcavePolygonShape3D>` | :ref:`create_trimesh_shape<class_Mesh_method_create_trimesh_shape>`\ (\ ) |const| |
  72. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  73. | :ref:`TriangleMesh<class_TriangleMesh>` | :ref:`generate_triangle_mesh<class_Mesh_method_generate_triangle_mesh>`\ (\ ) |const| |
  74. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | :ref:`AABB<class_AABB>` | :ref:`get_aabb<class_Mesh_method_get_aabb>`\ (\ ) |const| |
  76. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | :ref:`PackedVector3Array<class_PackedVector3Array>` | :ref:`get_faces<class_Mesh_method_get_faces>`\ (\ ) |const| |
  78. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | :ref:`int<class_int>` | :ref:`get_surface_count<class_Mesh_method_get_surface_count>`\ (\ ) |const| |
  80. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | :ref:`Array<class_Array>` | :ref:`surface_get_arrays<class_Mesh_method_surface_get_arrays>`\ (\ surf_idx\: :ref:`int<class_int>`\ ) |const| |
  82. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | :ref:`Array<class_Array>`\[:ref:`Array<class_Array>`\] | :ref:`surface_get_blend_shape_arrays<class_Mesh_method_surface_get_blend_shape_arrays>`\ (\ surf_idx\: :ref:`int<class_int>`\ ) |const| |
  84. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | :ref:`Material<class_Material>` | :ref:`surface_get_material<class_Mesh_method_surface_get_material>`\ (\ surf_idx\: :ref:`int<class_int>`\ ) |const| |
  86. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  87. | |void| | :ref:`surface_set_material<class_Mesh_method_surface_set_material>`\ (\ surf_idx\: :ref:`int<class_int>`, material\: :ref:`Material<class_Material>`\ ) |
  88. +-----------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  89. .. rst-class:: classref-section-separator
  90. ----
  91. .. rst-class:: classref-descriptions-group
  92. Enumerations
  93. ------------
  94. .. _enum_Mesh_PrimitiveType:
  95. .. rst-class:: classref-enumeration
  96. enum **PrimitiveType**: :ref:`🔗<enum_Mesh_PrimitiveType>`
  97. .. _class_Mesh_constant_PRIMITIVE_POINTS:
  98. .. rst-class:: classref-enumeration-constant
  99. :ref:`PrimitiveType<enum_Mesh_PrimitiveType>` **PRIMITIVE_POINTS** = ``0``
  100. Render array as points (one vertex equals one point).
  101. .. _class_Mesh_constant_PRIMITIVE_LINES:
  102. .. rst-class:: classref-enumeration-constant
  103. :ref:`PrimitiveType<enum_Mesh_PrimitiveType>` **PRIMITIVE_LINES** = ``1``
  104. Render array as lines (every two vertices a line is created).
  105. .. _class_Mesh_constant_PRIMITIVE_LINE_STRIP:
  106. .. rst-class:: classref-enumeration-constant
  107. :ref:`PrimitiveType<enum_Mesh_PrimitiveType>` **PRIMITIVE_LINE_STRIP** = ``2``
  108. Render array as line strip.
  109. .. _class_Mesh_constant_PRIMITIVE_TRIANGLES:
  110. .. rst-class:: classref-enumeration-constant
  111. :ref:`PrimitiveType<enum_Mesh_PrimitiveType>` **PRIMITIVE_TRIANGLES** = ``3``
  112. Render array as triangles (every three vertices a triangle is created).
  113. .. _class_Mesh_constant_PRIMITIVE_TRIANGLE_STRIP:
  114. .. rst-class:: classref-enumeration-constant
  115. :ref:`PrimitiveType<enum_Mesh_PrimitiveType>` **PRIMITIVE_TRIANGLE_STRIP** = ``4``
  116. Render array as triangle strips.
  117. .. rst-class:: classref-item-separator
  118. ----
  119. .. _enum_Mesh_ArrayType:
  120. .. rst-class:: classref-enumeration
  121. enum **ArrayType**: :ref:`🔗<enum_Mesh_ArrayType>`
  122. .. _class_Mesh_constant_ARRAY_VERTEX:
  123. .. rst-class:: classref-enumeration-constant
  124. :ref:`ArrayType<enum_Mesh_ArrayType>` **ARRAY_VERTEX** = ``0``
  125. :ref:`PackedVector3Array<class_PackedVector3Array>`, :ref:`PackedVector2Array<class_PackedVector2Array>`, or :ref:`Array<class_Array>` of vertex positions.
  126. .. _class_Mesh_constant_ARRAY_NORMAL:
  127. .. rst-class:: classref-enumeration-constant
  128. :ref:`ArrayType<enum_Mesh_ArrayType>` **ARRAY_NORMAL** = ``1``
  129. :ref:`PackedVector3Array<class_PackedVector3Array>` of vertex normals.
  130. \ **Note:** The array has to consist of normal vectors, otherwise they will be normalized by the engine, potentially causing visual discrepancies.
  131. .. _class_Mesh_constant_ARRAY_TANGENT:
  132. .. rst-class:: classref-enumeration-constant
  133. :ref:`ArrayType<enum_Mesh_ArrayType>` **ARRAY_TANGENT** = ``2``
  134. :ref:`PackedFloat32Array<class_PackedFloat32Array>` of vertex tangents. Each element in groups of 4 floats, first 3 floats determine the tangent, and the last the binormal direction as -1 or 1.
  135. .. _class_Mesh_constant_ARRAY_COLOR:
  136. .. rst-class:: classref-enumeration-constant
  137. :ref:`ArrayType<enum_Mesh_ArrayType>` **ARRAY_COLOR** = ``3``
  138. :ref:`PackedColorArray<class_PackedColorArray>` of vertex colors.
  139. .. _class_Mesh_constant_ARRAY_TEX_UV:
  140. .. rst-class:: classref-enumeration-constant
  141. :ref:`ArrayType<enum_Mesh_ArrayType>` **ARRAY_TEX_UV** = ``4``
  142. :ref:`PackedVector2Array<class_PackedVector2Array>` for UV coordinates.
  143. .. _class_Mesh_constant_ARRAY_TEX_UV2:
  144. .. rst-class:: classref-enumeration-constant
  145. :ref:`ArrayType<enum_Mesh_ArrayType>` **ARRAY_TEX_UV2** = ``5``
  146. :ref:`PackedVector2Array<class_PackedVector2Array>` for second UV coordinates.
  147. .. _class_Mesh_constant_ARRAY_CUSTOM0:
  148. .. rst-class:: classref-enumeration-constant
  149. :ref:`ArrayType<enum_Mesh_ArrayType>` **ARRAY_CUSTOM0** = ``6``
  150. Contains custom color channel 0. :ref:`PackedByteArray<class_PackedByteArray>` if ``(format >> Mesh.ARRAY_FORMAT_CUSTOM0_SHIFT) & Mesh.ARRAY_FORMAT_CUSTOM_MASK`` is :ref:`ARRAY_CUSTOM_RGBA8_UNORM<class_Mesh_constant_ARRAY_CUSTOM_RGBA8_UNORM>`, :ref:`ARRAY_CUSTOM_RGBA8_SNORM<class_Mesh_constant_ARRAY_CUSTOM_RGBA8_SNORM>`, :ref:`ARRAY_CUSTOM_RG_HALF<class_Mesh_constant_ARRAY_CUSTOM_RG_HALF>`, or :ref:`ARRAY_CUSTOM_RGBA_HALF<class_Mesh_constant_ARRAY_CUSTOM_RGBA_HALF>`. :ref:`PackedFloat32Array<class_PackedFloat32Array>` otherwise.
  151. .. _class_Mesh_constant_ARRAY_CUSTOM1:
  152. .. rst-class:: classref-enumeration-constant
  153. :ref:`ArrayType<enum_Mesh_ArrayType>` **ARRAY_CUSTOM1** = ``7``
  154. Contains custom color channel 1. :ref:`PackedByteArray<class_PackedByteArray>` if ``(format >> Mesh.ARRAY_FORMAT_CUSTOM1_SHIFT) & Mesh.ARRAY_FORMAT_CUSTOM_MASK`` is :ref:`ARRAY_CUSTOM_RGBA8_UNORM<class_Mesh_constant_ARRAY_CUSTOM_RGBA8_UNORM>`, :ref:`ARRAY_CUSTOM_RGBA8_SNORM<class_Mesh_constant_ARRAY_CUSTOM_RGBA8_SNORM>`, :ref:`ARRAY_CUSTOM_RG_HALF<class_Mesh_constant_ARRAY_CUSTOM_RG_HALF>`, or :ref:`ARRAY_CUSTOM_RGBA_HALF<class_Mesh_constant_ARRAY_CUSTOM_RGBA_HALF>`. :ref:`PackedFloat32Array<class_PackedFloat32Array>` otherwise.
  155. .. _class_Mesh_constant_ARRAY_CUSTOM2:
  156. .. rst-class:: classref-enumeration-constant
  157. :ref:`ArrayType<enum_Mesh_ArrayType>` **ARRAY_CUSTOM2** = ``8``
  158. Contains custom color channel 2. :ref:`PackedByteArray<class_PackedByteArray>` if ``(format >> Mesh.ARRAY_FORMAT_CUSTOM2_SHIFT) & Mesh.ARRAY_FORMAT_CUSTOM_MASK`` is :ref:`ARRAY_CUSTOM_RGBA8_UNORM<class_Mesh_constant_ARRAY_CUSTOM_RGBA8_UNORM>`, :ref:`ARRAY_CUSTOM_RGBA8_SNORM<class_Mesh_constant_ARRAY_CUSTOM_RGBA8_SNORM>`, :ref:`ARRAY_CUSTOM_RG_HALF<class_Mesh_constant_ARRAY_CUSTOM_RG_HALF>`, or :ref:`ARRAY_CUSTOM_RGBA_HALF<class_Mesh_constant_ARRAY_CUSTOM_RGBA_HALF>`. :ref:`PackedFloat32Array<class_PackedFloat32Array>` otherwise.
  159. .. _class_Mesh_constant_ARRAY_CUSTOM3:
  160. .. rst-class:: classref-enumeration-constant
  161. :ref:`ArrayType<enum_Mesh_ArrayType>` **ARRAY_CUSTOM3** = ``9``
  162. Contains custom color channel 3. :ref:`PackedByteArray<class_PackedByteArray>` if ``(format >> Mesh.ARRAY_FORMAT_CUSTOM3_SHIFT) & Mesh.ARRAY_FORMAT_CUSTOM_MASK`` is :ref:`ARRAY_CUSTOM_RGBA8_UNORM<class_Mesh_constant_ARRAY_CUSTOM_RGBA8_UNORM>`, :ref:`ARRAY_CUSTOM_RGBA8_SNORM<class_Mesh_constant_ARRAY_CUSTOM_RGBA8_SNORM>`, :ref:`ARRAY_CUSTOM_RG_HALF<class_Mesh_constant_ARRAY_CUSTOM_RG_HALF>`, or :ref:`ARRAY_CUSTOM_RGBA_HALF<class_Mesh_constant_ARRAY_CUSTOM_RGBA_HALF>`. :ref:`PackedFloat32Array<class_PackedFloat32Array>` otherwise.
  163. .. _class_Mesh_constant_ARRAY_BONES:
  164. .. rst-class:: classref-enumeration-constant
  165. :ref:`ArrayType<enum_Mesh_ArrayType>` **ARRAY_BONES** = ``10``
  166. :ref:`PackedFloat32Array<class_PackedFloat32Array>` or :ref:`PackedInt32Array<class_PackedInt32Array>` of bone indices. Contains either 4 or 8 numbers per vertex depending on the presence of the :ref:`ARRAY_FLAG_USE_8_BONE_WEIGHTS<class_Mesh_constant_ARRAY_FLAG_USE_8_BONE_WEIGHTS>` flag.
  167. .. _class_Mesh_constant_ARRAY_WEIGHTS:
  168. .. rst-class:: classref-enumeration-constant
  169. :ref:`ArrayType<enum_Mesh_ArrayType>` **ARRAY_WEIGHTS** = ``11``
  170. :ref:`PackedFloat32Array<class_PackedFloat32Array>` or :ref:`PackedFloat64Array<class_PackedFloat64Array>` of bone weights in the range ``0.0`` to ``1.0`` (inclusive). Contains either 4 or 8 numbers per vertex depending on the presence of the :ref:`ARRAY_FLAG_USE_8_BONE_WEIGHTS<class_Mesh_constant_ARRAY_FLAG_USE_8_BONE_WEIGHTS>` flag.
  171. .. _class_Mesh_constant_ARRAY_INDEX:
  172. .. rst-class:: classref-enumeration-constant
  173. :ref:`ArrayType<enum_Mesh_ArrayType>` **ARRAY_INDEX** = ``12``
  174. :ref:`PackedInt32Array<class_PackedInt32Array>` of integers used as indices referencing vertices, colors, normals, tangents, and textures. All of those arrays must have the same number of elements as the vertex array. No index can be beyond the vertex array size. When this index array is present, it puts the function into "index mode," where the index selects the *i*'th vertex, normal, tangent, color, UV, etc. This means if you want to have different normals or colors along an edge, you have to duplicate the vertices.
  175. For triangles, the index array is interpreted as triples, referring to the vertices of each triangle. For lines, the index array is in pairs indicating the start and end of each line.
  176. .. _class_Mesh_constant_ARRAY_MAX:
  177. .. rst-class:: classref-enumeration-constant
  178. :ref:`ArrayType<enum_Mesh_ArrayType>` **ARRAY_MAX** = ``13``
  179. Represents the size of the :ref:`ArrayType<enum_Mesh_ArrayType>` enum.
  180. .. rst-class:: classref-item-separator
  181. ----
  182. .. _enum_Mesh_ArrayCustomFormat:
  183. .. rst-class:: classref-enumeration
  184. enum **ArrayCustomFormat**: :ref:`🔗<enum_Mesh_ArrayCustomFormat>`
  185. .. _class_Mesh_constant_ARRAY_CUSTOM_RGBA8_UNORM:
  186. .. rst-class:: classref-enumeration-constant
  187. :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>` **ARRAY_CUSTOM_RGBA8_UNORM** = ``0``
  188. Indicates this custom channel contains unsigned normalized byte colors from 0 to 1, encoded as :ref:`PackedByteArray<class_PackedByteArray>`.
  189. .. _class_Mesh_constant_ARRAY_CUSTOM_RGBA8_SNORM:
  190. .. rst-class:: classref-enumeration-constant
  191. :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>` **ARRAY_CUSTOM_RGBA8_SNORM** = ``1``
  192. Indicates this custom channel contains signed normalized byte colors from -1 to 1, encoded as :ref:`PackedByteArray<class_PackedByteArray>`.
  193. .. _class_Mesh_constant_ARRAY_CUSTOM_RG_HALF:
  194. .. rst-class:: classref-enumeration-constant
  195. :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>` **ARRAY_CUSTOM_RG_HALF** = ``2``
  196. Indicates this custom channel contains half precision float colors, encoded as :ref:`PackedByteArray<class_PackedByteArray>`. Only red and green channels are used.
  197. .. _class_Mesh_constant_ARRAY_CUSTOM_RGBA_HALF:
  198. .. rst-class:: classref-enumeration-constant
  199. :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>` **ARRAY_CUSTOM_RGBA_HALF** = ``3``
  200. Indicates this custom channel contains half precision float colors, encoded as :ref:`PackedByteArray<class_PackedByteArray>`.
  201. .. _class_Mesh_constant_ARRAY_CUSTOM_R_FLOAT:
  202. .. rst-class:: classref-enumeration-constant
  203. :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>` **ARRAY_CUSTOM_R_FLOAT** = ``4``
  204. Indicates this custom channel contains full float colors, in a :ref:`PackedFloat32Array<class_PackedFloat32Array>`. Only the red channel is used.
  205. .. _class_Mesh_constant_ARRAY_CUSTOM_RG_FLOAT:
  206. .. rst-class:: classref-enumeration-constant
  207. :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>` **ARRAY_CUSTOM_RG_FLOAT** = ``5``
  208. Indicates this custom channel contains full float colors, in a :ref:`PackedFloat32Array<class_PackedFloat32Array>`. Only red and green channels are used.
  209. .. _class_Mesh_constant_ARRAY_CUSTOM_RGB_FLOAT:
  210. .. rst-class:: classref-enumeration-constant
  211. :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>` **ARRAY_CUSTOM_RGB_FLOAT** = ``6``
  212. Indicates this custom channel contains full float colors, in a :ref:`PackedFloat32Array<class_PackedFloat32Array>`. Only red, green and blue channels are used.
  213. .. _class_Mesh_constant_ARRAY_CUSTOM_RGBA_FLOAT:
  214. .. rst-class:: classref-enumeration-constant
  215. :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>` **ARRAY_CUSTOM_RGBA_FLOAT** = ``7``
  216. Indicates this custom channel contains full float colors, in a :ref:`PackedFloat32Array<class_PackedFloat32Array>`.
  217. .. _class_Mesh_constant_ARRAY_CUSTOM_MAX:
  218. .. rst-class:: classref-enumeration-constant
  219. :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>` **ARRAY_CUSTOM_MAX** = ``8``
  220. Represents the size of the :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>` enum.
  221. .. rst-class:: classref-item-separator
  222. ----
  223. .. _enum_Mesh_ArrayFormat:
  224. .. rst-class:: classref-enumeration
  225. flags **ArrayFormat**: :ref:`🔗<enum_Mesh_ArrayFormat>`
  226. .. _class_Mesh_constant_ARRAY_FORMAT_VERTEX:
  227. .. rst-class:: classref-enumeration-constant
  228. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_VERTEX** = ``1``
  229. Mesh array contains vertices. All meshes require a vertex array so this should always be present.
  230. .. _class_Mesh_constant_ARRAY_FORMAT_NORMAL:
  231. .. rst-class:: classref-enumeration-constant
  232. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_NORMAL** = ``2``
  233. Mesh array contains normals.
  234. .. _class_Mesh_constant_ARRAY_FORMAT_TANGENT:
  235. .. rst-class:: classref-enumeration-constant
  236. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_TANGENT** = ``4``
  237. Mesh array contains tangents.
  238. .. _class_Mesh_constant_ARRAY_FORMAT_COLOR:
  239. .. rst-class:: classref-enumeration-constant
  240. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_COLOR** = ``8``
  241. Mesh array contains colors.
  242. .. _class_Mesh_constant_ARRAY_FORMAT_TEX_UV:
  243. .. rst-class:: classref-enumeration-constant
  244. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_TEX_UV** = ``16``
  245. Mesh array contains UVs.
  246. .. _class_Mesh_constant_ARRAY_FORMAT_TEX_UV2:
  247. .. rst-class:: classref-enumeration-constant
  248. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_TEX_UV2** = ``32``
  249. Mesh array contains second UV.
  250. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM0:
  251. .. rst-class:: classref-enumeration-constant
  252. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_CUSTOM0** = ``64``
  253. Mesh array contains custom channel index 0.
  254. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM1:
  255. .. rst-class:: classref-enumeration-constant
  256. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_CUSTOM1** = ``128``
  257. Mesh array contains custom channel index 1.
  258. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM2:
  259. .. rst-class:: classref-enumeration-constant
  260. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_CUSTOM2** = ``256``
  261. Mesh array contains custom channel index 2.
  262. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM3:
  263. .. rst-class:: classref-enumeration-constant
  264. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_CUSTOM3** = ``512``
  265. Mesh array contains custom channel index 3.
  266. .. _class_Mesh_constant_ARRAY_FORMAT_BONES:
  267. .. rst-class:: classref-enumeration-constant
  268. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_BONES** = ``1024``
  269. Mesh array contains bones.
  270. .. _class_Mesh_constant_ARRAY_FORMAT_WEIGHTS:
  271. .. rst-class:: classref-enumeration-constant
  272. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_WEIGHTS** = ``2048``
  273. Mesh array contains bone weights.
  274. .. _class_Mesh_constant_ARRAY_FORMAT_INDEX:
  275. .. rst-class:: classref-enumeration-constant
  276. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_INDEX** = ``4096``
  277. Mesh array uses indices.
  278. .. _class_Mesh_constant_ARRAY_FORMAT_BLEND_SHAPE_MASK:
  279. .. rst-class:: classref-enumeration-constant
  280. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_BLEND_SHAPE_MASK** = ``7``
  281. Mask of mesh channels permitted in blend shapes.
  282. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM_BASE:
  283. .. rst-class:: classref-enumeration-constant
  284. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_CUSTOM_BASE** = ``13``
  285. Shift of first custom channel.
  286. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM_BITS:
  287. .. rst-class:: classref-enumeration-constant
  288. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_CUSTOM_BITS** = ``3``
  289. Number of format bits per custom channel. See :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>`.
  290. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM0_SHIFT:
  291. .. rst-class:: classref-enumeration-constant
  292. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_CUSTOM0_SHIFT** = ``13``
  293. Amount to shift :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>` for custom channel index 0.
  294. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM1_SHIFT:
  295. .. rst-class:: classref-enumeration-constant
  296. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_CUSTOM1_SHIFT** = ``16``
  297. Amount to shift :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>` for custom channel index 1.
  298. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM2_SHIFT:
  299. .. rst-class:: classref-enumeration-constant
  300. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_CUSTOM2_SHIFT** = ``19``
  301. Amount to shift :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>` for custom channel index 2.
  302. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM3_SHIFT:
  303. .. rst-class:: classref-enumeration-constant
  304. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_CUSTOM3_SHIFT** = ``22``
  305. Amount to shift :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>` for custom channel index 3.
  306. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM_MASK:
  307. .. rst-class:: classref-enumeration-constant
  308. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_CUSTOM_MASK** = ``7``
  309. Mask of custom format bits per custom channel. Must be shifted by one of the SHIFT constants. See :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>`.
  310. .. _class_Mesh_constant_ARRAY_COMPRESS_FLAGS_BASE:
  311. .. rst-class:: classref-enumeration-constant
  312. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_COMPRESS_FLAGS_BASE** = ``25``
  313. Shift of first compress flag. Compress flags should be passed to :ref:`ArrayMesh.add_surface_from_arrays<class_ArrayMesh_method_add_surface_from_arrays>` and :ref:`SurfaceTool.commit<class_SurfaceTool_method_commit>`.
  314. .. _class_Mesh_constant_ARRAY_FLAG_USE_2D_VERTICES:
  315. .. rst-class:: classref-enumeration-constant
  316. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FLAG_USE_2D_VERTICES** = ``33554432``
  317. Flag used to mark that the array contains 2D vertices.
  318. .. _class_Mesh_constant_ARRAY_FLAG_USE_DYNAMIC_UPDATE:
  319. .. rst-class:: classref-enumeration-constant
  320. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FLAG_USE_DYNAMIC_UPDATE** = ``67108864``
  321. Flag indices that the mesh data will use ``GL_DYNAMIC_DRAW`` on GLES. Unused on Vulkan.
  322. .. _class_Mesh_constant_ARRAY_FLAG_USE_8_BONE_WEIGHTS:
  323. .. rst-class:: classref-enumeration-constant
  324. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FLAG_USE_8_BONE_WEIGHTS** = ``134217728``
  325. Flag used to mark that the mesh contains up to 8 bone influences per vertex. This flag indicates that :ref:`ARRAY_BONES<class_Mesh_constant_ARRAY_BONES>` and :ref:`ARRAY_WEIGHTS<class_Mesh_constant_ARRAY_WEIGHTS>` elements will have double length.
  326. .. _class_Mesh_constant_ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY:
  327. .. rst-class:: classref-enumeration-constant
  328. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY** = ``268435456``
  329. Flag used to mark that the mesh intentionally contains no vertex array.
  330. .. _class_Mesh_constant_ARRAY_FLAG_COMPRESS_ATTRIBUTES:
  331. .. rst-class:: classref-enumeration-constant
  332. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FLAG_COMPRESS_ATTRIBUTES** = ``536870912``
  333. Flag used to mark that a mesh is using compressed attributes (vertices, normals, tangents, UVs). When this form of compression is enabled, vertex positions will be packed into an RGBA16UNORM attribute and scaled in the vertex shader. The normal and tangent will be packed into an RG16UNORM representing an axis, and a 16-bit float stored in the A-channel of the vertex. UVs will use 16-bit normalized floats instead of full 32-bit signed floats. When using this compression mode you must use either vertices, normals, and tangents or only vertices. You cannot use normals without tangents. Importers will automatically enable this compression if they can.
  334. .. rst-class:: classref-item-separator
  335. ----
  336. .. _enum_Mesh_BlendShapeMode:
  337. .. rst-class:: classref-enumeration
  338. enum **BlendShapeMode**: :ref:`🔗<enum_Mesh_BlendShapeMode>`
  339. .. _class_Mesh_constant_BLEND_SHAPE_MODE_NORMALIZED:
  340. .. rst-class:: classref-enumeration-constant
  341. :ref:`BlendShapeMode<enum_Mesh_BlendShapeMode>` **BLEND_SHAPE_MODE_NORMALIZED** = ``0``
  342. Blend shapes are normalized.
  343. .. _class_Mesh_constant_BLEND_SHAPE_MODE_RELATIVE:
  344. .. rst-class:: classref-enumeration-constant
  345. :ref:`BlendShapeMode<enum_Mesh_BlendShapeMode>` **BLEND_SHAPE_MODE_RELATIVE** = ``1``
  346. Blend shapes are relative to base weight.
  347. .. rst-class:: classref-section-separator
  348. ----
  349. .. rst-class:: classref-descriptions-group
  350. Property Descriptions
  351. ---------------------
  352. .. _class_Mesh_property_lightmap_size_hint:
  353. .. rst-class:: classref-property
  354. :ref:`Vector2i<class_Vector2i>` **lightmap_size_hint** = ``Vector2i(0, 0)`` :ref:`🔗<class_Mesh_property_lightmap_size_hint>`
  355. .. rst-class:: classref-property-setget
  356. - |void| **set_lightmap_size_hint**\ (\ value\: :ref:`Vector2i<class_Vector2i>`\ )
  357. - :ref:`Vector2i<class_Vector2i>` **get_lightmap_size_hint**\ (\ )
  358. Sets a hint to be used for lightmap resolution.
  359. .. rst-class:: classref-section-separator
  360. ----
  361. .. rst-class:: classref-descriptions-group
  362. Method Descriptions
  363. -------------------
  364. .. _class_Mesh_private_method__get_aabb:
  365. .. rst-class:: classref-method
  366. :ref:`AABB<class_AABB>` **_get_aabb**\ (\ ) |virtual| |const| :ref:`🔗<class_Mesh_private_method__get_aabb>`
  367. Virtual method to override the :ref:`AABB<class_AABB>` for a custom class extending **Mesh**.
  368. .. rst-class:: classref-item-separator
  369. ----
  370. .. _class_Mesh_private_method__get_blend_shape_count:
  371. .. rst-class:: classref-method
  372. :ref:`int<class_int>` **_get_blend_shape_count**\ (\ ) |virtual| |const| :ref:`🔗<class_Mesh_private_method__get_blend_shape_count>`
  373. Virtual method to override the number of blend shapes for a custom class extending **Mesh**.
  374. .. rst-class:: classref-item-separator
  375. ----
  376. .. _class_Mesh_private_method__get_blend_shape_name:
  377. .. rst-class:: classref-method
  378. :ref:`StringName<class_StringName>` **_get_blend_shape_name**\ (\ index\: :ref:`int<class_int>`\ ) |virtual| |const| :ref:`🔗<class_Mesh_private_method__get_blend_shape_name>`
  379. Virtual method to override the retrieval of blend shape names for a custom class extending **Mesh**.
  380. .. rst-class:: classref-item-separator
  381. ----
  382. .. _class_Mesh_private_method__get_surface_count:
  383. .. rst-class:: classref-method
  384. :ref:`int<class_int>` **_get_surface_count**\ (\ ) |virtual| |const| :ref:`🔗<class_Mesh_private_method__get_surface_count>`
  385. Virtual method to override the surface count for a custom class extending **Mesh**.
  386. .. rst-class:: classref-item-separator
  387. ----
  388. .. _class_Mesh_private_method__set_blend_shape_name:
  389. .. rst-class:: classref-method
  390. |void| **_set_blend_shape_name**\ (\ index\: :ref:`int<class_int>`, name\: :ref:`StringName<class_StringName>`\ ) |virtual| :ref:`🔗<class_Mesh_private_method__set_blend_shape_name>`
  391. Virtual method to override the names of blend shapes for a custom class extending **Mesh**.
  392. .. rst-class:: classref-item-separator
  393. ----
  394. .. _class_Mesh_private_method__surface_get_array_index_len:
  395. .. rst-class:: classref-method
  396. :ref:`int<class_int>` **_surface_get_array_index_len**\ (\ index\: :ref:`int<class_int>`\ ) |virtual| |const| :ref:`🔗<class_Mesh_private_method__surface_get_array_index_len>`
  397. Virtual method to override the surface array index length for a custom class extending **Mesh**.
  398. .. rst-class:: classref-item-separator
  399. ----
  400. .. _class_Mesh_private_method__surface_get_array_len:
  401. .. rst-class:: classref-method
  402. :ref:`int<class_int>` **_surface_get_array_len**\ (\ index\: :ref:`int<class_int>`\ ) |virtual| |const| :ref:`🔗<class_Mesh_private_method__surface_get_array_len>`
  403. Virtual method to override the surface array length for a custom class extending **Mesh**.
  404. .. rst-class:: classref-item-separator
  405. ----
  406. .. _class_Mesh_private_method__surface_get_arrays:
  407. .. rst-class:: classref-method
  408. :ref:`Array<class_Array>` **_surface_get_arrays**\ (\ index\: :ref:`int<class_int>`\ ) |virtual| |const| :ref:`🔗<class_Mesh_private_method__surface_get_arrays>`
  409. Virtual method to override the surface arrays for a custom class extending **Mesh**.
  410. .. rst-class:: classref-item-separator
  411. ----
  412. .. _class_Mesh_private_method__surface_get_blend_shape_arrays:
  413. .. rst-class:: classref-method
  414. :ref:`Array<class_Array>`\[:ref:`Array<class_Array>`\] **_surface_get_blend_shape_arrays**\ (\ index\: :ref:`int<class_int>`\ ) |virtual| |const| :ref:`🔗<class_Mesh_private_method__surface_get_blend_shape_arrays>`
  415. Virtual method to override the blend shape arrays for a custom class extending **Mesh**.
  416. .. rst-class:: classref-item-separator
  417. ----
  418. .. _class_Mesh_private_method__surface_get_format:
  419. .. rst-class:: classref-method
  420. :ref:`int<class_int>` **_surface_get_format**\ (\ index\: :ref:`int<class_int>`\ ) |virtual| |const| :ref:`🔗<class_Mesh_private_method__surface_get_format>`
  421. Virtual method to override the surface format for a custom class extending **Mesh**.
  422. .. rst-class:: classref-item-separator
  423. ----
  424. .. _class_Mesh_private_method__surface_get_lods:
  425. .. rst-class:: classref-method
  426. :ref:`Dictionary<class_Dictionary>` **_surface_get_lods**\ (\ index\: :ref:`int<class_int>`\ ) |virtual| |const| :ref:`🔗<class_Mesh_private_method__surface_get_lods>`
  427. Virtual method to override the surface LODs for a custom class extending **Mesh**.
  428. .. rst-class:: classref-item-separator
  429. ----
  430. .. _class_Mesh_private_method__surface_get_material:
  431. .. rst-class:: classref-method
  432. :ref:`Material<class_Material>` **_surface_get_material**\ (\ index\: :ref:`int<class_int>`\ ) |virtual| |const| :ref:`🔗<class_Mesh_private_method__surface_get_material>`
  433. Virtual method to override the surface material for a custom class extending **Mesh**.
  434. .. rst-class:: classref-item-separator
  435. ----
  436. .. _class_Mesh_private_method__surface_get_primitive_type:
  437. .. rst-class:: classref-method
  438. :ref:`int<class_int>` **_surface_get_primitive_type**\ (\ index\: :ref:`int<class_int>`\ ) |virtual| |const| :ref:`🔗<class_Mesh_private_method__surface_get_primitive_type>`
  439. Virtual method to override the surface primitive type for a custom class extending **Mesh**.
  440. .. rst-class:: classref-item-separator
  441. ----
  442. .. _class_Mesh_private_method__surface_set_material:
  443. .. rst-class:: classref-method
  444. |void| **_surface_set_material**\ (\ index\: :ref:`int<class_int>`, material\: :ref:`Material<class_Material>`\ ) |virtual| :ref:`🔗<class_Mesh_private_method__surface_set_material>`
  445. Virtual method to override the setting of a ``material`` at the given ``index`` for a custom class extending **Mesh**.
  446. .. rst-class:: classref-item-separator
  447. ----
  448. .. _class_Mesh_method_create_convex_shape:
  449. .. rst-class:: classref-method
  450. :ref:`ConvexPolygonShape3D<class_ConvexPolygonShape3D>` **create_convex_shape**\ (\ clean\: :ref:`bool<class_bool>` = true, simplify\: :ref:`bool<class_bool>` = false\ ) |const| :ref:`🔗<class_Mesh_method_create_convex_shape>`
  451. Calculate a :ref:`ConvexPolygonShape3D<class_ConvexPolygonShape3D>` from the mesh.
  452. If ``clean`` is ``true`` (default), duplicate and interior vertices are removed automatically. You can set it to ``false`` to make the process faster if not needed.
  453. If ``simplify`` is ``true``, the geometry can be further simplified to reduce the number of vertices. Disabled by default.
  454. .. rst-class:: classref-item-separator
  455. ----
  456. .. _class_Mesh_method_create_outline:
  457. .. rst-class:: classref-method
  458. :ref:`Mesh<class_Mesh>` **create_outline**\ (\ margin\: :ref:`float<class_float>`\ ) |const| :ref:`🔗<class_Mesh_method_create_outline>`
  459. Calculate an outline mesh at a defined offset (margin) from the original mesh.
  460. \ **Note:** This method typically returns the vertices in reverse order (e.g. clockwise to counterclockwise).
  461. .. rst-class:: classref-item-separator
  462. ----
  463. .. _class_Mesh_method_create_placeholder:
  464. .. rst-class:: classref-method
  465. :ref:`Resource<class_Resource>` **create_placeholder**\ (\ ) |const| :ref:`🔗<class_Mesh_method_create_placeholder>`
  466. Creates a placeholder version of this resource (:ref:`PlaceholderMesh<class_PlaceholderMesh>`).
  467. .. rst-class:: classref-item-separator
  468. ----
  469. .. _class_Mesh_method_create_trimesh_shape:
  470. .. rst-class:: classref-method
  471. :ref:`ConcavePolygonShape3D<class_ConcavePolygonShape3D>` **create_trimesh_shape**\ (\ ) |const| :ref:`🔗<class_Mesh_method_create_trimesh_shape>`
  472. Calculate a :ref:`ConcavePolygonShape3D<class_ConcavePolygonShape3D>` from the mesh.
  473. .. rst-class:: classref-item-separator
  474. ----
  475. .. _class_Mesh_method_generate_triangle_mesh:
  476. .. rst-class:: classref-method
  477. :ref:`TriangleMesh<class_TriangleMesh>` **generate_triangle_mesh**\ (\ ) |const| :ref:`🔗<class_Mesh_method_generate_triangle_mesh>`
  478. Generate a :ref:`TriangleMesh<class_TriangleMesh>` from the mesh. Considers only surfaces using one of these primitive types: :ref:`PRIMITIVE_TRIANGLES<class_Mesh_constant_PRIMITIVE_TRIANGLES>`, :ref:`PRIMITIVE_TRIANGLE_STRIP<class_Mesh_constant_PRIMITIVE_TRIANGLE_STRIP>`.
  479. .. rst-class:: classref-item-separator
  480. ----
  481. .. _class_Mesh_method_get_aabb:
  482. .. rst-class:: classref-method
  483. :ref:`AABB<class_AABB>` **get_aabb**\ (\ ) |const| :ref:`🔗<class_Mesh_method_get_aabb>`
  484. Returns the smallest :ref:`AABB<class_AABB>` enclosing this mesh in local space. Not affected by ``custom_aabb``.
  485. \ **Note:** This is only implemented for :ref:`ArrayMesh<class_ArrayMesh>` and :ref:`PrimitiveMesh<class_PrimitiveMesh>`.
  486. .. rst-class:: classref-item-separator
  487. ----
  488. .. _class_Mesh_method_get_faces:
  489. .. rst-class:: classref-method
  490. :ref:`PackedVector3Array<class_PackedVector3Array>` **get_faces**\ (\ ) |const| :ref:`🔗<class_Mesh_method_get_faces>`
  491. Returns all the vertices that make up the faces of the mesh. Each three vertices represent one triangle.
  492. .. rst-class:: classref-item-separator
  493. ----
  494. .. _class_Mesh_method_get_surface_count:
  495. .. rst-class:: classref-method
  496. :ref:`int<class_int>` **get_surface_count**\ (\ ) |const| :ref:`🔗<class_Mesh_method_get_surface_count>`
  497. Returns the number of surfaces that the **Mesh** holds. This is equivalent to :ref:`MeshInstance3D.get_surface_override_material_count<class_MeshInstance3D_method_get_surface_override_material_count>`.
  498. .. rst-class:: classref-item-separator
  499. ----
  500. .. _class_Mesh_method_surface_get_arrays:
  501. .. rst-class:: classref-method
  502. :ref:`Array<class_Array>` **surface_get_arrays**\ (\ surf_idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_Mesh_method_surface_get_arrays>`
  503. Returns the arrays for the vertices, normals, UVs, etc. that make up the requested surface (see :ref:`ArrayMesh.add_surface_from_arrays<class_ArrayMesh_method_add_surface_from_arrays>`).
  504. .. rst-class:: classref-item-separator
  505. ----
  506. .. _class_Mesh_method_surface_get_blend_shape_arrays:
  507. .. rst-class:: classref-method
  508. :ref:`Array<class_Array>`\[:ref:`Array<class_Array>`\] **surface_get_blend_shape_arrays**\ (\ surf_idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_Mesh_method_surface_get_blend_shape_arrays>`
  509. Returns the blend shape arrays for the requested surface.
  510. .. rst-class:: classref-item-separator
  511. ----
  512. .. _class_Mesh_method_surface_get_material:
  513. .. rst-class:: classref-method
  514. :ref:`Material<class_Material>` **surface_get_material**\ (\ surf_idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_Mesh_method_surface_get_material>`
  515. Returns a :ref:`Material<class_Material>` in a given surface. Surface is rendered using this material.
  516. \ **Note:** This returns the material within the **Mesh** resource, not the :ref:`Material<class_Material>` associated to the :ref:`MeshInstance3D<class_MeshInstance3D>`'s Surface Material Override properties. To get the :ref:`Material<class_Material>` associated to the :ref:`MeshInstance3D<class_MeshInstance3D>`'s Surface Material Override properties, use :ref:`MeshInstance3D.get_surface_override_material<class_MeshInstance3D_method_get_surface_override_material>` instead.
  517. .. rst-class:: classref-item-separator
  518. ----
  519. .. _class_Mesh_method_surface_set_material:
  520. .. rst-class:: classref-method
  521. |void| **surface_set_material**\ (\ surf_idx\: :ref:`int<class_int>`, material\: :ref:`Material<class_Material>`\ ) :ref:`🔗<class_Mesh_method_surface_set_material>`
  522. Sets a :ref:`Material<class_Material>` for a given surface. Surface will be rendered using this material.
  523. \ **Note:** This assigns the material within the **Mesh** resource, not the :ref:`Material<class_Material>` associated to the :ref:`MeshInstance3D<class_MeshInstance3D>`'s Surface Material Override properties. To set the :ref:`Material<class_Material>` associated to the :ref:`MeshInstance3D<class_MeshInstance3D>`'s Surface Material Override properties, use :ref:`MeshInstance3D.set_surface_override_material<class_MeshInstance3D_method_set_surface_override_material>` instead.
  524. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  525. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  526. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  527. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  528. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  529. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  530. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  531. .. |void| replace:: :abbr:`void (No return value.)`