Mesh

Inherits: Resource < Reference < Object

Inherited By: ArrayMesh, PrimitiveMesh

Un Resource que contiene un array de vértices de una geometría.

Descripción

La malla es un tipo de Resource que contiene una geometría basada en un array de vértices, dividida en superficies. Cada superficie contiene un array completamente separado y un material utilizado para dibujarlo. En cuanto al diseño, se prefiere una malla con múltiples superficies a una sola superficie, porque los objetos creados en un software de edición 3D suelen contener múltiples materiales.

Tutoriales

Propiedades

Vector2

lightmap_size_hint

Vector2( 0, 0 )

Métodos

Shape

create_convex_shape ( bool clean=true, bool simplify=false ) const

Mesh

create_outline ( float margin ) const

Shape

create_trimesh_shape ( ) const

TriangleMesh

generate_triangle_mesh ( ) const

AABB

get_aabb ( ) const

PoolVector3Array

get_faces ( ) const

int

get_surface_count ( ) const

Array

surface_get_arrays ( int surf_idx ) const

Array

surface_get_blend_shape_arrays ( int surf_idx ) const

Material

surface_get_material ( int surf_idx ) const

void

surface_set_material ( int surf_idx, Material material )

Enumeraciones

enum PrimitiveType:

  • PRIMITIVE_POINTS = 0 --- Renderizar un array como puntos (un vértice es igual a un punto).

  • PRIMITIVE_LINES = 1 --- Renderiza el array como líneas (cada dos vértices se crea una línea).

  • PRIMITIVE_LINE_STRIP = 2 --- Renderiza un array como una tira de líneas.

  • PRIMITIVE_LINE_LOOP = 3 --- Render array as line loop (like line strip, but closed).

  • PRIMITIVE_TRIANGLES = 4 --- Renderizar la matriz como triángulos (cada tres vértices se crea un triángulo).

  • PRIMITIVE_TRIANGLE_STRIP = 5 --- Renderizar un array como tiras de triángulo.

  • PRIMITIVE_TRIANGLE_FAN = 6 --- Render array as triangle fans.


enum BlendShapeMode:

  • BLEND_SHAPE_MODE_NORMALIZED = 0 --- Las formas de la mezcla se normalizan.

  • BLEND_SHAPE_MODE_RELATIVE = 1 --- Las formas de la mezcla son relativas al peso base.


enum ArrayFormat:

  • ARRAY_FORMAT_VERTEX = 1 --- El array de malla contiene vértices. Todas las mallas requieren un array de vértices, así que esto siempre debe estar presente.

  • ARRAY_FORMAT_NORMAL = 2 --- El array de malla contiene normales.

  • ARRAY_FORMAT_TANGENT = 4 --- El array de malla contiene tangentes.

  • ARRAY_FORMAT_COLOR = 8 --- El array de malla contiene colores.

  • ARRAY_FORMAT_TEX_UV = 16 --- El array de malla contiene UVs.

  • ARRAY_FORMAT_TEX_UV2 = 32 --- El array de malla contiene un segundo UV.

  • ARRAY_FORMAT_BONES = 64 --- El array de malla contiene huesos.

  • ARRAY_FORMAT_WEIGHTS = 128 --- El array de malla contiene pesos de huesos.

  • ARRAY_FORMAT_INDEX = 256 --- El array de malla usa índices.

  • ARRAY_COMPRESS_BASE = 9 --- Used internally to calculate other ARRAY_COMPRESS_* enum values. Do not use.

  • ARRAY_COMPRESS_VERTEX = 512 --- Flag used to mark a compressed (half float) vertex array.

  • ARRAY_COMPRESS_NORMAL = 1024 --- Flag utilizada para marcar un array normal comprimido (real).

  • ARRAY_COMPRESS_TANGENT = 2048 --- Flag utilizada para marcar un array tangencial comprimido (real).

  • ARRAY_COMPRESS_COLOR = 4096 --- Flag usada para marcar una array de colores comprimida (real).

  • ARRAY_COMPRESS_TEX_UV = 8192 --- Flag usada para marcar un array de coordenadas UV comprimidas (real).

  • ARRAY_COMPRESS_TEX_UV2 = 16384 --- Flag usada para marcar un array de coordenadas UV comprimidas (real) para las segundas coordenadas UV.

  • ARRAY_COMPRESS_BONES = 32768 --- Flag used to mark a compressed bone array.

  • ARRAY_COMPRESS_WEIGHTS = 65536 --- Flag used to mark a compressed (half float) weight array.

  • ARRAY_COMPRESS_INDEX = 131072 --- Flag usada para marcar un array de índices comprimida.

  • ARRAY_FLAG_USE_2D_VERTICES = 262144 --- Flag usada para marcar que el array contiene vértices 2D.

  • ARRAY_FLAG_USE_16_BIT_BONES = 524288 --- Flag used to mark that the array uses 16-bit bones instead of 8-bit.

  • ARRAY_FLAG_USE_OCTAHEDRAL_COMPRESSION = 2097152 --- Flag used to mark that the array uses an octahedral representation of normal and tangent vectors rather than cartesian.

  • ARRAY_COMPRESS_DEFAULT = 2194432 --- Used to set flags ARRAY_COMPRESS_VERTEX, ARRAY_COMPRESS_NORMAL, ARRAY_COMPRESS_TANGENT, ARRAY_COMPRESS_COLOR, ARRAY_COMPRESS_TEX_UV, ARRAY_COMPRESS_TEX_UV2, ARRAY_COMPRESS_WEIGHTS, and ARRAY_FLAG_USE_OCTAHEDRAL_COMPRESSION quickly.


enum ArrayType:

  • ARRAY_VERTEX = 0 --- Array de vértices.

  • ARRAY_NORMAL = 1 --- Array de normales.

  • ARRAY_TANGENT = 2 --- Array de tangentes como un array de reales, 4 reales por tangente.

  • ARRAY_COLOR = 3 --- Array de colores.

  • ARRAY_TEX_UV = 4 --- Array de coordenadas UV.

  • ARRAY_TEX_UV2 = 5 --- Array de un segundo conjunto de coordenadas UV.

  • ARRAY_BONES = 6 --- Array de datos de los huesos.

  • ARRAY_WEIGHTS = 7 --- Array de pesos.

  • ARRAY_INDEX = 8 --- Array de índices.

  • ARRAY_MAX = 9 --- Representa el tamaño del enum ArrayType.

Descripciones de Propiedades

Default

Vector2( 0, 0 )

Setter

set_lightmap_size_hint(value)

Getter

get_lightmap_size_hint()

Sets a hint to be used for lightmap resolution in BakedLightmap. Overrides BakedLightmap.default_texels_per_unit.

Descripciones de Métodos

  • Shape create_convex_shape ( bool clean=true, bool simplify=false ) const

Calculate a ConvexPolygonShape from the mesh.

If clean is true (default), duplicate and interior vertices are removed automatically. You can set it to false to make the process faster if not needed.

If simplify is true, the geometry can be further simplified to reduce the amount of vertices. Disabled by default.


Calcular una malla de contorno en un desplazamiento definido (margen) de la malla original.

Nota: Este método típicamente devuelve los vértices en orden inverso (por ejemplo, de derecha a izquierda).


  • Shape create_trimesh_shape ( ) const

Calculate a ConcavePolygonShape from the mesh.


Genera un TriangleMesh desde la malla.


  • AABB get_aabb ( ) const

Returns the smallest AABB enclosing this mesh in local space. Not affected by custom_aabb. See also VisualInstance.get_transformed_aabb.

Note: This is only implemented for ArrayMesh and PrimitiveMesh.


Devuelve todos los vértices que forman las caras de la malla. Cada tres vértices representan un triángulo.


  • int get_surface_count ( ) const

Devuelve la cantidad de superficies que la Mesh sostiene.


  • Array surface_get_arrays ( int surf_idx ) const

Devuelve los arrays para los vértices, normales, uvs, etc. que conforman la superficie solicitada (ver ArrayMesh.add_surface_from_arrays).


  • Array surface_get_blend_shape_arrays ( int surf_idx ) const

Devuelve los arrays de formas de mezcla para la superficie solicitada.


Devuelve un Material en una superficie determinada. La superficie se renderiza usando este material.


  • void surface_set_material ( int surf_idx, Material material )

Establece un Material para una superficie determinada. La superficie se renderizará usando este material.