import type { HeightGrid } from '../../terrain'; /** Metres the ground is held below the surface it meets: clear of z-fighting, far below a step the capsule would feel. */ export declare const TERRAIN_CONFORM_CLEARANCE_METRES = 0.05; /** Past this the surface is a bridge deck or a tunnel roof rather than a road ON the ground, and the terrain is left alone. */ export declare const TERRAIN_CONFORM_MAX_DEVIATION_METRES = 3; /** Unit normal Y a triangle needs to count as something the ground should meet: decks and sidewalk tops, not kerb faces. */ export declare const TERRAIN_CONFORM_MIN_UP_FACING = 0.7; /** One indexed world-space mesh; the road bake hands its merged collider tier over exactly as it assembled it. */ export interface TerrainConformSurface { positions: Float32Array; indices: Uint32Array; } export interface TerrainConformOptions { /** Default 0.05 m. */ clearanceMetres?: number; /** Default 3 m. */ maxDeviationMetres?: number; /** Default 0.7. */ minUpFacing?: number; /** * Skip the pass that moves the samples under a surface onto it, and only hold the corners of every cell the surface * crosses below it (never raising anything). This is what a COARSER lattice of the same field needs: its cells are 2, 4 * or 8 times wider than the posting the roads were conformed at, so a cell's corners sit beside the road, not under it. */ holdOnly?: boolean; } export interface TerrainConformStats { samplesConformed: number; /** Of the conformed samples, how many ended above and below the height the grid came in with. */ raised: number; lowered: number; /** Conformed samples no surface covers: corners of a cell a surface crosses, held below it so the cell's interpolation stays under. */ widened: number; /** Up-facing and non-degenerate: the triangles the walk actually rasterized. */ trianglesUsed: number; trianglesSkipped: number; } /** * Moves every grid sample under an up-facing surface triangle to `clearanceMetres` below the LOWEST corner of its own * cell, MUTATING `grid.heights`: a sample that took the deck's height at its own point alone would still let the * linear chord to its neighbour cut through a deck that breaks or sags between them. The four corners of every grid * cell a triangle crosses are also held (never raised) below the triangle's lowest point over that cell: the cell's * surface is interpolated from those corners alone, so a deck crossing it without covering a sample — a median gap, a * kerb step, the ground beside a sloped deck — otherwise has the terrain rise through it between the samples. * Order-independent: the minimum is taken across overlapping triangles, and every gate reads the heights as given. */ export declare function conformGridToSurfaces(grid: HeightGrid, surfaces: Iterable, options?: TerrainConformOptions): TerrainConformStats; /** Metres a lookup bucket spans. Road triangles are a couple of metres across, so a bucket holds a handful of them. */ export declare const SURFACE_INDEX_BUCKET_METRES = 8; export interface SurfaceHeightIndexOptions { /** Default 0.7, the conform pass's own threshold. */ minUpFacing?: number; bucketMetres?: number; } export interface SurfaceHeightIndex { /** * The up-facing surface over a world XZ, or null where none covers it. `nearY` picks the covering surface CLOSEST to * it — a viaduct and the street under it both cover the point, and only the caller's own height says which it means. */ heightAt(x: number, z: number, nearY?: number): number | null; triangles: number; } /** A uniform XZ bucket grid over one cell's up-facing surfaces: what lane paint is seated on instead of the terrain. */ export declare function buildSurfaceHeightIndex(surfaces: Iterable, options?: SurfaceHeightIndexOptions): SurfaceHeightIndex;