import { type Cs2GeneratedMesh, type Cs2RoadPieces } from '../roadPieces'; import type { Cs2CompositionParameters, Cs2CompositionPart } from '../types'; /** 14 x 14 cells over Granit's 14,336 m world, on the same origin as the 4 m terrain grid. */ export declare const CS2_CELL_SIZE_METRES = 1024; /** Above this the composition is a bridge deck, an overpass or elevated rail rather than a kerb. */ export declare const CS2_ELEVATED_STRUCTURE_METRES = 6; /** Nodes resolve no generated mesh on Granit, but the reference walks all three parts and so does this. */ export declare const CS2_COMPOSITION_PARTS: readonly ["edge", "startNode", "endNode"]; /** The 12-float transform, eight 4x4 curve matrices and four sync vectors of one instance. */ export declare const COMPOSITION_PARAMETER_FLOATS = 156; export type Cs2RoadFamily = 'road' | 'structure' | 'gravel' | 'sidewalk' | 'parking' | 'track' | 'grass'; /** * The generated library's marker slot. A Marker composition (the game's invisible nets: the car, road, pedestrian and harbour paths * through lots and buildings, airplane taxiways and runways) draws only in the game's marker view, as a box over its path: 2 m tall * for a path, 30 m for an airplane lane. Every marker composition carries this slot and nothing else, and no other composition * carries it (Pacifica and Leonida: the same 20 meshes). Baked as a road (the unknown-slot default), Pacifica's port airport became * a 60 m wide, 30 m tall asphalt plateau with kerb walls standing over the harbour, a dark slab with a ruled top from the quay * (owner check 10, pose 22), and each of some 38,000 invisible paths a 2 m kerbed box, colliders included. The bake leaves it out. */ export declare const CS2_MARKER_SLOT = 10; /** A slot the game never draws outside its marker view (`CS2_MARKER_SLOT`). */ export declare function isMarkerSlot(slot: number): boolean; /** * Landmark bridges whose own steel (the truss, the deck sides, the cables: the composition slots the generated library does not * know) is painted, sRGB. The roads leave those triangles out and the landmark layer (`src/cs2/landmarks.ts`) draws them in this * colour, eagerly, beside the bridge's own towers: a named landmark has to read from across the bay, far past the stream radius. * Golden Gate: International Orange. TrussArchBridge03: the game's sage-green arch (Pacifica's SE rail bridge, pacifica-cs2-ref 27: * its lit steel reads (144, 158, 126) on screen where the restyled road drew the slot as pale kerb and concrete). Its composition is * slot 9 (the track bed, which stays) and slot 39 (arch, truss, hangers and deck sides). */ export declare const CS2_PAINTED_BRIDGES: ReadonlyMap; /** A slot of a painted bridge's composition that is its own steel rather than a road surface or concrete. */ export declare function isBridgeSteelSlot(slot: number): boolean; export declare const CS2_FAMILY_TILE_METRES: Readonly>; export declare const CS2_FAMILY_ROUGHNESS: Readonly>; /** Only reached by a slot that ships no `_BaseColorMap`: the reference renderer's typed palette, sRGB hex. */ export declare const CS2_FAMILY_COLOUR: Readonly>; /** What a player stands or drives on. Structure joins per instance, and only below the elevated threshold. */ export declare const CS2_COLLIDER_FAMILIES: ReadonlySet; /** What lane paint is seated on: the carriageway and the bays that carry their own markings, never a kerb or a path. */ export declare const CS2_MARKING_SEAT_FAMILIES: ReadonlySet; export interface Cs2RoadInstance { compositionEntityId: number; /** Packed rather than kept as objects: 16,842 instances of nested arrays are not free. */ parameters: Float32Array; /** Which of the edge's three parts this is: the node parts take the sync remap progressively along t. */ part: Cs2CompositionPart; cx: number; cz: number; elevated: boolean; /** The edge is a painted landmark bridge (`CS2_PAINTED_BRIDGES`), named here: its steel slots are drawn by the landmark layer, not here. */ paintedBridge?: string; } export interface Cs2RoadInstanceWalk { instances: Cs2RoadInstance[]; /** Elements of `edges[]`, which is not the bundle's own `source.edgeCount`. */ edges: number; /** Compositions whose centre lies outside the cell grid, left out of every cell. */ outsideGrid: number; /** Marker compositions (`CS2_MARKER_SLOT`), which the game does not draw: left out of every cell. */ markers: number; } /** The cell grid every layer buckets into: the terrain grid's origin and extent in whole cells. */ export interface Cs2CellOptions { cellSizeM: number; originX: number; originZ: number; cellsX: number; cellsZ: number; } export interface Cs2RoadInstanceOptions extends Cs2CellOptions { /** Subtracted from every CS2 Y before anything is compared against the terrain. */ seaLevelMetres: number; terrainHeightAt(x: number, z: number): number; elevatedMetres?: number; /** `roads-v2.json`'s `prefabNames`, which name the painted bridges; without it no edge is one. */ prefabNames?: readonly string[]; } export interface Cs2SlotUv { /** `source` keeps the cross-section uv0 the CS2 material samples with; `worldXZ` projects at `tileMetres`. */ mode: 'source' | 'worldXZ'; tileMetres: number; } export interface Cs2RoadSlotGeometry { slot: number; family: Cs2RoadFamily; positions: Float32Array; normals: Float32Array; uvs: Float32Array; indices: Uint32Array; } export interface Cs2RoadCellGeometry { slots: Cs2RoadSlotGeometry[]; collider: { positions: Float32Array; indices: Uint32Array; }; trianglesByFamily: Map; } export interface Cs2RoadCellOptions { seaLevelMetres: number; terrainHeightAt(x: number, z: number): number; slotUv(slot: number): Cs2SlotUv; /** * Some compositions (Leonida's Small Road) draw the sidewalk in the carriageway's own slot, 0.2 m above it, so the slot says * nothing about what a triangle is. With this on, the top faces of slot 0 that sit `SIDEWALK_RAISE_M` or more above the * composition's lowest level are baked as the sidewalk slot (`SIDEWALK_SLOT`), and everything downstream (surface kind, * paint seating, colliders, the tree mask) reads them as sidewalk. */ sidewalkFromElevation?: boolean; /** * Default true: the reference renderer's rigid per-composition shift onto the terrain. Off when the terrain is * conformed to the roads instead — the shift is then not only redundant but harmful, since each piece meeting at a * node takes its own median and the decks step against each other by whatever their medians differ. */ shiftToTerrain?: boolean; } export declare function roadSlotFamily(slot: number): Cs2RoadFamily; export declare function cellIndexAt(value: number, origin: number, sizeMetres: number): number; /** The cell a point falls in, or null outside the grid: an out-of-map stub has no legal Scene id or bundle path. */ export declare function cellAt(x: number, z: number, options: Cs2CellOptions): { cx: number; cz: number; } | null; export declare function cellKey(cx: number, cz: number): string; /** * Walks `edges[]` exactly once — the file is 84 MB and re-scanning it per instance is the one thing this layer must * not do — and resolves every composition part that has both a deformation payload and a mesh. */ export declare function collectCs2RoadInstances(bundleRoot: string, pieces: Cs2RoadPieces, options: Cs2RoadInstanceOptions): Promise; /** * Deforms every instance of one cell once, conforms it, and splits it into one buffer per material slot. The datum * correction belongs to the whole composition, so a road surface and the kerb beside it always move together. */ export declare function bakeCs2RoadCell(instances: readonly Cs2RoadInstance[], pieces: Cs2RoadPieces, options: Cs2RoadCellOptions): Cs2RoadCellGeometry; /** * The steel of every painted landmark bridge instance (`paintedBridge`, `isBridgeSteelSlot`), deformed exactly as the road bake * deforms the rest of the composition (same datum, no terrain shift: the decks keep CS2's heights), in world space. This is the * geometry `bakeCs2RoadCell` leaves out; the landmark layer draws it, one paint per bridge (`bridge` keeps one bridge's steel). */ export declare function bridgeSteelGeometry(instances: readonly Cs2RoadInstance[], pieces: Cs2RoadPieces, seaLevelMetres: number, bridge?: string): { positions: Float32Array; indices: Uint32Array; }; /** The mirrored world-XZ extent of a composition's control points, which is what buckets it into a cell. */ export declare function compositionBounds(parameters: Cs2CompositionParameters): { minX: number; maxX: number; minZ: number; maxZ: number; }; /** The mean control point in world space, still on the CS2 height datum: what the elevated test measures from. */ export declare function compositionMean(parameters: Cs2CompositionParameters): [number, number, number]; export declare function validCompositionParameters(parameters: Cs2CompositionParameters): boolean; export declare function packCompositionParameters(parameters: Cs2CompositionParameters): Float32Array; export declare function unpackCompositionParameters(packed: Float32Array): Cs2CompositionParameters; /** The slot a raised sidewalk top in the carriageway's slot is baked as (the sidewalk family's own). */ export declare const SIDEWALK_SLOT = 7; /** A top face this far above the composition's lowest carriageway level is a sidewalk (the base game's kerb height is 0.2). */ export declare const SIDEWALK_RAISE_M = 0.12; /** Slot 0's raised top faces move to the sidewalk slot; every other range passes through untouched. */ export declare function splitRaisedSidewalk(mesh: Cs2GeneratedMesh, deformed: { positions: Float32Array; normals: Float32Array; indices: Uint32Array; }, ranges: ReadonlyArray<{ materialIndex: number; startIndex: number; indexCount: number; }>): Array<{ materialIndex: number; startIndex: number; indexCount: number; deformed: typeof deformed; }>;