import type { Document } from '@gltf-transform/core'; /** * DRAW-CALL JOIN FOR AN IMPORTED AVATAR. * * The publish gate counts one draw per primitive per node, and caps an avatar at `AVATAR_MAX_DRAW_CALLS` (12). A * VRoid export is one primitive per surface spread over several skinned meshes, so after the material atlas an avatar * with 8 materials still arrives at 13-33 draws. The web import joined them in the backend (`avatar-import.fit.ts`) * after this converter had finished; the Creator Tools path (`helix bridge import`) never did, and 101 of the 273 corpus * VRMs were refused at publish on draws alone. This is the same pass, run INSIDE the converter and BEFORE the LOD * ladder, so LOD0 and every level derived from it are already within budget and both paths ship the same file. * * Joining primitives that share a material, skin and attribute layout changes no geometry, weight or material. What * can go wrong, and what each step below does about it: * - Blend shapes. `joinPrimitives` writes no morph targets, so a face joined naively loses every viseme. Morphed * meshes are joined here, per mesh, rebuilding each target through the exact vertex order the joiner uses. * - The first-/third-person hide lists name primitives (`Hair001baked_12`). The join renames everything it touches, so * the lists are re-declared from the surviving primitives, and a view class never merges with another one. * - Skins. The joiner groups by skin OBJECT. Morphed meshes and each view class get a clone over the same joints and * inverse bind matrices for the duration of the join; identical skins are collapsed back to one afterwards, so the * rig the next stages (LODs, preview) and the runtime see is the one that came in. */ /** The platform's `AVATAR_MAX_DRAW_CALLS`: the wall a published avatar may not cross. */ export declare const AVATAR_MAX_DRAW_CALLS = 12; export interface JoinDrawsReport { /** Draw calls (primitives over every mesh-bearing node) before and after. */ before: number; after: number; joined: boolean; /** Why nothing was joined, when that is not simply "already within budget". */ skipped?: string; /** Surfaces re-declared for the first-/third-person views after the join renamed them. */ viewHide?: { firstPersonHide: number; thirdPersonHide: number; }; } /** What the publish gate counts for a single-scene avatar: primitives over every node that bears a mesh. */ export declare function countDraws(document: Document): number; /** * Bring a single-scene avatar within the draw-call budget by joining same-material primitives. A no-op (the document * is not touched) when it is already within `limit`. Never throws on a join it cannot do: it leaves those primitives * as they were and the publish gate states the real number. */ export declare function joinDraws(document: Document, limit?: number): JoinDrawsReport;