InstancedMesh class

Many copies of one Geometry / Material pair, each placed by its own model transform.

Use an InstancedMesh for foliage, crowds, debris, or any scene that holds many copies of the same mesh. Attach it to a node with an InstancedMeshComponent; the whole set is then one render item, one pipeline, and one cull test rather than one node per copy.

Phase 3c carries a per-instance transform only. The naive backend still issues one draw call per instance.

Constructors

InstancedMesh({required Geometry geometry, required Material material})
Creates an instanced mesh that draws geometry shaded by material. It starts with no instances; add them with addInstance.

Properties

geometry Geometry
The geometry drawn for every instance.
final
hashCode int
The hash code for this object.
no setterinherited
instanceCount int
The number of instances.
no setter
material Material
The material every instance is shaded with.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addInstance(Matrix4 transform) int
Adds an instance placed by transform and returns its index.
clearInstances() → void
Removes every instance.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeInstanceAt(int index) → void
Removes the instance at index. Instances after it shift down by one, so their indices change.
setInstanceTransform(int index, Matrix4 transform) → void
Replaces the transform of the instance at index.
toString() String
A string representation of this object.
inherited

Operators

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