Просмотр исходного кода

Merge pull request #243 from matterport/mp_main

[three] - workaround path trailing slash assumption in three/LoaderUtil
Garrett Johnson 3 лет назад
Родитель
Сommit
25de40d871
2 измененных файлов с 7 добавлено и 3 удалено
  1. 1 1
      src/three/B3DMLoader.js
  2. 6 2
      src/three/GLTFExtensionLoader.js

+ 1 - 1
src/three/B3DMLoader.js

@@ -41,7 +41,7 @@ export class B3DMLoader extends B3DMLoaderBase {
 
 			// GLTFLoader assumes the working path ends in a slash
 			let workingPath = this.workingPath;
-			if ( ! /[\\/]$/.test( workingPath ) ) {
+			if ( ! /[\\/]$/.test( workingPath ) && workingPath.length ) {
 
 				workingPath += '/';
 

+ 6 - 2
src/three/GLTFExtensionLoader.js

@@ -40,12 +40,16 @@ export class GLTFExtensionLoader extends LoaderBase {
 
 				}
 
-
 			}
 
 			// assume any pre-registered loader has paths configured as the user desires, but if we're making
 			// a new loader, use the working path during parse to support relative uris on other hosts
-			const resourcePath = loader.resourcePath || loader.path || this.workingPath;
+			let resourcePath = loader.resourcePath || loader.path || this.workingPath;
+			if ( ! /[\\/]$/.test( resourcePath ) && resourcePath.length ) {
+
+				resourcePath += '/';
+
+			}
 
 			loader.parse( buffer, resourcePath, model => {