Builtin Library
- ..
- README.md758 B
- bindings.yaml1.3 KB
- shader.wgsl3.5 KB
README.md
terrain_index
Writes one node's triangles into the terrain's shared index buffer. One thread per quad, six indices each.
The node's vertices live at vertexSlot in the vertex pool and its triangles
land at writeSlot in the index buffer. Keeping the two apart is what makes a
cut change cheap: a node that survives a cut keeps its vertex slot, so a cut
that only adds, drops or reorders nodes rewrites indices without re-meshing a
vertex, and re-meshing a node for a moved camera rewrites vertices without
touching an index.
The active cut's indices are written as one contiguous run from index 0, so the whole terrain — every node, at every level — draws as a single indexed draw.
Winding is CCW seen from +Y, the outward side of a heightfield.