Garrett Johnson 4 سال پیش
والد
کامیت
387d26f5d6
3فایلهای تغییر یافته به همراه23 افزوده شده و 16 حذف شده
  1. 1 10
      example/ionExample.js
  2. 11 3
      src/three/B3DMLoader.js
  3. 11 3
      src/three/I3DMLoader.js

+ 1 - 10
example/ionExample.js

@@ -111,15 +111,7 @@ function setupTiles() {
 	const loader = new GLTFLoader( tiles.manager );
 	loader.setDRACOLoader( dracoLoader );
 
-	tiles.manager.addHandler( /\.gltf$/, {
-
-		parse( ...args ) {
-
-			return loader.parse( ...args );
-
-		}
-
-	} );
+	tiles.manager.addHandler( /\.gltf$/, loader );
 	offsetParent.add( tiles.group );
 
 }
@@ -149,7 +141,6 @@ function reinstantiateTiles() {
 
 	if ( params.ionAssetId ) {
 
-
 		url = new URL( `https://api.cesium.com/v1/assets/${params.ionAssetId}/endpoint` );
 		url.searchParams.append( 'access_token', params.ionAccessToken );
 

+ 11 - 3
src/three/B3DMLoader.js

@@ -33,13 +33,21 @@ export class B3DMLoader extends B3DMLoaderBase {
 
 			}
 
-			if ( fetchOptions.header ) {
+			if ( fetchOptions.headers ) {
 
-				loader.setRequestHeader( fetchOptions.header );
+				loader.setRequestHeader( fetchOptions.headers );
 
 			}
 
-			loader.parse( gltfBuffer, this.workingPath, model => {
+			// GLTFLoader assumes the working path ends in a slash
+			let workingPath = this.workingPath;
+			if ( !/[\\/]$/.test( workingPath ) ) {
+
+				workingPath += '/';
+
+			}
+
+			loader.parse( gltfBuffer, workingPath, model => {
 
 				const { batchTable, featureTable } = b3dm;
 				const { scene } = model;

+ 11 - 3
src/three/I3DMLoader.js

@@ -50,13 +50,21 @@ export class I3DMLoader extends I3DMLoaderBase {
 
 					}
 
-					if ( fetchOptions.header ) {
+					if ( fetchOptions.headers ) {
 
-						loader.setRequestHeader( fetchOptions.header );
+						loader.setRequestHeader( fetchOptions.headers );
 
 					}
 
-					loader.parse( gltfBuffer, this.workingPath, model => {
+					// GLTFLoader assumes the working path ends in a slash
+					let workingPath = this.workingPath;
+					if ( !/[\\/]$/.test( workingPath ) ) {
+
+						workingPath += '/';
+
+					}
+
+					loader.parse( gltfBuffer, workingPath, model => {
 
 						const INSTANCES_LENGTH = featureTable.getData( 'INSTANCES_LENGTH' );
 						const POSITION = featureTable.getData( 'POSITION', INSTANCES_LENGTH, 'FLOAT', 'VEC3' );