MeshClusters class final

A mesh's index buffer read as consecutive runs of triangles, each with a box and a cone of normals — C9, for the scan or the CAD part too big to draw whole every frame.

Runs of the buffer rather than lists of triangles. The clusters tile the indices in order: cluster i is [firstIndex(i), firstIndex(i + 1)), and the last one ends at the end. The splitter reorders the triangles so that is true, and nothing else about the mesh changes. So a reader that knows nothing of clusters — an older .f3d build, the glTF writer, the shadow pass — draws the whole buffer and gets the whole mesh, and the scene pass draws a subset by concatenating runs rather than by gathering triangles.

Culled in the mesh's own space. Whether a triangle faces away from the eye is the sign of a volume, and an affine transform keeps that sign or flips all of them — which the renderer answers by flipping the winding it draws with. So the eye is carried into the mesh instead of every cone out of it, and a node scaled unevenly needs no wider cone.

Constructors

MeshClusters({required Uint32List firstIndices, required Float32List data})
Adopts firstIndices (one more entry than there are clusters, starting at zero and ending at the index count) and data (floatsPerCluster per cluster, see measure).

Properties

data → Float32List
floatsPerCluster floats per cluster.
final
firstIndices → Uint32List
Where each run starts in the index buffer, plus where the last one ends.
final
hashCode → int
The hash code for this object.
no setterinherited
indexCount → int
The index count the runs tile: the mesh this table belongs to has exactly this many indices.
no setter
length → int
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

boundsInto(int cluster, Aabb3 out) → void
Writes cluster cluster's box, in the mesh's space, into out.
facesAwayFrom(int cluster, double x, double y, double z) → bool
Whether every triangle of cluster faces away from an eye at (x, y, z) in the mesh's space.
firstIndex(int cluster) → int
indexCountOf(int cluster) → int
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

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

Static Methods

measure({required VertexLayout layout, required Float32List vertices, required Uint32List indices, required Uint32List firstIndices}) → MeshClusters
The table for indices over the positions in vertices (laid out by layout), cut at firstIndices.

Constants

coneMargin → const double
How much wider than the widest normal each cone is made, in radians.
floatsPerCluster → const int
The minimum and maximum corners of the box, the cone's unit axis, and the cosine and sine of its half-angle.