I want to add a byte array (Uint8Array) of GLB files to a scene.
I have tried the code below, but it does not work, am I using GLTFLoader incorrectly?
It appears that neither the onLoad nor onError callback functions are being called.
const loader = new GLTFLoader();
loader.parse(bytes, "",
(gltf) => {
const model = gltf.scene;
scene.add(model);
var bbox = new THREE.Box3().setFromObject(scene);
var center = bbox.clone().min.add(bbox.max).divideScalar(2.0);
console.log(center);
},
(error) => {
console.log(error);
}
);