Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

Mesh

Inherits: Resource < RefCounted < Object

Inherited By: ArrayMesh, ImmediateMesh, PlaceholderMesh, PrimitiveMesh

A Resource that contains vertex array-based geometry.

Description

Mesh is a type of Resource that contains vertex array-based geometry, divided in surfaces. Each surface contains a completely separate array and a material used to draw it. Design wise, a mesh with multiple surfaces is preferred to a single surface, because objects created in 3D editing software commonly contain multiple materials.

Tutorials

Properties

Vector2i

lightmap_size_hint

Vector2i(0, 0)

Methods

AABB

_get_aabb ( ) virtual const

int

_get_blend_shape_count ( ) virtual const

StringName

_get_blend_shape_name ( int index ) virtual const

int

_get_surface_count ( ) virtual const

void

_set_blend_shape_name ( int index, StringName name ) virtual

int

_surface_get_array_index_len ( int index ) virtual const

int

_surface_get_array_len ( int index ) virtual const

Array

_surface_get_arrays ( int index ) virtual const

Array[]

_surface_get_blend_shape_arrays ( int index ) virtual const

int

_surface_get_format ( int index ) virtual const

Dictionary

_surface_get_lods ( int index ) virtual const

Material

_surface_get_material ( int index ) virtual const

int

_surface_get_primitive_type ( int index ) virtual const

void

_surface_set_material ( int index, Material material ) virtual

ConvexPolygonShape3D

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

Mesh

create_outline ( float margin ) const

Resource

create_placeholder ( ) const

ConcavePolygonShape3D

create_trimesh_shape ( ) const

TriangleMesh

generate_triangle_mesh ( ) const

AABB

get_aabb ( ) const

PackedVector3Array

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 )


Enumerations

enum PrimitiveType:

PrimitiveType PRIMITIVE_POINTS = 0

Render array as points (one vertex equals one point).

PrimitiveType PRIMITIVE_LINES = 1

Render array as lines (every two vertices a line is created).

PrimitiveType PRIMITIVE_LINE_STRIP = 2

Render array as line strip.

PrimitiveType PRIMITIVE_TRIANGLES = 3

Render array as triangles (every three vertices a triangle is created).

PrimitiveType PRIMITIVE_TRIANGLE_STRIP = 4

Render array as triangle strips.


enum ArrayType:

ArrayType ARRAY_VERTEX = 0

PackedVector3Array, PackedVector2Array, or Array of vertex positions.

ArrayType ARRAY_NORMAL = 1

PackedVector3Array of vertex normals.

ArrayType ARRAY_TANGENT = 2

PackedFloat32Array 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.

ArrayType ARRAY_COLOR = 3

PackedColorArray of vertex colors.

ArrayType ARRAY_TEX_UV = 4

PackedVector2Array for UV coordinates.

ArrayType ARRAY_TEX_UV2 = 5

PackedVector2Array for second UV coordinates.

ArrayType ARRAY_CUSTOM0 = 6

Contains custom color channel 0. PackedByteArray if (format >> Mesh.ARRAY_FORMAT_CUSTOM0_SHIFT) & Mesh.ARRAY_FORMAT_CUSTOM_MASK is ARRAY_CUSTOM_RGBA8_UNORM, ARRAY_CUSTOM_RGBA8_UNORM, ARRAY_CUSTOM_RG_HALF or ARRAY_CUSTOM_RGBA_HALF. PackedFloat32Array otherwise.

ArrayType ARRAY_CUSTOM1 = 7

Contains custom color channel 1. PackedByteArray if (format >> Mesh.ARRAY_FORMAT_CUSTOM1_SHIFT) & Mesh.ARRAY_FORMAT_CUSTOM_MASK is ARRAY_CUSTOM_RGBA8_UNORM, ARRAY_CUSTOM_RGBA8_UNORM, ARRAY_CUSTOM_RG_HALF or ARRAY_CUSTOM_RGBA_HALF. PackedFloat32Array otherwise.

ArrayType ARRAY_CUSTOM2 = 8

Contains custom color channel 2. PackedByteArray if (format >> Mesh.ARRAY_FORMAT_CUSTOM2_SHIFT) & Mesh.ARRAY_FORMAT_CUSTOM_MASK is ARRAY_CUSTOM_RGBA8_UNORM, ARRAY_CUSTOM_RGBA8_UNORM, ARRAY_CUSTOM_RG_HALF or ARRAY_CUSTOM_RGBA_HALF. PackedFloat32Array otherwise.

ArrayType ARRAY_CUSTOM3 = 9

Contains custom color channel 3. PackedByteArray if (format >> Mesh.ARRAY_FORMAT_CUSTOM3_SHIFT) & Mesh.ARRAY_FORMAT_CUSTOM_MASK is ARRAY_CUSTOM_RGBA8_UNORM, ARRAY_CUSTOM_RGBA8_UNORM, ARRAY_CUSTOM_RG_HALF or ARRAY_CUSTOM_RGBA_HALF. PackedFloat32Array otherwise.

ArrayType ARRAY_BONES = 10

PackedFloat32Array or PackedInt32Array of bone indices. Contains either 4 or 8 numbers per vertex depending on the presence of the ARRAY_FLAG_USE_8_BONE_WEIGHTS flag.

ArrayType ARRAY_WEIGHTS = 11

PackedFloat32Array or PackedFloat64Array of bone weights in the range 0.0 to 1.0 (inclusive). Contains either 4 or 8 numbers per vertex depending on the presence of the ARRAY_FLAG_USE_8_BONE_WEIGHTS flag.

ArrayType ARRAY_INDEX = 12