@sayduck/three-gltf-loader
v2.1.1
Published
Sayduck's customized version of three.js glTF loader
Downloads
25
Readme
Sayduck's customized version of three.js glTF loader
Installation
npm i --save @sayduck/three-gltf-loader
Description
three.js's GLTFLoader wrapped as a module for easy importing, TypeScript type definitions included.
Usage
import * as THREE from "three";
import GLTFLoader from "three-gltf-loader";
const loader = new GLTFLoader();
loader.load(
"path/to/your/file.gltf",
gltf => {
// called when the resource is loaded
scene.add(gltf.scene);
},
xhr => {
// called while loading is progressing
console.log(`${(xhr.loaded / xhr.total) * 100}% loaded`);
},
error => {
// called when loading has errors
console.error("An error happened", error);
}
);
For further documentation, see the official GLTFLoader docs.