SortKey class abstract final

Draw sort keys: one integer per draw, sorted ascending.

An opaque key packs, from most to least significant:

bits field
4 phase (shadow, opaque, sky, transparent, …)
12 pipeline
16 material
12 mesh
8 depth bucket, near first

so draws of one pipeline, material and mesh sit together (and can merge into one instanced draw), front to back inside each group. A transparent key must order back to front first, so it puts the depth bucket straight after the phase: phase, depth, pipeline, material, mesh.

52 bits in all, so a key is exact as a JavaScript number. On the web, Dart's << and | work on 32 bits, so keys are built with multiplication and addition.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

batchOf(int opaqueKey) → int
The pipeline, material and mesh of an opaque key, which decide whether two draws can share one instanced draw.
depthBucket(double viewDepth, double near, double far) → int
Quantises viewDepth between near and far into a bucket, 0 nearest.
opaque({required int phase, required int pipeline, required int material, required int mesh, required int depth}) → int
A key for an opaque (or alpha-tested) draw.
phaseOf(int key) → int
The phase stored in key.
transparent({required int phase, required int depth, required int pipeline, required int material, required int mesh}) → int
A key for a transparent draw, back to front: pass depth with far small and near large (maxDepth - nearFirstBucket).

Constants

maxDepth → const int
Largest depth bucket.
maxMaterial → const int
Largest material index.
maxMesh → const int
Largest mesh index.
maxPhase → const int
Largest phase.
maxPipeline → const int
Largest pipeline index.