class_arraymesh.rst 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the ArrayMesh.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_ArrayMesh:
  5. ArrayMesh
  6. =========
  7. **Inherits:** :ref:`Mesh<class_Mesh>` **<** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Properties
  12. ----------
  13. +-------------------------------------------------+-----------------------------------------------------------+
  14. | :ref:`BlendShapeMode<enum_Mesh_BlendShapeMode>` | :ref:`blend_shape_mode<class_ArrayMesh_blend_shape_mode>` |
  15. +-------------------------------------------------+-----------------------------------------------------------+
  16. | :ref:`AABB<class_AABB>` | :ref:`custom_aabb<class_ArrayMesh_custom_aabb>` |
  17. +-------------------------------------------------+-----------------------------------------------------------+
  18. Methods
  19. -------
  20. +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | void | :ref:`add_blend_shape<class_ArrayMesh_add_blend_shape>` **(** :ref:`String<class_String>` name **)** |
  22. +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | void | :ref:`add_surface_from_arrays<class_ArrayMesh_add_surface_from_arrays>` **(** :ref:`PrimitiveType<enum_Mesh_PrimitiveType>` primitive, :ref:`Array<class_Array>` arrays, :ref:`Array<class_Array>` blend_shapes=[ ], :ref:`int<class_int>` compress_flags=97280 **)** |
  24. +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | void | :ref:`center_geometry<class_ArrayMesh_center_geometry>` **(** **)** |
  26. +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | void | :ref:`clear_blend_shapes<class_ArrayMesh_clear_blend_shapes>` **(** **)** |
  28. +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`int<class_int>` | :ref:`get_blend_shape_count<class_ArrayMesh_get_blend_shape_count>` **(** **)** const |
  30. +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`String<class_String>` | :ref:`get_blend_shape_name<class_ArrayMesh_get_blend_shape_name>` **(** :ref:`int<class_int>` index **)** const |
  32. +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`lightmap_unwrap<class_ArrayMesh_lightmap_unwrap>` **(** :ref:`Transform<class_Transform>` transform, :ref:`float<class_float>` texel_size **)** |
  34. +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | void | :ref:`regen_normalmaps<class_ArrayMesh_regen_normalmaps>` **(** **)** |
  36. +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`int<class_int>` | :ref:`surface_find_by_name<class_ArrayMesh_surface_find_by_name>` **(** :ref:`String<class_String>` name **)** const |
  38. +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`int<class_int>` | :ref:`surface_get_array_index_len<class_ArrayMesh_surface_get_array_index_len>` **(** :ref:`int<class_int>` surf_idx **)** const |
  40. +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`int<class_int>` | :ref:`surface_get_array_len<class_ArrayMesh_surface_get_array_len>` **(** :ref:`int<class_int>` surf_idx **)** const |
  42. +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`int<class_int>` | :ref:`surface_get_format<class_ArrayMesh_surface_get_format>` **(** :ref:`int<class_int>` surf_idx **)** const |
  44. +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`String<class_String>` | :ref:`surface_get_name<class_ArrayMesh_surface_get_name>` **(** :ref:`int<class_int>` surf_idx **)** const |
  46. +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`PrimitiveType<enum_Mesh_PrimitiveType>` | :ref:`surface_get_primitive_type<class_ArrayMesh_surface_get_primitive_type>` **(** :ref:`int<class_int>` surf_idx **)** const |
  48. +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | void | :ref:`surface_remove<class_ArrayMesh_surface_remove>` **(** :ref:`int<class_int>` surf_idx **)** |
  50. +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | void | :ref:`surface_set_material<class_ArrayMesh_surface_set_material>` **(** :ref:`int<class_int>` surf_idx, :ref:`Material<class_Material>` material **)** |
  52. +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | void | :ref:`surface_set_name<class_ArrayMesh_surface_set_name>` **(** :ref:`int<class_int>` surf_idx, :ref:`String<class_String>` name **)** |
  54. +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | void | :ref:`surface_update_region<class_ArrayMesh_surface_update_region>` **(** :ref:`int<class_int>` surf_idx, :ref:`int<class_int>` offset, :ref:`PoolByteArray<class_PoolByteArray>` data **)** |
  56. +------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. Enumerations
  58. ------------
  59. .. _enum_ArrayMesh_ArrayFormat:
  60. enum **ArrayFormat**:
  61. - **ARRAY_FORMAT_VERTEX** = **1** --- Array format will include vertices (mandatory).
  62. - **ARRAY_FORMAT_NORMAL** = **2** --- Array format will include normals
  63. - **ARRAY_FORMAT_TANGENT** = **4** --- Array format will include tangents
  64. - **ARRAY_FORMAT_COLOR** = **8** --- Array format will include a color array.
  65. - **ARRAY_FORMAT_TEX_UV** = **16** --- Array format will include UVs.
  66. - **ARRAY_FORMAT_TEX_UV2** = **32** --- Array format will include another set of UVs.
  67. - **ARRAY_FORMAT_BONES** = **64** --- Array format will include bone indices.
  68. - **ARRAY_FORMAT_WEIGHTS** = **128** --- Array format will include bone weights.
  69. - **ARRAY_FORMAT_INDEX** = **256** --- Index array will be used.
  70. .. _enum_ArrayMesh_ArrayType:
  71. enum **ArrayType**:
  72. - **ARRAY_VERTEX** = **0** --- Vertex array (array of :ref:`Vector3<class_Vector3>` vertices).
  73. - **ARRAY_NORMAL** = **1** --- Normal array (array of :ref:`Vector3<class_Vector3>` normals).
  74. - **ARRAY_TANGENT** = **2** --- Tangent array, array of groups of 4 floats. first 3 floats determine the tangent, and the last the binormal direction as -1 or 1.
  75. - **ARRAY_COLOR** = **3** --- Vertex array (array of :ref:`Color<class_Color>` colors).
  76. - **ARRAY_TEX_UV** = **4** --- UV array (array of :ref:`Vector3<class_Vector3>` UVs or float array of groups of 2 floats (u,v)).
  77. - **ARRAY_TEX_UV2** = **5** --- Second UV array (array of :ref:`Vector3<class_Vector3>` UVs or float array of groups of 2 floats (u,v)).
  78. - **ARRAY_BONES** = **6** --- Array of bone indices, as a float array. Each element in groups of 4 floats.
  79. - **ARRAY_WEIGHTS** = **7** --- Array of bone weights, as a float array. Each element in groups of 4 floats.
  80. - **ARRAY_INDEX** = **8** --- :ref:`Array<class_Array>` 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.
  81. 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.
  82. - **ARRAY_MAX** = **9**
  83. Constants
  84. ---------
  85. - **NO_INDEX_ARRAY** = **-1** --- Default value used for index_array_len when no indices are present.
  86. - **ARRAY_WEIGHTS_SIZE** = **4** --- Amount of weights/bone indices per vertex (always 4).
  87. Property Descriptions
  88. ---------------------
  89. .. _class_ArrayMesh_blend_shape_mode:
  90. - :ref:`BlendShapeMode<enum_Mesh_BlendShapeMode>` **blend_shape_mode**
  91. +----------+-----------------------------+
  92. | *Setter* | set_blend_shape_mode(value) |
  93. +----------+-----------------------------+
  94. | *Getter* | get_blend_shape_mode() |
  95. +----------+-----------------------------+
  96. .. _class_ArrayMesh_custom_aabb:
  97. - :ref:`AABB<class_AABB>` **custom_aabb**
  98. +----------+------------------------+
  99. | *Setter* | set_custom_aabb(value) |
  100. +----------+------------------------+
  101. | *Getter* | get_custom_aabb() |
  102. +----------+------------------------+
  103. An overriding bounding box for this mesh.
  104. Method Descriptions
  105. -------------------
  106. .. _class_ArrayMesh_add_blend_shape:
  107. - void **add_blend_shape** **(** :ref:`String<class_String>` name **)**
  108. .. _class_ArrayMesh_add_surface_from_arrays:
  109. - void **add_surface_from_arrays** **(** :ref:`PrimitiveType<enum_Mesh_PrimitiveType>` primitive, :ref:`Array<class_Array>` arrays, :ref:`Array<class_Array>` blend_shapes=[ ], :ref:`int<class_int>` compress_flags=97280 **)**
  110. Creates a new surface.
  111. Surfaces are created to be rendered using a "primitive", which may be PRIMITIVE_POINTS, PRIMITIVE_LINES, PRIMITIVE_LINE_STRIP, PRIMITIVE_LINE_LOOP, PRIMITIVE_TRIANGLES, PRIMITIVE_TRIANGLE_STRIP, PRIMITIVE_TRIANGLE_FAN. See :ref:`Mesh<class_Mesh>` for details. (As a note, when using indices, it is recommended to only use points, lines or triangles). :ref:`get_surface_count<class_ArrayMesh_get_surface_count>` will become the surf_idx for this new surface.
  112. The ``arrays`` argument is an array of arrays. See :ref:`ArrayType<enum_@GlobalScope_ArrayType>` for the values used in this array. For example, ``arrays[0]`` is the array of vertices. That first vertex sub-array is always required; the others are optional. Adding an index array puts this function into "index mode" where the vertex and other arrays become the sources of data and the index array defines the vertex order. All sub-arrays must have the same length as the vertex array or be empty, except for ``ARRAY_INDEX`` if it is used.
  113. Adding an index array puts this function into "index mode" where the vertex and other arrays become the sources of data, and the index array defines the order of the vertices.
  114. Godot uses clockwise winding order for front faces of triangle primitive modes.
  115. .. _class_ArrayMesh_center_geometry:
  116. - void **center_geometry** **(** **)**
  117. Centers the geometry.
  118. .. _class_ArrayMesh_clear_blend_shapes:
  119. - void **clear_blend_shapes** **(** **)**
  120. Remove all blend shapes from this ``ArrayMesh``.
  121. .. _class_ArrayMesh_get_blend_shape_count:
  122. - :ref:`int<class_int>` **get_blend_shape_count** **(** **)** const
  123. Returns the number of blend shapes that the ``ArrayMesh`` holds.
  124. .. _class_ArrayMesh_get_blend_shape_name:
  125. - :ref:`String<class_String>` **get_blend_shape_name** **(** :ref:`int<class_int>` index **)** const
  126. Returns the name of the blend shape at this index.
  127. .. _class_ArrayMesh_lightmap_unwrap:
  128. - :ref:`Error<enum_@GlobalScope_Error>` **lightmap_unwrap** **(** :ref:`Transform<class_Transform>` transform, :ref:`float<class_float>` texel_size **)**
  129. Will perform a UV unwrap on the ``ArrayMesh`` to prepare the mesh for lightmapping.
  130. .. _class_ArrayMesh_regen_normalmaps:
  131. - void **regen_normalmaps** **(** **)**
  132. Will regenerate normal maps for the ``ArrayMesh``.
  133. .. _class_ArrayMesh_surface_find_by_name:
  134. - :ref:`int<class_int>` **surface_find_by_name** **(** :ref:`String<class_String>` name **)** const
  135. Return the index of the first surface with this name held within this ``ArrayMesh``. If none are found -1 is returned.
  136. .. _class_ArrayMesh_surface_get_array_index_len:
  137. - :ref:`int<class_int>` **surface_get_array_index_len** **(** :ref:`int<class_int>` surf_idx **)** const
  138. Return the length in indices of the index array in the requested surface (see :ref:`add_surface_from_arrays<class_ArrayMesh_add_surface_from_arrays>`).
  139. .. _class_ArrayMesh_surface_get_array_len:
  140. - :ref:`int<class_int>` **surface_get_array_len** **(** :ref:`int<class_int>` surf_idx **)** const
  141. Return the length in vertices of the vertex array in the requested surface (see :ref:`add_surface_from_arrays<class_ArrayMesh_add_surface_from_arrays>`).
  142. .. _class_ArrayMesh_surface_get_format:
  143. - :ref:`int<class_int>` **surface_get_format** **(** :ref:`int<class_int>` surf_idx **)** const
  144. Return the format mask of the requested surface (see :ref:`add_surface_from_arrays<class_ArrayMesh_add_surface_from_arrays>`).
  145. .. _class_ArrayMesh_surface_get_name:
  146. - :ref:`String<class_String>` **surface_get_name** **(** :ref:`int<class_int>` surf_idx **)** const
  147. Get the name assigned to this surface.
  148. .. _class_ArrayMesh_surface_get_primitive_type:
  149. - :ref:`PrimitiveType<enum_Mesh_PrimitiveType>` **surface_get_primitive_type** **(** :ref:`int<class_int>` surf_idx **)** const
  150. Return the primitive type of the requested surface (see :ref:`add_surface_from_arrays<class_ArrayMesh_add_surface_from_arrays>`).
  151. .. _class_ArrayMesh_surface_remove:
  152. - void **surface_remove** **(** :ref:`int<class_int>` surf_idx **)**
  153. Remove a surface at position surf_idx, shifting greater surfaces one surf_idx slot down.
  154. .. _class_ArrayMesh_surface_set_material:
  155. - void **surface_set_material** **(** :ref:`int<class_int>` surf_idx, :ref:`Material<class_Material>` material **)**
  156. Set a :ref:`Material<class_Material>` for a given surface. Surface will be rendered using this material.
  157. .. _class_ArrayMesh_surface_set_name:
  158. - void **surface_set_name** **(** :ref:`int<class_int>` surf_idx, :ref:`String<class_String>` name **)**
  159. Set a name for a given surface.
  160. .. _class_ArrayMesh_surface_update_region:
  161. - void **surface_update_region** **(** :ref:`int<class_int>` surf_idx, :ref:`int<class_int>` offset, :ref:`PoolByteArray<class_PoolByteArray>` data **)**