/** * MIRRORED, byte for byte, in helix-creator-cli `src/bakedPack/encode.ts` (with `hxb.ts`): `helix bake-lighting --packed` * packs the field it just took with that copy. Change both together (the CLI's header names the check). * * The HXB1 PACKER. Isomorphic on purpose — `CompressionStream` and `crypto.subtle` exist in the browser the bake driver * runs in AND in node (`scripts/pack-baked-field.mjs`, the tests) — so `helix bake-lighting --packed` packs inside the * page, from the field it just took, with no copy of this code in the CLI. Not part of the runtime's play path: nothing * in the barrel imports it, and the bake driver reaches it by dynamic import so a playing world never loads it. */ import type { PackableStore } from './packTypes.js'; import type { Vec3 } from './hxb.js'; export interface PackOptions { /** Level 0 is refined until it holds at most this many probes. Default 64. */ coarseProbes?: number; /** Probes per refinement block per axis. Default 8. */ cell?: Vec3; /** Where refinement starts, world metres. Default: the world volume's centre. */ focus?: Vec3; /** The phone tier. `false` skips it; `maxProbes` bounds the resampled lattice (default 512 — 56 KB of lighting for a * one-key world, far under the 300 KB a phone is allowed). A lattice already inside the bound is not resampled and * gets no file of its own: `lowIsField` says the field file IS the phone tier. */ low?: false | { maxProbes?: number; }; /** Emit the geometry file when the store carries geometry. Default true. */ geometry?: boolean; } export interface PackReport { fieldBytes: number; fieldPhase0Bytes: number; geometryBytes: number; lowBytes: number; lowProbes: number; levels: number[]; sections: number; } export interface PackedBake { bakeId: string; field: Uint8Array; geometry: Uint8Array | null; /** The coarse phone-tier container; null when `lowIsField` or when asked not to pack one. */ low: Uint8Array | null; /** The lattice already fits the phone budget, so the field file is read whole on a phone. */ lowIsField: boolean; report: PackReport; } /** Halves the cell count of the longest axis until the lattice fits `maxProbes`. */ export declare function lowLattice(dims: Vec3, maxProbes: number): Vec3; /** The same lighting on the lattice `lowLattice` picks for each volume. SH is linear, so interpolation is exact. */ export declare function resampleStore(store: PackableStore, maxProbes: number): PackableStore; /** Lane-planar float16 depth, the second lane stored as variance (see the header of hxb.ts). */ export declare function depthToBytes(depth: Float32Array, lanes: number): Uint8Array; export declare function packStore(store: PackableStore, options?: PackOptions): Promise;