import type { Vec2 } from "./geometry.js"; /** * Deterministic minimap terrain bake (#1036): rasterize an authored world's terrain (plus optional * biome zones and water) into a top-down RGBA image and a matching world-bounds rectangle, then * encode it as a PNG data URI. The editor runs this as a bake action and stores the result on the * scene document; runtime feeds it straight into the existing `Minimap` / `WorldMap` `background` + * `mapBounds` props — no new runtime render path, and the same authored world always bakes the same * image (safe for verify/CI). Pure: no canvas, no DOM, `core` still imports nothing external. */ /** World-space rectangle the bake spans (matches the react `MapBounds` shape structurally). */ export interface MinimapBakeBounds { minX: number; minZ: number; maxX: number; maxZ: number; } /** One biome/region tint painted over the terrain shade where the ground falls inside its polygon. */ export interface MinimapBakeZone { /** Closed XZ polygon in world space. */ polygon: readonly Vec2[]; /** `#rgb` / `#rrggbb` tint. */ color: string; /** Blend strength 0..1. Default 0.5. */ alpha?: number; } /** The authored world a bake reads — a height sampler, its bounds, and optional zones/water. */ export interface MinimapBakeSource { bounds: MinimapBakeBounds; sampleHeight(x: number, z: number): number; /** Optional surface normal for slope shading; flat shading when omitted. */ sampleNormal?(x: number, z: number): readonly [number, number, number]; zones?: readonly MinimapBakeZone[]; /** Ground at or below this height renders as water. */ waterLevel?: number; } /** The height→color ramp and water color used by the bake. */ export interface MinimapBakePalette { low: string; high: string; water: string; } /** The built-in height→color ramp and water color a bake uses when no palette override is given. */ export declare const DEFAULT_MINIMAP_PALETTE: MinimapBakePalette; /** Options for {@link bakeMinimapImage}. */ export interface MinimapBakeOptions { /** Pixel resolution of the longer axis; the shorter axis keeps world aspect. Default 128. */ resolution?: number; palette?: Partial; } /** A baked minimap image: RGBA pixels plus the world bounds they span. */ export interface MinimapBake { width: number; height: number; /** Row-major RGBA, length `width * height * 4`. */ pixels: Uint8ClampedArray; bounds: MinimapBakeBounds; } /** * Rasterizes a top-down terrain image: height maps onto a low→high color ramp (normalized over the * sampled height range), slope darkens the shade, water fills below `waterLevel`, and each zone * polygon tints the ground it covers. Deterministic for a fixed source. The bounds are preserved so * a player-centered minimap pans the image correctly. * @capability minimap-bake rasterize authored terrain + zones into a top-down minimap image */ export declare function bakeMinimapImage(source: MinimapBakeSource, options?: MinimapBakeOptions): MinimapBake; /** Encodes an RGBA bake to raw PNG bytes (pure; stored DEFLATE, valid for any decoder). */ export declare function encodeBakePng(bake: MinimapBake): Uint8Array; /** * Encodes a bake as a `data:image/png;base64,...` URI — the exact string the `Minimap` / * `WorldMap` `background` prop takes. Deterministic for a fixed bake. * @capability minimap-bake encode a baked minimap as a PNG data URI for the Minimap background */ export declare function minimapBakeToPngDataUri(bake: MinimapBake): string; /** One-call convenience: rasterize a source and return `{ background, mapBounds }` for a minimap. */ export declare function bakeMinimapBackground(source: MinimapBakeSource, options?: MinimapBakeOptions): { background: string; mapBounds: MinimapBakeBounds; };