David Catuhe 7 years ago
parent
commit
12d6fd72ab

File diff suppressed because it is too large
+ 2342 - 2330
Playground/babylon.d.txt


File diff suppressed because it is too large
+ 2372 - 2372
dist/preview release/babylon.d.ts


+ 16 - 10
dist/preview release/loaders/babylon.glTF1FileLoader.d.ts

@@ -98,6 +98,10 @@ declare module BABYLON {
          */
          */
         compileShadowGenerators: boolean;
         compileShadowGenerators: boolean;
         /**
         /**
+         * Function called before loading a url referenced by the asset.
+         */
+        preprocessUrlAsync: (url: string) => Promise<string>;
+        /**
          * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
          * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
          */
          */
         onMeshLoadedObservable: Observable<AbstractMesh>;
         onMeshLoadedObservable: Observable<AbstractMesh>;
@@ -199,6 +203,10 @@ declare module BABYLON {
          */
          */
         compileShadowGenerators: boolean;
         compileShadowGenerators: boolean;
         /**
         /**
+         * Function called before loading a url referenced by the asset.
+         */
+        preprocessUrlAsync: (url: string) => Promise<string>;
+        /**
          * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
          * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
          */
          */
         readonly onMeshLoadedObservable: Observable<AbstractMesh>;
         readonly onMeshLoadedObservable: Observable<AbstractMesh>;
@@ -743,16 +751,14 @@ declare module BABYLON.GLTF1 {
         compileMaterials: boolean;
         compileMaterials: boolean;
         useClipPlane: boolean;
         useClipPlane: boolean;
         compileShadowGenerators: boolean;
         compileShadowGenerators: boolean;
-        onDisposeObservable: Observable<IGLTFLoader>;
-        onMeshLoadedObservable: Observable<AbstractMesh>;
-        onTextureLoadedObservable: Observable<BaseTexture>;
-        onMaterialLoadedObservable: Observable<Material>;
-        onCameraLoadedObservable: Observable<Camera>;
-        onCompleteObservable: Observable<IGLTFLoader>;
-        onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
-        /**
-        * State of the loader
-        */
+        preprocessUrlAsync: (url: string) => Promise<string>;
+        readonly onMeshLoadedObservable: Observable<AbstractMesh>;
+        readonly onTextureLoadedObservable: Observable<BaseTexture>;
+        readonly onMaterialLoadedObservable: Observable<Material>;
+        readonly onCameraLoadedObservable: Observable<Camera>;
+        readonly onCompleteObservable: Observable<IGLTFLoader>;
+        readonly onDisposeObservable: Observable<IGLTFLoader>;
+        readonly onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
         state: Nullable<GLTFLoaderState>;
         state: Nullable<GLTFLoaderState>;
         dispose(): void;
         dispose(): void;
         private _importMeshAsync(meshesNames, scene, data, rootUrl, onSuccess, onProgress?, onError?);
         private _importMeshAsync(meshesNames, scene, data, rootUrl, onSuccess, onProgress?, onError?);

+ 8 - 4
dist/preview release/loaders/babylon.glTF1FileLoader.js

@@ -84,6 +84,10 @@ var BABYLON;
              */
              */
             this.compileShadowGenerators = false;
             this.compileShadowGenerators = false;
             /**
             /**
+             * Function called before loading a url referenced by the asset.
+             */
+            this.preprocessUrlAsync = function (url) { return Promise.resolve(url); };
+            /**
              * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
              * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
              */
              */
             this.onMeshLoadedObservable = new BABYLON.Observable();
             this.onMeshLoadedObservable = new BABYLON.Observable();
@@ -262,6 +266,7 @@ var BABYLON;
                 this._loader.dispose();
                 this._loader.dispose();
                 this._loader = null;
                 this._loader = null;
             }
             }
+            this.preprocessUrlAsync = function (url) { return Promise.resolve(url); };
             this.onMeshLoadedObservable.clear();
             this.onMeshLoadedObservable.clear();
             this.onTextureLoadedObservable.clear();
             this.onTextureLoadedObservable.clear();
             this.onMaterialLoadedObservable.clear();
             this.onMaterialLoadedObservable.clear();
@@ -389,6 +394,7 @@ var BABYLON;
             loader.compileMaterials = this.compileMaterials;
             loader.compileMaterials = this.compileMaterials;
             loader.useClipPlane = this.useClipPlane;
             loader.useClipPlane = this.useClipPlane;
             loader.compileShadowGenerators = this.compileShadowGenerators;
             loader.compileShadowGenerators = this.compileShadowGenerators;
+            loader.preprocessUrlAsync = this.preprocessUrlAsync;
             loader.onMeshLoadedObservable.add(function (mesh) { return _this.onMeshLoadedObservable.notifyObservers(mesh); });
             loader.onMeshLoadedObservable.add(function (mesh) { return _this.onMeshLoadedObservable.notifyObservers(mesh); });
             loader.onTextureLoadedObservable.add(function (texture) { return _this.onTextureLoadedObservable.notifyObservers(texture); });
             loader.onTextureLoadedObservable.add(function (texture) { return _this.onTextureLoadedObservable.notifyObservers(texture); });
             loader.onMaterialLoadedObservable.add(function (material) { return _this.onMaterialLoadedObservable.notifyObservers(material); });
             loader.onMaterialLoadedObservable.add(function (material) { return _this.onMaterialLoadedObservable.notifyObservers(material); });
@@ -1968,16 +1974,14 @@ var BABYLON;
                 this.compileMaterials = false;
                 this.compileMaterials = false;
                 this.useClipPlane = false;
                 this.useClipPlane = false;
                 this.compileShadowGenerators = false;
                 this.compileShadowGenerators = false;
-                this.onDisposeObservable = new BABYLON.Observable();
+                this.preprocessUrlAsync = function (url) { return Promise.resolve(url); };
                 this.onMeshLoadedObservable = new BABYLON.Observable();
                 this.onMeshLoadedObservable = new BABYLON.Observable();
                 this.onTextureLoadedObservable = new BABYLON.Observable();
                 this.onTextureLoadedObservable = new BABYLON.Observable();
                 this.onMaterialLoadedObservable = new BABYLON.Observable();
                 this.onMaterialLoadedObservable = new BABYLON.Observable();
                 this.onCameraLoadedObservable = new BABYLON.Observable();
                 this.onCameraLoadedObservable = new BABYLON.Observable();
                 this.onCompleteObservable = new BABYLON.Observable();
                 this.onCompleteObservable = new BABYLON.Observable();
+                this.onDisposeObservable = new BABYLON.Observable();
                 this.onExtensionLoadedObservable = new BABYLON.Observable();
                 this.onExtensionLoadedObservable = new BABYLON.Observable();
-                /**
-                * State of the loader
-                */
                 this.state = null;
                 this.state = null;
             }
             }
             GLTFLoader.RegisterExtension = function (extension) {
             GLTFLoader.RegisterExtension = function (extension) {

File diff suppressed because it is too large
+ 2 - 2
dist/preview release/loaders/babylon.glTF1FileLoader.min.js


+ 14 - 2
dist/preview release/loaders/babylon.glTF2FileLoader.d.ts

@@ -98,6 +98,10 @@ declare module BABYLON {
          */
          */
         compileShadowGenerators: boolean;
         compileShadowGenerators: boolean;
         /**
         /**
+         * Function called before loading a url referenced by the asset.
+         */
+        preprocessUrlAsync: (url: string) => Promise<string>;
+        /**
          * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
          * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
          */
          */
         onMeshLoadedObservable: Observable<AbstractMesh>;
         onMeshLoadedObservable: Observable<AbstractMesh>;
@@ -199,6 +203,10 @@ declare module BABYLON {
          */
          */
         compileShadowGenerators: boolean;
         compileShadowGenerators: boolean;
         /**
         /**
+         * Function called before loading a url referenced by the asset.
+         */
+        preprocessUrlAsync: (url: string) => Promise<string>;
+        /**
          * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
          * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
          */
          */
         readonly onMeshLoadedObservable: Observable<AbstractMesh>;
         readonly onMeshLoadedObservable: Observable<AbstractMesh>;
@@ -495,8 +503,8 @@ declare module BABYLON.GLTF2 {
         private _defaultBabylonMaterials;
         private _defaultBabylonMaterials;
         private _progressCallback?;
         private _progressCallback?;
         private _requests;
         private _requests;
-        private static _Names;
-        private static _Factories;
+        private static _ExtensionNames;
+        private static _ExtensionFactories;
         /** @hidden */
         /** @hidden */
         static _Register(name: string, factory: (loader: GLTFLoader) => GLTFLoaderExtension): void;
         static _Register(name: string, factory: (loader: GLTFLoader) => GLTFLoaderExtension): void;
         /**
         /**
@@ -520,6 +528,10 @@ declare module BABYLON.GLTF2 {
          */
          */
         compileShadowGenerators: boolean;
         compileShadowGenerators: boolean;
         /**
         /**
+         * Function called before loading a url referenced by the asset.
+         */
+        preprocessUrlAsync: (url: string) => Promise<string>;
+        /**
          * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
          * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
          */
          */
         readonly onMeshLoadedObservable: Observable<AbstractMesh>;
         readonly onMeshLoadedObservable: Observable<AbstractMesh>;

+ 48 - 32
dist/preview release/loaders/babylon.glTF2FileLoader.js

@@ -84,6 +84,10 @@ var BABYLON;
              */
              */
             this.compileShadowGenerators = false;
             this.compileShadowGenerators = false;
             /**
             /**
+             * Function called before loading a url referenced by the asset.
+             */
+            this.preprocessUrlAsync = function (url) { return Promise.resolve(url); };
+            /**
              * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
              * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
              */
              */
             this.onMeshLoadedObservable = new BABYLON.Observable();
             this.onMeshLoadedObservable = new BABYLON.Observable();
@@ -262,6 +266,7 @@ var BABYLON;
                 this._loader.dispose();
                 this._loader.dispose();
                 this._loader = null;
                 this._loader = null;
             }
             }
+            this.preprocessUrlAsync = function (url) { return Promise.resolve(url); };
             this.onMeshLoadedObservable.clear();
             this.onMeshLoadedObservable.clear();
             this.onTextureLoadedObservable.clear();
             this.onTextureLoadedObservable.clear();
             this.onMaterialLoadedObservable.clear();
             this.onMaterialLoadedObservable.clear();
@@ -389,6 +394,7 @@ var BABYLON;
             loader.compileMaterials = this.compileMaterials;
             loader.compileMaterials = this.compileMaterials;
             loader.useClipPlane = this.useClipPlane;
             loader.useClipPlane = this.useClipPlane;
             loader.compileShadowGenerators = this.compileShadowGenerators;
             loader.compileShadowGenerators = this.compileShadowGenerators;
+            loader.preprocessUrlAsync = this.preprocessUrlAsync;
             loader.onMeshLoadedObservable.add(function (mesh) { return _this.onMeshLoadedObservable.notifyObservers(mesh); });
             loader.onMeshLoadedObservable.add(function (mesh) { return _this.onMeshLoadedObservable.notifyObservers(mesh); });
             loader.onTextureLoadedObservable.add(function (texture) { return _this.onTextureLoadedObservable.notifyObservers(texture); });
             loader.onTextureLoadedObservable.add(function (texture) { return _this.onTextureLoadedObservable.notifyObservers(texture); });
             loader.onMaterialLoadedObservable.add(function (material) { return _this.onMaterialLoadedObservable.notifyObservers(material); });
             loader.onMaterialLoadedObservable.add(function (material) { return _this.onMaterialLoadedObservable.notifyObservers(material); });
@@ -648,6 +654,10 @@ var BABYLON;
                  */
                  */
                 this.compileShadowGenerators = false;
                 this.compileShadowGenerators = false;
                 /**
                 /**
+                 * Function called before loading a url referenced by the asset.
+                 */
+                this.preprocessUrlAsync = function (url) { return Promise.resolve(url); };
+                /**
                  * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
                  * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
                  */
                  */
                 this.onMeshLoadedObservable = new BABYLON.Observable();
                 this.onMeshLoadedObservable = new BABYLON.Observable();
@@ -681,13 +691,13 @@ var BABYLON;
             }
             }
             /** @hidden */
             /** @hidden */
             GLTFLoader._Register = function (name, factory) {
             GLTFLoader._Register = function (name, factory) {
-                if (GLTFLoader._Factories[name]) {
+                if (GLTFLoader._ExtensionFactories[name]) {
                     BABYLON.Tools.Error("Extension with the name '" + name + "' already exists");
                     BABYLON.Tools.Error("Extension with the name '" + name + "' already exists");
                     return;
                     return;
                 }
                 }
-                GLTFLoader._Factories[name] = factory;
+                GLTFLoader._ExtensionFactories[name] = factory;
                 // Keep the order of registration so that extensions registered first are called first.
                 // Keep the order of registration so that extensions registered first are called first.
-                GLTFLoader._Names.push(name);
+                GLTFLoader._ExtensionNames.push(name);
             };
             };
             Object.defineProperty(GLTFLoader.prototype, "state", {
             Object.defineProperty(GLTFLoader.prototype, "state", {
                 /**
                 /**
@@ -810,15 +820,17 @@ var BABYLON;
                     });
                     });
                     return resultPromise;
                     return resultPromise;
                 }).catch(function (error) {
                 }).catch(function (error) {
-                    BABYLON.Tools.Error("glTF Loader: " + error.message);
-                    _this._clear();
-                    throw error;
+                    if (!_this._disposed) {
+                        BABYLON.Tools.Error("glTF Loader: " + error.message);
+                        _this._clear();
+                        throw error;
+                    }
                 });
                 });
             };
             };
             GLTFLoader.prototype._loadExtensions = function () {
             GLTFLoader.prototype._loadExtensions = function () {
-                for (var _i = 0, _a = GLTFLoader._Names; _i < _a.length; _i++) {
+                for (var _i = 0, _a = GLTFLoader._ExtensionNames; _i < _a.length; _i++) {
                     var name_1 = _a[_i];
                     var name_1 = _a[_i];
-                    var extension = GLTFLoader._Factories[name_1](this);
+                    var extension = GLTFLoader._ExtensionFactories[name_1](this);
                     this._extensions[name_1] = extension;
                     this._extensions[name_1] = extension;
                     this.onExtensionLoadedObservable.notifyObservers(extension);
                     this.onExtensionLoadedObservable.notifyObservers(extension);
                 }
                 }
@@ -1897,31 +1909,35 @@ var BABYLON;
                 if (BABYLON.Tools.IsBase64(uri)) {
                 if (BABYLON.Tools.IsBase64(uri)) {
                     return Promise.resolve(new Uint8Array(BABYLON.Tools.DecodeBase64(uri)));
                     return Promise.resolve(new Uint8Array(BABYLON.Tools.DecodeBase64(uri)));
                 }
                 }
-                return new Promise(function (resolve, reject) {
-                    var request = BABYLON.Tools.LoadFile(_this._rootUrl + uri, function (data) {
-                        if (!_this._disposed) {
-                            resolve(new Uint8Array(data));
-                        }
-                    }, function (event) {
+                return this.preprocessUrlAsync(this._rootUrl + uri).then(function (url) {
+                    return new Promise(function (resolve, reject) {
                         if (!_this._disposed) {
                         if (!_this._disposed) {
-                            try {
-                                if (request && _this._state === BABYLON.GLTFLoaderState.LOADING) {
-                                    request._lengthComputable = event.lengthComputable;
-                                    request._loaded = event.loaded;
-                                    request._total = event.total;
-                                    _this._onProgress();
+                            var request_1 = BABYLON.Tools.LoadFile(url, function (data) {
+                                if (!_this._disposed) {
+                                    resolve(new Uint8Array(data));
                                 }
                                 }
-                            }
-                            catch (e) {
-                                reject(e);
-                            }
-                        }
-                    }, _this._babylonScene.database, true, function (request, exception) {
-                        if (!_this._disposed) {
-                            reject(new BABYLON.LoadFileError(context + ": Failed to load '" + uri + "'" + (request ? ": " + request.status + " " + request.statusText : ""), request));
+                            }, function (event) {
+                                if (!_this._disposed) {
+                                    try {
+                                        if (request_1 && _this._state === BABYLON.GLTFLoaderState.LOADING) {
+                                            request_1._lengthComputable = event.lengthComputable;
+                                            request_1._loaded = event.loaded;
+                                            request_1._total = event.total;
+                                            _this._onProgress();
+                                        }
+                                    }
+                                    catch (e) {
+                                        reject(e);
+                                    }
+                                }
+                            }, _this._babylonScene.database, true, function (request, exception) {
+                                if (!_this._disposed) {
+                                    reject(new BABYLON.LoadFileError(context + ": Failed to load '" + uri + "'" + (request ? ": " + request.status + " " + request.statusText : ""), request));
+                                }
+                            });
+                            _this._requests.push(request_1);
                         }
                         }
                     });
                     });
-                    _this._requests.push(request);
                 });
                 });
             };
             };
             GLTFLoader.prototype._onProgress = function () {
             GLTFLoader.prototype._onProgress = function () {
@@ -2112,7 +2128,7 @@ var BABYLON;
             };
             };
             /** @hidden */
             /** @hidden */
             GLTFLoader.prototype._applyExtensions = function (actionAsync) {
             GLTFLoader.prototype._applyExtensions = function (actionAsync) {
-                for (var _i = 0, _a = GLTFLoader._Names; _i < _a.length; _i++) {
+                for (var _i = 0, _a = GLTFLoader._ExtensionNames; _i < _a.length; _i++) {
                     var name_5 = _a[_i];
                     var name_5 = _a[_i];
                     var extension = this._extensions[name_5];
                     var extension = this._extensions[name_5];
                     if (extension.enabled) {
                     if (extension.enabled) {
@@ -2124,8 +2140,8 @@ var BABYLON;
                 }
                 }
                 return null;
                 return null;
             };
             };
-            GLTFLoader._Names = new Array();
-            GLTFLoader._Factories = {};
+            GLTFLoader._ExtensionNames = new Array();
+            GLTFLoader._ExtensionFactories = {};
             return GLTFLoader;
             return GLTFLoader;
         }());
         }());
         GLTF2.GLTFLoader = GLTFLoader;
         GLTF2.GLTFLoader = GLTFLoader;

File diff suppressed because it is too large
+ 2 - 2
dist/preview release/loaders/babylon.glTF2FileLoader.min.js


+ 22 - 12
dist/preview release/loaders/babylon.glTFFileLoader.d.ts

@@ -98,6 +98,10 @@ declare module BABYLON {
          */
          */
         compileShadowGenerators: boolean;
         compileShadowGenerators: boolean;
         /**
         /**
+         * Function called before loading a url referenced by the asset.
+         */
+        preprocessUrlAsync: (url: string) => Promise<string>;
+        /**
          * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
          * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
          */
          */
         onMeshLoadedObservable: Observable<AbstractMesh>;
         onMeshLoadedObservable: Observable<AbstractMesh>;
@@ -199,6 +203,10 @@ declare module BABYLON {
          */
          */
         compileShadowGenerators: boolean;
         compileShadowGenerators: boolean;
         /**
         /**
+         * Function called before loading a url referenced by the asset.
+         */
+        preprocessUrlAsync: (url: string) => Promise<string>;
+        /**
          * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
          * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
          */
          */
         readonly onMeshLoadedObservable: Observable<AbstractMesh>;
         readonly onMeshLoadedObservable: Observable<AbstractMesh>;
@@ -743,16 +751,14 @@ declare module BABYLON.GLTF1 {
         compileMaterials: boolean;
         compileMaterials: boolean;
         useClipPlane: boolean;
         useClipPlane: boolean;
         compileShadowGenerators: boolean;
         compileShadowGenerators: boolean;
-        onDisposeObservable: Observable<IGLTFLoader>;
-        onMeshLoadedObservable: Observable<AbstractMesh>;
-        onTextureLoadedObservable: Observable<BaseTexture>;
-        onMaterialLoadedObservable: Observable<Material>;
-        onCameraLoadedObservable: Observable<Camera>;
-        onCompleteObservable: Observable<IGLTFLoader>;
-        onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
-        /**
-        * State of the loader
-        */
+        preprocessUrlAsync: (url: string) => Promise<string>;
+        readonly onMeshLoadedObservable: Observable<AbstractMesh>;
+        readonly onTextureLoadedObservable: Observable<BaseTexture>;
+        readonly onMaterialLoadedObservable: Observable<Material>;
+        readonly onCameraLoadedObservable: Observable<Camera>;
+        readonly onCompleteObservable: Observable<IGLTFLoader>;
+        readonly onDisposeObservable: Observable<IGLTFLoader>;
+        readonly onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
         state: Nullable<GLTFLoaderState>;
         state: Nullable<GLTFLoaderState>;
         dispose(): void;
         dispose(): void;
         private _importMeshAsync(meshesNames, scene, data, rootUrl, onSuccess, onProgress?, onError?);
         private _importMeshAsync(meshesNames, scene, data, rootUrl, onSuccess, onProgress?, onError?);
@@ -1072,8 +1078,8 @@ declare module BABYLON.GLTF2 {
         private _defaultBabylonMaterials;
         private _defaultBabylonMaterials;
         private _progressCallback?;
         private _progressCallback?;
         private _requests;
         private _requests;
-        private static _Names;
-        private static _Factories;
+        private static _ExtensionNames;
+        private static _ExtensionFactories;
         /** @hidden */
         /** @hidden */
         static _Register(name: string, factory: (loader: GLTFLoader) => GLTFLoaderExtension): void;
         static _Register(name: string, factory: (loader: GLTFLoader) => GLTFLoaderExtension): void;
         /**
         /**
@@ -1097,6 +1103,10 @@ declare module BABYLON.GLTF2 {
          */
          */
         compileShadowGenerators: boolean;
         compileShadowGenerators: boolean;
         /**
         /**
+         * Function called before loading a url referenced by the asset.
+         */
+        preprocessUrlAsync: (url: string) => Promise<string>;
+        /**
          * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
          * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
          */
          */
         readonly onMeshLoadedObservable: Observable<AbstractMesh>;
         readonly onMeshLoadedObservable: Observable<AbstractMesh>;

+ 50 - 36
dist/preview release/loaders/babylon.glTFFileLoader.js

@@ -84,6 +84,10 @@ var BABYLON;
              */
              */
             this.compileShadowGenerators = false;
             this.compileShadowGenerators = false;
             /**
             /**
+             * Function called before loading a url referenced by the asset.
+             */
+            this.preprocessUrlAsync = function (url) { return Promise.resolve(url); };
+            /**
              * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
              * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
              */
              */
             this.onMeshLoadedObservable = new BABYLON.Observable();
             this.onMeshLoadedObservable = new BABYLON.Observable();
@@ -262,6 +266,7 @@ var BABYLON;
                 this._loader.dispose();
                 this._loader.dispose();
                 this._loader = null;
                 this._loader = null;
             }
             }
+            this.preprocessUrlAsync = function (url) { return Promise.resolve(url); };
             this.onMeshLoadedObservable.clear();
             this.onMeshLoadedObservable.clear();
             this.onTextureLoadedObservable.clear();
             this.onTextureLoadedObservable.clear();
             this.onMaterialLoadedObservable.clear();
             this.onMaterialLoadedObservable.clear();
@@ -389,6 +394,7 @@ var BABYLON;
             loader.compileMaterials = this.compileMaterials;
             loader.compileMaterials = this.compileMaterials;
             loader.useClipPlane = this.useClipPlane;
             loader.useClipPlane = this.useClipPlane;
             loader.compileShadowGenerators = this.compileShadowGenerators;
             loader.compileShadowGenerators = this.compileShadowGenerators;
+            loader.preprocessUrlAsync = this.preprocessUrlAsync;
             loader.onMeshLoadedObservable.add(function (mesh) { return _this.onMeshLoadedObservable.notifyObservers(mesh); });
             loader.onMeshLoadedObservable.add(function (mesh) { return _this.onMeshLoadedObservable.notifyObservers(mesh); });
             loader.onTextureLoadedObservable.add(function (texture) { return _this.onTextureLoadedObservable.notifyObservers(texture); });
             loader.onTextureLoadedObservable.add(function (texture) { return _this.onTextureLoadedObservable.notifyObservers(texture); });
             loader.onMaterialLoadedObservable.add(function (material) { return _this.onMaterialLoadedObservable.notifyObservers(material); });
             loader.onMaterialLoadedObservable.add(function (material) { return _this.onMaterialLoadedObservable.notifyObservers(material); });
@@ -1968,16 +1974,14 @@ var BABYLON;
                 this.compileMaterials = false;
                 this.compileMaterials = false;
                 this.useClipPlane = false;
                 this.useClipPlane = false;
                 this.compileShadowGenerators = false;
                 this.compileShadowGenerators = false;
-                this.onDisposeObservable = new BABYLON.Observable();
+                this.preprocessUrlAsync = function (url) { return Promise.resolve(url); };
                 this.onMeshLoadedObservable = new BABYLON.Observable();
                 this.onMeshLoadedObservable = new BABYLON.Observable();
                 this.onTextureLoadedObservable = new BABYLON.Observable();
                 this.onTextureLoadedObservable = new BABYLON.Observable();
                 this.onMaterialLoadedObservable = new BABYLON.Observable();
                 this.onMaterialLoadedObservable = new BABYLON.Observable();
                 this.onCameraLoadedObservable = new BABYLON.Observable();
                 this.onCameraLoadedObservable = new BABYLON.Observable();
                 this.onCompleteObservable = new BABYLON.Observable();
                 this.onCompleteObservable = new BABYLON.Observable();
+                this.onDisposeObservable = new BABYLON.Observable();
                 this.onExtensionLoadedObservable = new BABYLON.Observable();
                 this.onExtensionLoadedObservable = new BABYLON.Observable();
-                /**
-                * State of the loader
-                */
                 this.state = null;
                 this.state = null;
             }
             }
             GLTFLoader.RegisterExtension = function (extension) {
             GLTFLoader.RegisterExtension = function (extension) {
@@ -2864,6 +2868,10 @@ var BABYLON;
                  */
                  */
                 this.compileShadowGenerators = false;
                 this.compileShadowGenerators = false;
                 /**
                 /**
+                 * Function called before loading a url referenced by the asset.
+                 */
+                this.preprocessUrlAsync = function (url) { return Promise.resolve(url); };
+                /**
                  * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
                  * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
                  */
                  */
                 this.onMeshLoadedObservable = new BABYLON.Observable();
                 this.onMeshLoadedObservable = new BABYLON.Observable();
@@ -2897,13 +2905,13 @@ var BABYLON;
             }
             }
             /** @hidden */
             /** @hidden */
             GLTFLoader._Register = function (name, factory) {
             GLTFLoader._Register = function (name, factory) {
-                if (GLTFLoader._Factories[name]) {
+                if (GLTFLoader._ExtensionFactories[name]) {
                     BABYLON.Tools.Error("Extension with the name '" + name + "' already exists");
                     BABYLON.Tools.Error("Extension with the name '" + name + "' already exists");
                     return;
                     return;
                 }
                 }
-                GLTFLoader._Factories[name] = factory;
+                GLTFLoader._ExtensionFactories[name] = factory;
                 // Keep the order of registration so that extensions registered first are called first.
                 // Keep the order of registration so that extensions registered first are called first.
-                GLTFLoader._Names.push(name);
+                GLTFLoader._ExtensionNames.push(name);
             };
             };
             Object.defineProperty(GLTFLoader.prototype, "state", {
             Object.defineProperty(GLTFLoader.prototype, "state", {
                 /**
                 /**
@@ -3026,15 +3034,17 @@ var BABYLON;
                     });
                     });
                     return resultPromise;
                     return resultPromise;
                 }).catch(function (error) {
                 }).catch(function (error) {
-                    BABYLON.Tools.Error("glTF Loader: " + error.message);
-                    _this._clear();
-                    throw error;
+                    if (!_this._disposed) {
+                        BABYLON.Tools.Error("glTF Loader: " + error.message);
+                        _this._clear();
+                        throw error;
+                    }
                 });
                 });
             };
             };
             GLTFLoader.prototype._loadExtensions = function () {
             GLTFLoader.prototype._loadExtensions = function () {
-                for (var _i = 0, _a = GLTFLoader._Names; _i < _a.length; _i++) {
+                for (var _i = 0, _a = GLTFLoader._ExtensionNames; _i < _a.length; _i++) {
                     var name_1 = _a[_i];
                     var name_1 = _a[_i];
-                    var extension = GLTFLoader._Factories[name_1](this);
+                    var extension = GLTFLoader._ExtensionFactories[name_1](this);
                     this._extensions[name_1] = extension;
                     this._extensions[name_1] = extension;
                     this.onExtensionLoadedObservable.notifyObservers(extension);
                     this.onExtensionLoadedObservable.notifyObservers(extension);
                 }
                 }
@@ -4113,31 +4123,35 @@ var BABYLON;
                 if (BABYLON.Tools.IsBase64(uri)) {
                 if (BABYLON.Tools.IsBase64(uri)) {
                     return Promise.resolve(new Uint8Array(BABYLON.Tools.DecodeBase64(uri)));
                     return Promise.resolve(new Uint8Array(BABYLON.Tools.DecodeBase64(uri)));
                 }
                 }
-                return new Promise(function (resolve, reject) {
-                    var request = BABYLON.Tools.LoadFile(_this._rootUrl + uri, function (data) {
+                return this.preprocessUrlAsync(this._rootUrl + uri).then(function (url) {
+                    return new Promise(function (resolve, reject) {
                         if (!_this._disposed) {
                         if (!_this._disposed) {
-                            resolve(new Uint8Array(data));
-                        }
-                    }, function (event) {
-                        if (!_this._disposed) {
-                            try {
-                                if (request && _this._state === BABYLON.GLTFLoaderState.LOADING) {
-                                    request._lengthComputable = event.lengthComputable;
-                                    request._loaded = event.loaded;
-                                    request._total = event.total;
-                                    _this._onProgress();
+                            var request_1 = BABYLON.Tools.LoadFile(url, function (data) {
+                                if (!_this._disposed) {
+                                    resolve(new Uint8Array(data));
                                 }
                                 }
-                            }
-                            catch (e) {
-                                reject(e);
-                            }
-                        }
-                    }, _this._babylonScene.database, true, function (request, exception) {
-                        if (!_this._disposed) {
-                            reject(new BABYLON.LoadFileError(context + ": Failed to load '" + uri + "'" + (request ? ": " + request.status + " " + request.statusText : ""), request));
+                            }, function (event) {
+                                if (!_this._disposed) {
+                                    try {
+                                        if (request_1 && _this._state === BABYLON.GLTFLoaderState.LOADING) {
+                                            request_1._lengthComputable = event.lengthComputable;
+                                            request_1._loaded = event.loaded;
+                                            request_1._total = event.total;
+                                            _this._onProgress();
+                                        }
+                                    }
+                                    catch (e) {
+                                        reject(e);
+                                    }
+                                }
+                            }, _this._babylonScene.database, true, function (request, exception) {
+                                if (!_this._disposed) {
+                                    reject(new BABYLON.LoadFileError(context + ": Failed to load '" + uri + "'" + (request ? ": " + request.status + " " + request.statusText : ""), request));
+                                }
+                            });
+                            _this._requests.push(request_1);
                         }
                         }
                     });
                     });
-                    _this._requests.push(request);
                 });
                 });
             };
             };
             GLTFLoader.prototype._onProgress = function () {
             GLTFLoader.prototype._onProgress = function () {
@@ -4328,7 +4342,7 @@ var BABYLON;
             };
             };
             /** @hidden */
             /** @hidden */
             GLTFLoader.prototype._applyExtensions = function (actionAsync) {
             GLTFLoader.prototype._applyExtensions = function (actionAsync) {
-                for (var _i = 0, _a = GLTFLoader._Names; _i < _a.length; _i++) {
+                for (var _i = 0, _a = GLTFLoader._ExtensionNames; _i < _a.length; _i++) {
                     var name_5 = _a[_i];
                     var name_5 = _a[_i];
                     var extension = this._extensions[name_5];
                     var extension = this._extensions[name_5];
                     if (extension.enabled) {
                     if (extension.enabled) {
@@ -4340,8 +4354,8 @@ var BABYLON;
                 }
                 }
                 return null;
                 return null;
             };
             };
-            GLTFLoader._Names = new Array();
-            GLTFLoader._Factories = {};
+            GLTFLoader._ExtensionNames = new Array();
+            GLTFLoader._ExtensionFactories = {};
             return GLTFLoader;
             return GLTFLoader;
         }());
         }());
         GLTF2.GLTFLoader = GLTFLoader;
         GLTF2.GLTFLoader = GLTFLoader;

File diff suppressed because it is too large
+ 3 - 3
dist/preview release/loaders/babylon.glTFFileLoader.min.js


+ 22 - 12
dist/preview release/loaders/babylonjs.loaders.d.ts

@@ -194,6 +194,10 @@ declare module BABYLON {
          */
          */
         compileShadowGenerators: boolean;
         compileShadowGenerators: boolean;
         /**
         /**
+         * Function called before loading a url referenced by the asset.
+         */
+        preprocessUrlAsync: (url: string) => Promise<string>;
+        /**
          * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
          * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
          */
          */
         onMeshLoadedObservable: Observable<AbstractMesh>;
         onMeshLoadedObservable: Observable<AbstractMesh>;
@@ -295,6 +299,10 @@ declare module BABYLON {
          */
          */
         compileShadowGenerators: boolean;
         compileShadowGenerators: boolean;
         /**
         /**
+         * Function called before loading a url referenced by the asset.
+         */
+        preprocessUrlAsync: (url: string) => Promise<string>;
+        /**
          * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
          * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
          */
          */
         readonly onMeshLoadedObservable: Observable<AbstractMesh>;
         readonly onMeshLoadedObservable: Observable<AbstractMesh>;
@@ -839,16 +847,14 @@ declare module BABYLON.GLTF1 {
         compileMaterials: boolean;
         compileMaterials: boolean;
         useClipPlane: boolean;
         useClipPlane: boolean;
         compileShadowGenerators: boolean;
         compileShadowGenerators: boolean;
-        onDisposeObservable: Observable<IGLTFLoader>;
-        onMeshLoadedObservable: Observable<AbstractMesh>;
-        onTextureLoadedObservable: Observable<BaseTexture>;
-        onMaterialLoadedObservable: Observable<Material>;
-        onCameraLoadedObservable: Observable<Camera>;
-        onCompleteObservable: Observable<IGLTFLoader>;
-        onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
-        /**
-        * State of the loader
-        */
+        preprocessUrlAsync: (url: string) => Promise<string>;
+        readonly onMeshLoadedObservable: Observable<AbstractMesh>;
+        readonly onTextureLoadedObservable: Observable<BaseTexture>;
+        readonly onMaterialLoadedObservable: Observable<Material>;
+        readonly onCameraLoadedObservable: Observable<Camera>;
+        readonly onCompleteObservable: Observable<IGLTFLoader>;
+        readonly onDisposeObservable: Observable<IGLTFLoader>;
+        readonly onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
         state: Nullable<GLTFLoaderState>;
         state: Nullable<GLTFLoaderState>;
         dispose(): void;
         dispose(): void;
         private _importMeshAsync(meshesNames, scene, data, rootUrl, onSuccess, onProgress?, onError?);
         private _importMeshAsync(meshesNames, scene, data, rootUrl, onSuccess, onProgress?, onError?);
@@ -1168,8 +1174,8 @@ declare module BABYLON.GLTF2 {
         private _defaultBabylonMaterials;
         private _defaultBabylonMaterials;
         private _progressCallback?;
         private _progressCallback?;
         private _requests;
         private _requests;
-        private static _Names;
-        private static _Factories;
+        private static _ExtensionNames;
+        private static _ExtensionFactories;
         /** @hidden */
         /** @hidden */
         static _Register(name: string, factory: (loader: GLTFLoader) => GLTFLoaderExtension): void;
         static _Register(name: string, factory: (loader: GLTFLoader) => GLTFLoaderExtension): void;
         /**
         /**
@@ -1193,6 +1199,10 @@ declare module BABYLON.GLTF2 {
          */
          */
         compileShadowGenerators: boolean;
         compileShadowGenerators: boolean;
         /**
         /**
+         * Function called before loading a url referenced by the asset.
+         */
+        preprocessUrlAsync: (url: string) => Promise<string>;
+        /**
          * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
          * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
          */
          */
         readonly onMeshLoadedObservable: Observable<AbstractMesh>;
         readonly onMeshLoadedObservable: Observable<AbstractMesh>;

+ 50 - 36
dist/preview release/loaders/babylonjs.loaders.js

@@ -1084,6 +1084,10 @@ var BABYLON;
              */
              */
             this.compileShadowGenerators = false;
             this.compileShadowGenerators = false;
             /**
             /**
+             * Function called before loading a url referenced by the asset.
+             */
+            this.preprocessUrlAsync = function (url) { return Promise.resolve(url); };
+            /**
              * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
              * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
              */
              */
             this.onMeshLoadedObservable = new BABYLON.Observable();
             this.onMeshLoadedObservable = new BABYLON.Observable();
@@ -1262,6 +1266,7 @@ var BABYLON;
                 this._loader.dispose();
                 this._loader.dispose();
                 this._loader = null;
                 this._loader = null;
             }
             }
+            this.preprocessUrlAsync = function (url) { return Promise.resolve(url); };
             this.onMeshLoadedObservable.clear();
             this.onMeshLoadedObservable.clear();
             this.onTextureLoadedObservable.clear();
             this.onTextureLoadedObservable.clear();
             this.onMaterialLoadedObservable.clear();
             this.onMaterialLoadedObservable.clear();
@@ -1389,6 +1394,7 @@ var BABYLON;
             loader.compileMaterials = this.compileMaterials;
             loader.compileMaterials = this.compileMaterials;
             loader.useClipPlane = this.useClipPlane;
             loader.useClipPlane = this.useClipPlane;
             loader.compileShadowGenerators = this.compileShadowGenerators;
             loader.compileShadowGenerators = this.compileShadowGenerators;
+            loader.preprocessUrlAsync = this.preprocessUrlAsync;
             loader.onMeshLoadedObservable.add(function (mesh) { return _this.onMeshLoadedObservable.notifyObservers(mesh); });
             loader.onMeshLoadedObservable.add(function (mesh) { return _this.onMeshLoadedObservable.notifyObservers(mesh); });
             loader.onTextureLoadedObservable.add(function (texture) { return _this.onTextureLoadedObservable.notifyObservers(texture); });
             loader.onTextureLoadedObservable.add(function (texture) { return _this.onTextureLoadedObservable.notifyObservers(texture); });
             loader.onMaterialLoadedObservable.add(function (material) { return _this.onMaterialLoadedObservable.notifyObservers(material); });
             loader.onMaterialLoadedObservable.add(function (material) { return _this.onMaterialLoadedObservable.notifyObservers(material); });
@@ -2968,16 +2974,14 @@ var BABYLON;
                 this.compileMaterials = false;
                 this.compileMaterials = false;
                 this.useClipPlane = false;
                 this.useClipPlane = false;
                 this.compileShadowGenerators = false;
                 this.compileShadowGenerators = false;
-                this.onDisposeObservable = new BABYLON.Observable();
+                this.preprocessUrlAsync = function (url) { return Promise.resolve(url); };
                 this.onMeshLoadedObservable = new BABYLON.Observable();
                 this.onMeshLoadedObservable = new BABYLON.Observable();
                 this.onTextureLoadedObservable = new BABYLON.Observable();
                 this.onTextureLoadedObservable = new BABYLON.Observable();
                 this.onMaterialLoadedObservable = new BABYLON.Observable();
                 this.onMaterialLoadedObservable = new BABYLON.Observable();
                 this.onCameraLoadedObservable = new BABYLON.Observable();
                 this.onCameraLoadedObservable = new BABYLON.Observable();
                 this.onCompleteObservable = new BABYLON.Observable();
                 this.onCompleteObservable = new BABYLON.Observable();
+                this.onDisposeObservable = new BABYLON.Observable();
                 this.onExtensionLoadedObservable = new BABYLON.Observable();
                 this.onExtensionLoadedObservable = new BABYLON.Observable();
-                /**
-                * State of the loader
-                */
                 this.state = null;
                 this.state = null;
             }
             }
             GLTFLoader.RegisterExtension = function (extension) {
             GLTFLoader.RegisterExtension = function (extension) {
@@ -3846,6 +3850,10 @@ var BABYLON;
                  */
                  */
                 this.compileShadowGenerators = false;
                 this.compileShadowGenerators = false;
                 /**
                 /**
+                 * Function called before loading a url referenced by the asset.
+                 */
+                this.preprocessUrlAsync = function (url) { return Promise.resolve(url); };
+                /**
                  * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
                  * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
                  */
                  */
                 this.onMeshLoadedObservable = new BABYLON.Observable();
                 this.onMeshLoadedObservable = new BABYLON.Observable();
@@ -3879,13 +3887,13 @@ var BABYLON;
             }
             }
             /** @hidden */
             /** @hidden */
             GLTFLoader._Register = function (name, factory) {
             GLTFLoader._Register = function (name, factory) {
-                if (GLTFLoader._Factories[name]) {
+                if (GLTFLoader._ExtensionFactories[name]) {
                     BABYLON.Tools.Error("Extension with the name '" + name + "' already exists");
                     BABYLON.Tools.Error("Extension with the name '" + name + "' already exists");
                     return;
                     return;
                 }
                 }
-                GLTFLoader._Factories[name] = factory;
+                GLTFLoader._ExtensionFactories[name] = factory;
                 // Keep the order of registration so that extensions registered first are called first.
                 // Keep the order of registration so that extensions registered first are called first.
-                GLTFLoader._Names.push(name);
+                GLTFLoader._ExtensionNames.push(name);
             };
             };
             Object.defineProperty(GLTFLoader.prototype, "state", {
             Object.defineProperty(GLTFLoader.prototype, "state", {
                 /**
                 /**
@@ -4008,15 +4016,17 @@ var BABYLON;
                     });
                     });
                     return resultPromise;
                     return resultPromise;
                 }).catch(function (error) {
                 }).catch(function (error) {
-                    BABYLON.Tools.Error("glTF Loader: " + error.message);
-                    _this._clear();
-                    throw error;
+                    if (!_this._disposed) {
+                        BABYLON.Tools.Error("glTF Loader: " + error.message);
+                        _this._clear();
+                        throw error;
+                    }
                 });
                 });
             };
             };
             GLTFLoader.prototype._loadExtensions = function () {
             GLTFLoader.prototype._loadExtensions = function () {
-                for (var _i = 0, _a = GLTFLoader._Names; _i < _a.length; _i++) {
+                for (var _i = 0, _a = GLTFLoader._ExtensionNames; _i < _a.length; _i++) {
                     var name_1 = _a[_i];
                     var name_1 = _a[_i];
-                    var extension = GLTFLoader._Factories[name_1](this);
+                    var extension = GLTFLoader._ExtensionFactories[name_1](this);
                     this._extensions[name_1] = extension;
                     this._extensions[name_1] = extension;
                     this.onExtensionLoadedObservable.notifyObservers(extension);
                     this.onExtensionLoadedObservable.notifyObservers(extension);
                 }
                 }
@@ -5095,31 +5105,35 @@ var BABYLON;
                 if (BABYLON.Tools.IsBase64(uri)) {
                 if (BABYLON.Tools.IsBase64(uri)) {
                     return Promise.resolve(new Uint8Array(BABYLON.Tools.DecodeBase64(uri)));
                     return Promise.resolve(new Uint8Array(BABYLON.Tools.DecodeBase64(uri)));
                 }
                 }
-                return new Promise(function (resolve, reject) {
-                    var request = BABYLON.Tools.LoadFile(_this._rootUrl + uri, function (data) {
+                return this.preprocessUrlAsync(this._rootUrl + uri).then(function (url) {
+                    return new Promise(function (resolve, reject) {
                         if (!_this._disposed) {
                         if (!_this._disposed) {
-                            resolve(new Uint8Array(data));
-                        }
-                    }, function (event) {
-                        if (!_this._disposed) {
-                            try {
-                                if (request && _this._state === BABYLON.GLTFLoaderState.LOADING) {
-                                    request._lengthComputable = event.lengthComputable;
-                                    request._loaded = event.loaded;
-                                    request._total = event.total;
-                                    _this._onProgress();
+                            var request_1 = BABYLON.Tools.LoadFile(url, function (data) {
+                                if (!_this._disposed) {
+                                    resolve(new Uint8Array(data));
                                 }
                                 }
-                            }
-                            catch (e) {
-                                reject(e);
-                            }
-                        }
-                    }, _this._babylonScene.database, true, function (request, exception) {
-                        if (!_this._disposed) {
-                            reject(new BABYLON.LoadFileError(context + ": Failed to load '" + uri + "'" + (request ? ": " + request.status + " " + request.statusText : ""), request));
+                            }, function (event) {
+                                if (!_this._disposed) {
+                                    try {
+                                        if (request_1 && _this._state === BABYLON.GLTFLoaderState.LOADING) {
+                                            request_1._lengthComputable = event.lengthComputable;
+                                            request_1._loaded = event.loaded;
+                                            request_1._total = event.total;
+                                            _this._onProgress();
+                                        }
+                                    }
+                                    catch (e) {
+                                        reject(e);
+                                    }
+                                }
+                            }, _this._babylonScene.database, true, function (request, exception) {
+                                if (!_this._disposed) {
+                                    reject(new BABYLON.LoadFileError(context + ": Failed to load '" + uri + "'" + (request ? ": " + request.status + " " + request.statusText : ""), request));
+                                }
+                            });
+                            _this._requests.push(request_1);
                         }
                         }
                     });
                     });
-                    _this._requests.push(request);
                 });
                 });
             };
             };
             GLTFLoader.prototype._onProgress = function () {
             GLTFLoader.prototype._onProgress = function () {
@@ -5310,7 +5324,7 @@ var BABYLON;
             };
             };
             /** @hidden */
             /** @hidden */
             GLTFLoader.prototype._applyExtensions = function (actionAsync) {
             GLTFLoader.prototype._applyExtensions = function (actionAsync) {
-                for (var _i = 0, _a = GLTFLoader._Names; _i < _a.length; _i++) {
+                for (var _i = 0, _a = GLTFLoader._ExtensionNames; _i < _a.length; _i++) {
                     var name_5 = _a[_i];
                     var name_5 = _a[_i];
                     var extension = this._extensions[name_5];
                     var extension = this._extensions[name_5];
                     if (extension.enabled) {
                     if (extension.enabled) {
@@ -5322,8 +5336,8 @@ var BABYLON;
                 }
                 }
                 return null;
                 return null;
             };
             };
-            GLTFLoader._Names = new Array();
-            GLTFLoader._Factories = {};
+            GLTFLoader._ExtensionNames = new Array();
+            GLTFLoader._ExtensionFactories = {};
             return GLTFLoader;
             return GLTFLoader;
         }());
         }());
         GLTF2.GLTFLoader = GLTFLoader;
         GLTF2.GLTFLoader = GLTFLoader;

File diff suppressed because it is too large
+ 4 - 4
dist/preview release/loaders/babylonjs.loaders.min.js


+ 22 - 12
dist/preview release/loaders/babylonjs.loaders.module.d.ts

@@ -201,6 +201,10 @@ declare module BABYLON {
          */
          */
         compileShadowGenerators: boolean;
         compileShadowGenerators: boolean;
         /**
         /**
+         * Function called before loading a url referenced by the asset.
+         */
+        preprocessUrlAsync: (url: string) => Promise<string>;
+        /**
          * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
          * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
          */
          */
         onMeshLoadedObservable: Observable<AbstractMesh>;
         onMeshLoadedObservable: Observable<AbstractMesh>;
@@ -302,6 +306,10 @@ declare module BABYLON {
          */
          */
         compileShadowGenerators: boolean;
         compileShadowGenerators: boolean;
         /**
         /**
+         * Function called before loading a url referenced by the asset.
+         */
+        preprocessUrlAsync: (url: string) => Promise<string>;
+        /**
          * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
          * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
          */
          */
         readonly onMeshLoadedObservable: Observable<AbstractMesh>;
         readonly onMeshLoadedObservable: Observable<AbstractMesh>;
@@ -846,16 +854,14 @@ declare module BABYLON.GLTF1 {
         compileMaterials: boolean;
         compileMaterials: boolean;
         useClipPlane: boolean;
         useClipPlane: boolean;
         compileShadowGenerators: boolean;
         compileShadowGenerators: boolean;
-        onDisposeObservable: Observable<IGLTFLoader>;
-        onMeshLoadedObservable: Observable<AbstractMesh>;
-        onTextureLoadedObservable: Observable<BaseTexture>;
-        onMaterialLoadedObservable: Observable<Material>;
-        onCameraLoadedObservable: Observable<Camera>;
-        onCompleteObservable: Observable<IGLTFLoader>;
-        onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
-        /**
-        * State of the loader
-        */
+        preprocessUrlAsync: (url: string) => Promise<string>;
+        readonly onMeshLoadedObservable: Observable<AbstractMesh>;
+        readonly onTextureLoadedObservable: Observable<BaseTexture>;
+        readonly onMaterialLoadedObservable: Observable<Material>;
+        readonly onCameraLoadedObservable: Observable<Camera>;
+        readonly onCompleteObservable: Observable<IGLTFLoader>;
+        readonly onDisposeObservable: Observable<IGLTFLoader>;
+        readonly onExtensionLoadedObservable: Observable<IGLTFLoaderExtension>;
         state: Nullable<GLTFLoaderState>;
         state: Nullable<GLTFLoaderState>;
         dispose(): void;
         dispose(): void;
         private _importMeshAsync(meshesNames, scene, data, rootUrl, onSuccess, onProgress?, onError?);
         private _importMeshAsync(meshesNames, scene, data, rootUrl, onSuccess, onProgress?, onError?);
@@ -1175,8 +1181,8 @@ declare module BABYLON.GLTF2 {
         private _defaultBabylonMaterials;
         private _defaultBabylonMaterials;
         private _progressCallback?;
         private _progressCallback?;
         private _requests;
         private _requests;
-        private static _Names;
-        private static _Factories;
+        private static _ExtensionNames;
+        private static _ExtensionFactories;
         /** @hidden */
         /** @hidden */
         static _Register(name: string, factory: (loader: GLTFLoader) => GLTFLoaderExtension): void;
         static _Register(name: string, factory: (loader: GLTFLoader) => GLTFLoaderExtension): void;
         /**
         /**
@@ -1200,6 +1206,10 @@ declare module BABYLON.GLTF2 {
          */
          */
         compileShadowGenerators: boolean;
         compileShadowGenerators: boolean;
         /**
         /**
+         * Function called before loading a url referenced by the asset.
+         */
+        preprocessUrlAsync: (url: string) => Promise<string>;
+        /**
          * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
          * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
          */
          */
         readonly onMeshLoadedObservable: Observable<AbstractMesh>;
         readonly onMeshLoadedObservable: Observable<AbstractMesh>;