import { Document } from '@gltf-transform/core'; /** * Reads a static GLB into plain typed arrays: every mesh instance is baked into scene space and merged per material. * Draco, meshopt, KTX2 (Basis) and WebP inputs are decoded here, so the rest of the compiler only ever sees floats and * encoded image bytes. Skinned content is refused: avatars, characters and skinned add-ons ship their own LODs. */ export interface ModelImage { /** Stable index in `ItemModel.images`; images with identical bytes share one entry. */ index: number; mimeType: string; bytes: Uint8Array; sha256: string; } export interface ModelTextureRef { image: ModelImage; texCoord: number; wrapS: number; wrapT: number; magFilter: number | null; minFilter: number | null; /** KHR_texture_transform, when the source declares one. */ transform?: { offset: [number, number]; rotation: number; scale: [number, number]; texCoord: number | null; }; } export interface ModelMaterial { index: number; name: string; baseColorFactor: [number, number, number, number]; metallicFactor: number; roughnessFactor: number; emissiveFactor: [number, number, number]; emissiveStrength: number; alphaMode: 'OPAQUE' | 'MASK' | 'BLEND'; alphaCutoff: number; doubleSided: boolean; unlit: boolean; baseColor: ModelTextureRef | null; metallicRoughness: ModelTextureRef | null; normal: (ModelTextureRef & { scale: number; }) | null; occlusion: (ModelTextureRef & { strength: number; }) | null; emissive: ModelTextureRef | null; /** True when occlusion and metallicRoughness are the same image and UV set (an ORM texture). */ packedOrm: boolean; } /** One material's triangles in scene space. Vertices are welded; arrays are parallel. */ export interface ModelGroup { material: number; positions: Float32Array; normals: Float32Array; uv0: Float32Array | null; uv1: Float32Array | null; /** RGBA floats 0..1 */ colors: Float32Array | null; indices: Uint32Array; } export interface ItemModel { groups: ModelGroup[]; materials: ModelMaterial[]; images: ModelImage[]; bounds: { min: [number, number, number]; max: [number, number, number]; }; triangles: number; /** Things the compiler could not carry into the LODs (extensions, morph targets, animation); never silent. */ warnings: string[]; extensionsUsed: string[]; } export declare class SkinnedModelError extends Error { constructor(detail: string); } export declare function readGltfDocument(bytes: Uint8Array): Promise; /** Compact vertices not referenced by any index (after degenerate removal) so every array is dense. */ export declare function compactGroup(group: ModelGroup): ModelGroup; export declare function readItemModel(bytes: Uint8Array): Promise; export declare function itemModelFromDocument(document: Document): ItemModel;