class_mesh.rst 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984
  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.
  16. .. rst-class:: classref-introduction-group
  17. Tutorials
  18. ---------
  19. - `3D Material Testers Demo <https://godotengine.org/asset-library/asset/123>`__
  20. - `3D Kinematic Character Demo <https://godotengine.org/asset-library/asset/126>`__
  21. - `3D Platformer Demo <https://godotengine.org/asset-library/asset/125>`__
  22. - `Third Person Shooter Demo <https://godotengine.org/asset-library/asset/678>`__
  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>` **(** :ref:`int<class_int>` index **)** |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>` **(** :ref:`int<class_int>` index, :ref:`StringName<class_StringName>` name **)** |virtual| |
  46. +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`int<class_int>` | :ref:`_surface_get_array_index_len<class_Mesh_private_method__surface_get_array_index_len>` **(** :ref:`int<class_int>` index **)** |virtual| |const| |
  48. +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`int<class_int>` | :ref:`_surface_get_array_len<class_Mesh_private_method__surface_get_array_len>` **(** :ref:`int<class_int>` index **)** |virtual| |const| |
  50. +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`Array<class_Array>` | :ref:`_surface_get_arrays<class_Mesh_private_method__surface_get_arrays>` **(** :ref:`int<class_int>` index **)** |virtual| |const| |
  52. +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`Array[]<class_Array>` | :ref:`_surface_get_blend_shape_arrays<class_Mesh_private_method__surface_get_blend_shape_arrays>` **(** :ref:`int<class_int>` index **)** |virtual| |const| |
  54. +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | :ref:`int<class_int>` | :ref:`_surface_get_format<class_Mesh_private_method__surface_get_format>` **(** :ref:`int<class_int>` index **)** |virtual| |const| |
  56. +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | :ref:`Dictionary<class_Dictionary>` | :ref:`_surface_get_lods<class_Mesh_private_method__surface_get_lods>` **(** :ref:`int<class_int>` index **)** |virtual| |const| |
  58. +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | :ref:`Material<class_Material>` | :ref:`_surface_get_material<class_Mesh_private_method__surface_get_material>` **(** :ref:`int<class_int>` index **)** |virtual| |const| |
  60. +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | :ref:`int<class_int>` | :ref:`_surface_get_primitive_type<class_Mesh_private_method__surface_get_primitive_type>` **(** :ref:`int<class_int>` index **)** |virtual| |const| |
  62. +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | void | :ref:`_surface_set_material<class_Mesh_private_method__surface_set_material>` **(** :ref:`int<class_int>` index, :ref:`Material<class_Material>` material **)** |virtual| |
  64. +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | :ref:`ConvexPolygonShape3D<class_ConvexPolygonShape3D>` | :ref:`create_convex_shape<class_Mesh_method_create_convex_shape>` **(** :ref:`bool<class_bool>` clean=true, :ref:`bool<class_bool>` simplify=false **)** |const| |
  66. +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | :ref:`Mesh<class_Mesh>` | :ref:`create_outline<class_Mesh_method_create_outline>` **(** :ref:`float<class_float>` margin **)** |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>` **(** :ref:`int<class_int>` surf_idx **)** |const| |
  82. +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | :ref:`Array[]<class_Array>` | :ref:`surface_get_blend_shape_arrays<class_Mesh_method_surface_get_blend_shape_arrays>` **(** :ref:`int<class_int>` surf_idx **)** |const| |
  84. +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | :ref:`Material<class_Material>` | :ref:`surface_get_material<class_Mesh_method_surface_get_material>` **(** :ref:`int<class_int>` surf_idx **)** |const| |
  86. +-----------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  87. | void | :ref:`surface_set_material<class_Mesh_method_surface_set_material>` **(** :ref:`int<class_int>` surf_idx, :ref:`Material<class_Material>` 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**:
  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**:
  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. .. _class_Mesh_constant_ARRAY_TANGENT:
  131. .. rst-class:: classref-enumeration-constant
  132. :ref:`ArrayType<enum_Mesh_ArrayType>` **ARRAY_TANGENT** = ``2``
  133. :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.
  134. .. _class_Mesh_constant_ARRAY_COLOR:
  135. .. rst-class:: classref-enumeration-constant
  136. :ref:`ArrayType<enum_Mesh_ArrayType>` **ARRAY_COLOR** = ``3``
  137. :ref:`PackedColorArray<class_PackedColorArray>` of vertex colors.
  138. .. _class_Mesh_constant_ARRAY_TEX_UV:
  139. .. rst-class:: classref-enumeration-constant
  140. :ref:`ArrayType<enum_Mesh_ArrayType>` **ARRAY_TEX_UV** = ``4``
  141. :ref:`PackedVector2Array<class_PackedVector2Array>` for UV coordinates.
  142. .. _class_Mesh_constant_ARRAY_TEX_UV2:
  143. .. rst-class:: classref-enumeration-constant
  144. :ref:`ArrayType<enum_Mesh_ArrayType>` **ARRAY_TEX_UV2** = ``5``
  145. :ref:`PackedVector2Array<class_PackedVector2Array>` for second UV coordinates.
  146. .. _class_Mesh_constant_ARRAY_CUSTOM0:
  147. .. rst-class:: classref-enumeration-constant
  148. :ref:`ArrayType<enum_Mesh_ArrayType>` **ARRAY_CUSTOM0** = ``6``
  149. 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_UNORM<class_Mesh_constant_ARRAY_CUSTOM_RGBA8_UNORM>`, :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.
  150. .. _class_Mesh_constant_ARRAY_CUSTOM1:
  151. .. rst-class:: classref-enumeration-constant
  152. :ref:`ArrayType<enum_Mesh_ArrayType>` **ARRAY_CUSTOM1** = ``7``
  153. 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_UNORM<class_Mesh_constant_ARRAY_CUSTOM_RGBA8_UNORM>`, :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.
  154. .. _class_Mesh_constant_ARRAY_CUSTOM2:
  155. .. rst-class:: classref-enumeration-constant
  156. :ref:`ArrayType<enum_Mesh_ArrayType>` **ARRAY_CUSTOM2** = ``8``
  157. 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_UNORM<class_Mesh_constant_ARRAY_CUSTOM_RGBA8_UNORM>`, :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.
  158. .. _class_Mesh_constant_ARRAY_CUSTOM3:
  159. .. rst-class:: classref-enumeration-constant
  160. :ref:`ArrayType<enum_Mesh_ArrayType>` **ARRAY_CUSTOM3** = ``9``
  161. 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_UNORM<class_Mesh_constant_ARRAY_CUSTOM_RGBA8_UNORM>`, :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.
  162. .. _class_Mesh_constant_ARRAY_BONES:
  163. .. rst-class:: classref-enumeration-constant
  164. :ref:`ArrayType<enum_Mesh_ArrayType>` **ARRAY_BONES** = ``10``
  165. :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.
  166. .. _class_Mesh_constant_ARRAY_WEIGHTS:
  167. .. rst-class:: classref-enumeration-constant
  168. :ref:`ArrayType<enum_Mesh_ArrayType>` **ARRAY_WEIGHTS** = ``11``
  169. :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.
  170. .. _class_Mesh_constant_ARRAY_INDEX:
  171. .. rst-class:: classref-enumeration-constant
  172. :ref:`ArrayType<enum_Mesh_ArrayType>` **ARRAY_INDEX** = ``12``
  173. :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.
  174. 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.
  175. .. _class_Mesh_constant_ARRAY_MAX:
  176. .. rst-class:: classref-enumeration-constant
  177. :ref:`ArrayType<enum_Mesh_ArrayType>` **ARRAY_MAX** = ``13``
  178. Represents the size of the :ref:`ArrayType<enum_Mesh_ArrayType>` enum.
  179. .. rst-class:: classref-item-separator
  180. ----
  181. .. _enum_Mesh_ArrayCustomFormat:
  182. .. rst-class:: classref-enumeration
  183. enum **ArrayCustomFormat**:
  184. .. _class_Mesh_constant_ARRAY_CUSTOM_RGBA8_UNORM:
  185. .. rst-class:: classref-enumeration-constant
  186. :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>` **ARRAY_CUSTOM_RGBA8_UNORM** = ``0``
  187. Indicates this custom channel contains unsigned normalized byte colors from 0 to 1, encoded as :ref:`PackedByteArray<class_PackedByteArray>`.
  188. .. _class_Mesh_constant_ARRAY_CUSTOM_RGBA8_SNORM:
  189. .. rst-class:: classref-enumeration-constant
  190. :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>` **ARRAY_CUSTOM_RGBA8_SNORM** = ``1``
  191. Indicates this custom channel contains signed normalized byte colors from -1 to 1, encoded as :ref:`PackedByteArray<class_PackedByteArray>`.
  192. .. _class_Mesh_constant_ARRAY_CUSTOM_RG_HALF:
  193. .. rst-class:: classref-enumeration-constant
  194. :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>` **ARRAY_CUSTOM_RG_HALF** = ``2``
  195. Indicates this custom channel contains half precision float colors, encoded as :ref:`PackedByteArray<class_PackedByteArray>`. Only red and green channels are used.
  196. .. _class_Mesh_constant_ARRAY_CUSTOM_RGBA_HALF:
  197. .. rst-class:: classref-enumeration-constant
  198. :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>` **ARRAY_CUSTOM_RGBA_HALF** = ``3``
  199. Indicates this custom channel contains half precision float colors, encoded as :ref:`PackedByteArray<class_PackedByteArray>`.
  200. .. _class_Mesh_constant_ARRAY_CUSTOM_R_FLOAT:
  201. .. rst-class:: classref-enumeration-constant
  202. :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>` **ARRAY_CUSTOM_R_FLOAT** = ``4``
  203. Indicates this custom channel contains full float colors, in a :ref:`PackedFloat32Array<class_PackedFloat32Array>`. Only the red channel is used.
  204. .. _class_Mesh_constant_ARRAY_CUSTOM_RG_FLOAT:
  205. .. rst-class:: classref-enumeration-constant
  206. :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>` **ARRAY_CUSTOM_RG_FLOAT** = ``5``
  207. Indicates this custom channel contains full float colors, in a :ref:`PackedFloat32Array<class_PackedFloat32Array>`. Only red and green channels are used.
  208. .. _class_Mesh_constant_ARRAY_CUSTOM_RGB_FLOAT:
  209. .. rst-class:: classref-enumeration-constant
  210. :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>` **ARRAY_CUSTOM_RGB_FLOAT** = ``6``
  211. Indicates this custom channel contains full float colors, in a :ref:`PackedFloat32Array<class_PackedFloat32Array>`. Only red, green and blue channels are used.
  212. .. _class_Mesh_constant_ARRAY_CUSTOM_RGBA_FLOAT:
  213. .. rst-class:: classref-enumeration-constant
  214. :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>` **ARRAY_CUSTOM_RGBA_FLOAT** = ``7``
  215. Indicates this custom channel contains full float colors, in a :ref:`PackedFloat32Array<class_PackedFloat32Array>`.
  216. .. _class_Mesh_constant_ARRAY_CUSTOM_MAX:
  217. .. rst-class:: classref-enumeration-constant
  218. :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>` **ARRAY_CUSTOM_MAX** = ``8``
  219. Represents the size of the :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>` enum.
  220. .. rst-class:: classref-item-separator
  221. ----
  222. .. _enum_Mesh_ArrayFormat:
  223. .. rst-class:: classref-enumeration
  224. flags **ArrayFormat**:
  225. .. _class_Mesh_constant_ARRAY_FORMAT_VERTEX:
  226. .. rst-class:: classref-enumeration-constant
  227. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_VERTEX** = ``1``
  228. Mesh array contains vertices. All meshes require a vertex array so this should always be present.
  229. .. _class_Mesh_constant_ARRAY_FORMAT_NORMAL:
  230. .. rst-class:: classref-enumeration-constant
  231. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_NORMAL** = ``2``
  232. Mesh array contains normals.
  233. .. _class_Mesh_constant_ARRAY_FORMAT_TANGENT:
  234. .. rst-class:: classref-enumeration-constant
  235. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_TANGENT** = ``4``
  236. Mesh array contains tangents.
  237. .. _class_Mesh_constant_ARRAY_FORMAT_COLOR:
  238. .. rst-class:: classref-enumeration-constant
  239. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_COLOR** = ``8``
  240. Mesh array contains colors.
  241. .. _class_Mesh_constant_ARRAY_FORMAT_TEX_UV:
  242. .. rst-class:: classref-enumeration-constant
  243. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_TEX_UV** = ``16``
  244. Mesh array contains UVs.
  245. .. _class_Mesh_constant_ARRAY_FORMAT_TEX_UV2:
  246. .. rst-class:: classref-enumeration-constant
  247. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_TEX_UV2** = ``32``
  248. Mesh array contains second UV.
  249. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM0:
  250. .. rst-class:: classref-enumeration-constant
  251. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_CUSTOM0** = ``64``
  252. Mesh array contains custom channel index 0.
  253. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM1:
  254. .. rst-class:: classref-enumeration-constant
  255. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_CUSTOM1** = ``128``
  256. Mesh array contains custom channel index 1.
  257. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM2:
  258. .. rst-class:: classref-enumeration-constant
  259. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_CUSTOM2** = ``256``
  260. Mesh array contains custom channel index 2.
  261. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM3:
  262. .. rst-class:: classref-enumeration-constant
  263. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_CUSTOM3** = ``512``
  264. Mesh array contains custom channel index 3.
  265. .. _class_Mesh_constant_ARRAY_FORMAT_BONES:
  266. .. rst-class:: classref-enumeration-constant
  267. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_BONES** = ``1024``
  268. Mesh array contains bones.
  269. .. _class_Mesh_constant_ARRAY_FORMAT_WEIGHTS:
  270. .. rst-class:: classref-enumeration-constant
  271. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_WEIGHTS** = ``2048``
  272. Mesh array contains bone weights.
  273. .. _class_Mesh_constant_ARRAY_FORMAT_INDEX:
  274. .. rst-class:: classref-enumeration-constant
  275. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_INDEX** = ``4096``
  276. Mesh array uses indices.
  277. .. _class_Mesh_constant_ARRAY_FORMAT_BLEND_SHAPE_MASK:
  278. .. rst-class:: classref-enumeration-constant
  279. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_BLEND_SHAPE_MASK** = ``7``
  280. Mask of mesh channels permitted in blend shapes.
  281. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM_BASE:
  282. .. rst-class:: classref-enumeration-constant
  283. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_CUSTOM_BASE** = ``13``
  284. Shift of first custom channel.
  285. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM_BITS:
  286. .. rst-class:: classref-enumeration-constant
  287. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_CUSTOM_BITS** = ``3``
  288. Number of format bits per custom channel. See :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>`.
  289. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM0_SHIFT:
  290. .. rst-class:: classref-enumeration-constant
  291. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_CUSTOM0_SHIFT** = ``13``
  292. Amount to shift :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>` for custom channel index 0.
  293. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM1_SHIFT:
  294. .. rst-class:: classref-enumeration-constant
  295. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_CUSTOM1_SHIFT** = ``16``
  296. Amount to shift :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>` for custom channel index 1.
  297. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM2_SHIFT:
  298. .. rst-class:: classref-enumeration-constant
  299. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_CUSTOM2_SHIFT** = ``19``
  300. Amount to shift :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>` for custom channel index 2.
  301. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM3_SHIFT:
  302. .. rst-class:: classref-enumeration-constant
  303. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_CUSTOM3_SHIFT** = ``22``
  304. Amount to shift :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>` for custom channel index 3.
  305. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM_MASK:
  306. .. rst-class:: classref-enumeration-constant
  307. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FORMAT_CUSTOM_MASK** = ``7``
  308. Mask of custom format bits per custom channel. Must be shifted by one of the SHIFT constants. See :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>`.
  309. .. _class_Mesh_constant_ARRAY_COMPRESS_FLAGS_BASE:
  310. .. rst-class:: classref-enumeration-constant
  311. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_COMPRESS_FLAGS_BASE** = ``25``
  312. 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>`.
  313. .. _class_Mesh_constant_ARRAY_FLAG_USE_2D_VERTICES:
  314. .. rst-class:: classref-enumeration-constant
  315. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FLAG_USE_2D_VERTICES** = ``33554432``
  316. Flag used to mark that the array contains 2D vertices.
  317. .. _class_Mesh_constant_ARRAY_FLAG_USE_DYNAMIC_UPDATE:
  318. .. rst-class:: classref-enumeration-constant
  319. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FLAG_USE_DYNAMIC_UPDATE** = ``67108864``
  320. Flag indices that the mesh data will use ``GL_DYNAMIC_DRAW`` on GLES. Unused on Vulkan.
  321. .. _class_Mesh_constant_ARRAY_FLAG_USE_8_BONE_WEIGHTS:
  322. .. rst-class:: classref-enumeration-constant
  323. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FLAG_USE_8_BONE_WEIGHTS** = ``134217728``
  324. 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.
  325. .. _class_Mesh_constant_ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY:
  326. .. rst-class:: classref-enumeration-constant
  327. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FLAG_USES_EMPTY_VERTEX_ARRAY** = ``268435456``
  328. Flag used to mark that the mesh intentionally contains no vertex array.
  329. .. _class_Mesh_constant_ARRAY_FLAG_COMPRESS_ATTRIBUTES:
  330. .. rst-class:: classref-enumeration-constant
  331. :ref:`ArrayFormat<enum_Mesh_ArrayFormat>` **ARRAY_FLAG_COMPRESS_ATTRIBUTES** = ``536870912``
  332. 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.
  333. .. rst-class:: classref-item-separator
  334. ----
  335. .. _enum_Mesh_BlendShapeMode:
  336. .. rst-class:: classref-enumeration
  337. enum **BlendShapeMode**:
  338. .. _class_Mesh_constant_BLEND_SHAPE_MODE_NORMALIZED:
  339. .. rst-class:: classref-enumeration-constant
  340. :ref:`BlendShapeMode<enum_Mesh_BlendShapeMode>` **BLEND_SHAPE_MODE_NORMALIZED** = ``0``
  341. Blend shapes are normalized.
  342. .. _class_Mesh_constant_BLEND_SHAPE_MODE_RELATIVE:
  343. .. rst-class:: classref-enumeration-constant
  344. :ref:`BlendShapeMode<enum_Mesh_BlendShapeMode>` **BLEND_SHAPE_MODE_RELATIVE** = ``1``
  345. Blend shapes are relative to base weight.
  346. .. rst-class:: classref-section-separator
  347. ----
  348. .. rst-class:: classref-descriptions-group
  349. Property Descriptions
  350. ---------------------
  351. .. _class_Mesh_property_lightmap_size_hint:
  352. .. rst-class:: classref-property
  353. :ref:`Vector2i<class_Vector2i>` **lightmap_size_hint** = ``Vector2i(0, 0)``
  354. .. rst-class:: classref-property-setget
  355. - void **set_lightmap_size_hint** **(** :ref:`Vector2i<class_Vector2i>` value **)**
  356. - :ref:`Vector2i<class_Vector2i>` **get_lightmap_size_hint** **(** **)**
  357. Sets a hint to be used for lightmap resolution.
  358. .. rst-class:: classref-section-separator
  359. ----
  360. .. rst-class:: classref-descriptions-group
  361. Method Descriptions
  362. -------------------
  363. .. _class_Mesh_private_method__get_aabb:
  364. .. rst-class:: classref-method
  365. :ref:`AABB<class_AABB>` **_get_aabb** **(** **)** |virtual| |const|
  366. Virtual method to override the :ref:`AABB<class_AABB>` for a custom class extending **Mesh**.
  367. .. rst-class:: classref-item-separator
  368. ----
  369. .. _class_Mesh_private_method__get_blend_shape_count:
  370. .. rst-class:: classref-method
  371. :ref:`int<class_int>` **_get_blend_shape_count** **(** **)** |virtual| |const|
  372. Virtual method to override the number of blend shapes for a custom class extending **Mesh**.
  373. .. rst-class:: classref-item-separator
  374. ----
  375. .. _class_Mesh_private_method__get_blend_shape_name:
  376. .. rst-class:: classref-method
  377. :ref:`StringName<class_StringName>` **_get_blend_shape_name** **(** :ref:`int<class_int>` index **)** |virtual| |const|
  378. Virtual method to override the retrieval of blend shape names for a custom class extending **Mesh**.
  379. .. rst-class:: classref-item-separator
  380. ----
  381. .. _class_Mesh_private_method__get_surface_count:
  382. .. rst-class:: classref-method
  383. :ref:`int<class_int>` **_get_surface_count** **(** **)** |virtual| |const|
  384. Virtual method to override the surface count for a custom class extending **Mesh**.
  385. .. rst-class:: classref-item-separator
  386. ----
  387. .. _class_Mesh_private_method__set_blend_shape_name:
  388. .. rst-class:: classref-method
  389. void **_set_blend_shape_name** **(** :ref:`int<class_int>` index, :ref:`StringName<class_StringName>` name **)** |virtual|
  390. Virtual method to override the names of blend shapes for a custom class extending **Mesh**.
  391. .. rst-class:: classref-item-separator
  392. ----
  393. .. _class_Mesh_private_method__surface_get_array_index_len:
  394. .. rst-class:: classref-method
  395. :ref:`int<class_int>` **_surface_get_array_index_len** **(** :ref:`int<class_int>` index **)** |virtual| |const|
  396. Virtual method to override the surface array index length for a custom class extending **Mesh**.
  397. .. rst-class:: classref-item-separator
  398. ----
  399. .. _class_Mesh_private_method__surface_get_array_len:
  400. .. rst-class:: classref-method
  401. :ref:`int<class_int>` **_surface_get_array_len** **(** :ref:`int<class_int>` index **)** |virtual| |const|
  402. Virtual method to override the surface array length for a custom class extending **Mesh**.
  403. .. rst-class:: classref-item-separator
  404. ----
  405. .. _class_Mesh_private_method__surface_get_arrays:
  406. .. rst-class:: classref-method
  407. :ref:`Array<class_Array>` **_surface_get_arrays** **(** :ref:`int<class_int>` index **)** |virtual| |const|
  408. Virtual method to override the surface arrays for a custom class extending **Mesh**.
  409. .. rst-class:: classref-item-separator
  410. ----
  411. .. _class_Mesh_private_method__surface_get_blend_shape_arrays:
  412. .. rst-class:: classref-method
  413. :ref:`Array[]<class_Array>` **_surface_get_blend_shape_arrays** **(** :ref:`int<class_int>` index **)** |virtual| |const|
  414. Virtual method to override the blend shape arrays for a custom class extending **Mesh**.
  415. .. rst-class:: classref-item-separator
  416. ----
  417. .. _class_Mesh_private_method__surface_get_format:
  418. .. rst-class:: classref-method
  419. :ref:`int<class_int>` **_surface_get_format** **(** :ref:`int<class_int>` index **)** |virtual| |const|
  420. Virtual method to override the surface format for a custom class extending **Mesh**.
  421. .. rst-class:: classref-item-separator
  422. ----
  423. .. _class_Mesh_private_method__surface_get_lods:
  424. .. rst-class:: classref-method
  425. :ref:`Dictionary<class_Dictionary>` **_surface_get_lods** **(** :ref:`int<class_int>` index **)** |virtual| |const|
  426. Virtual method to override the surface LODs for a custom class extending **Mesh**.
  427. .. rst-class:: classref-item-separator
  428. ----
  429. .. _class_Mesh_private_method__surface_get_material:
  430. .. rst-class:: classref-method
  431. :ref:`Material<class_Material>` **_surface_get_material** **(** :ref:`int<class_int>` index **)** |virtual| |const|
  432. Virtual method to override the surface material for a custom class extending **Mesh**.
  433. .. rst-class:: classref-item-separator
  434. ----
  435. .. _class_Mesh_private_method__surface_get_primitive_type:
  436. .. rst-class:: classref-method
  437. :ref:`int<class_int>` **_surface_get_primitive_type** **(** :ref:`int<class_int>` index **)** |virtual| |const|
  438. Virtual method to override the surface primitive type for a custom class extending **Mesh**.
  439. .. rst-class:: classref-item-separator
  440. ----
  441. .. _class_Mesh_private_method__surface_set_material:
  442. .. rst-class:: classref-method
  443. void **_surface_set_material** **(** :ref:`int<class_int>` index, :ref:`Material<class_Material>` material **)** |virtual|
  444. Virtual method to override the setting of a ``material`` at the given ``index`` for a custom class extending **Mesh**.
  445. .. rst-class:: classref-item-separator
  446. ----
  447. .. _class_Mesh_method_create_convex_shape:
  448. .. rst-class:: classref-method
  449. :ref:`ConvexPolygonShape3D<class_ConvexPolygonShape3D>` **create_convex_shape** **(** :ref:`bool<class_bool>` clean=true, :ref:`bool<class_bool>` simplify=false **)** |const|
  450. Calculate a :ref:`ConvexPolygonShape3D<class_ConvexPolygonShape3D>` from the mesh.
  451. 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.
  452. If ``simplify`` is ``true``, the geometry can be further simplified to reduce the number of vertices. Disabled by default.
  453. .. rst-class:: classref-item-separator
  454. ----
  455. .. _class_Mesh_method_create_outline:
  456. .. rst-class:: classref-method
  457. :ref:`Mesh<class_Mesh>` **create_outline** **(** :ref:`float<class_float>` margin **)** |const|
  458. Calculate an outline mesh at a defined offset (margin) from the original mesh.
  459. \ **Note:** This method typically returns the vertices in reverse order (e.g. clockwise to counterclockwise).
  460. .. rst-class:: classref-item-separator
  461. ----
  462. .. _class_Mesh_method_create_placeholder:
  463. .. rst-class:: classref-method
  464. :ref:`Resource<class_Resource>` **create_placeholder** **(** **)** |const|
  465. Creates a placeholder version of this resource (:ref:`PlaceholderMesh<class_PlaceholderMesh>`).
  466. .. rst-class:: classref-item-separator
  467. ----
  468. .. _class_Mesh_method_create_trimesh_shape:
  469. .. rst-class:: classref-method
  470. :ref:`ConcavePolygonShape3D<class_ConcavePolygonShape3D>` **create_trimesh_shape** **(** **)** |const|
  471. Calculate a :ref:`ConcavePolygonShape3D<class_ConcavePolygonShape3D>` from the mesh.
  472. .. rst-class:: classref-item-separator
  473. ----
  474. .. _class_Mesh_method_generate_triangle_mesh:
  475. .. rst-class:: classref-method
  476. :ref:`TriangleMesh<class_TriangleMesh>` **generate_triangle_mesh** **(** **)** |const|
  477. 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>`.
  478. .. rst-class:: classref-item-separator
  479. ----
  480. .. _class_Mesh_method_get_aabb:
  481. .. rst-class:: classref-method
  482. :ref:`AABB<class_AABB>` **get_aabb** **(** **)** |const|
  483. Returns the smallest :ref:`AABB<class_AABB>` enclosing this mesh in local space. Not affected by ``custom_aabb``.
  484. \ **Note:** This is only implemented for :ref:`ArrayMesh<class_ArrayMesh>` and :ref:`PrimitiveMesh<class_PrimitiveMesh>`.
  485. .. rst-class:: classref-item-separator
  486. ----
  487. .. _class_Mesh_method_get_faces:
  488. .. rst-class:: classref-method
  489. :ref:`PackedVector3Array<class_PackedVector3Array>` **get_faces** **(** **)** |const|
  490. Returns all the vertices that make up the faces of the mesh. Each three vertices represent one triangle.
  491. .. rst-class:: classref-item-separator
  492. ----
  493. .. _class_Mesh_method_get_surface_count:
  494. .. rst-class:: classref-method
  495. :ref:`int<class_int>` **get_surface_count** **(** **)** |const|
  496. 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>`.
  497. .. rst-class:: classref-item-separator
  498. ----
  499. .. _class_Mesh_method_surface_get_arrays:
  500. .. rst-class:: classref-method
  501. :ref:`Array<class_Array>` **surface_get_arrays** **(** :ref:`int<class_int>` surf_idx **)** |const|
  502. 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>`).
  503. .. rst-class:: classref-item-separator
  504. ----
  505. .. _class_Mesh_method_surface_get_blend_shape_arrays:
  506. .. rst-class:: classref-method
  507. :ref:`Array[]<class_Array>` **surface_get_blend_shape_arrays** **(** :ref:`int<class_int>` surf_idx **)** |const|
  508. Returns the blend shape arrays for the requested surface.
  509. .. rst-class:: classref-item-separator
  510. ----
  511. .. _class_Mesh_method_surface_get_material:
  512. .. rst-class:: classref-method
  513. :ref:`Material<class_Material>` **surface_get_material** **(** :ref:`int<class_int>` surf_idx **)** |const|
  514. Returns a :ref:`Material<class_Material>` in a given surface. Surface is rendered using this material.
  515. \ **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.
  516. .. rst-class:: classref-item-separator
  517. ----
  518. .. _class_Mesh_method_surface_set_material:
  519. .. rst-class:: classref-method
  520. void **surface_set_material** **(** :ref:`int<class_int>` surf_idx, :ref:`Material<class_Material>` material **)**
  521. Sets a :ref:`Material<class_Material>` for a given surface. Surface will be rendered using this material.
  522. \ **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.
  523. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  524. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  525. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  526. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  527. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  528. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  529. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`