import { type Cs2RoadBins, type Cs2RoadCurve } from '../roads'; import { type Cs2CellOptions } from './roadBake'; export declare const CS2_MARKING_SEGMENTS = 6; export declare const CS2_MARKING_LIFT_METRES = 0.12; /** Paint seated on a baked deck needs no terrain clearance, only enough to stay off it. */ export declare const CS2_MARKING_ROAD_LIFT_METRES = 0.03; /** How far a deck may sit from the lane's own authored height and still be the deck it belongs to. */ export declare const CS2_MARKING_SEAT_REACH_METRES = 2; export declare const CS2_MARKING_MIN_HALF_WIDTH_METRES = 0.03; export declare const CS2_MARKING_YELLOW = "#f5c94a"; export declare const CS2_MARKING_WHITE = "#f4f0df"; export declare const CS2_MARKING_DASH_PERIOD_METRES = 4.5; export declare const CS2_MARKING_DASH_FILL = 0.56; export declare const CS2_MARKING_YIELD_PERIOD_METRES = 1.25; export declare const CS2_MARKING_YIELD_FILL = 0.42; /** A zebra's bars: the crossing lane's own width across the road, 0.5 m bars on a 1 m rhythm along the crossing (CS2's NA crosswalk, pose 03). */ export declare const CS2_ZEBRA_PERIOD_METRES = 1; export declare const CS2_ZEBRA_FILL = 0.5; /** Paint conforms to the terrain up to 2 m above it and keeps its authored height from 6 m: a bridge keeps its deck. */ export declare const CS2_CONFORM_FULL_ABOVE_METRES = 2; export declare const CS2_PRESERVE_FULL_ABOVE_METRES = 6; export declare const CS2_CONFORM_FULL_BELOW_METRES = -6; export declare const CS2_PRESERVE_FULL_BELOW_METRES = -10; /** Variant B's dash mask: a 4 x 64 alpha stripe whose V axis is one dash period. */ export declare const CS2_STRIPE_WIDTH_TEXELS = 4; export declare const CS2_STRIPE_HEIGHT_TEXELS = 64; export type Cs2MarkingPattern = 'solid' | 'dashed' | 'yield' | 'zebra'; export interface Cs2Marking { lane: number; curve: Cs2RoadCurve; yellow: boolean; pattern: Cs2MarkingPattern; /** Metres of one dash cycle; 0 is an unbroken line. */ periodMetres: number; fill: number; cx: number; cz: number; } export type Cs2MarkingCellOptions = Cs2CellOptions; export interface Cs2MarkingGeometryOptions { seaLevelMetres: number; terrainHeightAt(x: number, z: number): number; /** Deck height at a world XZ near the lane's own height, or null where no carriageway covers it. */ surfaceHeightAt?(x: number, z: number, nearY: number): number | null; /** Metres above a seated deck; default 0.03. */ markingLiftMetres?: number; /** Pass one in to receive the tally; the ribbons fill it as they are placed. */ seating?: Cs2MarkingSeating; segments?: number; } /** Rail points placed on a baked deck versus fallen back to the terrain rule, counted left and right separately. */ export interface Cs2MarkingSeating { seatedOnRoad: number; fallbackTerrain: number; } export interface Cs2MarkingMesh { material: string; positions: Float32Array; uvs: Float32Array; indices: Uint32Array; /** Variant A only: linear RGB carrying the paint colour so one material draws every style. */ colours?: Float32Array; } export interface Cs2MarkingStation { left: [number, number, number]; right: [number, number, number]; /** Arc length from the start of the lane, in metres. */ distance: number; } /** * Every lane of kind 6, with the style the flags imply and the cell its curve midpoint falls in, and every marked crossing (a pedestrian * lane flagged `crosswalk`) as a zebra: the lane's ribbon cut into bars along the walking line. */ export declare function collectCs2Markings(bins: Cs2RoadBins, options: Cs2MarkingCellOptions): Cs2Marking[]; /** The lit part of each dash cycle, in arc length. A period of zero is one unbroken run. */ export declare function dashIntervals(lengthMetres: number, periodMetres: number, fill: number): Array<[number, number]>; /** * The ribbon rails of one marking, seated on the baked deck under each rail point so the paint lies ON the asphalt. * Off the carriageway there is no deck to read, and the rail falls back to the reference's own per-vertex terrain * blend: fully onto the terrain near the ground, fully authored on a bridge. Left and right are sampled * independently either way, so a ribbon banks with the surface it lies on. */ export declare function markingStations(marking: Cs2Marking, options: Cs2MarkingGeometryOptions): Cs2MarkingStation[]; /** * Variant A: one material, dashes cut as geometry. Only the lit part of each cycle is emitted, so nothing on the GPU * has to discard and the paint needs no texture at all. */ export declare function buildMarkingCellA(markings: readonly Cs2Marking[], options: Cs2MarkingGeometryOptions): Cs2MarkingMesh[]; /** * Variant B: one material per pattern, the whole ribbon emitted, and the dashes masked by an alpha stripe whose V is * arc length over the dash period. */ export declare function buildMarkingCellB(markings: readonly Cs2Marking[], options: Cs2MarkingGeometryOptions): Cs2MarkingMesh[]; export declare function markingColour(marking: Cs2Marking): string; /** The five materials variant B declares. Yield collapses to one material, so a yellow yield lane paints white. */ export declare function markingMaterialB(marking: Cs2Marking): string; /** * The alpha stripe variant B masks its dashes with: white where the cycle is lit, transparent where it is not, so one * texture serves both dash colours and a second serves the tighter yield cycle. */ export declare function encodeCs2StripeKtx2(fill: number): Promise; export declare function cubicBezier(curve: Cs2RoadCurve, t: number): [number, number, number];