Explorar el Código

Fix draco loader instantiation

Garrett Johnson hace 4 años
padre
commit
c8248896c6
Se han modificado 1 ficheros con 5 adiciones y 5 borrados
  1. 5 5
      example/index.js

+ 5 - 5
example/index.js

@@ -86,17 +86,17 @@ function reinstantiateTiles() {
 
 	}
 
+	// Note the DRACO compression files need to be supplied via an explicit source.
+	// We use unpkg here but in practice should be provided by the application.
+	const dracoLoader = new DRACOLoader();
+	dracoLoader.setDecoderPath( 'https://unpkg.com/three@0.116.1/examples/js/libs/draco/gltf/' );
+
 	tiles = new TilesRenderer( url );
 	tiles.fetchOptions.mode = 'cors';
 	tiles.manager.addHandler( /\.gltf$/, {
 
 		parse( ...args ) {
 
-			// Note the DRACO compression files need to be supplied via an explicit source.
-			// We use unpkg here but in practice should be provided by the application.
-			const dracoLoader = new DRACOLoader();
-			dracoLoader.setDecoderPath( 'https://unpkg.com/three@0.116.1/examples/js/libs/draco/gltf/' );
-
 			const loader = new GLTFLoader( tiles.manager );
 			loader.setDRACOLoader( dracoLoader );
 			return loader.parse( ...args );