Mesh
A Resource
that contains vertex array-based geometry.
class Mesh
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. The maximum number of surfaces per mesh is RenderingServer
maxMeshSurfaces````.
Superclasses
class Resource
Base class for serializable objects.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Types
Type members
Instance members
var lightmapSizeHint: Vector2i
Sets a hint to be used for lightmap resolution.
func createConvexShape(clean: Bool, simplify: Bool
) -> ConvexPolygonShape3D? Calculate a
ConvexPolygonShape3D
from the mesh.func createOutline(margin: Double
) -> Mesh? Calculate an outline mesh at a defined offset (margin) from the original mesh.
func createPlaceholder(
) -> Resource? Creates a placeholder version of this resource (
PlaceholderMesh
).func createTrimeshShape(
) -> ConcavePolygonShape3D? Calculate a
ConcavePolygonShape3D
from the mesh.func generateTriangleMesh(
) -> TriangleMesh? Generate a
TriangleMesh
from the mesh. Considers only surfaces using one of these primitive types: .primitiveTriangles, .primitiveTriangleStrip.func getAabb(
) -> AABB Returns the smallest
AABB
enclosing this mesh in local space. Not affected bycustom_aabb
.func getFaces(
) -> PackedVector3Array Returns all the vertices that make up the faces of the mesh. Each three vertices represent one triangle.
func getSurfaceCount(
) -> Int32 Returns the number of surfaces that the
Mesh
holds. This is equivalent togetSurfaceOverrideMaterialCount
.func surfaceGetArrays(surfIdx: Int32
) -> GArray Returns the arrays for the vertices, normals, UVs, etc. that make up the requested surface (see
addSurfaceFromArrays(primitive:arrays:blendShapes:lods:flags:)
).func surfaceGetBlendShapeArrays(surfIdx: Int32
) -> VariantCollection<GArray> Returns the blend shape arrays for the requested surface.
func surfaceGetMaterial(surfIdx: Int32
) -> Material? Returns a
Material
in a given surface. Surface is rendered using this material.func surfaceSetMaterial(surfIdx: Int32, material: Material?
) Sets a
Material
for a given surface. Surface will be rendered using this material.
Show implementation details (14)
Hide implementation details
func _getAabb(
) -> AABB Virtual method to override the
AABB
for a custom class extendingMesh
.func _getBlendShapeCount(
) -> Int32 Virtual method to override the number of blend shapes for a custom class extending
Mesh
.func _getBlendShapeName(index: Int32
) -> StringName Virtual method to override the retrieval of blend shape names for a custom class extending
Mesh
.func _getSurfaceCount(
) -> Int32 Virtual method to override the surface count for a custom class extending
Mesh
.func _setBlendShapeName(index: Int32, name: StringName
) Virtual method to override the names of blend shapes for a custom class extending
Mesh
.func _surfaceGetArrayIndexLen(index: Int32
) -> Int32 Virtual method to override the surface array index length for a custom class extending
Mesh
.func _surfaceGetArrayLen(index: Int32
) -> Int32 Virtual method to override the surface array length for a custom class extending
Mesh
.func _surfaceGetArrays(index: Int32
) -> GArray Virtual method to override the surface arrays for a custom class extending
Mesh
.func _surfaceGetBlendShapeArrays(index: Int32
) -> VariantCollection<GArray> Virtual method to override the blend shape arrays for a custom class extending
Mesh
.func _surfaceGetFormat(index: Int32
) -> UInt32 Virtual method to override the surface format for a custom class extending
Mesh
.func _surfaceGetLods(index: Int32
) -> GDictionary Virtual method to override the surface LODs for a custom class extending
Mesh
.func _surfaceGetMaterial(index: Int32
) -> Material? Virtual method to override the surface material for a custom class extending
Mesh
.func _surfaceGetPrimitiveType(index: Int32
) -> UInt32 Virtual method to override the surface primitive type for a custom class extending
Mesh
.func _surfaceSetMaterial(index: Int32, material: Material?
) Virtual method to override the setting of a
material
at the givenindex
for a custom class extendingMesh
.
Subclasses
class ArrayMesh
Mesh
type that provides utility for constructing a surface from arrays.class ImmediateMesh
Mesh optimized for creating geometry manually.
class PlaceholderMesh
Placeholder class for a mesh.
class PrimitiveMesh
Base class for all primitive meshes. Handles applying a
Material
to a primitive mesh.