UNPKG

gltf-loader-ts

Version:

Engine-agnostic glTF 2.0 loader in TypeScript

31 lines (30 loc) 1.35 kB
import { GltfAsset } from './gltf-asset'; import { LoadingManager } from './loadingmanager'; import * as gltf from './gltf'; export { gltf }; export * from './gltf-asset'; export * from './loadingmanager'; /** Main class of the library */ export declare class GltfLoader { private manager; /** * Pass in a custom `LoadingManager` for progress reporting. */ constructor(manager?: LoadingManager); /** * Load glTF from a URL. Only the main file is loaded - external buffer and image files * are loaded lazily when needed. To load all, you can use `GltfAsset.preFetchAll()` */ load(url: string, onProgress?: (xhr: XMLHttpRequest) => void): Promise<GltfAsset>; /** * Load from `File`s you might get from a file input or via drag-and-drop. * `fileMap` is expected to map from a full file path (including directories if present). * This matches the format provided by [simple-dropzone](https://www.npmjs.com/package/simple-dropzone). * If you don't need support for directories/zip files, you can use `File.name` as the key. * * Note that `preFetchAll` is called on the result GltfAsset before returning it so that * the uploaded files can be garbage-collected immediately. */ loadFromFiles(fileMap: Map<string, File>): Promise<GltfAsset>; private parse; }