import { Document } from '@gltf-transform/core'; export interface MergeLodsResult { document: Document; scenes: string[]; texturesBefore: number; texturesAfter: number; } /** * Merges per-LOD GLBs into one multi-scene document: scene i = LOD level i (named `lodN`, document * order = level order), then dedup() collapses the byte-identical embedded images/materials the * per-LOD optimize runs each carried. Three.js GLTFLoader exposes the levels as gltf.scenes[i] and * its per-index caching shares one Texture/Material instance across levels — the runtime GPU dedupe * falls out of the file format, no runtime code. (C2 materials backlog items 1+4.) * * EACH LOD SCENE KEEPS ITS OWN, COMPLETE SKELETON — by design, not by oversight. Every level was parsed * from the same conformed bytes, so a multi-LOD character carries N same-named copies of the rig. Folding * them onto one skeleton rooted in every scene (helix-creator-cli #219, reverted 2026-09-28) produces a * file that is valid glTF but does not load: a three.js Object3D has ONE parent, so GLTFLoader cannot put * one bone hierarchy into three scenes. Scenes 2..n get their own copy of the root while their * SkinnedMeshes still point at scene 1's bones; `SkeletonUtils.clone(scene)` — the engine's add-on path * (`CharacterPartCache.load` → `attachSkinnedPart`) — then finds no such bones in the scene it clones, * yields `undefined` bones, and the garment never attaches (live 2026-09-28: every merged garment vanished * and region-hide took the collar with it, leaving floating heads). The joint-count "bloat" is the price of * the multi-scene LOD format under three.js. `assertSelfContainedLodScenes` enforces the invariant here, * and `test/engine-runtime/` loads real pipeline output through the engine's own three.js path. */ export declare function mergeLods(documents: Document[]): Promise; /** * The structural precondition for a multi-scene character GLB to load in three.js: every node belongs to * EXACTLY ONE scene, and every skinned mesh's joints live in the same scene as the mesh. Breaking either * makes GLTFLoader/SkeletonUtils hand the engine `undefined` bones (see `mergeLods`' header). Throws with the * offending names so the packager fails loudly instead of shipping an add-on that silently never renders. */ export declare function assertSelfContainedLodScenes(document: Document): void;