Mesh.xml 11 KB

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