ImmediateMesh
Mesh optimized for creating geometry manually.
ImmediateMesh.swift:16class ImmediateMesh
A mesh type optimized for creating geometry manually, similar to OpenGL 1.x immediate mode.
Here’s a sample on how to generate a triangular face:
Superclasses
class Mesh
A
Resource
that contains vertex array-based geometry.
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.
Type members
Instance members
func clearSurfaces(
) Clear all surfaces.
func surfaceAddVertex(Vector3
) Add a 3D vertex using the current attributes previously set.
func surfaceAddVertex2d(vertex: Vector2
) Add a 2D vertex using the current attributes previously set.
func surfaceBegin(primitive: Mesh.PrimitiveType, material: Material?
) Begin a new surface.
func surfaceEnd(
) End and commit current surface. Note that surface being created will not be visible until this function is called.
func surfaceSetColor(Color
) Set the color attribute that will be pushed with the next vertex.
func surfaceSetNormal(Vector3
) Set the normal attribute that will be pushed with the next vertex.
func surfaceSetTangent(Plane
) Set the tangent attribute that will be pushed with the next vertex.
func surfaceSetUv(Vector2
) Set the UV attribute that will be pushed with the next vertex.
func surfaceSetUv2(Vector2
) Set the UV2 attribute that will be pushed with the next vertex.