Explorar el Código

moved decoder loading

Petter hace 4 años
padre
commit
9b49fbdfd1
Se han modificado 1 ficheros con 9 adiciones y 8 borrados
  1. 9 8
      example/ionExample.js

+ 9 - 8
example/ionExample.js

@@ -110,18 +110,19 @@ function setupTiles() {
 
 	tiles.fetchOptions.mode = 'cors';
 
+	// 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.123.0/examples/js/libs/draco/gltf/' );
+	dracoLoader.setDecoderConfig( { type: "js" } );
+
+	const loader = new GLTFLoader( tiles.manager );
+	loader.setDRACOLoader( dracoLoader );
+
 	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.123.0/examples/js/libs/draco/gltf/' );
-			dracoLoader.setDecoderConfig( { type: "js" } ); // WASM overloads memory without some sort of bottleneck on loading
-
-			const loader = new GLTFLoader( tiles.manager );
-			loader.setDRACOLoader( dracoLoader );
 			return loader.parse( ...args );
 
 		}