From 75c0daebc2f5a26b61a1c4cec743a2b7c5bd4793 Mon Sep 17 00:00:00 2001 From: Emily Lifsey Date: Mon, 14 Oct 2024 14:44:51 -0500 Subject: [PATCH] fix(draco): improving the logic check for path override --- packages/scene-composer/src/three/loaderUtilsHelpers.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/scene-composer/src/three/loaderUtilsHelpers.ts b/packages/scene-composer/src/three/loaderUtilsHelpers.ts index 50fd7f72e..652791c02 100644 --- a/packages/scene-composer/src/three/loaderUtilsHelpers.ts +++ b/packages/scene-composer/src/three/loaderUtilsHelpers.ts @@ -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); @@ -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);