I am using VITE and I must get a reference to the three paths to load a gltf model, so far I used this.
const THREE_PATH = `https://unpkg.com/three@0.${REVISION}.x`
I need to replace it with my local three-path.
I am using VITE and I must get a reference to the three paths to load a gltf model, so far I used this.
const THREE_PATH = `https://unpkg.com/three@0.${REVISION}.x`
I need to replace it with my local three-path.
if you’re using vite i don’t know why you would want to use a cdns?
import { REVISION } from 'three'
if you want to load a gltf, it’s supposed to be in /public, you shouldn’t use gltf but glb, then you also don’t need to mess with extra paths, but if you have to the gltf loader has a method to inject resource paths.
I am using it in a different way…
const MANAGER = new LoadingManager();
const THREE_PATH = `https://unpkg.com/three@0.${REVISION}.x`;
console.log(THREE_PATH)
const DRACO_LOADER = new DRACOLoader(MANAGER).setDecoderPath(
`${THREE_PATH}/examples/jsm/libs/draco/gltf/`,
);
const KTX2_LOADER = new KTX2Loader(MANAGER).setTranscoderPath(
`${THREE_PATH}/examples/jsm/libs/basis/`,
);
I am answering my own question:slight_smile:
const MANAGER = new LoadingManager();
const DRACO_LOADER = new DRACOLoader(MANAGER).setDecoderPath('three/examples/jsm/libs/draco/gltf/');
const KTX2_LOADER = new KTX2Loader(MANAGER).setTranscoderPath('three/examples/jsm/libs/basis/');
ahh, decoder paths. i suggest you use the official google cdn in that case: https://www.gstatic.com/draco/versioned/decoders/1.5.5/ though basis i have no idea if an official cdn exists.