Updating from v148 to v155 broke dracoloader

My mesh appears to be invalid, where it was valid in v148 it is now invalid in v155.
I assume the loader is expecting a .drc file as the documentation suggests.

The file has not changed, only my version of threejs.
I have it working just fine in the online editor.

Is there anything that I need to change about what I am doing from v148 to v155?

import { LoadingManager, Object3D } from 'three';
import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader';
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader';

export class MeshLoader {
    manager: LoadingManager;
    dracoLoader: DRACOLoader;

    constructor() {
        this.manager = new LoadingManager();

        this.dracoLoader = new DRACOLoader();
        this.dracoLoader.setDecoderPath('./node_modules/three/examples/jsm/libs/draco/');
    }

    public load = (path: string) => {
        return new GLTFLoader(this.manager).setDRACOLoader(this.dracoLoader).loadAsync(path);
    }
}

If it is really a .drc file then you shouldn’t be using GLTFLoader, only DRACOLoader. That’s been true in any version of three.js.

If you have copied the decoder files out of ./node_modules/three/examples/jsm/libs/draco, then make sure you update them, they do change and current versions of DRACOLoader can depend on having current versions of those decoders.

If it’s neither of those things you may need to provide a way to reproduce this issue, I’m not aware of any reason a valid mesh couldn’t be decoded otherwise.

I was trying to load a .glb file to be complete.

I had copied the decoder files which seems to be exactly what you said;
They needed an update to work correctly!

Once I moved the files form node module into my assets forlder, updating the dependency it worked just fine.

1 Like