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.
35 lines (34 loc) • 1.68 kB
TypeScript
import * as THREE from 'three/webgpu';
import type { VirtualMeshSource } from './core/preprocess/buildVirtualMesh.js';
export interface FromGeometryOptions {
/**
* Keep the `uv` attribute. Vertices are then welded by position and UV, so UV seams stay separate vertices
* (the simplifier treats them as seams, not borders). Default: true when the geometry has a `uv` attribute.
*/
uvs?: boolean;
/** Keep the `color` attribute as per-vertex colors (multiplied with the material color). Default: false. */
colors?: boolean;
/**
* 'compute' (default): smooth normals over the position-welded mesh, ignoring the `normal` attribute.
* 'keep': use the geometry's normals; vertices with different normals stay separate, so hard edges stay hard.
*/
normals?: 'compute' | 'keep';
/** Only this range of the index buffer (or of the vertices, for non-indexed geometry), e.g. one of `geometry.groups`. */
range?: {
start: number;
count: number;
};
}
/**
* Weld vertices and produce a `VirtualMeshSource`. By default vertices are welded by position (and UV when the
* geometry has UVs) and get smooth normals, so meshlets share edges. See `FromGeometryOptions`.
*/
export declare function fromBufferGeometry(geometry: THREE.BufferGeometry, options?: FromGeometryOptions): VirtualMeshSource;
/**
* Concatenate several already-welded meshes into one source mesh with per-vertex colors.
* Each part uses its own `colors` if present, otherwise the given flat `color`.
*/
export declare function mergeSources(parts: {
mesh: VirtualMeshSource;
color?: THREE.ColorRepresentation;
}[]): VirtualMeshSource;