import type { CitySource } from '../source'; import type { ConformedTerrain } from '../terrain'; import { type HeightGrid } from '../../terrain/grid'; import { type TerrainPreset } from '../../terrain/presets'; import { type CarveStats, type RoadSinkReport, type RoadSurfaces, type ShoulderStats } from '../../cs2/restyle/terrainCarve'; export declare const URBAN_TERRAIN_PRESET: TerrainPreset; /** * A CS2 map's cliffs and steep banks: the pack's `rock` warmed to CS2's brown cliff, not the urban preset's `granite`. Granite is a polished * counter stone (pack mean #a59c9d, roughness 0.35, metalness 0.05): on Pacifica's hills it read as pale grey fuzzy "snow" and, glossy, it * mirrored the sky as blue patches (pacifica-cs2-ref 02 and 15, where CS2 shows brown rock). CS2's lit cliff reads about (110, 95, 55) on * screen against its lawn's (54, 59, 20); scaled through the lawn's own calibration (the accent tint below) that is a linear albedo near * (0.077, 0.084, 0.047), which is the rock mean (#50565c, linear 0.080, 0.093, 0.107) times (0.96, 0.90, 0.44): sRGB #faf3b2. */ export declare const CS2_SLOPE_ROCK: { readonly material: "rock"; readonly tint: "#faf3b2"; }; /** * A CS2 map's terrain preset: the urban preset with the park grass darkened to CS2's. Measured at the CS2 reference pose 25 (large park, * default daylight), CS2's lawn reads (54, 59, 20) on screen and Pacifica's (82, 85, 24): the same olive, about 1.5x brighter. A live tint * sweep at that pose put the screen's response to the accent tint near linear in red and green and weak in blue, which fits the urban tint * scaled by (0.40, 0.47, 0.60) in linear (#9ba483 to #657467). The layer order is the urban preset's, so the role indices the outer land * reads (`outerLandSplatLayers`) stay valid for both. */ export declare const CS2_URBAN_TERRAIN_PRESET: TerrainPreset; /** Bump when a CS2 map's ground paint changes for the same source (the convert's landscape stage keys on it): 1 = waterline sand, brown rock; 2 = no paved verge; 3 = the ground shouldered flush to the road edges (no kerb-high step, no carved dirt band); 4 = the carve holds each lattice under the road exactly (no posts dug beside it) and the ground paint runs grass to the road's drawn edge (no 4 m stepped band); 5 = a road edge standing on land over a shore bed under the water gets its bank (no vertical face from the bed up to the lip); 6 = the tops of concrete structures (a tunnel's roof slab) are never opened as a cut (Pacifica's substation hill had spikes dug to the rail tunnel's slab); 7 = (withdrawn) the fine field carved at its own posting only; 8 = the fine field carved at every stride again, as 6: 7's stride-1-only hold lowered 120 posts beside roads by 0.5-3.9 m, most below the CS2 source (Pacifica rd22 against rd12). */ export declare const CS2_GROUND_VERSION = 8; /** The terrain preset a city source bakes with: CS2 maps get CS2's darker park grass; every other map keeps the urban preset. */ export declare function terrainPresetFor(source: Pick): TerrainPreset; export interface CityTerrainOptions { /** 2 m per sample is the design default (512 m tiles). */ metresPerSample?: 1 | 2 | 4; /** Splat resolution of the authored picture. */ splatMetresPerPixel?: number; /** The ground with the roads cut and filled into it, and the road roles to paint (`buildSceneRoads`). */ conformed?: ConformedTerrain | null; /** `natural`: unmapped land away from streets is painted grass and shore sand (see `CitySplatOptions.natural`); `urban` (default) leaves it paved. */ ground?: 'urban' | 'natural'; /** * The up-facing road surface (world metres). The ground is carved under it at every sample stride the engine draws it at (1, 2, 4 and 8, and the * coarse layer is the stride-8 lattice), because the conform only clears the road at the field's own posting: at a 32 m cell the chord between * two corners rises through a deck that lies between them. See `src/cs2/restyle/terrainCarve.ts`. */ carve?: RoadSurfaces | null; /** The sea level the scene draws (metres): a road under the ground whose floor is not above it keeps its hill, because opening it would flood it. */ carveFloorM?: number; } export interface CityTerrainCarve { /** Share of the road's vertices under the drawn terrain at each stride, before and after the carve (`measureRoadSink`). */ before: RoadSinkReport; after: RoadSinkReport; stats: CarveStats; /** The ground brought to the road edges before the carve (`shapeRoadShoulders`). */ shoulders: ShoulderStats; } export interface CityTerrainResult { dir: string; tilesX: number; tilesZ: number; originX: number; originZ: number; metresPerSample: number; heightRangeM: [number, number]; kind: 'dem' | 'flat'; /** Present when the ground was carved under the roads at every LOD stride. */ carve?: CityTerrainCarve; /** Terrain height (scene Y) at a plan point, bilinear over the authoring grid; clamps outside it. */ heightAt(x: number, z: number): number; /** * The terrain AS DRAWN at a plan point: the lattice quad split the engine draws and `helix scene validate` measures against (stride 1). * Anything that must stand ON the ground (trees, props) is seated with this one; `heightAt` is bilinear, which on a steep cell differs from * the drawn triangles by metres, and a finer height field makes more cells steep. */ groundAt(x: number, z: number): number; } export declare function heightSampler(grid: HeightGrid): (x: number, z: number) => number; /** Decode the source DEM to metres (scene Y), row 0 northernmost = smallest z. */ export declare function decodeCityDem(source: CitySource): { values: Float32Array; w: number; h: number; mps: number; ox: number; oz: number; } | null; /** * Replaces the outermost `n` samples of every edge of the source DEM by the sample `n` in wherever they differ from it by more than * {@link DEM_EDGE_JUMP_M}. A Cities: Skylines II height map carries a few samples of bogus land along its border (9.8 m of "land" in the * sea, 28 to 56 m wide), which the coarse layer's padding then extrudes past the map as a hard rectangle. Edits the raster in place and * returns how many samples changed. */ export declare function repairDemEdges(source: CitySource, n: number): number; /** A narrow raised strip along the border is the game's edge rim when the ground this far in (metres) is sea... */ export declare const DEM_SEA_RIM_INNER_M: readonly [number, number]; /** ...and the rim lies within this many metres of the border (Leonida: 28-36 m of +5.4 m ground over 14 m of sea). */ export declare const DEM_SEA_RIM_WIDTH_M = 48; /** * Lowers CS2's raised edge rim into the sea it stands in. Along parts of a map's border the game's height map carries a flat strip of * land a few samples wide over deep sea: Leonida's south, east and north edges hold 28-36 m of ground at +5.4 m with the sea floor at * -14 m from 40 m in (6.7, 3.9 and 1.4 km of border). Drawn, it was a thin straight line of land ruled along the map's edge (owner * sweep 2026-10-23). `repairDemEdges` cannot see it: its reference sample, `n` in, is still on the rim. * * Every border position reads its own profile inwards. Where the ground 64-128 m in lies under the sea (its median) and the outer 48 m * rises out of it, every sample from the border to 64 m in is lowered to no higher than the profile's ground at 64 m. The lowering is * weighted by how deep that inner ground lies (full from 3 m under the surface, none at it), so a rim fades out where the sea behind it * shallows into a real shore instead of stopping in a step, and real land at the border (dry ground behind it) is never touched. Only * ever lowers; reads the untouched raster, so corners and edge order do not matter. Edits the raster in place; returns samples changed. */ export declare function lowerSeaRims(source: CitySource, seaLevelY: number): number; /** The grid is aligned to the source's `boundsXZ`, which sits on the 256 m city grid, so tiles and building cells nest. */ export declare function terrainGridFor(source: CitySource, metresPerSample: number, conformed?: ConformedTerrain | null): HeightGrid; export declare function buildCityTerrain(source: CitySource, dir: string, options?: CityTerrainOptions): Promise; /** * Both halves of the source DEM's edge repair (`repairDemEdges`, then `lowerSeaRims` at the source's sea level), in place. The * landscape and the ocean bathymetry must read the same repaired ground: the bathymetry once read the raw source, so the raised rim * the landscape lowered stayed DRY in `ocean.rgba`, the visual ocean discarded it, and the lowered sea floor showed through as a pale * straight sand line along Leonida's east and south edges (owner sweep 2026-10-23). `demEdgeRepair` 0 or absent changes nothing. */ export declare function repairSourceEdges(source: CitySource, demEdgeRepair: number | undefined): { repaired: number; lowered: number; } | null;