import type { CitySource } from '../source'; import { type HeightGrid } from '../../terrain/grid'; import { type OceanBathymetry } from '../../terrain/island'; /** Metres: a sea floor read through water needs no better, and finer steps are noise that costs a phone seconds (see `heightStepM`). */ export declare const DEFAULT_OCEAN_HEIGHT_STEP_M = 0.25; export interface OceanFileOptions { /** The height grid the ground height is read from; omitted, the source's DEM resampled at `groundMetresPerSample`. */ grid?: HeightGrid; /** Ground sampling when no grid is given (default 8: the ocean file never needs finer). */ groundMetresPerSample?: number; /** Metres between ocean samples, 1..8. Default: the smallest that keeps the file within the format's 2049 samples a side (at least 2). */ spacingM?: number; /** A sea cell this far above the surface is dry (the polygon edge and a beach overlap by a few decimetres). Default 2 m, the baker's own flood-fill threshold. */ dryAboveM?: number; /** Wet sea floor near the edge that joins the field's border outside every sea polygon (default true; see `floodOpenSeaFromBorder`). */ floodFromBorder?: boolean; /** Height resolution of the baked file in metres (default 0.25: see `OceanBathymetryOptions.heightStepM`). 0 keeps the format's full 2 mm. */ heightStepM?: number; log?: (line: string) => void; } export interface OceanFileResult { written: boolean; /** Why nothing was written. */ reason?: string; /** Surface height the file is pinned to; the visuals' `ocean.level` must equal it (the shell default is 0). */ level?: number; info?: OceanBathymetry; files?: string[]; /** Share of the ocean samples that are open sea. */ wetFraction?: number; warnings: string[]; } /** * The scanline fill is half-open (a sample exactly on a ring's far edge, or on its last row, is outside), so a sea body * whose ring runs along the map's border left the field's outermost row or column dry. The visual ocean discards every * dry fragment, so that one-sample strip (7 m on a 14 km map) opened a ruled slit in the sea along the border: the ground * under it read as a thin white or sand line to the horizon, a V at each corner (Pacifica north and east, Leonida north, * south and east; Jack, 2026-10-22). Past the field the shader treats the sea as open, so a border sample whose inward * neighbour is sea is sea too. Edits `mask` in place; the dry-ground test on the height still applies afterwards. */ export declare function closeFieldBorder(mask: Uint8Array, width: number, height: number): void; /** How far in from the map's edge the open sea may claim ground under the surface that no sea polygon covers. */ export declare const OPEN_SEA_EDGE_BAND_M = 1024; /** * The open sea also reaches every sample under the surface that joins the field's border through ground under the surface: past the * field the sea is open, and CS2 floods whatever lies below its sea level and touches it. The game's water polygons stop short of * some of that (Leonida's south-west and south-east corners: a 560 m square of sea floor at -14 m outside every `sea` ring), and * a dry sample there is a discarded fragment, so the sea floor showed through as a square sand wedge at the map's corner (Jack, * 2026-10-22). The flood keeps to a band along the edge (`bandSamples`) and to ground at least `belowM` under the surface: inland, * CS2 keeps marsh and polders under its sea level dry, and the polygons are the authority there. Basins that never reach the * border stay as the polygons drew them. Edits `mask` in place; returns the samples it wetted. */ export declare function floodOpenSeaFromBorder(mask: Uint8Array, width: number, height: number, groundAt: (i: number, j: number) => number, level: number, bandSamples: number, belowM?: number): number; /** The open sea of a city source as the visual ocean draws it: what `writeCityOceanFile` bakes into `ocean.rgba`'s wet channel. */ export interface CityOpenSea { /** Surface height (scene Y). */ level: number; grid: HeightGrid; /** The bathymetry's own lattice: spacing between samples, and the field's origin and step. */ spacingM: number; /** Is the sample the engine reads at this plan point wet (open sea drawn there, dry ground discarded)? False outside the field. */ wetAt: (x: number, z: number) => boolean; warnings: string[]; } /** * The wet area `ocean.rgba` carries, computed once for both users: the bathymetry file and every placement that must not stand in * the sea (`vegetation/openSea.ts`). The `sea`/`ocean` water bodies are the wet area, closed along the field's border and flooded * from it through ground under the surface, and a sample more than `dryAboveM` above the surface is dry. Null when the source has * no open sea or the map needs finer ocean samples than the format allows (`fail.reason` then says which). */ export declare function cityOpenSea(source: CitySource, options?: OceanFileOptions, fail?: { reason?: string; }): CityOpenSea | null; /** * Writes `ocean.json` and `ocean.rgba` into `packageDir` (the Scene package folder, beside `scene.helix-scene.json`) from a city * source's open sea: the `sea`/`ocean` water bodies (the same bodies `citySeaFromWater` turns into the `water.sea` volume) as the * wet area, the DEM as the ground. A source without an open sea writes nothing. The Scene document does not reference the pair, so * it can be called after `createCityScene` or `composeWorld` and neither document's integrity moves. */ export declare function writeCityOceanFile(source: CitySource, packageDir: string, options?: OceanFileOptions): OceanFileResult;