import { AnimationClip, BufferAttribute, BufferGeometry, Camera, Group, InterleavedBufferAttribute, Loader, LoadingManager, Material, Mesh, MeshStandardMaterial, Object3D, Scene, SkinnedMesh, Texture } from 'three' import { Entity } from '../../../ecs/classes/Entity' import { DRACOLoader } from './DRACOLoader' import { KTX2Loader } from './KTX2Loader' export interface GLTF { animations: AnimationClip[] scene: Scene scenes: Scene[] cameras: Camera[] asset: { copyright?: string | undefined generator?: string | undefined version?: string | undefined minVersion?: string | undefined extensions?: any extras?: any } parser: GLTFParser userData: any } export class GLTFLoader extends Loader { constructor(manager?: LoadingManager) dracoLoader: DRACOLoader | null ktx2Loader: KTX2Loader | null load( url: string, onLoad: (gltf: GLTF) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void ): void loadAsync(url: string, onProgress?: (event: ProgressEvent) => void): Promise setDRACOLoader(dracoLoader: DRACOLoader): GLTFLoader register(callback: (parser: any) => any): GLTFLoader unregister(callback: (parser: any) => any): GLTFLoader setKTX2Loader(ktx2Loader: KTX2Loader): GLTFLoader setMeshoptDecoder(meshoptDecoder: /* MeshoptDecoder */ any): GLTFLoader parse( data: ArrayBuffer | string, path: string, onLoad: (gltf: GLTF) => void, onError?: (event: ErrorEvent) => void ): void } export interface GLTFReference { type: 'materials' | 'nodes' | 'textures' index: number } export class GLTFParser { json: any options: { path?: string url?: string } associations: Map getDependency: (type: string, index: number) => Promise getDependencies: (type: string) => Promise loadBuffer: (bufferIndex: number) => Promise loadBufferView: (bufferViewIndex: number) => Promise loadAccessor: (accessorIndex: number) => Promise loadTexture: (textureIndex: number) => Promise loadTextureImage: ( textureIndex: number, /** * GLTF.Image * See: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/schema/image.schema.json */ source: { [key: string]: any }, loader: Loader ) => Promise assignTexture: ( materialParams: { [key: string]: any }, mapName: string, mapDef: { index: number texCoord?: number | undefined extensions?: any } ) => Promise assignFinalMaterial: (object: Mesh) => void getMaterialType: () => typeof MeshStandardMaterial loadMaterial: (materialIndex: number) => Promise createUniqueName: (originalName: string) => string createNodeMesh: (nodeIndex: number) => Promise loadGeometries: ( /** * GLTF.Primitive[] * See: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/schema/mesh.primitive.schema.json */ primitives: Array<{ [key: string]: any }> ) => Promise loadMesh: (meshIndex: number) => Promise loadCamera: (cameraIndex: number) => Promise loadSkin: (skinIndex: number) => Promise<{ joints: number[] inverseBindMatrices?: BufferAttribute | InterleavedBufferAttribute | undefined }> loadAnimation: (animationIndex: number) => Promise loadNode: (nodeIndex: number) => Promise loadScene: () => Promise } export interface GLTFLoaderPlugin { beforeRoot?: (() => Promise | null) | undefined afterRoot?: ((result: GLTF) => Promise | null) | undefined loadMesh?: ((meshIndex: number) => Promise | null) | undefined loadBufferView?: ((bufferViewIndex: number) => Promise | null) | undefined loadMaterial?: ((materialIndex: number) => Promise | null) | undefined loadTexture?: ((textureIndex: number) => Promise | null) | undefined getMaterialType?: ((materialIndex: number) => typeof Material | null) | undefined extendMaterialParams?: | ((materialIndex: number, materialParams: { [key: string]: any }) => Promise | null) | undefined createNodeAttachment?: ((nodeIndex: number) => Promise | null) | undefined }