import * as THREE from "three"; import { GLTFLoader as THREEGLTFLoader } from "./thirdparty/GLTFLoader"; import type { GLTF as THREEGLTF } from "./thirdparty/GLTFLoader"; import type { GLTFParser, GLTFReference } from "./thirdparty/GLTFLoader"; import { DRACOLoader } from './thirdparty/DRACOLoader'; import { DDSLoader } from './thirdparty/DDSLoader'; import type { DDS } from './thirdparty/DDSLoader'; import { GLTFObject } from "./gltf-object"; /** * GLTFLoader 返回数据 * @description * 一般情况下,gltf.scene 为模型对象,直接通过 `five.scene.add(gltf.scene)` 即可添加到场景 * Five 的模型单位 1 为 1米,载入的模型单位标准不一,请自行 scale。 * 如果涉及模型内置动画,GLTF 已经帮你封装了,通过 `gltf.animations` 可以获取动画帧。gltf.scene.mixer 为对应的 动画混合器。 * 通过 `gltf.scene.mixer.clipAction(gltf.animations[0]).play()` 即可播放动画。 */ interface GLTF { animations: THREE.AnimationClip[]; scene: GLTFObject; scenes: GLTFObject[]; cameras: THREE.Camera[]; asset: { copyright?: string; generator?: string; version?: string; minVersion?: string; extensions?: any; extras?: any; }; parser: GLTFParser; userData: any; } /** * GLTF 模型加载器 */ declare class GLTFLoader extends THREEGLTFLoader { static get version(): string; /** * GLTF 模型加载器 * * @example * ``` * const gltfLoader = new GLTFLoader(); * gltfLoader.load("https://vr-public.realsee-cdn.cn/release/static/image/release/five/demo/gltf/plants/scene.gltf", ({ scene }) => { * five.scene.add(scene); * }); * ``` */ constructor(manager?: THREE.LoadingManager); /** * 加载模型 * @param url - 模型 URL * @param onLoad - 加载完成回调 * @param onProgress - 加载进度回调 * @param onError - 加载错误回调 */ load(url: string, onLoad: (gltf: GLTF) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; parse(data: ArrayBuffer | string, path: string, onLoad: (gltf: GLTF) => void, onError?: (event: ErrorEvent) => void): void; } export { GLTFObject, GLTFLoader, GLTFParser, GLTFReference, GLTF, DRACOLoader, DDSLoader, DDS, THREEGLTFLoader, THREEGLTF };