Hi, I am new to threejs, I am using GLTFLoader to load a .glb file and it’s size is 10+MB so it’s creating performance issues for me, to avoid that I am using DRACOLoader for compression but loaded file size remains same.
function loadGLTF(modelName) {
var loader = new THREE.GLTFLoader();
THREE.DRACOLoader.setDecoderPath('models/draco/');
loader.setDRACOLoader(new THREE.DRACOLoader());
loader.load(
// resource URL
'models/Bridge.glb',
// called when the resource is loaded
function (gltf) {
// mixer = new THREE.AnimationMixer(mesh);
gltf.animations; // Array<THREE.AnimationClip>
gltf.scene; // THREE.Scene
gltf.scenes; // Array<THREE.Scene>
gltf.cameras; // Array<THREE.Camera>
gltf.asset; // Object
gltf.animations = new THREE.Object3D();
gltf.scene.position.set(1.5, -0.75, 0.3);
gltf.scene.rotation.set(0, 0, 0)
gltf.scene.scale.set(1, 1, 1)
scene.add(gltf.scene);
},
// called when loading is in progresses
function (xhr) {
console.log((xhr.loaded / xhr.total * 100) + '% loaded');
},
// called when loading has errors
function (error) {
console.log('An error happened');
}
);
}