import { type LevelPlan } from './atlas'; import type { ItemModel, ModelGroup } from './model'; import { type TextureCache, type TextureMethod } from './textures'; /** What a level keeps of the source material. */ export interface LevelTextureSpec { maxEdge: number; /** Edge cap for the normal, metallic-roughness and occlusion maps when it is below `maxEdge`. */ dataMaxEdge?: number; normal: boolean; metallicRoughness: boolean; occlusion: boolean; emissive: boolean; } export declare const LOD1_TEXTURES: LevelTextureSpec; export declare const LOD2_TEXTURES: LevelTextureSpec; /** * Texture specs tried in order until the level is strictly smaller in bytes than the level above it: the full set, the * data maps at half size, then colour and emissive only (the dropped maps fold into the material factors). */ export declare const LOD1_TEXTURE_LADDER: readonly LevelTextureSpec[]; export declare const LOD2_TEXTURE_LADDER: readonly LevelTextureSpec[]; /** One texture in a written level: what it cost and how it was made. */ export interface WrittenTexture { /** Source image index; -1 for an atlas texture, whose `sources` lists the images it was built from. */ image: number; sources?: number[]; slot: 'baseColor' | 'metallicRoughness' | 'normal' | 'occlusion' | 'emissive'; method: TextureMethod; width: number; height: number; bytes: number; sourceBytes: number; psnr: number | null; } export interface WrittenLevel { bytes: Uint8Array; triangles: number; vertices: number; textureCount: number; textureMaxEdge: number; textures: WrittenTexture[]; /** Approximate GPU-resident bytes: quantized vertex and index buffers plus transcoded textures with mips. */ residentBytes: number; /** Primitives in the level: its draw calls per placement band. */ primitives: number; /** The material atlas, when the level shares one material set across several source materials. */ atlas?: { width: number; height: number; recipes: number; swatches: number; foldedToMean: number; }; /** Plan notes for the report (merged render states, folded tilings, dropped maps). */ notes: string[]; } export interface WriteLevelOptions { /** 'level': quantized, meshopt-compressed, KTX2 textures. 'capture': plain float GLB with PNG textures for the impostor page. */ mode: 'level' | 'capture'; textures: LevelTextureSpec; /** The level's primitive and atlas plan; computed from the groups when absent. Pass it to share the plan across texture rungs. */ plan?: LevelPlan; } /** Plans how a level is drawn (primitives and material atlas) so several texture rungs of the same geometry share the work. */ export declare function planLevelGlb(model: ItemModel, allGroups: readonly ModelGroup[], cache: TextureCache, spec: LevelTextureSpec): Promise; /** Writes one self-contained GLB for the groups. */ export declare function writeLevelGlb(model: ItemModel, allGroups: readonly ModelGroup[], cache: TextureCache, options: WriteLevelOptions): Promise;