Mesh.xml 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Mesh" inherits="Resource" version="3.4">
  3. <brief_description>
  4. A [Resource] that contains vertex array-based geometry.
  5. </brief_description>
  6. <description>
  7. Mesh is a type of [Resource] that contains vertex array-based geometry, divided in [i]surfaces[/i]. 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.
  8. </description>
  9. <tutorials>
  10. <link title="3D Material Testers Demo">https://godotengine.org/asset-library/asset/123</link>
  11. <link title="3D Kinematic Character Demo">https://godotengine.org/asset-library/asset/126</link>
  12. <link title="3D Platformer Demo">https://godotengine.org/asset-library/asset/125</link>
  13. <link title="Third Person Shooter Demo">https://godotengine.org/asset-library/asset/678</link>
  14. </tutorials>
  15. <methods>
  16. <method name="create_convex_shape" qualifiers="const">
  17. <return type="Shape">
  18. </return>
  19. <description>
  20. Calculate a [ConvexPolygonShape] from the mesh.
  21. </description>
  22. </method>
  23. <method name="create_outline" qualifiers="const">
  24. <return type="Mesh">
  25. </return>
  26. <argument index="0" name="margin" type="float">
  27. </argument>
  28. <description>
  29. Calculate an outline mesh at a defined offset (margin) from the original mesh.
  30. [b]Note:[/b] This method typically returns the vertices in reverse order (e.g. clockwise to counterclockwise).
  31. </description>
  32. </method>
  33. <method name="create_trimesh_shape" qualifiers="const">
  34. <return type="Shape">
  35. </return>
  36. <description>
  37. Calculate a [ConcavePolygonShape] from the mesh.
  38. </description>
  39. </method>
  40. <method name="generate_triangle_mesh" qualifiers="const">
  41. <return type="TriangleMesh">
  42. </return>
  43. <description>
  44. Generate a [TriangleMesh] from the mesh.
  45. </description>
  46. </method>
  47. <method name="get_aabb" qualifiers="const">
  48. <return type="AABB">
  49. </return>
  50. <description>
  51. Returns the smallest [AABB] enclosing this mesh in local space. Not affected by [code]custom_aabb[/code]. See also [method VisualInstance.get_transformed_aabb].
  52. [b]Note:[/b] This is only implemented for [ArrayMesh] and [PrimitiveMesh].
  53. </description>
  54. </method>
  55. <method name="get_faces" qualifiers="const">
  56. <return type="PoolVector3Array">
  57. </return>
  58. <description>
  59. Returns all the vertices that make up the faces of the mesh. Each three vertices represent one triangle.
  60. </description>
  61. </method>
  62. <method name="get_surface_count" qualifiers="const">
  63. <return type="int">
  64. </return>
  65. <description>
  66. Returns the amount of surfaces that the [Mesh] holds.
  67. </description>
  68. </method>
  69. <method name="surface_get_arrays" qualifiers="const">
  70. <return type="Array">
  71. </return>
  72. <argument index="0" name="surf_idx" type="int">
  73. </argument>
  74. <description>
  75. Returns the arrays for the vertices, normals, uvs, etc. that make up the requested surface (see [method ArrayMesh.add_surface_from_arrays]).
  76. </description>
  77. </method>
  78. <method name="surface_get_blend_shape_arrays" qualifiers="const">
  79. <return type="Array">
  80. </return>
  81. <argument index="0" name="surf_idx" type="int">
  82. </argument>
  83. <description>
  84. Returns the blend shape arrays for the requested surface.
  85. </description>
  86. </method>
  87. <method name="surface_get_material" qualifiers="const">
  88. <return type="Material">
  89. </return>
  90. <argument index="0" name="surf_idx" type="int">
  91. </argument>
  92. <description>
  93. Returns a [Material] in a given surface. Surface is rendered using this material.
  94. </description>
  95. </method>
  96. <method name="surface_set_material">
  97. <return type="void">
  98. </return>
  99. <argument index="0" name="surf_idx" type="int">
  100. </argument>
  101. <argument index="1" name="material" type="Material">
  102. </argument>
  103. <description>
  104. Sets a [Material] for a given surface. Surface will be rendered using this material.
  105. </description>
  106. </method>
  107. </methods>
  108. <members>
  109. <member name="lightmap_size_hint" type="Vector2" setter="set_lightmap_size_hint" getter="get_lightmap_size_hint" default="Vector2( 0, 0 )">
  110. Sets a hint to be used for lightmap resolution in [BakedLightmap]. Overrides [member BakedLightmap.default_texels_per_unit].
  111. </member>
  112. </members>
  113. <constants>
  114. <constant name="PRIMITIVE_POINTS" value="0" enum="PrimitiveType">
  115. Render array as points (one vertex equals one point).
  116. </constant>
  117. <constant name="PRIMITIVE_LINES" value="1" enum="PrimitiveType">
  118. Render array as lines (every two vertices a line is created).
  119. </constant>
  120. <constant name="PRIMITIVE_LINE_STRIP" value="2" enum="PrimitiveType">
  121. Render array as line strip.
  122. </constant>
  123. <constant name="PRIMITIVE_LINE_LOOP" value="3" enum="PrimitiveType">
  124. Render array as line loop (like line strip, but closed).
  125. </constant>
  126. <constant name="PRIMITIVE_TRIANGLES" value="4" enum="PrimitiveType">
  127. Render array as triangles (every three vertices a triangle is created).
  128. </constant>
  129. <constant name="PRIMITIVE_TRIANGLE_STRIP" value="5" enum="PrimitiveType">
  130. Render array as triangle strips.
  131. </constant>
  132. <constant name="PRIMITIVE_TRIANGLE_FAN" value="6" enum="PrimitiveType">
  133. Render array as triangle fans.
  134. </constant>
  135. <constant name="BLEND_SHAPE_MODE_NORMALIZED" value="0" enum="BlendShapeMode">
  136. Blend shapes are normalized.
  137. </constant>
  138. <constant name="BLEND_SHAPE_MODE_RELATIVE" value="1" enum="BlendShapeMode">
  139. Blend shapes are relative to base weight.
  140. </constant>
  141. <constant name="ARRAY_FORMAT_VERTEX" value="1" enum="ArrayFormat">
  142. Mesh array contains vertices. All meshes require a vertex array so this should always be present.
  143. </constant>
  144. <constant name="ARRAY_FORMAT_NORMAL" value="2" enum="ArrayFormat">
  145. Mesh array contains normals.
  146. </constant>
  147. <constant name="ARRAY_FORMAT_TANGENT" value="4" enum="ArrayFormat">
  148. Mesh array contains tangents.
  149. </constant>
  150. <constant name="ARRAY_FORMAT_COLOR" value="8" enum="ArrayFormat">
  151. Mesh array contains colors.
  152. </constant>
  153. <constant name="ARRAY_FORMAT_TEX_UV" value="16" enum="ArrayFormat">
  154. Mesh array contains UVs.
  155. </constant>
  156. <constant name="ARRAY_FORMAT_TEX_UV2" value="32" enum="ArrayFormat">
  157. Mesh array contains second UV.
  158. </constant>
  159. <constant name="ARRAY_FORMAT_BONES" value="64" enum="ArrayFormat">
  160. Mesh array contains bones.
  161. </constant>
  162. <constant name="ARRAY_FORMAT_WEIGHTS" value="128" enum="ArrayFormat">
  163. Mesh array contains bone weights.
  164. </constant>
  165. <constant name="ARRAY_FORMAT_INDEX" value="256" enum="ArrayFormat">
  166. Mesh array uses indices.
  167. </constant>
  168. <constant name="ARRAY_COMPRESS_BASE" value="9" enum="ArrayFormat">
  169. Used internally to calculate other [code]ARRAY_COMPRESS_*[/code] enum values. Do not use.
  170. </constant>
  171. <constant name="ARRAY_COMPRESS_VERTEX" value="512" enum="ArrayFormat">
  172. Flag used to mark a compressed (half float) vertex array.
  173. </constant>
  174. <constant name="ARRAY_COMPRESS_NORMAL" value="1024" enum="ArrayFormat">
  175. Flag used to mark a compressed (half float) normal array.
  176. </constant>
  177. <constant name="ARRAY_COMPRESS_TANGENT" value="2048" enum="ArrayFormat">
  178. Flag used to mark a compressed (half float) tangent array.
  179. </constant>
  180. <constant name="ARRAY_COMPRESS_COLOR" value="4096" enum="ArrayFormat">
  181. Flag used to mark a compressed (half float) color array.
  182. </constant>
  183. <constant name="ARRAY_COMPRESS_TEX_UV" value="8192" enum="ArrayFormat">
  184. Flag used to mark a compressed (half float) UV coordinates array.
  185. </constant>
  186. <constant name="ARRAY_COMPRESS_TEX_UV2" value="16384" enum="ArrayFormat">
  187. Flag used to mark a compressed (half float) UV coordinates array for the second UV coordinates.
  188. </constant>
  189. <constant name="ARRAY_COMPRESS_BONES" value="32768" enum="ArrayFormat">
  190. Flag used to mark a compressed bone array.
  191. </constant>
  192. <constant name="ARRAY_COMPRESS_WEIGHTS" value="65536" enum="ArrayFormat">
  193. Flag used to mark a compressed (half float) weight array.
  194. </constant>
  195. <constant name="ARRAY_COMPRESS_INDEX" value="131072" enum="ArrayFormat">
  196. Flag used to mark a compressed index array.
  197. </constant>
  198. <constant name="ARRAY_FLAG_USE_2D_VERTICES" value="262144" enum="ArrayFormat">
  199. Flag used to mark that the array contains 2D vertices.
  200. </constant>
  201. <constant name="ARRAY_FLAG_USE_16_BIT_BONES" value="524288" enum="ArrayFormat">
  202. Flag used to mark that the array uses 16-bit bones instead of 8-bit.
  203. </constant>
  204. <constant name="ARRAY_COMPRESS_DEFAULT" value="97280" enum="ArrayFormat">
  205. Used to set flags [constant ARRAY_COMPRESS_VERTEX], [constant ARRAY_COMPRESS_NORMAL], [constant ARRAY_COMPRESS_TANGENT], [constant ARRAY_COMPRESS_COLOR], [constant ARRAY_COMPRESS_TEX_UV], [constant ARRAY_COMPRESS_TEX_UV2] and [constant ARRAY_COMPRESS_WEIGHTS] quickly.
  206. </constant>
  207. <constant name="ARRAY_VERTEX" value="0" enum="ArrayType">
  208. Array of vertices.
  209. </constant>
  210. <constant name="ARRAY_NORMAL" value="1" enum="ArrayType">
  211. Array of normals.
  212. </constant>
  213. <constant name="ARRAY_TANGENT" value="2" enum="ArrayType">
  214. Array of tangents as an array of floats, 4 floats per tangent.
  215. </constant>
  216. <constant name="ARRAY_COLOR" value="3" enum="ArrayType">
  217. Array of colors.
  218. </constant>
  219. <constant name="ARRAY_TEX_UV" value="4" enum="ArrayType">
  220. Array of UV coordinates.
  221. </constant>
  222. <constant name="ARRAY_TEX_UV2" value="5" enum="ArrayType">
  223. Array of second set of UV coordinates.
  224. </constant>
  225. <constant name="ARRAY_BONES" value="6" enum="ArrayType">
  226. Array of bone data.
  227. </constant>
  228. <constant name="ARRAY_WEIGHTS" value="7" enum="ArrayType">
  229. Array of weights.
  230. </constant>
  231. <constant name="ARRAY_INDEX" value="8" enum="ArrayType">
  232. Array of indices.
  233. </constant>
  234. <constant name="ARRAY_MAX" value="9" enum="ArrayType">
  235. Represents the size of the [enum ArrayType] enum.
  236. </constant>
  237. </constants>
  238. </class>