import { type SceneTerrainMaterialRole } from '@hypersoniclabs/helix-manifest'; import { type HeightGrid, type SampleField } from './grid'; import { type TerrainPreset } from './presets'; import { type TerrainSource } from './tile'; /** A channel of an authored splat image, in the order sharp hands them back. */ export type TerrainSplatChannel = 'R' | 'G' | 'B' | 'A'; /** * An RGBA8 splat authored outside the CLI, covering the grid's world extent exactly: column 0 sits on `originX`, * row 0 on `originZ`. A role named in `roles` takes its weight from that channel instead of the preset's rule. */ export interface TerrainSplatSource { width: number; height: number; channels: 4; data: Uint8Array; roles: Partial>; } export interface BakeTerrainOptions { /** Seed of the per-role noise term; the landform's own seed is irrelevant to it. */ seed?: number; /** * The authoring grid the source was tiled from. Without it the bake reassembles the grid from the tiles, whose * heights are u16 over the TILE's range: a 400 m tile quantizes to 6 mm steps, which terraces the normals. */ grid?: HeightGrid; /** An authored splat that overrides the preset's rules for the roles it names. */ splat?: TerrainSplatSource; /** * Splat and normal texels per height cell along each axis on the fine tiles: 1 (the default) bakes one texel per sample cell, 2 bakes a * 4 m grid's maps at 2 m (Catmull-Rom heights between the samples). A city painted at 2 m a pixel lost half its picture to the 4 m bake: * every lot edge, verge and shore stepped in 4 m texels, which read as pixelated ground from the air (CS2 maps, 2026-10-22). */ texelsPerCell?: 1 | 2; } /** Channels one splat pixel carries; a role past the fourth is folded into the kept role with the most weight. */ export declare const SPLAT_CHANNELS = 4; /** * Evaluates the preset's rules at every splat pixel and writes one RGBA8 PNG per tile plus one for the coarse layer, * and the matching normal map beside each. Slope, curvature and the normals come from the reassembled full grid, so * neither the weights nor the normals step at a tile boundary. */ export declare function bakeTerrainSplats(source: TerrainSource, preset: TerrainPreset, options?: BakeTerrainOptions): Promise; /** The coarse samples taken from the FULL grid rather than the quantized coarse field, picked exactly as `tileTerrain` did. */ /** * One tile's heights at `k` samples per grid cell, with one refined sample of margin all round (so the slope and curvature at the tile's * edge see their neighbours): Catmull-Rom through the grid samples, which passes through every one of them, so the k = 1 lattice is exact. */ export declare function refineTileField(grid: HeightGrid, i0: number, j0: number, k: number): SampleField; /** Loads an authored RGBA8 splat off disk in the shape `bakeTerrainSplats` takes, alpha included whatever the PNG carries. */ export declare function readTerrainSplatSource(pngPath: string, roles: Partial>): Promise; /** Authoring consumers sample semantic roles before the four-channel material folding. */ export declare function createTerrainRoleSampler(grid: HeightGrid, preset: TerrainPreset, seed?: number): (i: number, j: number) => Partial>;