Files
godot-docs-l10n/classes/es/class_arraymesh.rst
Rémi Verschelde cf78697eea Add localized class reference as pre-generated RST files
Currently including `zh_CN` and `es` which both have very high completion
ratios. Others will be added once they reach a significant percentage too.

These RST files will be used by godot-docs in place of its `classes` folder
after we sync with https://github.com/godotengine/godot-docs/pull/5458.

The update workflow is manual for now (example for `zh_CN`):

- Build `godotengine/godot` in the branch we currently track (now `3.x`)
- Run `godot --doctool -l zh_CN`
- Run `cd doc && make rst LANGARG=zh_CN`
- Copy `doc/_build/rst/*` to `classes/zh_CN/` here
- Make sure to have `classes/zh_CN/index.rst` copied from `docs/classes`
2021-12-21 16:07:55 +01:00

387 lines
25 KiB
ReStructuredText

:github_url: hide
.. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
.. DO NOT EDIT THIS FILE, but the ArrayMesh.xml source instead.
.. The source is found in doc/classes or modules/<name>/doc_classes.
.. _class_ArrayMesh:
ArrayMesh
=========
**Inherits:** :ref:`Mesh<class_Mesh>` **<** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
Tipo :ref:`Mesh<class_Mesh>` que provee la funcionalidad para construir una superficie desde arrays.
Descripción
----------------------
The ``ArrayMesh`` is used to construct a :ref:`Mesh<class_Mesh>` by specifying the attributes as arrays.
The most basic example is the creation of a single triangle:
::
var vertices = PoolVector3Array()
vertices.push_back(Vector3(0, 1, 0))
vertices.push_back(Vector3(1, 0, 0))
vertices.push_back(Vector3(0, 0, 1))
# Initialize the ArrayMesh.
var arr_mesh = ArrayMesh.new()
var arrays = []
arrays.resize(ArrayMesh.ARRAY_MAX)
arrays[ArrayMesh.ARRAY_VERTEX] = vertices
# Create the Mesh.
arr_mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, arrays)
var m = MeshInstance.new()
m.mesh = arr_mesh
The :ref:`MeshInstance<class_MeshInstance>` is ready to be added to the :ref:`SceneTree<class_SceneTree>` to be shown.
See also :ref:`ImmediateGeometry<class_ImmediateGeometry>`, :ref:`MeshDataTool<class_MeshDataTool>` and :ref:`SurfaceTool<class_SurfaceTool>` for procedural geometry generation.
\ **Note:** Godot uses clockwise `winding order <https://learnopengl.com/Advanced-OpenGL/Face-culling>`__ for front faces of triangle primitive modes.
Tutoriales
--------------------
- :doc:`../tutorials/3d/procedural_geometry/arraymesh`
Propiedades
----------------------
+-------------------------------------------------+--------------------------------------------------------------------+------------------------------+
| :ref:`BlendShapeMode<enum_Mesh_BlendShapeMode>` | :ref:`blend_shape_mode<class_ArrayMesh_property_blend_shape_mode>` | ``1`` |
+-------------------------------------------------+--------------------------------------------------------------------+------------------------------+
| :ref:`AABB<class_AABB>` | :ref:`custom_aabb<class_ArrayMesh_property_custom_aabb>` | ``AABB( 0, 0, 0, 0, 0, 0 )`` |
+-------------------------------------------------+--------------------------------------------------------------------+------------------------------+
Métodos
--------------
+-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`add_blend_shape<class_ArrayMesh_method_add_blend_shape>` **(** :ref:`String<class_String>` name **)** |
+-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`add_surface_from_arrays<class_ArrayMesh_method_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=2194432 **)** |
+-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`clear_blend_shapes<class_ArrayMesh_method_clear_blend_shapes>` **(** **)** |
+-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`clear_surfaces<class_ArrayMesh_method_clear_surfaces>` **(** **)** |
+-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_blend_shape_count<class_ArrayMesh_method_get_blend_shape_count>` **(** **)** |const| |
+-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`get_blend_shape_name<class_ArrayMesh_method_get_blend_shape_name>` **(** :ref:`int<class_int>` index **)** |const| |
+-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Error<enum_@GlobalScope_Error>` | :ref:`lightmap_unwrap<class_ArrayMesh_method_lightmap_unwrap>` **(** :ref:`Transform<class_Transform>` transform, :ref:`float<class_float>` texel_size **)** |
+-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`regen_normalmaps<class_ArrayMesh_method_regen_normalmaps>` **(** **)** |
+-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_blend_shape_name<class_ArrayMesh_method_set_blend_shape_name>` **(** :ref:`int<class_int>` index, :ref:`String<class_String>` name **)** |
+-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`surface_find_by_name<class_ArrayMesh_method_surface_find_by_name>` **(** :ref:`String<class_String>` name **)** |const| |
+-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`surface_get_array_index_len<class_ArrayMesh_method_surface_get_array_index_len>` **(** :ref:`int<class_int>` surf_idx **)** |const| |
+-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`surface_get_array_len<class_ArrayMesh_method_surface_get_array_len>` **(** :ref:`int<class_int>` surf_idx **)** |const| |
+-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`surface_get_format<class_ArrayMesh_method_surface_get_format>` **(** :ref:`int<class_int>` surf_idx **)** |const| |
+-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`surface_get_name<class_ArrayMesh_method_surface_get_name>` **(** :ref:`int<class_int>` surf_idx **)** |const| |
+-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PrimitiveType<enum_Mesh_PrimitiveType>` | :ref:`surface_get_primitive_type<class_ArrayMesh_method_surface_get_primitive_type>` **(** :ref:`int<class_int>` surf_idx **)** |const| |
+-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`surface_remove<class_ArrayMesh_method_surface_remove>` **(** :ref:`int<class_int>` surf_idx **)** |
+-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`surface_set_name<class_ArrayMesh_method_surface_set_name>` **(** :ref:`int<class_int>` surf_idx, :ref:`String<class_String>` name **)** |
+-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`surface_update_region<class_ArrayMesh_method_surface_update_region>` **(** :ref:`int<class_int>` surf_idx, :ref:`int<class_int>` offset, :ref:`PoolByteArray<class_PoolByteArray>` data **)** |
+-----------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Enumeraciones
--------------------------
.. _enum_ArrayMesh_ArrayType:
.. _class_ArrayMesh_constant_ARRAY_VERTEX:
.. _class_ArrayMesh_constant_ARRAY_NORMAL:
.. _class_ArrayMesh_constant_ARRAY_TANGENT:
.. _class_ArrayMesh_constant_ARRAY_COLOR:
.. _class_ArrayMesh_constant_ARRAY_TEX_UV:
.. _class_ArrayMesh_constant_ARRAY_TEX_UV2:
.. _class_ArrayMesh_constant_ARRAY_BONES:
.. _class_ArrayMesh_constant_ARRAY_WEIGHTS:
.. _class_ArrayMesh_constant_ARRAY_INDEX:
.. _class_ArrayMesh_constant_ARRAY_MAX:
enum **ArrayType**:
- **ARRAY_VERTEX** = **0** --- :ref:`PoolVector3Array<class_PoolVector3Array>`, :ref:`PoolVector2Array<class_PoolVector2Array>`, or :ref:`Array<class_Array>` of vertex positions.
- **ARRAY_NORMAL** = **1** --- :ref:`PoolVector3Array<class_PoolVector3Array>` of vertex normals.
- **ARRAY_TANGENT** = **2** --- :ref:`PoolRealArray<class_PoolRealArray>` 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.
- **ARRAY_COLOR** = **3** --- :ref:`PoolColorArray<class_PoolColorArray>` of vertex colors.
- **ARRAY_TEX_UV** = **4** --- :ref:`PoolVector2Array<class_PoolVector2Array>` for UV coordinates.
- **ARRAY_TEX_UV2** = **5** --- :ref:`PoolVector2Array<class_PoolVector2Array>` for second UV coordinates.
- **ARRAY_BONES** = **6** --- :ref:`PoolRealArray<class_PoolRealArray>` or :ref:`PoolIntArray<class_PoolIntArray>` of bone indices. Each element in groups of 4 floats.
- **ARRAY_WEIGHTS** = **7** --- :ref:`PoolRealArray<class_PoolRealArray>` of bone weights. Each element in groups of 4 floats.
- **ARRAY_INDEX** = **8** --- :ref:`PoolIntArray<class_PoolIntArray>` 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.
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.
- **ARRAY_MAX** = **9** --- Representa el tamaño del enum :ref:`ArrayType<enum_ArrayMesh_ArrayType>`.
----
.. _enum_ArrayMesh_ArrayFormat:
.. _class_ArrayMesh_constant_ARRAY_FORMAT_VERTEX:
.. _class_ArrayMesh_constant_ARRAY_FORMAT_NORMAL:
.. _class_ArrayMesh_constant_ARRAY_FORMAT_TANGENT:
.. _class_ArrayMesh_constant_ARRAY_FORMAT_COLOR:
.. _class_ArrayMesh_constant_ARRAY_FORMAT_TEX_UV:
.. _class_ArrayMesh_constant_ARRAY_FORMAT_TEX_UV2:
.. _class_ArrayMesh_constant_ARRAY_FORMAT_BONES:
.. _class_ArrayMesh_constant_ARRAY_FORMAT_WEIGHTS:
.. _class_ArrayMesh_constant_ARRAY_FORMAT_INDEX:
enum **ArrayFormat**:
- **ARRAY_FORMAT_VERTEX** = **1** --- El formato de Arary incluira vertices (obligatorio).
- **ARRAY_FORMAT_NORMAL** = **2** --- El format de array incluira normales.
- **ARRAY_FORMAT_TANGENT** = **4** --- El formato de array incluira tangentes.
- **ARRAY_FORMAT_COLOR** = **8** --- El formato de array incluira un array de colores.
- **ARRAY_FORMAT_TEX_UV** = **16** --- El formato de array incluira UVs.
- **ARRAY_FORMAT_TEX_UV2** = **32** --- El formato de array incluira otr array de UVs.
- **ARRAY_FORMAT_BONES** = **64** --- El formato de array incluira indices de hueso.
- **ARRAY_FORMAT_WEIGHTS** = **128** --- El formato de array incluira pesos de hueso.
- **ARRAY_FORMAT_INDEX** = **256** --- El array de indices sera utilizado.
Constantes
--------------------
.. _class_ArrayMesh_constant_NO_INDEX_ARRAY:
.. _class_ArrayMesh_constant_ARRAY_WEIGHTS_SIZE:
- **NO_INDEX_ARRAY** = **-1** --- Valor por defecto usado para un index_array_len cuando no hay indices.
- **ARRAY_WEIGHTS_SIZE** = **4** --- Cantidad de pesos/hueso indices por vertice (siempre 4).
Descripciones de Propiedades
--------------------------------------------------------
.. _class_ArrayMesh_property_blend_shape_mode:
- :ref:`BlendShapeMode<enum_Mesh_BlendShapeMode>` **blend_shape_mode**
+-----------+-----------------------------+
| *Default* | ``1`` |
+-----------+-----------------------------+
| *Setter* | set_blend_shape_mode(value) |
+-----------+-----------------------------+
| *Getter* | get_blend_shape_mode() |
+-----------+-----------------------------+
Coloca el modo de mezcla de forma a :ref:`BlendShapeMode<enum_Mesh_BlendShapeMode>`.
----
.. _class_ArrayMesh_property_custom_aabb:
- :ref:`AABB<class_AABB>` **custom_aabb**
+-----------+------------------------------+
| *Default* | ``AABB( 0, 0, 0, 0, 0, 0 )`` |
+-----------+------------------------------+
| *Setter* | set_custom_aabb(value) |
+-----------+------------------------------+
| *Getter* | get_custom_aabb() |
+-----------+------------------------------+
Sobreescribe el :ref:`AABB<class_AABB>` con uno definido por usuario para el uso con el tronco(frustum). Especialmente util para evitar inesperadas selecciones cuando se use un shader a vertices desplazados.
Descripciones de Métodos
------------------------------------------------
.. _class_ArrayMesh_method_add_blend_shape:
- void **add_blend_shape** **(** :ref:`String<class_String>` name **)**
Añade un nombre a una forma de mezcla que se añadira con :ref:`add_surface_from_arrays<class_ArrayMesh_method_add_surface_from_arrays>`. Debe ser llamada antes que la superficie sea añadida.
----
.. _class_ArrayMesh_method_add_surface_from_arrays:
- 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=2194432 **)**
Creates a new surface.
Surfaces are created to be rendered using a ``primitive``, which may be any of the types defined in :ref:`PrimitiveType<enum_Mesh_PrimitiveType>`. (As a note, when using indices, it is recommended to only use points, lines, or triangles.) :ref:`Mesh.get_surface_count<class_Mesh_method_get_surface_count>` will become the ``surf_idx`` for this new surface.
The ``arrays`` argument is an array of arrays. See :ref:`ArrayType<enum_ArrayMesh_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 :ref:`ARRAY_INDEX<class_ArrayMesh_constant_ARRAY_INDEX>` if it is used.
----
.. _class_ArrayMesh_method_clear_blend_shapes:
- void **clear_blend_shapes** **(** **)**
Elimina todos las formas de mezcla de este ``ArrayMesh``.
----
.. _class_ArrayMesh_method_clear_surfaces:
- void **clear_surfaces** **(** **)**
Elimina todas las superificies de este ``ArrayMesh``.
----
.. _class_ArrayMesh_method_get_blend_shape_count:
- :ref:`int<class_int>` **get_blend_shape_count** **(** **)** |const|
Devuelve el numero de formas de mezcla que el ``ArrayMesh`` posee.
----
.. _class_ArrayMesh_method_get_blend_shape_name:
- :ref:`String<class_String>` **get_blend_shape_name** **(** :ref:`int<class_int>` index **)** |const|
Devuelve el nombre de la forma de mezcla de este indice.
----
.. _class_ArrayMesh_method_lightmap_unwrap:
- :ref:`Error<enum_@GlobalScope_Error>` **lightmap_unwrap** **(** :ref:`Transform<class_Transform>` transform, :ref:`float<class_float>` texel_size **)**
Ejecutara un desenvolver UV en el ``ArrayMesh`` para preparar la malla para iluminacion de mapas.
----
.. _class_ArrayMesh_method_regen_normalmaps:
- void **regen_normalmaps** **(** **)**
Regenerara los mapas de normales para el ``ArrayMesh``.
----
.. _class_ArrayMesh_method_set_blend_shape_name:
- void **set_blend_shape_name** **(** :ref:`int<class_int>` index, :ref:`String<class_String>` name **)**
----
.. _class_ArrayMesh_method_surface_find_by_name:
- :ref:`int<class_int>` **surface_find_by_name** **(** :ref:`String<class_String>` name **)** |const|
Devuelve el indice de la primer superficie con este nombre mantenido dentro de este ``ArrayMesh``. Si no es encontrado, -1 es devuelto.
----
.. _class_ArrayMesh_method_surface_get_array_index_len:
- :ref:`int<class_int>` **surface_get_array_index_len** **(** :ref:`int<class_int>` surf_idx **)** |const|
Devuelve la longitud en indices del array de indices de la superificie solicitada( ver :ref:`add_surface_from_arrays<class_ArrayMesh_method_add_surface_from_arrays>`).
----
.. _class_ArrayMesh_method_surface_get_array_len:
- :ref:`int<class_int>` **surface_get_array_len** **(** :ref:`int<class_int>` surf_idx **)** |const|
Devuelve la longitud en vertices del array de vertice en la superficie solicitada (ver\ :ref:`add_surface_from_arrays<class_ArrayMesh_method_add_surface_from_arrays>`).
----
.. _class_ArrayMesh_method_surface_get_format:
- :ref:`int<class_int>` **surface_get_format** **(** :ref:`int<class_int>` surf_idx **)** |const|
Devuelve la mascara de formato de la superficie solicitada (ver\ :ref:`add_surface_from_arrays<class_ArrayMesh_method_add_surface_from_arrays>`).
----
.. _class_ArrayMesh_method_surface_get_name:
- :ref:`String<class_String>` **surface_get_name** **(** :ref:`int<class_int>` surf_idx **)** |const|
Obtiene el nombre asignado a esta superficie.
----
.. _class_ArrayMesh_method_surface_get_primitive_type:
- :ref:`PrimitiveType<enum_Mesh_PrimitiveType>` **surface_get_primitive_type** **(** :ref:`int<class_int>` surf_idx **)** |const|
Devuelve el tipo primitivo de la superficie solicitada (ver :ref:`add_surface_from_arrays<class_ArrayMesh_method_add_surface_from_arrays>`).
----
.. _class_ArrayMesh_method_surface_remove:
- void **surface_remove** **(** :ref:`int<class_int>` surf_idx **)**
Removes a surface at position ``surf_idx``, shifting greater surfaces one ``surf_idx`` slot down.
----
.. _class_ArrayMesh_method_surface_set_name:
- void **surface_set_name** **(** :ref:`int<class_int>` surf_idx, :ref:`String<class_String>` name **)**
Obtiene un nombre para una superficie dada.
----
.. _class_ArrayMesh_method_surface_update_region:
- void **surface_update_region** **(** :ref:`int<class_int>` surf_idx, :ref:`int<class_int>` offset, :ref:`PoolByteArray<class_PoolByteArray>` data **)**
Actualiza una region especifica de la malla de arrays en la GPU.
\ **Aviso:** Solo usarlo si sabes lo que haces. Puedes causar el programa deje de funcionar al llamar esta funcion con argumentos incorrectos.
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`