Skip to content

Commit

Permalink
fix(draco): improving the logic check for path override
Browse files Browse the repository at this point in the history
  • Loading branch information
mumanity committed Oct 14, 2024
1 parent 63afb47 commit 75c0dae
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/scene-composer/src/three/loaderUtilsHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import { GLTFLoader, GLTFLoader as TwinMakerGLTFLoader } from './GLTFLoader';
export const setupDracoSupport = (loader: GLTFLoader, dracoLoader: DRACOLoader = new DRACOLoader()): void => {
const { dracoDecoder } = getGlobalSettings();
if (dracoDecoder.enable) {
const dracoDecoderPath = dracoDecoder.path ?? `${THREE_PATH}/examples/jsm/libs/draco/gltf/`;
const dracoDecoderPath =
dracoDecoder.path !== undefined ? dracoDecoder.path : `${THREE_PATH}/examples/jsm/libs/draco/gltf/`;
// TODO: with CSP issues, Chrome/Edge and some other unknown browsers may fail to load WASM, so we enforce to
// only JS DRACO decoder for now. Please fix once we found a better solution
dracoLoader.setDecoderConfig({ type: 'js' }).setDecoderPath(dracoDecoderPath);
Expand All @@ -28,7 +29,8 @@ export const setupBasisuSupport = (
): void => {
const { basisuDecoder } = getGlobalSettings();
if (basisuDecoder.enable) {
const ktx2DecoderPath = basisuDecoder.path ?? `${THREE_PATH}/examples/jsm/libs/basis/`;
const ktx2DecoderPath =
basisuDecoder.path !== undefined ? basisuDecoder.path : `${THREE_PATH}/examples/jsm/libs/basis/`;

ktx2Loader.setTranscoderPath(ktx2DecoderPath).detectSupport(renderer);

Expand Down

0 comments on commit 75c0dae

Please sign in to comment.