InstanceBatch class final
Many copies of one primitive in one material, drawn in one call: grass, rocks, tiles, a fence's posts. Unlike MeshInstances, which the renderer culls and packs one by one each frame, a batch is culled as a whole by its bounds and keeps its instances on the GPU between frames, uploaded again only when they change (setInstances).
Opaque materials only: a batch is never sorted back to front.
Constructors
- InstanceBatch(GpuPrimitive primitive, GpuMaterial material)
-
primitiveinmaterial, with no instances yet.
Properties
- bounds → Aabb3
-
Every instance's bounds together, in the world.
final
- buffer ↔ GpuBuffer?
-
Where the renderer keeps the uploaded data, and of which revision.
getter/setter pair
- castShadows ↔ bool
-
Casts shadows.
getter/setter pair
- count → int
-
Instances held.
no setter
- data → Float32List
-
The instances' data, kBatchInstanceFloats floats each.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- material ↔ GpuMaterial
-
How each instance looks.
getter/setter pair
- maxDistance ↔ double
-
Not drawn when its bounds are further than this from the camera, in
metres: small things far away (the grass of the next field).
getter/setter pair
- primitive ↔ GpuPrimitive
-
What each instance draws.
getter/setter pair
- revision → int
-
Bumped by every setInstances: the renderer uploads again when it
differs from what it last uploaded.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- uploaded ↔ int
-
getter/setter pair
- visible ↔ bool
-
Drawn at all.
getter/setter pair
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setInstances(
List< Matrix4> worlds) → void -
Replaces the instances with one at each of
worlds(world from local), and their bounds with what primitive's bounds become there. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
writeInstance(
Float32List out, int o, Matrix4 m) → void -
Writes
mand its normal matrix (the inverse transpose of its upper 3×3) intooutato: one instance's kBatchInstanceFloats floats.