Selaa lähdekoodia

Merge pull request #15618 from gilnoycloudinary/dev

GLTFLoader  - Support Host Relative URL
Mr.doob 6 vuotta sitten
vanhempi
commit
50d7a5b3a6
1 muutettua tiedostoa jossa 7 lisäystä ja 0 poistoa
  1. 7 0
      examples/js/loaders/GLTFLoader.js

+ 7 - 0
examples/js/loaders/GLTFLoader.js

@@ -1187,6 +1187,13 @@ THREE.GLTFLoader = ( function () {
 
 		// Invalid URL
 		if ( typeof url !== 'string' || url === '' ) return '';
+		
+		// Host Relative URL
+		if ( /^https?:\/\//i.test( path ) && /^\//.test( url ) ) {
+
+			path = path.replace( /(^https?:\/\/[^\/]+).*/i , '$1' );
+
+		}
 
 		// Absolute URL http://,https://,//
 		if ( /^(https?:)?\/\//i.test( url ) ) return url;