import type { Tile } from '../geometry/hexasphere.types'; import type { BodyConfig } from '../types/body.types'; import type { TileState } from './TileState'; /** * Authoritative simulation state for a single celestial body. * * Pure data-layer result of {@link initBodySimulation} — captures per-tile * elevation (quantised into integer bands), sea level, liquid coverage and * the dominant surface liquid type. Independent from any render layer so * it can run in a headless environment. Resource distribution is an * entirely off-lib concern: consumers run their own strategy against the * returned sim and keep the result wherever fits their domain. */ export interface BodySimulation { readonly tiles: readonly Tile[]; readonly tileStates: ReadonlyMap; readonly config: BodyConfig; /** * Atmosphere board tiles — independent hexasphere from the sol board, with * its own subdivision count (derived from the atmosphere outer radius * rather than the sol surface radius). Empty array when the body carries * no atmosphere (`hasAtmosphere(config) === false`). * * Atmo tile ids are NOT comparable to sol tile ids: a sol tile `42` has * no relation to an atmo tile `42` — they live on separate hexaspheres. * Resource distribution on the atmo board is an off-lib concern; the lib * exposes the tiles, consumers paint them through the atmo board mesh. */ readonly atmoTiles: readonly Tile[]; /** * Returns the integer elevation band `[0, N-1]` at any world-space point on * the planet. Uses the same seeded simplex + quantisation as tile * elevations, so a point placed on a tile center resolves to that tile's * band. Safe for smooth-sphere vertex colouring which then looks up the * palette by band index. */ readonly elevationAt: (x: number, y: number, z: number) => number; /** * Simplex-space threshold where the sea waterline sits, for shaders that * reuse the raw simplex noise (smooth-sphere ocean mask). Use * {@link seaLevelElevation} everywhere else — the band-space value is the * canonical one for tile logic. * * Equals `-1` on dry bodies (no ocean), so `> -1` works as the "has water" * test like before. */ readonly seaLevelNoise: number; /** * Inverse of the band-quantisation: maps a (possibly fractional) band * value to the corresponding simplex-noise threshold. Used at runtime to * push a moving sea level into the ocean-mask shader uniform. * * Returns `-1` on dry bodies (no quantisation table available). */ readonly bandToNoiseThreshold: (band: number) => number; /** Fraction of tiles below sea level (0..1). 0 for stars / gaseous / dry worlds. */ readonly liquidCoverage: number; /** * Sea waterline expressed in band space `[0, N-1]` (can be fractional — * the waterline may sit between two bands). `-1` on dry bodies. Callers * mutating this at runtime (UI sliders, external mutators) drive submerged * reclassification via `elevation < seaLevelElevation`. */ readonly seaLevelElevation: number; /** * `true` when the body carries a surface liquid (rocky with * `liquidState !== 'none'`). Dry worlds, gaseous, metallic and stars all * report `false`. Substance identity is caller-owned and not surfaced * here — consumers that need a label look up their own catalogue keyed * on the original config they passed in. */ readonly hasLiquidSurface: boolean; } /** * Deterministically derives a {@link BodySimulation} from a seed/config * and a pre-generated tile mesh. * * Three-step pipeline: * 1. Sample seeded simplex noise for every tile. * 2. Rank tiles into `N` equal-frequency bands (elevation 0..N-1), where * `N` is derived from `(radius, coreRadiusRatio)` via * `resolveTerrainLevelCount` (render layer). * 3. Resolve liquid coverage → a band-space sea waterline + assemble * the immutable `TileState` map. * * @param tiles - Hexasphere tiles produced by `generateHexasphere`. * @param config - Full body physics/visual configuration. */ export declare function initBodySimulation(tiles: Tile[], config: BodyConfig, atmoTiles?: readonly Tile[]): BodySimulation; //# sourceMappingURL=BodySimulation.d.ts.map