import { type Cs2CompositionParameters, type Cs2GeneratedCompositionManifest, type Cs2GeneratedMeshRecord } from './types'; export declare const GENERATED_VERTEX_STRIDE = 32; /** Ground compositions cluster this close to the terrain; anything farther is deliberate structure (bridges, tunnels). */ export declare const TERRAIN_CONFORMANCE_LIMIT_METRES = 1.25; export declare const TERRAIN_CONFORMANCE_LIFT_METRES = 0.035; export interface Cs2GeneratedMesh { record: Cs2GeneratedMeshRecord; bytes: DataView; indices: Uint32Array; } export interface Cs2RoadPieces { manifest: Cs2GeneratedCompositionManifest; meshes: Cs2GeneratedMesh[]; /** Every composition entity id a `roads-v2.json` `compositionRefs` can name, mapped to the mesh that draws it. */ byCompositionEntityId: Map; } export interface Cs2GeneratedVertex { /** Curve-space lateral coordinate, before the sync remap. */ lateral: number; /** Metres, added to Y. */ elevation: number; t: number; normal: [number, number, number]; packedTangent: number; /** Indices into `matrices`, NOT colour. */ colourA: number; colourB: number; /** Low 3 bits pick the sync pair. */ flags: number; uv: [number, number]; } export interface Cs2DeformedInstance { positions: Float32Array; normals: Float32Array; /** Triangles are reversed relative to the source: this layer alone ships source winding under a Z mirror. */ indices: Uint32Array; } export interface Cs2TerrainConformance { medianMetres: number; shiftMetres: number; applied: boolean; } /** Reads `road-pieces/road-composition-generated.json` and its interleaved bin. */ export declare function readCs2RoadPieces(root: string): Promise; /** One vertex of the 32-byte interleaved layout. */ export declare function decodeVertex(mesh: Cs2GeneratedMesh, vertex: number): Cs2GeneratedVertex; /** * Evaluates one instance of a generated composition: the two curve matrices the vertex names, the sync remap, then the * single Z mirror this layer still needs. The mirror flips handedness, so every triangle comes back as (a, c, b). * * A node piece of a one-way or asymmetric composition ships its two halves as strips that stop short of the middle * (e.g. lateral 0..0.56 and 0.44..1 of the full width) and bridges the rest onto the middle curve. Taken literally the * bridge runs straight from the strip's inner edge to the node centre and cuts across the corner point the neighbouring * piece meets, leaving a sliver of ground at every such junction (214 across Granit). Each strip is therefore stretched * so its inner edge lands on its inner curve (1 or 2), the layout the full-span strips of symmetric pieces already have. * * On a NODE piece (`options.nodePiece`) the sync remap is applied progressively along the piece: identity at t = 0, * where the piece continues the edge piece's own lane and kerb columns, full at t = 1, where the targets make it meet * the neighbouring pieces. Applied at full strength from t = 0 the node's kerb line jogs 0.4–1.8 m against the edge's * at every seam; lerped, the two match to the sample size while the corners still close. */ export interface DeformInstanceOptions { /** A start/end-node part rather than the edge's segment; default false. */ nodePiece?: boolean; } export declare function deformInstance(mesh: Cs2GeneratedMesh, parameters: Cs2CompositionParameters, options?: DeformInstanceOptions): Cs2DeformedInstance; /** * CS2 runs a terrain-adjustment stage after deforming a composition. The per-composition median of (vertexY - terrainY) * corrects the sampling datum without flattening kerbs; a median outside +/-1.25 m is a bridge or a tunnel, left alone. */ export declare function evalTerrainConformance(positions: Float32Array, terrainSampleAt: (x: number, z: number) => number): Cs2TerrainConformance; export interface LateralRange { min: number; max: number; } /** One strip = one (curve A, curve B, sync pair) triple; the key packs the three bytes the vertex carries. */ export declare function stripKey(vertex: Pick): number; /** The source lateral extent of every strip in a mesh, once per mesh: what says whether a strip reaches the middle. */ export declare function stripLateralRanges(mesh: Cs2GeneratedMesh): Map;