|
@@ -1958,34 +1958,6 @@ const ALPHA_MODES = {
|
|
|
BLEND: 'BLEND'
|
|
|
};
|
|
|
|
|
|
-/* UTILITY FUNCTIONS */
|
|
|
-
|
|
|
-function resolveURL( url, path ) {
|
|
|
-
|
|
|
- // 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;
|
|
|
-
|
|
|
- // Data URI
|
|
|
- if ( /^data:.*,.*$/i.test( url ) ) return url;
|
|
|
-
|
|
|
- // Blob URL
|
|
|
- if ( /^blob:.*$/i.test( url ) ) return url;
|
|
|
-
|
|
|
- // Relative URL
|
|
|
- return path + url;
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
/**
|
|
|
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#default-material
|
|
|
*/
|
|
@@ -2645,7 +2617,7 @@ class GLTFParser {
|
|
|
|
|
|
return new Promise( function ( resolve, reject ) {
|
|
|
|
|
|
- loader.load( resolveURL( bufferDef.uri, options.path ), resolve, undefined, function () {
|
|
|
+ loader.load( LoaderUtils.resolveURL( bufferDef.uri, options.path ), resolve, undefined, function () {
|
|
|
|
|
|
reject( new Error( 'THREE.GLTFLoader: Failed to load buffer "' + bufferDef.uri + '".' ) );
|
|
|
|
|
@@ -2891,7 +2863,7 @@ class GLTFParser {
|
|
|
|
|
|
}
|
|
|
|
|
|
- loader.load( resolveURL( sourceURI, options.path ), onLoad, undefined, reject );
|
|
|
+ loader.load( LoaderUtils.resolveURL( sourceURI, options.path ), onLoad, undefined, reject );
|
|
|
|
|
|
} );
|
|
|
|