import type { CitySource, RoadEdge } from '../source'; import type { TerrainSplatSource } from '../../terrain/bake'; export interface CitySplatOptions { originX: number; originZ: number; spanM: number; metresPerPixel: number; /** The road generator's per-sample roles (0 natural, 1 asphalt, 2 pavement, 3 bank); when given they replace the painted street strokes. */ roads?: { roles: Uint8Array; samplesX: number; samplesZ: number; originX: number; originZ: number; metresPerSample: number; }; /** * Natural ground (`terrain.ground: "natural"`): land that no area covers and that lies farther than `NATURAL_ROAD_BUFFER_M` from every street's drawn edge is * grass, and low shore (below `NATURAL_SHORE_M` above the datum) is sand, instead of the paved base. A source that maps only its built-up * lots (a Cities: Skylines II map: every wetland, scrub and open field is unmapped) otherwise reads as one grey-brown slab from the air. */ natural?: { heightAt: (x: number, z: number) => number; /** Unmapped ground lower than this is shore sand (default `NATURAL_SHORE_M`; a CS2 map passes `CS2_NATURAL_SHORE_M`). */ shoreM?: number; /** * Sand stops at the waterline (a CS2 map passes true). A water body paints sand only on ground under its own surface; the dry land its * outline reaches over is natural ground, and the grass/sand feather never carries sand onto it. A CS2 water outline is the water * simulation's cell mask, which in Pacifica's south-east marsh lies over every forested island: 30 % of the marsh's dry land between * 0.3 and 0.8 m came out sand, so the marsh forest stood on a tan desert where the game shows dark grass (pacifica-cs2-ref 12, 21). */ waterline?: boolean; /** * Pave the verge beside every street that has a sidewalk (default true). A CS2 map passes false: the game's ground reaches the sidewalk, * which is road geometry the roads draw on top, and its own splat is grass there (`R` and `G` 0.98 on the verge pixels at * pacifica-cs2-ref 13 and 29). The paved band, 6 m past every sidewalk and under every elevated ramp, was the pale, smeared ground the * owner rejected three times beside the south-east freeway (13) and the fenced field beside a downtown sidewalk (29), where CS2 is grass. */ verge?: boolean; }; } /** * Unmapped ground within this many metres of a street's drawn edge (kerb plus sidewalk) stays the paved base: the verge. It was 24 m from the * carriageway, which in a dense CS2 city is every block, so the whole downtown read as one bare beige slab between the roads while the game's * own ground there is grass (its splat carries grass weight on 97% of the land the slab covered); the sidewalk is geometry the roads draw on top. */ export declare const NATURAL_ROAD_BUFFER_M = 6; /** Unmapped ground lower than this (metres above the datum the terrain is authored on) is shore sand. */ export declare const NATURAL_SHORE_M = 0.8; /** * A Cities: Skylines II map's shore. The game paints sand only where the player laid a sand surface (those are `beach` areas, painted as * sand anyway); its unpainted ground is grass to the waterline. Its marshes lie a few decimetres above the sea: Pacifica's south-east marsh * has 32 % of its land between 0 and 0.8 m (4.7 % below 0.3 m), so the 0.8 m rule laid a sand floor under the whole marsh forest where the * game shows dark green (pacifica-cs2-ref 12, 21). On a CS2 map only the bed under the sea itself is sand. */ export declare const CS2_NATURAL_SHORE_M = 0; /** Channel weights are exclusive per pixel (255 on one channel), so the preset's role rules never fight the authored picture. */ export declare const CITY_SPLAT_ROLES: { readonly R: "base"; readonly G: "cavity"; readonly B: "accent"; readonly A: "low"; }; /** Carriageway width kerb to kerb when the source has none: lanes x 3.2 m, else a class table. */ export declare function roadWidthM(edge: RoadEdge): number; /** `natural.waterline`: the feather may not leave sand on dry natural ground; its weight goes back to the grass. Returns the pixels restored. */ export declare function clearDrySand(data: Uint8Array, dry: Uint8Array): number; /** Where grass meets sand the edge is feathered over this many metres each side, and wobbled by up to the same, so a rectangular lot of sand does not read as a ruled seam (16 m: the terrain bakes the splat at 4 m a texel, so anything narrower is one hard texel). */ export declare const NATURAL_FEATHER_M = 16; /** * The sand share a feathered pixel may carry is the box mean of the sand among the grass and sand pixels around it, which for a straight edge is a * clean linear ramp but for a small sand patch (a lot's worth of beach, a one-pixel shore speck, a pond's rim) is the patch diluted over the whole * (2r + 1)^2 box: a 5 px patch at r = 8 spreads 9 % sand over a 33 px (66 m) square of lawn, a pale haze with no edge and no sand in it. Leonida * carried 164 such patches of 150+ texels whose sand never reached 60 %, and they read as pale blotches on the grass. The share is therefore shaped: * under `NATURAL_FEATHER_FLOOR` of sand it is none, over `1 - NATURAL_FEATHER_FLOOR` it is all, a smoothstep between. A straight edge still ramps (over * half the old width); a patch that never reaches the floor disappears into its lawn and one that does keeps a core with a short, real edge. */ export declare const NATURAL_FEATHER_FLOOR = 0.2; /** The shaped sand share (see `NATURAL_FEATHER_FLOOR`): 0 below the floor, 1 above its complement, smooth between. */ export declare function shapeSandShare(share: number): number; /** * Soften the grass / sand boundary. The painted picture is one class per pixel, so a CS2 beach (a rectangle of sand surface) meets the grass along a * ruled line, and the terrain's own height blend then draws it as a seam (Leonida, the beach sweep: a cream rectangle with square corners on a lawn). * Here the boundary is domain-warped by a value noise (up to `radiusPx` pixels) and the two weights are then the share of sand among the grass and * sand pixels around each pixel (a box of `radiusPx`), so the edge is a wavy ramp some 16 m wide. Streets, pavement and parks keep their crisp, one-class * edges: only pixels that are grass, base ground or sand take part, and only where both classes are near. Works tile by tile (`tilePx`) so a 7,168 px canvas * stays cheap; every tile reads the picture as painted, never another tile's output, so the result does not depend on the tile size or order. */ export declare function featherNaturalEdges(data: Uint8Array, size: number, radiusPx: number, tilePx?: number): number; /** Paint the splat for a city source. Order: areas, water, then streets on top. */ export declare function paintCitySplat(source: CitySource, options: CitySplatOptions): TerrainSplatSource;