GLTFLoader.d.ts 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import {
  2. AnimationClip,
  3. Camera,
  4. Group,
  5. Loader,
  6. LoadingManager,
  7. Object3D,
  8. Material,
  9. Texture
  10. } from '../../../src/Three';
  11. import { DRACOLoader } from './DRACOLoader';
  12. import { DDSLoader } from './DDSLoader';
  13. import { KTX2Loader } from './KTX2Loader';
  14. export interface GLTF {
  15. animations: AnimationClip[];
  16. scene: Group;
  17. scenes: Group[];
  18. cameras: Camera[];
  19. asset: {
  20. copyright?: string;
  21. generator?: string;
  22. version?: string;
  23. minVersion?: string;
  24. extensions?: any;
  25. extras?: any;
  26. };
  27. parser: GLTFParser;
  28. userData: any;
  29. }
  30. export class GLTFLoader extends Loader {
  31. constructor( manager?: LoadingManager );
  32. dracoLoader: DRACOLoader | null;
  33. ddsLoader: DDSLoader | null;
  34. load( url: string, onLoad: ( gltf: GLTF ) => void, onProgress?: ( event: ProgressEvent ) => void, onError?: ( event: ErrorEvent ) => void ) : void;
  35. setDRACOLoader( dracoLoader: DRACOLoader ): GLTFLoader;
  36. setDDSLoader( ddsLoader: DDSLoader ): GLTFLoader;
  37. setKTX2Loader( ktx2Loader: KTX2Loader ): GLTFLoader;
  38. setMeshoptDecoder( meshoptDecoder: /* MeshoptDecoder */ any ): GLTFLoader;
  39. parse( data: ArrayBuffer | string, path: string, onLoad: ( gltf: GLTF ) => void, onError?: ( event: ErrorEvent ) => void ) : void;
  40. }
  41. export interface GLTFReference {
  42. type: 'materials'|'nodes'|'textures';
  43. index: number;
  44. }
  45. export class GLTFParser {
  46. json: any;
  47. associations: Map<Object3D|Material|Texture, GLTFReference>;
  48. getDependency: ( type: string, index: number ) => Promise<any>;
  49. getDependencies: ( type: string ) => Promise<any[]>;
  50. }