MeshData class final

CPU-side geometry: interleaved vertices plus indices.

This layer deliberately knows nothing about any graphics backend, which keeps it testable without a GPU and portable to another backend.

Available extensions

Constructors

MeshData({required VertexLayout layout, required Float32List vertices, required Uint32List indices, List<MorphTarget> morphTargets = const <MorphTarget>[]})

Properties

fitsIn16BitIndices → bool
no setter
hashCode → int
The hash code for this object.
no setterinherited
indexCount → int
no setter
indices → Uint32List
Indices are always 32-bit on the CPU side; narrowing to 16 bit happens only when packing for the GPU.
final
layout → VertexLayout
final
morphTargets → List<MorphTarget>
Shapes this mesh can be blended towards. Empty for almost every mesh.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
triangleCount → int
no setter
vertexBytes → ByteData
no setter
vertexCount → int
no setter
vertices → Float32List
final

Methods

computeBounds() → Aabb3
convertedTo(VertexLayout target) → MeshData
A copy in a different vertex layout.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
packIndices() → PackedIndices
Prepares indices for upload. Uses 16 bit wherever possible: half the bandwidth and memory, and primitives never exceed 65536 vertices.
positionAt(int index, [Vector3? out]) → Vector3
Reads a vertex position. Passing out avoids allocating in hot loops: in Dart every Vector3 is a heap object, and on large meshes GC pauses eat the frame budget faster than draw calls do.
signedVolume() → double
Signed volume of the mesh.
toString() → String
A string representation of this object.
override
transformed(Matrix4 matrix) → MeshData
A transformed copy. Normals use the inverse-transpose, otherwise non-uniform scale skews them.
withGeneratedTangents({VertexLayout? target}) → MeshData

Available on MeshData, provided by the MeshTangents extension

A copy with per-vertex tangents derived from the UV parametrization.
withMorphTargets(List<MorphTarget> targets) → MeshData
Whether anything can deform this mesh.

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

merge(List<MeshData> parts) → MeshData
Concatenates meshes that share a layout, rebasing indices.