ArrayMesh

Inherits: Mesh < Resource < Reference < Object

Category: Core

Brief Description

Member Functions

void add_blend_shape ( String name )
void add_surface_from_arrays ( PrimitiveType primitive, Array arrays, Array blend_shapes=[ ], int compress_flags=97792 )
void center_geometry ( )
void clear_blend_shapes ( )
int get_blend_shape_count ( ) const
String get_blend_shape_name ( int index ) const
int get_surface_count ( ) const
Error lightmap_unwrap ( Transform arg0, float arg1 )
void regen_normalmaps ( )
int surface_get_array_index_len ( int surf_idx ) const
int surface_get_array_len ( int surf_idx ) const
Array surface_get_arrays ( int surf_idx ) const
Array surface_get_blend_shape_arrays ( int surf_idx ) const
int surface_get_format ( int surf_idx ) const
Material surface_get_material ( int surf_idx ) const
String surface_get_name ( int surf_idx ) const
PrimitiveType surface_get_primitive_type ( int surf_idx ) const
void surface_remove ( int surf_idx )
void surface_set_material ( int surf_idx, Material material )
void surface_set_name ( int surf_idx, String name )
void surface_update_region ( int surf_idx, int offset, PoolByteArray data )

Member Variables

Numeric Constants

  • NO_INDEX_ARRAY = -1 — Default value used for index_array_len when no indices are present.
  • ARRAY_WEIGHTS_SIZE = 4 — Amount of weights/bone indices per vertex (always 4).

Enums

enum ArrayFormat

  • ARRAY_FORMAT_VERTEX = 1 — Array format will include vertices (mandatory).
  • ARRAY_FORMAT_NORMAL = 2 — Array format will include normals
  • ARRAY_FORMAT_TANGENT = 4 — Array format will include tangents
  • ARRAY_FORMAT_COLOR = 8 — Array format will include a color array.
  • ARRAY_FORMAT_TEX_UV = 16 — Array format will include UVs.
  • ARRAY_FORMAT_TEX_UV2 = 32 — Array format will include another set of UVs.
  • ARRAY_FORMAT_BONES = 64 — Array format will include bone indices.
  • ARRAY_FORMAT_WEIGHTS = 128 — Array format will include bone weights.
  • ARRAY_FORMAT_INDEX = 256 — Index array will be used.

enum ArrayType

  • ARRAY_VERTEX = 0 — Vertex array (array of Vector3 vertices).
  • ARRAY_NORMAL = 1 — Normal array (array of Vector3 normals).
  • 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.
  • ARRAY_COLOR = 3 — Vertex array (array of Color colors).
  • ARRAY_TEX_UV = 4 — UV array (array of Vector3 UVs or float array of groups of 2 floats (u,v)).
  • ARRAY_TEX_UV2 = 5 — Second UV array (array of Vector3 UVs or float array of groups of 2 floats (u,v)).
  • ARRAY_BONES = 6 — Array of bone indices, as a float array. Each element in groups of 4 floats.
  • ARRAY_WEIGHTS = 7 — Array of bone weights, as a float array. Each element in groups of 4 floats.
  • ARRAY_INDEX = 8Array 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

Member Function Description

  • void add_blend_shape ( String name )

Creates a new surface.

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 Mesh for details. (As a note, when using indices, it is recommended to only use points, lines or triangles). get_surface_count will become the surf_idx for this new surface.

The arrays argument is an array of arrays. See 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.

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.

Godot uses clockwise winding order for front faces of triangle primitive modes.

  • void center_geometry ( )
  • void clear_blend_shapes ( )
  • int get_blend_shape_count ( ) const
  • String get_blend_shape_name ( int index ) const
  • int get_surface_count ( ) const

Return the amount of surfaces that the ArrayMesh holds.

  • void regen_normalmaps ( )
  • int surface_get_array_index_len ( int surf_idx ) const

Return the length in indices of the index array in the requested surface (see add_surface_from_arrays).

  • int surface_get_array_len ( int surf_idx ) const

Return the length in vertices of the vertex array in the requested surface (see add_surface_from_arrays).

  • Array surface_get_arrays ( int surf_idx ) const
  • Array surface_get_blend_shape_arrays ( int surf_idx ) const
  • int surface_get_format ( int surf_idx ) const

Return the format mask of the requested surface (see add_surface_from_arrays).

Return a Material in a given surface. Surface is rendered using this material.

  • String surface_get_name ( int surf_idx ) const

Return the primitive type of the requested surface (see add_surface_from_arrays).

  • void surface_remove ( int surf_idx )

Remove a surface at position surf_idx, shifting greater surfaces one surf_idx slot down.

  • void surface_set_material ( int surf_idx, Material material )
  • void surface_set_name ( int surf_idx, String name )

Set a Material for a given surface. Surface will be rendered using this material.