I have been trying to use GLTFLoader from Three.js to load a model into an offScreenCanvas. This is what I am currently trying:
import { DRACOLoader } from "three/examples/jsm/loaders/DRACOLoader";
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader";
const loader = new GLTFLoader();
const draco = new DRACOLoader();
draco.setDecoderConfig({ type: "js" });
draco.setDecoderPath("https://www.gstatic.com/draco/v1/decoders/");
loader.setDRACOLoader(draco);
const res = await fetch("https://static.motionmix.ai/web/female.glb");
if (!res.ok) return;
const arrayBuffer = await res.arrayBuffer();
loader.parse(
arrayBuffer,
"",
(gltf) => {
console.log("gltf loaded is", gltf);
},
(error) => {
console.log("error", error);
}
);
Neither the onload nor the onerror callback gets triggered. I am very new to using web workers in javascript. But I am completely at a loss here.
I have tried to use loader.load as well, but to no avail. it seems like the callbacks just won’t get called. Where am I going wrong?