three-virtual-geometry
Version:
Virtual geometry for three.js WebGPU: automatic cluster LOD and GPU-driven culling for billions of triangles. Independent implementation, not affiliated with Epic Games.
17 lines (16 loc) • 909 B
TypeScript
/**
* Groups meshlets into clusters of ~`groupSize` that share as many boundary
* edges as possible. This stands in for METIS (the graph partitioner nanite-webgpu uses):
* a greedy region-growing pass over the meshlet adjacency graph, seeded in
* Morton order so groups stay spatially compact. Meshlets without enough
* neighbours (e.g. disconnected leaves or grass blades) are then merged with
* spatially close leftovers so they can still be simplified together.
*/
export interface PartitionInput {
/** Boundary edge keys (position-welded vertex ids, see `edgeKey`). */
boundaryEdges: number[];
center: [number, number, number];
}
export declare function partitionMeshlets(meshlets: PartitionInput[], groupSize: number): number[][];
/** Indices sorted along a 30-bit Morton curve of the given points. */
export declare function mortonOrder(points: [number, number, number][]): number[];