class_mesh.rst 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the Mesh.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_Mesh:
  6. Mesh
  7. ====
  8. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  9. **Inherited By:** :ref:`ArrayMesh<class_ArrayMesh>`, :ref:`ImmediateMesh<class_ImmediateMesh>`, :ref:`PrimitiveMesh<class_PrimitiveMesh>`
  10. A :ref:`Resource<class_Resource>` that contains vertex array-based geometry.
  11. Description
  12. -----------
  13. 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.
  14. Tutorials
  15. ---------
  16. - `3D Material Testers Demo <https://godotengine.org/asset-library/asset/123>`__
  17. - `3D Kinematic Character Demo <https://godotengine.org/asset-library/asset/126>`__
  18. - `3D Platformer Demo <https://godotengine.org/asset-library/asset/125>`__
  19. - `Third Person Shooter Demo <https://godotengine.org/asset-library/asset/678>`__
  20. Properties
  21. ----------
  22. +---------------------------------+-------------------------------------------------------------------+--------------------+
  23. | :ref:`Vector2i<class_Vector2i>` | :ref:`lightmap_size_hint<class_Mesh_property_lightmap_size_hint>` | ``Vector2i(0, 0)`` |
  24. +---------------------------------+-------------------------------------------------------------------+--------------------+
  25. Methods
  26. -------
  27. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`AABB<class_AABB>` | :ref:`_get_aabb<class_Mesh_method__get_aabb>` **(** **)** |virtual| |const| |
  29. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`int<class_int>` | :ref:`_get_blend_shape_count<class_Mesh_method__get_blend_shape_count>` **(** **)** |virtual| |const| |
  31. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`StringName<class_StringName>` | :ref:`_get_blend_shape_name<class_Mesh_method__get_blend_shape_name>` **(** :ref:`int<class_int>` index **)** |virtual| |const| |
  33. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`int<class_int>` | :ref:`_get_surface_count<class_Mesh_method__get_surface_count>` **(** **)** |virtual| |const| |
  35. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | void | :ref:`_set_blend_shape_name<class_Mesh_method__set_blend_shape_name>` **(** :ref:`int<class_int>` index, :ref:`StringName<class_StringName>` name **)** |virtual| |
  37. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`int<class_int>` | :ref:`_surface_get_array_index_len<class_Mesh_method__surface_get_array_index_len>` **(** :ref:`int<class_int>` index **)** |virtual| |const| |
  39. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`int<class_int>` | :ref:`_surface_get_array_len<class_Mesh_method__surface_get_array_len>` **(** :ref:`int<class_int>` index **)** |virtual| |const| |
  41. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`Array<class_Array>` | :ref:`_surface_get_arrays<class_Mesh_method__surface_get_arrays>` **(** :ref:`int<class_int>` index **)** |virtual| |const| |
  43. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`Array<class_Array>` | :ref:`_surface_get_blend_shape_arrays<class_Mesh_method__surface_get_blend_shape_arrays>` **(** :ref:`int<class_int>` index **)** |virtual| |const| |
  45. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`int<class_int>` | :ref:`_surface_get_format<class_Mesh_method__surface_get_format>` **(** :ref:`int<class_int>` index **)** |virtual| |const| |
  47. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`Dictionary<class_Dictionary>` | :ref:`_surface_get_lods<class_Mesh_method__surface_get_lods>` **(** :ref:`int<class_int>` index **)** |virtual| |const| |
  49. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`Material<class_Material>` | :ref:`_surface_get_material<class_Mesh_method__surface_get_material>` **(** :ref:`int<class_int>` index **)** |virtual| |const| |
  51. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`int<class_int>` | :ref:`_surface_get_primitive_type<class_Mesh_method__surface_get_primitive_type>` **(** :ref:`int<class_int>` index **)** |virtual| |const| |
  53. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | void | :ref:`_surface_set_material<class_Mesh_method__surface_set_material>` **(** :ref:`int<class_int>` index, :ref:`Material<class_Material>` material **)** |virtual| |
  55. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | :ref:`Shape3D<class_Shape3D>` | :ref:`create_convex_shape<class_Mesh_method_create_convex_shape>` **(** :ref:`bool<class_bool>` clean=true, :ref:`bool<class_bool>` simplify=false **)** |const| |
  57. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | :ref:`Mesh<class_Mesh>` | :ref:`create_outline<class_Mesh_method_create_outline>` **(** :ref:`float<class_float>` margin **)** |const| |
  59. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | :ref:`Shape3D<class_Shape3D>` | :ref:`create_trimesh_shape<class_Mesh_method_create_trimesh_shape>` **(** **)** |const| |
  61. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | :ref:`TriangleMesh<class_TriangleMesh>` | :ref:`generate_triangle_mesh<class_Mesh_method_generate_triangle_mesh>` **(** **)** |const| |
  63. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | :ref:`AABB<class_AABB>` | :ref:`get_aabb<class_Mesh_method_get_aabb>` **(** **)** |const| |
  65. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | :ref:`PackedVector3Array<class_PackedVector3Array>` | :ref:`get_faces<class_Mesh_method_get_faces>` **(** **)** |const| |
  67. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | :ref:`int<class_int>` | :ref:`get_surface_count<class_Mesh_method_get_surface_count>` **(** **)** |const| |
  69. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | :ref:`Array<class_Array>` | :ref:`surface_get_arrays<class_Mesh_method_surface_get_arrays>` **(** :ref:`int<class_int>` surf_idx **)** |const| |
  71. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | :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| |
  73. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | :ref:`Material<class_Material>` | :ref:`surface_get_material<class_Mesh_method_surface_get_material>` **(** :ref:`int<class_int>` surf_idx **)** |const| |
  75. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | void | :ref:`surface_set_material<class_Mesh_method_surface_set_material>` **(** :ref:`int<class_int>` surf_idx, :ref:`Material<class_Material>` material **)** |
  77. +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. Enumerations
  79. ------------
  80. .. _enum_Mesh_PrimitiveType:
  81. .. _class_Mesh_constant_PRIMITIVE_POINTS:
  82. .. _class_Mesh_constant_PRIMITIVE_LINES:
  83. .. _class_Mesh_constant_PRIMITIVE_LINE_STRIP:
  84. .. _class_Mesh_constant_PRIMITIVE_TRIANGLES:
  85. .. _class_Mesh_constant_PRIMITIVE_TRIANGLE_STRIP:
  86. enum **PrimitiveType**:
  87. - **PRIMITIVE_POINTS** = **0** --- Render array as points (one vertex equals one point).
  88. - **PRIMITIVE_LINES** = **1** --- Render array as lines (every two vertices a line is created).
  89. - **PRIMITIVE_LINE_STRIP** = **2** --- Render array as line strip.
  90. - **PRIMITIVE_TRIANGLES** = **3** --- Render array as triangles (every three vertices a triangle is created).
  91. - **PRIMITIVE_TRIANGLE_STRIP** = **4** --- Render array as triangle strips.
  92. ----
  93. .. _enum_Mesh_ArrayType:
  94. .. _class_Mesh_constant_ARRAY_VERTEX:
  95. .. _class_Mesh_constant_ARRAY_NORMAL:
  96. .. _class_Mesh_constant_ARRAY_TANGENT:
  97. .. _class_Mesh_constant_ARRAY_COLOR:
  98. .. _class_Mesh_constant_ARRAY_TEX_UV:
  99. .. _class_Mesh_constant_ARRAY_TEX_UV2:
  100. .. _class_Mesh_constant_ARRAY_CUSTOM0:
  101. .. _class_Mesh_constant_ARRAY_CUSTOM1:
  102. .. _class_Mesh_constant_ARRAY_CUSTOM2:
  103. .. _class_Mesh_constant_ARRAY_CUSTOM3:
  104. .. _class_Mesh_constant_ARRAY_BONES:
  105. .. _class_Mesh_constant_ARRAY_WEIGHTS:
  106. .. _class_Mesh_constant_ARRAY_INDEX:
  107. .. _class_Mesh_constant_ARRAY_MAX:
  108. enum **ArrayType**:
  109. - **ARRAY_VERTEX** = **0** --- :ref:`PackedVector3Array<class_PackedVector3Array>`, :ref:`PackedVector2Array<class_PackedVector2Array>`, or :ref:`Array<class_Array>` of vertex positions.
  110. - **ARRAY_NORMAL** = **1** --- :ref:`PackedVector3Array<class_PackedVector3Array>` of vertex normals.
  111. - **ARRAY_TANGENT** = **2** --- :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.
  112. - **ARRAY_COLOR** = **3** --- :ref:`PackedColorArray<class_PackedColorArray>` of vertex colors.
  113. - **ARRAY_TEX_UV** = **4** --- :ref:`PackedVector2Array<class_PackedVector2Array>` for UV coordinates.
  114. - **ARRAY_TEX_UV2** = **5** --- :ref:`PackedVector2Array<class_PackedVector2Array>` for second UV coordinates.
  115. - **ARRAY_CUSTOM0** = **6**
  116. - **ARRAY_CUSTOM1** = **7**
  117. - **ARRAY_CUSTOM2** = **8**
  118. - **ARRAY_CUSTOM3** = **9**
  119. - **ARRAY_BONES** = **10** --- :ref:`PackedFloat32Array<class_PackedFloat32Array>` or :ref:`PackedInt32Array<class_PackedInt32Array>` of bone indices. Each element is a group of 4 numbers.
  120. - **ARRAY_WEIGHTS** = **11** --- :ref:`PackedFloat32Array<class_PackedFloat32Array>` of bone weights. Each element in groups of 4 floats.
  121. - **ARRAY_INDEX** = **12** --- :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.
  122. 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.
  123. - **ARRAY_MAX** = **13** --- Represents the size of the :ref:`ArrayType<enum_Mesh_ArrayType>` enum.
  124. ----
  125. .. _enum_Mesh_ArrayCustomFormat:
  126. .. _class_Mesh_constant_ARRAY_CUSTOM_RGBA8_UNORM:
  127. .. _class_Mesh_constant_ARRAY_CUSTOM_RGBA8_SNORM:
  128. .. _class_Mesh_constant_ARRAY_CUSTOM_RG_HALF:
  129. .. _class_Mesh_constant_ARRAY_CUSTOM_RGBA_HALF:
  130. .. _class_Mesh_constant_ARRAY_CUSTOM_R_FLOAT:
  131. .. _class_Mesh_constant_ARRAY_CUSTOM_RG_FLOAT:
  132. .. _class_Mesh_constant_ARRAY_CUSTOM_RGB_FLOAT:
  133. .. _class_Mesh_constant_ARRAY_CUSTOM_RGBA_FLOAT:
  134. .. _class_Mesh_constant_ARRAY_CUSTOM_MAX:
  135. enum **ArrayCustomFormat**:
  136. - **ARRAY_CUSTOM_RGBA8_UNORM** = **0**
  137. - **ARRAY_CUSTOM_RGBA8_SNORM** = **1**
  138. - **ARRAY_CUSTOM_RG_HALF** = **2**
  139. - **ARRAY_CUSTOM_RGBA_HALF** = **3**
  140. - **ARRAY_CUSTOM_R_FLOAT** = **4**
  141. - **ARRAY_CUSTOM_RG_FLOAT** = **5**
  142. - **ARRAY_CUSTOM_RGB_FLOAT** = **6**
  143. - **ARRAY_CUSTOM_RGBA_FLOAT** = **7**
  144. - **ARRAY_CUSTOM_MAX** = **8** --- Represents the size of the :ref:`ArrayCustomFormat<enum_Mesh_ArrayCustomFormat>` enum.
  145. ----
  146. .. _enum_Mesh_ArrayFormat:
  147. .. _class_Mesh_constant_ARRAY_FORMAT_VERTEX:
  148. .. _class_Mesh_constant_ARRAY_FORMAT_NORMAL:
  149. .. _class_Mesh_constant_ARRAY_FORMAT_TANGENT:
  150. .. _class_Mesh_constant_ARRAY_FORMAT_COLOR:
  151. .. _class_Mesh_constant_ARRAY_FORMAT_TEX_UV:
  152. .. _class_Mesh_constant_ARRAY_FORMAT_TEX_UV2:
  153. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM0:
  154. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM1:
  155. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM2:
  156. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM3:
  157. .. _class_Mesh_constant_ARRAY_FORMAT_BONES:
  158. .. _class_Mesh_constant_ARRAY_FORMAT_WEIGHTS:
  159. .. _class_Mesh_constant_ARRAY_FORMAT_INDEX:
  160. .. _class_Mesh_constant_ARRAY_FORMAT_BLEND_SHAPE_MASK:
  161. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM_BASE:
  162. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM_BITS:
  163. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM0_SHIFT:
  164. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM1_SHIFT:
  165. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM2_SHIFT:
  166. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM3_SHIFT:
  167. .. _class_Mesh_constant_ARRAY_FORMAT_CUSTOM_MASK:
  168. .. _class_Mesh_constant_ARRAY_COMPRESS_FLAGS_BASE:
  169. .. _class_Mesh_constant_ARRAY_FLAG_USE_2D_VERTICES:
  170. .. _class_Mesh_constant_ARRAY_FLAG_USE_DYNAMIC_UPDATE:
  171. .. _class_Mesh_constant_ARRAY_FLAG_USE_8_BONE_WEIGHTS:
  172. enum **ArrayFormat**:
  173. - **ARRAY_FORMAT_VERTEX** = **1** --- Mesh array contains vertices. All meshes require a vertex array so this should always be present.
  174. - **ARRAY_FORMAT_NORMAL** = **2** --- Mesh array contains normals.
  175. - **ARRAY_FORMAT_TANGENT** = **4** --- Mesh array contains tangents.
  176. - **ARRAY_FORMAT_COLOR** = **8** --- Mesh array contains colors.
  177. - **ARRAY_FORMAT_TEX_UV** = **16** --- Mesh array contains UVs.
  178. - **ARRAY_FORMAT_TEX_UV2** = **32** --- Mesh array contains second UV.
  179. - **ARRAY_FORMAT_CUSTOM0** = **64**
  180. - **ARRAY_FORMAT_CUSTOM1** = **128**
  181. - **ARRAY_FORMAT_CUSTOM2** = **256**
  182. - **ARRAY_FORMAT_CUSTOM3** = **512**
  183. - **ARRAY_FORMAT_BONES** = **1024** --- Mesh array contains bones.
  184. - **ARRAY_FORMAT_WEIGHTS** = **2048** --- Mesh array contains bone weights.
  185. - **ARRAY_FORMAT_INDEX** = **4096** --- Mesh array uses indices.
  186. - **ARRAY_FORMAT_BLEND_SHAPE_MASK** = **7**
  187. - **ARRAY_FORMAT_CUSTOM_BASE** = **13**
  188. - **ARRAY_FORMAT_CUSTOM_BITS** = **3**
  189. - **ARRAY_FORMAT_CUSTOM0_SHIFT** = **13**
  190. - **ARRAY_FORMAT_CUSTOM1_SHIFT** = **16**
  191. - **ARRAY_FORMAT_CUSTOM2_SHIFT** = **19**
  192. - **ARRAY_FORMAT_CUSTOM3_SHIFT** = **22**
  193. - **ARRAY_FORMAT_CUSTOM_MASK** = **7**
  194. - **ARRAY_COMPRESS_FLAGS_BASE** = **25**
  195. - **ARRAY_FLAG_USE_2D_VERTICES** = **33554432** --- Flag used to mark that the array contains 2D vertices.
  196. - **ARRAY_FLAG_USE_DYNAMIC_UPDATE** = **67108864**
  197. - **ARRAY_FLAG_USE_8_BONE_WEIGHTS** = **134217728**
  198. ----
  199. .. _enum_Mesh_BlendShapeMode:
  200. .. _class_Mesh_constant_BLEND_SHAPE_MODE_NORMALIZED:
  201. .. _class_Mesh_constant_BLEND_SHAPE_MODE_RELATIVE:
  202. enum **BlendShapeMode**:
  203. - **BLEND_SHAPE_MODE_NORMALIZED** = **0** --- Blend shapes are normalized.
  204. - **BLEND_SHAPE_MODE_RELATIVE** = **1** --- Blend shapes are relative to base weight.
  205. Property Descriptions
  206. ---------------------
  207. .. _class_Mesh_property_lightmap_size_hint:
  208. - :ref:`Vector2i<class_Vector2i>` **lightmap_size_hint**
  209. +-----------+-------------------------------+
  210. | *Default* | ``Vector2i(0, 0)`` |
  211. +-----------+-------------------------------+
  212. | *Setter* | set_lightmap_size_hint(value) |
  213. +-----------+-------------------------------+
  214. | *Getter* | get_lightmap_size_hint() |
  215. +-----------+-------------------------------+
  216. Sets a hint to be used for lightmap resolution.
  217. Method Descriptions
  218. -------------------
  219. .. _class_Mesh_method__get_aabb:
  220. - :ref:`AABB<class_AABB>` **_get_aabb** **(** **)** |virtual| |const|
  221. ----
  222. .. _class_Mesh_method__get_blend_shape_count:
  223. - :ref:`int<class_int>` **_get_blend_shape_count** **(** **)** |virtual| |const|
  224. ----
  225. .. _class_Mesh_method__get_blend_shape_name:
  226. - :ref:`StringName<class_StringName>` **_get_blend_shape_name** **(** :ref:`int<class_int>` index **)** |virtual| |const|
  227. ----
  228. .. _class_Mesh_method__get_surface_count:
  229. - :ref:`int<class_int>` **_get_surface_count** **(** **)** |virtual| |const|
  230. ----
  231. .. _class_Mesh_method__set_blend_shape_name:
  232. - void **_set_blend_shape_name** **(** :ref:`int<class_int>` index, :ref:`StringName<class_StringName>` name **)** |virtual|
  233. ----
  234. .. _class_Mesh_method__surface_get_array_index_len:
  235. - :ref:`int<class_int>` **_surface_get_array_index_len** **(** :ref:`int<class_int>` index **)** |virtual| |const|
  236. ----
  237. .. _class_Mesh_method__surface_get_array_len:
  238. - :ref:`int<class_int>` **_surface_get_array_len** **(** :ref:`int<class_int>` index **)** |virtual| |const|
  239. ----
  240. .. _class_Mesh_method__surface_get_arrays:
  241. - :ref:`Array<class_Array>` **_surface_get_arrays** **(** :ref:`int<class_int>` index **)** |virtual| |const|
  242. ----
  243. .. _class_Mesh_method__surface_get_blend_shape_arrays:
  244. - :ref:`Array<class_Array>` **_surface_get_blend_shape_arrays** **(** :ref:`int<class_int>` index **)** |virtual| |const|
  245. ----
  246. .. _class_Mesh_method__surface_get_format:
  247. - :ref:`int<class_int>` **_surface_get_format** **(** :ref:`int<class_int>` index **)** |virtual| |const|
  248. ----
  249. .. _class_Mesh_method__surface_get_lods:
  250. - :ref:`Dictionary<class_Dictionary>` **_surface_get_lods** **(** :ref:`int<class_int>` index **)** |virtual| |const|
  251. ----
  252. .. _class_Mesh_method__surface_get_material:
  253. - :ref:`Material<class_Material>` **_surface_get_material** **(** :ref:`int<class_int>` index **)** |virtual| |const|
  254. ----
  255. .. _class_Mesh_method__surface_get_primitive_type:
  256. - :ref:`int<class_int>` **_surface_get_primitive_type** **(** :ref:`int<class_int>` index **)** |virtual| |const|
  257. ----
  258. .. _class_Mesh_method__surface_set_material:
  259. - void **_surface_set_material** **(** :ref:`int<class_int>` index, :ref:`Material<class_Material>` material **)** |virtual|
  260. ----
  261. .. _class_Mesh_method_create_convex_shape:
  262. - :ref:`Shape3D<class_Shape3D>` **create_convex_shape** **(** :ref:`bool<class_bool>` clean=true, :ref:`bool<class_bool>` simplify=false **)** |const|
  263. Calculate a :ref:`ConvexPolygonShape3D<class_ConvexPolygonShape3D>` from the mesh.
  264. 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.
  265. If ``simplify`` is ``true``, the geometry can be further simplified to reduce the amount of vertices. Disabled by default.
  266. ----
  267. .. _class_Mesh_method_create_outline:
  268. - :ref:`Mesh<class_Mesh>` **create_outline** **(** :ref:`float<class_float>` margin **)** |const|
  269. Calculate an outline mesh at a defined offset (margin) from the original mesh.
  270. \ **Note:** This method typically returns the vertices in reverse order (e.g. clockwise to counterclockwise).
  271. ----
  272. .. _class_Mesh_method_create_trimesh_shape:
  273. - :ref:`Shape3D<class_Shape3D>` **create_trimesh_shape** **(** **)** |const|
  274. Calculate a :ref:`ConcavePolygonShape3D<class_ConcavePolygonShape3D>` from the mesh.
  275. ----
  276. .. _class_Mesh_method_generate_triangle_mesh:
  277. - :ref:`TriangleMesh<class_TriangleMesh>` **generate_triangle_mesh** **(** **)** |const|
  278. Generate a :ref:`TriangleMesh<class_TriangleMesh>` from the mesh.
  279. ----
  280. .. _class_Mesh_method_get_aabb:
  281. - :ref:`AABB<class_AABB>` **get_aabb** **(** **)** |const|
  282. Returns the smallest :ref:`AABB<class_AABB>` enclosing this mesh in local space. Not affected by ``custom_aabb``. See also :ref:`VisualInstance3D.get_transformed_aabb<class_VisualInstance3D_method_get_transformed_aabb>`.
  283. \ **Note:** This is only implemented for :ref:`ArrayMesh<class_ArrayMesh>` and :ref:`PrimitiveMesh<class_PrimitiveMesh>`.
  284. ----
  285. .. _class_Mesh_method_get_faces:
  286. - :ref:`PackedVector3Array<class_PackedVector3Array>` **get_faces** **(** **)** |const|
  287. Returns all the vertices that make up the faces of the mesh. Each three vertices represent one triangle.
  288. ----
  289. .. _class_Mesh_method_get_surface_count:
  290. - :ref:`int<class_int>` **get_surface_count** **(** **)** |const|
  291. Returns the amount of surfaces that the ``Mesh`` holds.
  292. ----
  293. .. _class_Mesh_method_surface_get_arrays:
  294. - :ref:`Array<class_Array>` **surface_get_arrays** **(** :ref:`int<class_int>` surf_idx **)** |const|
  295. 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>`).
  296. ----
  297. .. _class_Mesh_method_surface_get_blend_shape_arrays:
  298. - :ref:`Array<class_Array>` **surface_get_blend_shape_arrays** **(** :ref:`int<class_int>` surf_idx **)** |const|
  299. Returns the blend shape arrays for the requested surface.
  300. ----
  301. .. _class_Mesh_method_surface_get_material:
  302. - :ref:`Material<class_Material>` **surface_get_material** **(** :ref:`int<class_int>` surf_idx **)** |const|
  303. Returns a :ref:`Material<class_Material>` in a given surface. Surface is rendered using this material.
  304. ----
  305. .. _class_Mesh_method_surface_set_material:
  306. - void **surface_set_material** **(** :ref:`int<class_int>` surf_idx, :ref:`Material<class_Material>` material **)**
  307. Sets a :ref:`Material<class_Material>` for a given surface. Surface will be rendered using this material.
  308. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  309. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  310. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  311. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  312. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  313. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`