UNPKG

2 kBTypeScriptView Raw
1import { Loader } from './Loader';
2import { LoadingManager } from './LoadingManager';
3import { Object3D } from './../core/Object3D';
4import { Texture } from './../textures/Texture';
5import { Material } from './../materials/Material';
6import { AnimationClip } from './../animation/AnimationClip';
7import { InstancedBufferGeometry } from '../core/InstancedBufferGeometry';
8import { BufferGeometry } from '../core/BufferGeometry';
9
10export class ObjectLoader extends Loader {
11 constructor(manager?: LoadingManager);
12
13 load(
14 url: string,
15 // tslint:disable-next-line:no-unnecessary-generics
16 onLoad?: <ObjectType extends Object3D>(object: ObjectType) => void,
17 onProgress?: (event: ProgressEvent) => void,
18 onError?: (event: Error | ErrorEvent) => void,
19 ): void;
20 loadAsync<ObjectType extends Object3D>(
21 url: string,
22 onProgress?: (event: ProgressEvent) => void,
23 ): // tslint:disable-next-line:no-unnecessary-generics
24 Promise<ObjectType>;
25 // tslint:disable-next-line:no-unnecessary-generics
26 parse<T extends Object3D>(json: any, onLoad?: (object: Object3D) => void): T;
27 // tslint:disable-next-line:no-unnecessary-generics
28 parseAsync<T extends Object3D>(json: any): Promise<T>;
29 parseGeometries(json: any): { [key: string]: InstancedBufferGeometry | BufferGeometry }; // Array of BufferGeometry or Geometry or Geometry2.
30 parseMaterials(json: any, textures: Texture[]): Material[]; // Array of Classes that inherits from Matrial.
31 parseAnimations(json: any): AnimationClip[];
32 parseImages(json: any, onLoad: () => void): { [key: string]: HTMLImageElement };
33 parseImagesAsync(json: any): Promise<{ [key: string]: HTMLImageElement }>;
34 parseTextures(json: any, images: any): Texture[];
35 parseObject<T extends Object3D>(
36 data: any,
37 geometries: any[],
38 materials: Material[],
39 animations: AnimationClip[],
40 ): // tslint:disable-next-line:no-unnecessary-generics
41 T;
42}