class_arraymesh.rst 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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. Member Functions
  12. ----------------
  13. +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  14. | void | :ref:`add_blend_shape<class_ArrayMesh_add_blend_shape>` **(** :ref:`String<class_string>` name **)** |
  15. +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  16. | void | :ref:`add_surface_from_arrays<class_ArrayMesh_add_surface_from_arrays>` **(** :ref:`int<class_int>` primitive, :ref:`Array<class_array>` arrays, :ref:`Array<class_array>` blend_shapes=[ ], :ref:`int<class_int>` compress_flags=97792 **)** |
  17. +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  18. | void | :ref:`center_geometry<class_ArrayMesh_center_geometry>` **(** **)** |
  19. +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | void | :ref:`clear_blend_shapes<class_ArrayMesh_clear_blend_shapes>` **(** **)** |
  21. +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`int<class_int>` | :ref:`get_blend_shape_count<class_ArrayMesh_get_blend_shape_count>` **(** **)** const |
  23. +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`String<class_string>` | :ref:`get_blend_shape_name<class_ArrayMesh_get_blend_shape_name>` **(** :ref:`int<class_int>` index **)** const |
  25. +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`int<class_int>` | :ref:`get_surface_count<class_ArrayMesh_get_surface_count>` **(** **)** const |
  27. +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`int<class_int>` | :ref:`lightmap_unwrap<class_ArrayMesh_lightmap_unwrap>` **(** :ref:`Transform<class_transform>` arg0, :ref:`float<class_float>` arg1 **)** |
  29. +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | void | :ref:`regen_normalmaps<class_ArrayMesh_regen_normalmaps>` **(** **)** |
  31. +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`int<class_int>` | :ref:`surface_get_array_index_len<class_ArrayMesh_surface_get_array_index_len>` **(** :ref:`int<class_int>` surf_idx **)** const |
  33. +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`int<class_int>` | :ref:`surface_get_array_len<class_ArrayMesh_surface_get_array_len>` **(** :ref:`int<class_int>` surf_idx **)** const |
  35. +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`Array<class_array>` | :ref:`surface_get_arrays<class_ArrayMesh_surface_get_arrays>` **(** :ref:`int<class_int>` surf_idx **)** const |
  37. +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`Array<class_array>` | :ref:`surface_get_blend_shape_arrays<class_ArrayMesh_surface_get_blend_shape_arrays>` **(** :ref:`int<class_int>` surf_idx **)** const |
  39. +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`int<class_int>` | :ref:`surface_get_format<class_ArrayMesh_surface_get_format>` **(** :ref:`int<class_int>` surf_idx **)** const |
  41. +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`Material<class_material>` | :ref:`surface_get_material<class_ArrayMesh_surface_get_material>` **(** :ref:`int<class_int>` surf_idx **)** const |
  43. +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`String<class_string>` | :ref:`surface_get_name<class_ArrayMesh_surface_get_name>` **(** :ref:`int<class_int>` surf_idx **)** const |
  45. +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`int<class_int>` | :ref:`surface_get_primitive_type<class_ArrayMesh_surface_get_primitive_type>` **(** :ref:`int<class_int>` surf_idx **)** const |
  47. +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | void | :ref:`surface_remove<class_ArrayMesh_surface_remove>` **(** :ref:`int<class_int>` surf_idx **)** |
  49. +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | void | :ref:`surface_set_material<class_ArrayMesh_surface_set_material>` **(** :ref:`int<class_int>` surf_idx, :ref:`Material<class_material>` material **)** |
  51. +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | void | :ref:`surface_set_name<class_ArrayMesh_surface_set_name>` **(** :ref:`int<class_int>` surf_idx, :ref:`String<class_string>` name **)** |
  53. +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | 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 **)** |
  55. +----------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. Member Variables
  57. ----------------
  58. .. _class_ArrayMesh_blend_shape_mode:
  59. - :ref:`BlendShapeMode<enum_mesh_blendshapemode>` **blend_shape_mode**
  60. .. _class_ArrayMesh_custom_aabb:
  61. - :ref:`AABB<class_aabb>` **custom_aabb**
  62. Numeric Constants
  63. -----------------
  64. - **NO_INDEX_ARRAY** = **-1** --- Default value used for index_array_len when no indices are present.
  65. - **ARRAY_WEIGHTS_SIZE** = **4** --- Amount of weights/bone indices per vertex (always 4).
  66. Enums
  67. -----
  68. .. _enum_ArrayMesh_ArrayFormat:
  69. enum **ArrayFormat**
  70. - **ARRAY_FORMAT_VERTEX** = **1** --- Array format will include vertices (mandatory).
  71. - **ARRAY_FORMAT_NORMAL** = **2** --- Array format will include normals
  72. - **ARRAY_FORMAT_TANGENT** = **4** --- Array format will include tangents
  73. - **ARRAY_FORMAT_COLOR** = **8** --- Array format will include a color array.
  74. - **ARRAY_FORMAT_TEX_UV** = **16** --- Array format will include UVs.
  75. - **ARRAY_FORMAT_TEX_UV2** = **32** --- Array format will include another set of UVs.
  76. - **ARRAY_FORMAT_BONES** = **64** --- Array format will include bone indices.
  77. - **ARRAY_FORMAT_WEIGHTS** = **128** --- Array format will include bone weights.
  78. - **ARRAY_FORMAT_INDEX** = **256** --- Index array will be used.
  79. .. _enum_ArrayMesh_ArrayType:
  80. enum **ArrayType**
  81. - **ARRAY_VERTEX** = **0** --- Vertex array (array of :ref:`Vector3<class_vector3>` vertices).
  82. - **ARRAY_NORMAL** = **1** --- Normal array (array of :ref:`Vector3<class_vector3>` normals).
  83. - **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.
  84. - **ARRAY_COLOR** = **3** --- Vertex array (array of :ref:`Color<class_color>` colors).
  85. - **ARRAY_TEX_UV** = **4** --- UV array (array of :ref:`Vector3<class_vector3>` UVs or float array of groups of 2 floats (u,v)).
  86. - **ARRAY_TEX_UV2** = **5** --- Second UV array (array of :ref:`Vector3<class_vector3>` UVs or float array of groups of 2 floats (u,v)).
  87. - **ARRAY_BONES** = **6** --- Array of bone indices, as a float array. Each element in groups of 4 floats.
  88. - **ARRAY_WEIGHTS** = **7** --- Array of bone weights, as a float array. Each element in groups of 4 floats.
  89. - **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.
  90. 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.
  91. - **ARRAY_MAX** = **9**
  92. Member Function Description
  93. ---------------------------
  94. .. _class_ArrayMesh_add_blend_shape:
  95. - void **add_blend_shape** **(** :ref:`String<class_string>` name **)**
  96. .. _class_ArrayMesh_add_surface_from_arrays:
  97. - void **add_surface_from_arrays** **(** :ref:`int<class_int>` primitive, :ref:`Array<class_array>` arrays, :ref:`Array<class_array>` blend_shapes=[ ], :ref:`int<class_int>` compress_flags=97792 **)**
  98. Creates a new surface.
  99. 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.
  100. The ``arrays`` argument is an array of arrays. See enum 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.
  101. 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.
  102. Godot uses clockwise winding order for front faces of triangle primitive modes.
  103. .. _class_ArrayMesh_center_geometry:
  104. - void **center_geometry** **(** **)**
  105. .. _class_ArrayMesh_clear_blend_shapes:
  106. - void **clear_blend_shapes** **(** **)**
  107. .. _class_ArrayMesh_get_blend_shape_count:
  108. - :ref:`int<class_int>` **get_blend_shape_count** **(** **)** const
  109. .. _class_ArrayMesh_get_blend_shape_name:
  110. - :ref:`String<class_string>` **get_blend_shape_name** **(** :ref:`int<class_int>` index **)** const
  111. .. _class_ArrayMesh_get_surface_count:
  112. - :ref:`int<class_int>` **get_surface_count** **(** **)** const
  113. Return the amount of surfaces that the ``ArrayMesh`` holds.
  114. .. _class_ArrayMesh_lightmap_unwrap:
  115. - :ref:`int<class_int>` **lightmap_unwrap** **(** :ref:`Transform<class_transform>` arg0, :ref:`float<class_float>` arg1 **)**
  116. .. _class_ArrayMesh_regen_normalmaps:
  117. - void **regen_normalmaps** **(** **)**
  118. .. _class_ArrayMesh_surface_get_array_index_len:
  119. - :ref:`int<class_int>` **surface_get_array_index_len** **(** :ref:`int<class_int>` surf_idx **)** const
  120. Return the length in indices of the index array in the requested surface (see :ref:`add_surface<class_ArrayMesh_add_surface>`).
  121. .. _class_ArrayMesh_surface_get_array_len:
  122. - :ref:`int<class_int>` **surface_get_array_len** **(** :ref:`int<class_int>` surf_idx **)** const
  123. Return the length in vertices of the vertex array in the requested surface (see :ref:`add_surface<class_ArrayMesh_add_surface>`).
  124. .. _class_ArrayMesh_surface_get_arrays:
  125. - :ref:`Array<class_array>` **surface_get_arrays** **(** :ref:`int<class_int>` surf_idx **)** const
  126. .. _class_ArrayMesh_surface_get_blend_shape_arrays:
  127. - :ref:`Array<class_array>` **surface_get_blend_shape_arrays** **(** :ref:`int<class_int>` surf_idx **)** const
  128. .. _class_ArrayMesh_surface_get_format:
  129. - :ref:`int<class_int>` **surface_get_format** **(** :ref:`int<class_int>` surf_idx **)** const
  130. Return the format mask of the requested surface (see :ref:`add_surface<class_ArrayMesh_add_surface>`).
  131. .. _class_ArrayMesh_surface_get_material:
  132. - :ref:`Material<class_material>` **surface_get_material** **(** :ref:`int<class_int>` surf_idx **)** const
  133. Return a :ref:`Material<class_material>` in a given surface. Surface is rendered using this material.
  134. .. _class_ArrayMesh_surface_get_name:
  135. - :ref:`String<class_string>` **surface_get_name** **(** :ref:`int<class_int>` surf_idx **)** const
  136. .. _class_ArrayMesh_surface_get_primitive_type:
  137. - :ref:`int<class_int>` **surface_get_primitive_type** **(** :ref:`int<class_int>` surf_idx **)** const
  138. Return the primitive type of the requested surface (see :ref:`add_surface<class_ArrayMesh_add_surface>`).
  139. .. _class_ArrayMesh_surface_remove:
  140. - void **surface_remove** **(** :ref:`int<class_int>` surf_idx **)**
  141. Remove a surface at position surf_idx, shifting greater surfaces one surf_idx slot down.
  142. .. _class_ArrayMesh_surface_set_material:
  143. - void **surface_set_material** **(** :ref:`int<class_int>` surf_idx, :ref:`Material<class_material>` material **)**
  144. .. _class_ArrayMesh_surface_set_name:
  145. - void **surface_set_name** **(** :ref:`int<class_int>` surf_idx, :ref:`String<class_string>` name **)**
  146. Set a :ref:`Material<class_material>` for a given surface. Surface will be rendered using this material.
  147. .. _class_ArrayMesh_surface_update_region:
  148. - void **surface_update_region** **(** :ref:`int<class_int>` surf_idx, :ref:`int<class_int>` offset, :ref:`PoolByteArray<class_poolbytearray>` data **)**