@@ -3,6 +3,7 @@ import { injectNgtLoader, type NgtLoaderResults, type NgtObjectMap } from 'angul
33import { DRACOLoader , GLTFLoader , MeshoptDecoder , type GLTF } from 'three-stdlib' ;
44
55let dracoLoader : DRACOLoader | null = null ;
6+ let decoderPath = 'https://www.gstatic.com/draco/versioned/decoders/1.5.5/' ;
67
78function _extensions ( useDraco : boolean | string , useMeshOpt : boolean , extensions ?: ( loader : GLTFLoader ) => void ) {
89 return ( loader : THREE . Loader ) => {
@@ -15,12 +16,9 @@ function _extensions(useDraco: boolean | string, useMeshOpt: boolean, extensions
1516 dracoLoader = new DRACOLoader ( ) ;
1617 }
1718
18- dracoLoader . setDecoderPath (
19- typeof useDraco === 'string' ? useDraco : 'https://www.gstatic.com/draco/versioned/decoders/1.5.5/' ,
20- ) ;
19+ dracoLoader . setDecoderPath ( typeof useDraco === 'string' ? useDraco : decoderPath ) ;
2120 ( loader as GLTFLoader ) . setDRACOLoader ( dracoLoader ) ;
2221 }
23-
2422 if ( useMeshOpt ) {
2523 ( loader as GLTFLoader ) . setMeshoptDecoder (
2624 typeof MeshoptDecoder === 'function' ? MeshoptDecoder ( ) : MeshoptDecoder ,
@@ -65,3 +63,6 @@ injectNgtsGLTFLoader['preload'] = <TUrl extends string | string[] | Record<strin
6563) => {
6664 ( injectNgtLoader as any ) [ 'preload' ] ( ( ) => GLTFLoader , path , _extensions ( useDraco , useMeshOpt , extensions ) ) ;
6765} ;
66+ injectNgtsGLTFLoader [ 'setDecoderPath' ] = ( path : string ) => {
67+ decoderPath = path ;
68+ } ;
0 commit comments