瀏覽代碼

Merge remote-tracking branch 'upstream/master'

Sebastien Vandenberghe 7 年之前
父節點
當前提交
75ce88489f

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


+ 11 - 3
Tools/Gulp/gulpfile.js

@@ -800,10 +800,10 @@ gulp.task("typedoc-generate", function () {
             module: "commonjs",
             target: "es5",
             includeDeclarations: true,
- 
+
             // Output options (see typedoc docs)
             json: config.build.typedocJSON,
- 
+
             // TypeDoc options (see typedoc docs)
             ignoreCompilerErrors: true,
 
@@ -831,7 +831,7 @@ gulp.task("typedoc-validate", function () {
  */
 gulp.task("typedoc-generateValidationBaseline", function () {
     return gulp.src(config.build.typedocJSON)
-    .pipe(validateTypedoc(config.build.typedocValidationBaseline, "BABYLON", true, true));
+        .pipe(validateTypedoc(config.build.typedocValidationBaseline, "BABYLON", true, true));
 });
 
 /**
@@ -842,6 +842,14 @@ gulp.task("typedoc-all", function (cb) {
     runSequence("typedoc-generate", "typedoc-validate", "typedoc-generateValidationBaseline", cb);
 });
 
+
+/**
+ * Validate compile the code and check the comments and style case convention through typedoc
+ */
+gulp.task("typedoc-check", function (cb) {
+    runSequence("typescript-compile", "typedoc-generate", "typedoc-validate", cb);
+});
+
 /**
  * Launches the KARMA validation tests in chrome in order to debug them.
  * (Can only be launch locally.)

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


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


+ 452 - 49
dist/preview release/babylon.max.js

@@ -66471,9 +66471,9 @@ var BABYLON;
          * @param scene The scene the texture will be used in
          * @param size The cubemap desired size (the more it increases the longer the generation will be) If the size is omitted this implies you are using a preprocessed cubemap.
          * @param noMipmap Forces to not generate the mipmap if true
-         * @param generateHarmonics Specifies wether you want to extract the polynomial harmonics during the generation process
+         * @param generateHarmonics Specifies whether you want to extract the polynomial harmonics during the generation process
          * @param useInGammaSpace Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space)
-         * @param usePMREMGenerator Specifies wether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time.
+         * @param usePMREMGenerator Specifies whether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time.
          */
         function HDRCubeTexture(url, scene, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator, onLoad, onError) {
             if (noMipmap === void 0) { noMipmap = false; }
@@ -78171,34 +78171,114 @@ var BABYLON;
 
 var BABYLON;
 (function (BABYLON) {
+    /**
+     * Defines the list of states available for a task inside a {BABYLON.AssetsManager}
+     */
     var AssetTaskState;
     (function (AssetTaskState) {
+        /**
+         * Initialization
+         */
         AssetTaskState[AssetTaskState["INIT"] = 0] = "INIT";
+        /**
+         * Running
+         */
         AssetTaskState[AssetTaskState["RUNNING"] = 1] = "RUNNING";
+        /**
+         * Done
+         */
         AssetTaskState[AssetTaskState["DONE"] = 2] = "DONE";
+        /**
+         * Error
+         */
         AssetTaskState[AssetTaskState["ERROR"] = 3] = "ERROR";
     })(AssetTaskState = BABYLON.AssetTaskState || (BABYLON.AssetTaskState = {}));
+    /**
+     * Define an abstract asset task used with a {BABYLON.AssetsManager} class to load assets into a scene
+     */
     var AbstractAssetTask = /** @class */ (function () {
-        function AbstractAssetTask(name) {
+        /**
+         * Creates a new {BABYLON.AssetsManager}
+         * @param name defines the name of the task
+         */
+        function AbstractAssetTask(
+            /**
+             * Task name
+             */ name) {
             this.name = name;
-            this.isCompleted = false;
-            this.taskState = AssetTaskState.INIT;
+            this._isCompleted = false;
+            this._taskState = AssetTaskState.INIT;
         }
+        Object.defineProperty(AbstractAssetTask.prototype, "isCompleted", {
+            /**
+             * Get if the task is completed
+             */
+            get: function () {
+                return this._isCompleted;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(AbstractAssetTask.prototype, "taskState", {
+            /**
+             * Gets the current state of the task
+             */
+            get: function () {
+                return this._taskState;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(AbstractAssetTask.prototype, "errorObject", {
+            /**
+             * Gets the current error object (if task is in error)
+             */
+            get: function () {
+                return this._errorObject;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        /**
+         * Internal only
+         * @ignore
+         */
+        AbstractAssetTask.prototype._setErrorObject = function (message, exception) {
+            if (this._errorObject) {
+                return;
+            }
+            this._errorObject = {
+                message: message,
+                exception: exception
+            };
+        };
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         AbstractAssetTask.prototype.run = function (scene, onSuccess, onError) {
             var _this = this;
-            this.taskState = AssetTaskState.RUNNING;
+            this._taskState = AssetTaskState.RUNNING;
             this.runTask(scene, function () {
                 _this.onDoneCallback(onSuccess, onError);
             }, function (msg, exception) {
                 _this.onErrorCallback(onError, msg, exception);
             });
         };
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         AbstractAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
             throw new Error("runTask is not implemented");
         };
         AbstractAssetTask.prototype.onErrorCallback = function (onError, message, exception) {
-            this.taskState = AssetTaskState.ERROR;
-            this.errorObject = {
+            this._taskState = AssetTaskState.ERROR;
+            this._errorObject = {
                 message: message,
                 exception: exception
             };
@@ -78209,8 +78289,8 @@ var BABYLON;
         };
         AbstractAssetTask.prototype.onDoneCallback = function (onSuccess, onError) {
             try {
-                this.taskState = AssetTaskState.DONE;
-                this.isCompleted = true;
+                this._taskState = AssetTaskState.DONE;
+                this._isCompleted = true;
                 if (this.onSuccess) {
                     this.onSuccess(this);
                 }
@@ -78223,7 +78303,16 @@ var BABYLON;
         return AbstractAssetTask;
     }());
     BABYLON.AbstractAssetTask = AbstractAssetTask;
+    /**
+     * Class used to share progress information about assets loading
+     */
     var AssetsProgressEvent = /** @class */ (function () {
+        /**
+         * Creates a {BABYLON.AssetsProgressEvent}
+         * @param remainingCount defines the number of remaining tasks to process
+         * @param totalCount defines the total number of tasks
+         * @param task defines the task that was just processed
+         */
         function AssetsProgressEvent(remainingCount, totalCount, task) {
             this.remainingCount = remainingCount;
             this.totalCount = totalCount;
@@ -78232,9 +78321,35 @@ var BABYLON;
         return AssetsProgressEvent;
     }());
     BABYLON.AssetsProgressEvent = AssetsProgressEvent;
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load meshes
+     */
     var MeshAssetTask = /** @class */ (function (_super) {
         __extends(MeshAssetTask, _super);
-        function MeshAssetTask(name, meshesNames, rootUrl, sceneFilename) {
+        /**
+         * Creates a new {BABYLON.MeshAssetTask}
+         * @param name defines the name of the task
+         * @param meshesNames defines the list of mesh's names you want to load
+         * @param rootUrl defines the root url to use as a base to load your meshes and associated resources
+         * @param sceneFilename defines the filename of the scene to load from
+         */
+        function MeshAssetTask(
+            /**
+             * Defines the name of the task
+             */
+            name, 
+            /**
+             * Defines the list of mesh's names you want to load
+             */
+            meshesNames, 
+            /**
+             * Defines the root url to use as a base to load your meshes and associated resources
+             */
+            rootUrl, 
+            /**
+             * Defines the filename of the scene to load from
+             */
+            sceneFilename) {
             var _this = _super.call(this, name) || this;
             _this.name = name;
             _this.meshesNames = meshesNames;
@@ -78242,6 +78357,12 @@ var BABYLON;
             _this.sceneFilename = sceneFilename;
             return _this;
         }
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         MeshAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
             var _this = this;
             BABYLON.SceneLoader.ImportMesh(this.meshesNames, this.rootUrl, this.sceneFilename, scene, function (meshes, particleSystems, skeletons) {
@@ -78256,14 +78377,36 @@ var BABYLON;
         return MeshAssetTask;
     }(AbstractAssetTask));
     BABYLON.MeshAssetTask = MeshAssetTask;
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load text content
+     */
     var TextFileAssetTask = /** @class */ (function (_super) {
         __extends(TextFileAssetTask, _super);
-        function TextFileAssetTask(name, url) {
+        /**
+         * Creates a new TextFileAssetTask object
+         * @param name defines the name of the task
+         * @param url defines the location of the file to load
+         */
+        function TextFileAssetTask(
+            /**
+             * Defines the name of the task
+             */
+            name, 
+            /**
+             * Defines the location of the file to load
+             */
+            url) {
             var _this = _super.call(this, name) || this;
             _this.name = name;
             _this.url = url;
             return _this;
         }
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         TextFileAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
             var _this = this;
             scene._loadFile(this.url, function (data) {
@@ -78278,14 +78421,36 @@ var BABYLON;
         return TextFileAssetTask;
     }(AbstractAssetTask));
     BABYLON.TextFileAssetTask = TextFileAssetTask;
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load binary data
+     */
     var BinaryFileAssetTask = /** @class */ (function (_super) {
         __extends(BinaryFileAssetTask, _super);
-        function BinaryFileAssetTask(name, url) {
+        /**
+         * Creates a new BinaryFileAssetTask object
+         * @param name defines the name of the new task
+         * @param url defines the location of the file to load
+         */
+        function BinaryFileAssetTask(
+            /**
+             * Defines the name of the task
+             */
+            name, 
+            /**
+             * Defines the location of the file to load
+             */
+            url) {
             var _this = _super.call(this, name) || this;
             _this.name = name;
             _this.url = url;
             return _this;
         }
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         BinaryFileAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
             var _this = this;
             scene._loadFile(this.url, function (data) {
@@ -78300,14 +78465,36 @@ var BABYLON;
         return BinaryFileAssetTask;
     }(AbstractAssetTask));
     BABYLON.BinaryFileAssetTask = BinaryFileAssetTask;
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load images
+     */
     var ImageAssetTask = /** @class */ (function (_super) {
         __extends(ImageAssetTask, _super);
-        function ImageAssetTask(name, url) {
+        /**
+         * Creates a new ImageAssetTask
+         * @param name defines the name of the task
+         * @param url defines the location of the image to load
+         */
+        function ImageAssetTask(
+            /**
+             * Defines the name of the task
+             */
+            name, 
+            /**
+             * Defines the location of the image to load
+             */
+            url) {
             var _this = _super.call(this, name) || this;
             _this.name = name;
             _this.url = url;
             return _this;
         }
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         ImageAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
             var _this = this;
             var img = new Image();
@@ -78324,9 +78511,40 @@ var BABYLON;
         return ImageAssetTask;
     }(AbstractAssetTask));
     BABYLON.ImageAssetTask = ImageAssetTask;
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load 2D textures
+     */
     var TextureAssetTask = /** @class */ (function (_super) {
         __extends(TextureAssetTask, _super);
-        function TextureAssetTask(name, url, noMipmap, invertY, samplingMode) {
+        /**
+         * Creates a new TextureAssetTask object
+         * @param name defines the name of the task
+         * @param url defines the location of the file to load
+         * @param noMipmap defines if mipmap should not be generated (default is false)
+         * @param invertY defines if texture must be inverted on Y axis (default is false)
+         * @param samplingMode defines the sampling mode to use (default is BABYLON.Texture.TRILINEAR_SAMPLINGMODE)
+         */
+        function TextureAssetTask(
+            /**
+             * Defines the name of the task
+             */
+            name, 
+            /**
+             * Defines the location of the file to load
+             */
+            url, 
+            /**
+             * Defines if mipmap should not be generated (default is false)
+             */
+            noMipmap, 
+            /**
+             * Defines if texture must be inverted on Y axis (default is false)
+             */
+            invertY, 
+            /**
+             * Defines the sampling mode to use (default is BABYLON.Texture.TRILINEAR_SAMPLINGMODE)
+             */
+            samplingMode) {
             if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
             var _this = _super.call(this, name) || this;
             _this.name = name;
@@ -78336,6 +78554,12 @@ var BABYLON;
             _this.samplingMode = samplingMode;
             return _this;
         }
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         TextureAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
             var onload = function () {
                 onSuccess();
@@ -78348,9 +78572,40 @@ var BABYLON;
         return TextureAssetTask;
     }(AbstractAssetTask));
     BABYLON.TextureAssetTask = TextureAssetTask;
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load cube textures
+     */
     var CubeTextureAssetTask = /** @class */ (function (_super) {
         __extends(CubeTextureAssetTask, _super);
-        function CubeTextureAssetTask(name, url, extensions, noMipmap, files) {
+        /**
+         * Creates a new CubeTextureAssetTask
+         * @param name defines the name of the task
+         * @param url defines the location of the files to load (You have to specify the folder where the files are + filename with no extension)
+         * @param extensions defines the extensions to use to load files (["_px", "_py", "_pz", "_nx", "_ny", "_nz"] by default)
+         * @param noMipmap defines if mipmaps should not be generated (default is false)
+         * @param files defines the explicit list of files (undefined by default)
+         */
+        function CubeTextureAssetTask(
+            /**
+             * Defines the name of the task
+             */
+            name, 
+            /**
+             * Defines the location of the files to load (You have to specify the folder where the files are + filename with no extension)
+             */
+            url, 
+            /**
+             * Defines the extensions to use to load files (["_px", "_py", "_pz", "_nx", "_ny", "_nz"] by default)
+             */
+            extensions, 
+            /**
+             * Defines if mipmaps should not be generated (default is false)
+             */
+            noMipmap, 
+            /**
+             * Defines the explicit list of files (undefined by default)
+             */
+            files) {
             var _this = _super.call(this, name) || this;
             _this.name = name;
             _this.url = url;
@@ -78359,6 +78614,12 @@ var BABYLON;
             _this.files = files;
             return _this;
         }
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         CubeTextureAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
             var onload = function () {
                 onSuccess();
@@ -78371,9 +78632,50 @@ var BABYLON;
         return CubeTextureAssetTask;
     }(AbstractAssetTask));
     BABYLON.CubeTextureAssetTask = CubeTextureAssetTask;
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load HDR cube textures
+     */
     var HDRCubeTextureAssetTask = /** @class */ (function (_super) {
         __extends(HDRCubeTextureAssetTask, _super);
-        function HDRCubeTextureAssetTask(name, url, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator) {
+        /**
+         * Creates a new HDRCubeTextureAssetTask object
+         * @param name defines the name of the task
+         * @param url defines the location of the file to load
+         * @param size defines the desired size (the more it increases the longer the generation will be) If the size is omitted this implies you are using a preprocessed cubemap.
+         * @param noMipmap defines if mipmaps should not be generated (default is false)
+         * @param generateHarmonics specifies whether you want to extract the polynomial harmonics during the generation process (default is true)
+         * @param useInGammaSpace specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)
+         * @param usePMREMGenerator specifies whether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time (default is false)
+         */
+        function HDRCubeTextureAssetTask(
+            /**
+             * Defines the name of the task
+             */
+            name, 
+            /**
+             * Defines the location of the file to load
+             */
+            url, 
+            /**
+             * Defines the desired size (the more it increases the longer the generation will be) If the size is omitted this implies you are using a preprocessed cubemap.
+             */
+            size, 
+            /**
+             * Defines if mipmaps should not be generated (default is false)
+             */
+            noMipmap, 
+            /**
+             * Specifies whether you want to extract the polynomial harmonics during the generation process (default is true)
+             */
+            generateHarmonics, 
+            /**
+             * Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)
+             */
+            useInGammaSpace, 
+            /**
+             * Specifies whether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time (default is false)
+             */
+            usePMREMGenerator) {
             if (noMipmap === void 0) { noMipmap = false; }
             if (generateHarmonics === void 0) { generateHarmonics = true; }
             if (useInGammaSpace === void 0) { useInGammaSpace = false; }
@@ -78388,6 +78690,12 @@ var BABYLON;
             _this.usePMREMGenerator = usePMREMGenerator;
             return _this;
         }
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         HDRCubeTextureAssetTask.prototype.run = function (scene, onSuccess, onError) {
             var onload = function () {
                 onSuccess();
@@ -78400,77 +78708,167 @@ var BABYLON;
         return HDRCubeTextureAssetTask;
     }(AbstractAssetTask));
     BABYLON.HDRCubeTextureAssetTask = HDRCubeTextureAssetTask;
+    /**
+     * This class can be used to easily import assets into a scene
+     * @see http://doc.babylonjs.com/how_to/how_to_use_assetsmanager
+     */
     var AssetsManager = /** @class */ (function () {
+        /**
+         * Creates a new AssetsManager
+         * @param scene defines the scene to work on
+         */
         function AssetsManager(scene) {
             this._isLoading = false;
-            this.tasks = new Array();
-            this.waitingTasksCount = 0;
-            //Observables
+            this._tasks = new Array();
+            this._waitingTasksCount = 0;
+            this._totalTasksCount = 0;
+            /**
+             * Observable called when all tasks are processed
+             */
             this.onTaskSuccessObservable = new BABYLON.Observable();
+            /**
+             * Observable called when a task had an error
+             */
             this.onTaskErrorObservable = new BABYLON.Observable();
+            /**
+             * Observable called when a task is successful
+             */
             this.onTasksDoneObservable = new BABYLON.Observable();
+            /**
+             * Observable called when a task is done (whatever the result is)
+             */
             this.onProgressObservable = new BABYLON.Observable();
+            /**
+             * Gets or sets a boolean defining if the {BABYLON.AssetsManager} should use the default loading screen
+             * @see http://doc.babylonjs.com/how_to/creating_a_custom_loading_screen
+             */
             this.useDefaultLoadingScreen = true;
             this._scene = scene;
         }
+        /**
+         * Add a {BABYLON.MeshAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param meshesNames defines the name of meshes to load
+         * @param rootUrl defines the root url to use to locate files
+         * @param sceneFilename defines the filename of the scene file
+         * @returns a new {BABYLON.MeshAssetTask} object
+         */
         AssetsManager.prototype.addMeshTask = function (taskName, meshesNames, rootUrl, sceneFilename) {
             var task = new MeshAssetTask(taskName, meshesNames, rootUrl, sceneFilename);
-            this.tasks.push(task);
+            this._tasks.push(task);
             return task;
         };
+        /**
+         * Add a {BABYLON.TextFileAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param url defines the url of the file to load
+         * @returns a new {BABYLON.TextFileAssetTask} object
+         */
         AssetsManager.prototype.addTextFileTask = function (taskName, url) {
             var task = new TextFileAssetTask(taskName, url);
-            this.tasks.push(task);
+            this._tasks.push(task);
             return task;
         };
+        /**
+         * Add a {BABYLON.BinaryFileAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param url defines the url of the file to load
+         * @returns a new {BABYLON.BinaryFileAssetTask} object
+         */
         AssetsManager.prototype.addBinaryFileTask = function (taskName, url) {
             var task = new BinaryFileAssetTask(taskName, url);
-            this.tasks.push(task);
+            this._tasks.push(task);
             return task;
         };
+        /**
+         * Add a {BABYLON.ImageAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param url defines the url of the file to load
+         * @returns a new {BABYLON.ImageAssetTask} object
+         */
         AssetsManager.prototype.addImageTask = function (taskName, url) {
             var task = new ImageAssetTask(taskName, url);
-            this.tasks.push(task);
+            this._tasks.push(task);
             return task;
         };
+        /**
+         * Add a {BABYLON.TextureAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param url defines the url of the file to load
+         * @param noMipmap defines if the texture must not receive mipmaps (false by default)
+         * @param invertY defines if you want to invert Y axis of the loaded texture (false by default)
+         * @param samplingMode defines the sampling mode to use (BABYLON.Texture.TRILINEAR_SAMPLINGMODE by default)
+         * @returns a new {BABYLON.TextureAssetTask} object
+         */
         AssetsManager.prototype.addTextureTask = function (taskName, url, noMipmap, invertY, samplingMode) {
             if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
             var task = new TextureAssetTask(taskName, url, noMipmap, invertY, samplingMode);
-            this.tasks.push(task);
+            this._tasks.push(task);
             return task;
         };
-        AssetsManager.prototype.addCubeTextureTask = function (name, url, extensions, noMipmap, files) {
-            var task = new CubeTextureAssetTask(name, url, extensions, noMipmap, files);
-            this.tasks.push(task);
+        /**
+         * Add a {BABYLON.CubeTextureAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param url defines the url of the file to load
+         * @param extensions defines the extension to use to load the cube map (can be null)
+         * @param noMipmap defines if the texture must not receive mipmaps (false by default)
+         * @param files defines the list of files to load (can be null)
+         * @returns a new {BABYLON.CubeTextureAssetTask} object
+         */
+        AssetsManager.prototype.addCubeTextureTask = function (taskName, url, extensions, noMipmap, files) {
+            var task = new CubeTextureAssetTask(taskName, url, extensions, noMipmap, files);
+            this._tasks.push(task);
             return task;
         };
-        AssetsManager.prototype.addHDRCubeTextureTask = function (name, url, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator) {
+        /**
+         *
+         * Add a {BABYLON.HDRCubeTextureAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param url defines the url of the file to load
+         * @param size defines the size you want for the cubemap (can be null)
+         * @param noMipmap defines if the texture must not receive mipmaps (false by default)
+         * @param generateHarmonics defines if you want to automatically generate (true by default)
+         * @param useInGammaSpace defines if the texture must be considered in gamma space (false by default)
+         * @param usePMREMGenerator is a reserved parameter and must be set to false or ignored
+         * @returns a new {BABYLON.HDRCubeTextureAssetTask} object
+         */
+        AssetsManager.prototype.addHDRCubeTextureTask = function (taskName, url, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator) {
             if (noMipmap === void 0) { noMipmap = false; }
             if (generateHarmonics === void 0) { generateHarmonics = true; }
             if (useInGammaSpace === void 0) { useInGammaSpace = false; }
             if (usePMREMGenerator === void 0) { usePMREMGenerator = false; }
-            var task = new HDRCubeTextureAssetTask(name, url, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator);
-            this.tasks.push(task);
+            var task = new HDRCubeTextureAssetTask(taskName, url, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator);
+            this._tasks.push(task);
             return task;
         };
         AssetsManager.prototype._decreaseWaitingTasksCount = function (task) {
-            this.waitingTasksCount--;
+            var _this = this;
+            this._waitingTasksCount--;
             try {
+                if (task.taskState === AssetTaskState.DONE) {
+                    // Let's remove successfull tasks
+                    BABYLON.Tools.SetImmediate(function () {
+                        var index = _this._tasks.indexOf(task);
+                        if (index > -1) {
+                            _this._tasks.splice(index, 1);
+                        }
+                    });
+                }
                 if (this.onProgress) {
-                    this.onProgress(this.waitingTasksCount, this.tasks.length, task);
+                    this.onProgress(this._waitingTasksCount, this._totalTasksCount, task);
                 }
-                this.onProgressObservable.notifyObservers(new AssetsProgressEvent(this.waitingTasksCount, this.tasks.length, task));
+                this.onProgressObservable.notifyObservers(new AssetsProgressEvent(this._waitingTasksCount, this._totalTasksCount, task));
             }
             catch (e) {
                 BABYLON.Tools.Error("Error running progress callbacks.");
                 console.log(e);
             }
-            if (this.waitingTasksCount === 0) {
+            if (this._waitingTasksCount === 0) {
                 try {
                     if (this.onFinish) {
-                        this.onFinish(this.tasks);
+                        this.onFinish(this._tasks);
                     }
-                    this.onTasksDoneObservable.notifyObservers(this.tasks);
+                    this.onTasksDoneObservable.notifyObservers(this._tasks);
                 }
                 catch (e) {
                     BABYLON.Tools.Error("Error running tasks-done callbacks.");
@@ -78495,10 +78893,7 @@ var BABYLON;
                 }
             };
             var error = function (message, exception) {
-                task.errorObject = task.errorObject || {
-                    message: message,
-                    exception: exception
-                };
+                task._setErrorObject(message, exception);
                 if (_this.onTaskError) {
                     _this.onTaskError(task);
                 }
@@ -78507,30 +78902,38 @@ var BABYLON;
             };
             task.run(this._scene, done, error);
         };
+        /**
+         * Reset the {BABYLON.AssetsManager} and remove all tasks
+         * @return the current instance of the {BABYLON.AssetsManager}
+         */
         AssetsManager.prototype.reset = function () {
             this._isLoading = false;
-            this.tasks = new Array();
+            this._tasks = new Array();
             return this;
         };
+        /**
+         * Start the loading process
+         * @return the current instance of the {BABYLON.AssetsManager}
+         */
         AssetsManager.prototype.load = function () {
             if (this._isLoading) {
                 return this;
             }
             this._isLoading = true;
-            this.waitingTasksCount = this.tasks.length;
-            if (this.waitingTasksCount === 0) {
+            this._waitingTasksCount = this._tasks.length;
+            this._totalTasksCount = this._tasks.length;
+            if (this._waitingTasksCount === 0) {
                 if (this.onFinish) {
-                    this.onFinish(this.tasks);
+                    this.onFinish(this._tasks);
                 }
-                this.onTasksDoneObservable.notifyObservers(this.tasks);
-                this._isLoading = false;
+                this.onTasksDoneObservable.notifyObservers(this._tasks);
                 return this;
             }
             if (this.useDefaultLoadingScreen) {
                 this._scene.getEngine().displayLoadingUI();
             }
-            for (var index = 0; index < this.tasks.length; index++) {
-                var task = this.tasks[index];
+            for (var index = 0; index < this._tasks.length; index++) {
+                var task = this._tasks[index];
                 this._runTask(task);
             }
             return this;

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


File diff suppressed because it is too large
+ 2354 - 1786
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


File diff suppressed because it is too large
+ 3 - 3
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 452 - 49
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -66317,9 +66317,9 @@ var BABYLON;
          * @param scene The scene the texture will be used in
          * @param size The cubemap desired size (the more it increases the longer the generation will be) If the size is omitted this implies you are using a preprocessed cubemap.
          * @param noMipmap Forces to not generate the mipmap if true
-         * @param generateHarmonics Specifies wether you want to extract the polynomial harmonics during the generation process
+         * @param generateHarmonics Specifies whether you want to extract the polynomial harmonics during the generation process
          * @param useInGammaSpace Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space)
-         * @param usePMREMGenerator Specifies wether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time.
+         * @param usePMREMGenerator Specifies whether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time.
          */
         function HDRCubeTexture(url, scene, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator, onLoad, onError) {
             if (noMipmap === void 0) { noMipmap = false; }
@@ -78017,34 +78017,114 @@ var BABYLON;
 
 var BABYLON;
 (function (BABYLON) {
+    /**
+     * Defines the list of states available for a task inside a {BABYLON.AssetsManager}
+     */
     var AssetTaskState;
     (function (AssetTaskState) {
+        /**
+         * Initialization
+         */
         AssetTaskState[AssetTaskState["INIT"] = 0] = "INIT";
+        /**
+         * Running
+         */
         AssetTaskState[AssetTaskState["RUNNING"] = 1] = "RUNNING";
+        /**
+         * Done
+         */
         AssetTaskState[AssetTaskState["DONE"] = 2] = "DONE";
+        /**
+         * Error
+         */
         AssetTaskState[AssetTaskState["ERROR"] = 3] = "ERROR";
     })(AssetTaskState = BABYLON.AssetTaskState || (BABYLON.AssetTaskState = {}));
+    /**
+     * Define an abstract asset task used with a {BABYLON.AssetsManager} class to load assets into a scene
+     */
     var AbstractAssetTask = /** @class */ (function () {
-        function AbstractAssetTask(name) {
+        /**
+         * Creates a new {BABYLON.AssetsManager}
+         * @param name defines the name of the task
+         */
+        function AbstractAssetTask(
+            /**
+             * Task name
+             */ name) {
             this.name = name;
-            this.isCompleted = false;
-            this.taskState = AssetTaskState.INIT;
+            this._isCompleted = false;
+            this._taskState = AssetTaskState.INIT;
         }
+        Object.defineProperty(AbstractAssetTask.prototype, "isCompleted", {
+            /**
+             * Get if the task is completed
+             */
+            get: function () {
+                return this._isCompleted;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(AbstractAssetTask.prototype, "taskState", {
+            /**
+             * Gets the current state of the task
+             */
+            get: function () {
+                return this._taskState;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(AbstractAssetTask.prototype, "errorObject", {
+            /**
+             * Gets the current error object (if task is in error)
+             */
+            get: function () {
+                return this._errorObject;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        /**
+         * Internal only
+         * @ignore
+         */
+        AbstractAssetTask.prototype._setErrorObject = function (message, exception) {
+            if (this._errorObject) {
+                return;
+            }
+            this._errorObject = {
+                message: message,
+                exception: exception
+            };
+        };
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         AbstractAssetTask.prototype.run = function (scene, onSuccess, onError) {
             var _this = this;
-            this.taskState = AssetTaskState.RUNNING;
+            this._taskState = AssetTaskState.RUNNING;
             this.runTask(scene, function () {
                 _this.onDoneCallback(onSuccess, onError);
             }, function (msg, exception) {
                 _this.onErrorCallback(onError, msg, exception);
             });
         };
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         AbstractAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
             throw new Error("runTask is not implemented");
         };
         AbstractAssetTask.prototype.onErrorCallback = function (onError, message, exception) {
-            this.taskState = AssetTaskState.ERROR;
-            this.errorObject = {
+            this._taskState = AssetTaskState.ERROR;
+            this._errorObject = {
                 message: message,
                 exception: exception
             };
@@ -78055,8 +78135,8 @@ var BABYLON;
         };
         AbstractAssetTask.prototype.onDoneCallback = function (onSuccess, onError) {
             try {
-                this.taskState = AssetTaskState.DONE;
-                this.isCompleted = true;
+                this._taskState = AssetTaskState.DONE;
+                this._isCompleted = true;
                 if (this.onSuccess) {
                     this.onSuccess(this);
                 }
@@ -78069,7 +78149,16 @@ var BABYLON;
         return AbstractAssetTask;
     }());
     BABYLON.AbstractAssetTask = AbstractAssetTask;
+    /**
+     * Class used to share progress information about assets loading
+     */
     var AssetsProgressEvent = /** @class */ (function () {
+        /**
+         * Creates a {BABYLON.AssetsProgressEvent}
+         * @param remainingCount defines the number of remaining tasks to process
+         * @param totalCount defines the total number of tasks
+         * @param task defines the task that was just processed
+         */
         function AssetsProgressEvent(remainingCount, totalCount, task) {
             this.remainingCount = remainingCount;
             this.totalCount = totalCount;
@@ -78078,9 +78167,35 @@ var BABYLON;
         return AssetsProgressEvent;
     }());
     BABYLON.AssetsProgressEvent = AssetsProgressEvent;
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load meshes
+     */
     var MeshAssetTask = /** @class */ (function (_super) {
         __extends(MeshAssetTask, _super);
-        function MeshAssetTask(name, meshesNames, rootUrl, sceneFilename) {
+        /**
+         * Creates a new {BABYLON.MeshAssetTask}
+         * @param name defines the name of the task
+         * @param meshesNames defines the list of mesh's names you want to load
+         * @param rootUrl defines the root url to use as a base to load your meshes and associated resources
+         * @param sceneFilename defines the filename of the scene to load from
+         */
+        function MeshAssetTask(
+            /**
+             * Defines the name of the task
+             */
+            name, 
+            /**
+             * Defines the list of mesh's names you want to load
+             */
+            meshesNames, 
+            /**
+             * Defines the root url to use as a base to load your meshes and associated resources
+             */
+            rootUrl, 
+            /**
+             * Defines the filename of the scene to load from
+             */
+            sceneFilename) {
             var _this = _super.call(this, name) || this;
             _this.name = name;
             _this.meshesNames = meshesNames;
@@ -78088,6 +78203,12 @@ var BABYLON;
             _this.sceneFilename = sceneFilename;
             return _this;
         }
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         MeshAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
             var _this = this;
             BABYLON.SceneLoader.ImportMesh(this.meshesNames, this.rootUrl, this.sceneFilename, scene, function (meshes, particleSystems, skeletons) {
@@ -78102,14 +78223,36 @@ var BABYLON;
         return MeshAssetTask;
     }(AbstractAssetTask));
     BABYLON.MeshAssetTask = MeshAssetTask;
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load text content
+     */
     var TextFileAssetTask = /** @class */ (function (_super) {
         __extends(TextFileAssetTask, _super);
-        function TextFileAssetTask(name, url) {
+        /**
+         * Creates a new TextFileAssetTask object
+         * @param name defines the name of the task
+         * @param url defines the location of the file to load
+         */
+        function TextFileAssetTask(
+            /**
+             * Defines the name of the task
+             */
+            name, 
+            /**
+             * Defines the location of the file to load
+             */
+            url) {
             var _this = _super.call(this, name) || this;
             _this.name = name;
             _this.url = url;
             return _this;
         }
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         TextFileAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
             var _this = this;
             scene._loadFile(this.url, function (data) {
@@ -78124,14 +78267,36 @@ var BABYLON;
         return TextFileAssetTask;
     }(AbstractAssetTask));
     BABYLON.TextFileAssetTask = TextFileAssetTask;
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load binary data
+     */
     var BinaryFileAssetTask = /** @class */ (function (_super) {
         __extends(BinaryFileAssetTask, _super);
-        function BinaryFileAssetTask(name, url) {
+        /**
+         * Creates a new BinaryFileAssetTask object
+         * @param name defines the name of the new task
+         * @param url defines the location of the file to load
+         */
+        function BinaryFileAssetTask(
+            /**
+             * Defines the name of the task
+             */
+            name, 
+            /**
+             * Defines the location of the file to load
+             */
+            url) {
             var _this = _super.call(this, name) || this;
             _this.name = name;
             _this.url = url;
             return _this;
         }
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         BinaryFileAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
             var _this = this;
             scene._loadFile(this.url, function (data) {
@@ -78146,14 +78311,36 @@ var BABYLON;
         return BinaryFileAssetTask;
     }(AbstractAssetTask));
     BABYLON.BinaryFileAssetTask = BinaryFileAssetTask;
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load images
+     */
     var ImageAssetTask = /** @class */ (function (_super) {
         __extends(ImageAssetTask, _super);
-        function ImageAssetTask(name, url) {
+        /**
+         * Creates a new ImageAssetTask
+         * @param name defines the name of the task
+         * @param url defines the location of the image to load
+         */
+        function ImageAssetTask(
+            /**
+             * Defines the name of the task
+             */
+            name, 
+            /**
+             * Defines the location of the image to load
+             */
+            url) {
             var _this = _super.call(this, name) || this;
             _this.name = name;
             _this.url = url;
             return _this;
         }
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         ImageAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
             var _this = this;
             var img = new Image();
@@ -78170,9 +78357,40 @@ var BABYLON;
         return ImageAssetTask;
     }(AbstractAssetTask));
     BABYLON.ImageAssetTask = ImageAssetTask;
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load 2D textures
+     */
     var TextureAssetTask = /** @class */ (function (_super) {
         __extends(TextureAssetTask, _super);
-        function TextureAssetTask(name, url, noMipmap, invertY, samplingMode) {
+        /**
+         * Creates a new TextureAssetTask object
+         * @param name defines the name of the task
+         * @param url defines the location of the file to load
+         * @param noMipmap defines if mipmap should not be generated (default is false)
+         * @param invertY defines if texture must be inverted on Y axis (default is false)
+         * @param samplingMode defines the sampling mode to use (default is BABYLON.Texture.TRILINEAR_SAMPLINGMODE)
+         */
+        function TextureAssetTask(
+            /**
+             * Defines the name of the task
+             */
+            name, 
+            /**
+             * Defines the location of the file to load
+             */
+            url, 
+            /**
+             * Defines if mipmap should not be generated (default is false)
+             */
+            noMipmap, 
+            /**
+             * Defines if texture must be inverted on Y axis (default is false)
+             */
+            invertY, 
+            /**
+             * Defines the sampling mode to use (default is BABYLON.Texture.TRILINEAR_SAMPLINGMODE)
+             */
+            samplingMode) {
             if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
             var _this = _super.call(this, name) || this;
             _this.name = name;
@@ -78182,6 +78400,12 @@ var BABYLON;
             _this.samplingMode = samplingMode;
             return _this;
         }
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         TextureAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
             var onload = function () {
                 onSuccess();
@@ -78194,9 +78418,40 @@ var BABYLON;
         return TextureAssetTask;
     }(AbstractAssetTask));
     BABYLON.TextureAssetTask = TextureAssetTask;
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load cube textures
+     */
     var CubeTextureAssetTask = /** @class */ (function (_super) {
         __extends(CubeTextureAssetTask, _super);
-        function CubeTextureAssetTask(name, url, extensions, noMipmap, files) {
+        /**
+         * Creates a new CubeTextureAssetTask
+         * @param name defines the name of the task
+         * @param url defines the location of the files to load (You have to specify the folder where the files are + filename with no extension)
+         * @param extensions defines the extensions to use to load files (["_px", "_py", "_pz", "_nx", "_ny", "_nz"] by default)
+         * @param noMipmap defines if mipmaps should not be generated (default is false)
+         * @param files defines the explicit list of files (undefined by default)
+         */
+        function CubeTextureAssetTask(
+            /**
+             * Defines the name of the task
+             */
+            name, 
+            /**
+             * Defines the location of the files to load (You have to specify the folder where the files are + filename with no extension)
+             */
+            url, 
+            /**
+             * Defines the extensions to use to load files (["_px", "_py", "_pz", "_nx", "_ny", "_nz"] by default)
+             */
+            extensions, 
+            /**
+             * Defines if mipmaps should not be generated (default is false)
+             */
+            noMipmap, 
+            /**
+             * Defines the explicit list of files (undefined by default)
+             */
+            files) {
             var _this = _super.call(this, name) || this;
             _this.name = name;
             _this.url = url;
@@ -78205,6 +78460,12 @@ var BABYLON;
             _this.files = files;
             return _this;
         }
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         CubeTextureAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
             var onload = function () {
                 onSuccess();
@@ -78217,9 +78478,50 @@ var BABYLON;
         return CubeTextureAssetTask;
     }(AbstractAssetTask));
     BABYLON.CubeTextureAssetTask = CubeTextureAssetTask;
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load HDR cube textures
+     */
     var HDRCubeTextureAssetTask = /** @class */ (function (_super) {
         __extends(HDRCubeTextureAssetTask, _super);
-        function HDRCubeTextureAssetTask(name, url, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator) {
+        /**
+         * Creates a new HDRCubeTextureAssetTask object
+         * @param name defines the name of the task
+         * @param url defines the location of the file to load
+         * @param size defines the desired size (the more it increases the longer the generation will be) If the size is omitted this implies you are using a preprocessed cubemap.
+         * @param noMipmap defines if mipmaps should not be generated (default is false)
+         * @param generateHarmonics specifies whether you want to extract the polynomial harmonics during the generation process (default is true)
+         * @param useInGammaSpace specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)
+         * @param usePMREMGenerator specifies whether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time (default is false)
+         */
+        function HDRCubeTextureAssetTask(
+            /**
+             * Defines the name of the task
+             */
+            name, 
+            /**
+             * Defines the location of the file to load
+             */
+            url, 
+            /**
+             * Defines the desired size (the more it increases the longer the generation will be) If the size is omitted this implies you are using a preprocessed cubemap.
+             */
+            size, 
+            /**
+             * Defines if mipmaps should not be generated (default is false)
+             */
+            noMipmap, 
+            /**
+             * Specifies whether you want to extract the polynomial harmonics during the generation process (default is true)
+             */
+            generateHarmonics, 
+            /**
+             * Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)
+             */
+            useInGammaSpace, 
+            /**
+             * Specifies whether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time (default is false)
+             */
+            usePMREMGenerator) {
             if (noMipmap === void 0) { noMipmap = false; }
             if (generateHarmonics === void 0) { generateHarmonics = true; }
             if (useInGammaSpace === void 0) { useInGammaSpace = false; }
@@ -78234,6 +78536,12 @@ var BABYLON;
             _this.usePMREMGenerator = usePMREMGenerator;
             return _this;
         }
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         HDRCubeTextureAssetTask.prototype.run = function (scene, onSuccess, onError) {
             var onload = function () {
                 onSuccess();
@@ -78246,77 +78554,167 @@ var BABYLON;
         return HDRCubeTextureAssetTask;
     }(AbstractAssetTask));
     BABYLON.HDRCubeTextureAssetTask = HDRCubeTextureAssetTask;
+    /**
+     * This class can be used to easily import assets into a scene
+     * @see http://doc.babylonjs.com/how_to/how_to_use_assetsmanager
+     */
     var AssetsManager = /** @class */ (function () {
+        /**
+         * Creates a new AssetsManager
+         * @param scene defines the scene to work on
+         */
         function AssetsManager(scene) {
             this._isLoading = false;
-            this.tasks = new Array();
-            this.waitingTasksCount = 0;
-            //Observables
+            this._tasks = new Array();
+            this._waitingTasksCount = 0;
+            this._totalTasksCount = 0;
+            /**
+             * Observable called when all tasks are processed
+             */
             this.onTaskSuccessObservable = new BABYLON.Observable();
+            /**
+             * Observable called when a task had an error
+             */
             this.onTaskErrorObservable = new BABYLON.Observable();
+            /**
+             * Observable called when a task is successful
+             */
             this.onTasksDoneObservable = new BABYLON.Observable();
+            /**
+             * Observable called when a task is done (whatever the result is)
+             */
             this.onProgressObservable = new BABYLON.Observable();
+            /**
+             * Gets or sets a boolean defining if the {BABYLON.AssetsManager} should use the default loading screen
+             * @see http://doc.babylonjs.com/how_to/creating_a_custom_loading_screen
+             */
             this.useDefaultLoadingScreen = true;
             this._scene = scene;
         }
+        /**
+         * Add a {BABYLON.MeshAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param meshesNames defines the name of meshes to load
+         * @param rootUrl defines the root url to use to locate files
+         * @param sceneFilename defines the filename of the scene file
+         * @returns a new {BABYLON.MeshAssetTask} object
+         */
         AssetsManager.prototype.addMeshTask = function (taskName, meshesNames, rootUrl, sceneFilename) {
             var task = new MeshAssetTask(taskName, meshesNames, rootUrl, sceneFilename);
-            this.tasks.push(task);
+            this._tasks.push(task);
             return task;
         };
+        /**
+         * Add a {BABYLON.TextFileAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param url defines the url of the file to load
+         * @returns a new {BABYLON.TextFileAssetTask} object
+         */
         AssetsManager.prototype.addTextFileTask = function (taskName, url) {
             var task = new TextFileAssetTask(taskName, url);
-            this.tasks.push(task);
+            this._tasks.push(task);
             return task;
         };
+        /**
+         * Add a {BABYLON.BinaryFileAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param url defines the url of the file to load
+         * @returns a new {BABYLON.BinaryFileAssetTask} object
+         */
         AssetsManager.prototype.addBinaryFileTask = function (taskName, url) {
             var task = new BinaryFileAssetTask(taskName, url);
-            this.tasks.push(task);
+            this._tasks.push(task);
             return task;
         };
+        /**
+         * Add a {BABYLON.ImageAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param url defines the url of the file to load
+         * @returns a new {BABYLON.ImageAssetTask} object
+         */
         AssetsManager.prototype.addImageTask = function (taskName, url) {
             var task = new ImageAssetTask(taskName, url);
-            this.tasks.push(task);
+            this._tasks.push(task);
             return task;
         };
+        /**
+         * Add a {BABYLON.TextureAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param url defines the url of the file to load
+         * @param noMipmap defines if the texture must not receive mipmaps (false by default)
+         * @param invertY defines if you want to invert Y axis of the loaded texture (false by default)
+         * @param samplingMode defines the sampling mode to use (BABYLON.Texture.TRILINEAR_SAMPLINGMODE by default)
+         * @returns a new {BABYLON.TextureAssetTask} object
+         */
         AssetsManager.prototype.addTextureTask = function (taskName, url, noMipmap, invertY, samplingMode) {
             if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
             var task = new TextureAssetTask(taskName, url, noMipmap, invertY, samplingMode);
-            this.tasks.push(task);
+            this._tasks.push(task);
             return task;
         };
-        AssetsManager.prototype.addCubeTextureTask = function (name, url, extensions, noMipmap, files) {
-            var task = new CubeTextureAssetTask(name, url, extensions, noMipmap, files);
-            this.tasks.push(task);
+        /**
+         * Add a {BABYLON.CubeTextureAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param url defines the url of the file to load
+         * @param extensions defines the extension to use to load the cube map (can be null)
+         * @param noMipmap defines if the texture must not receive mipmaps (false by default)
+         * @param files defines the list of files to load (can be null)
+         * @returns a new {BABYLON.CubeTextureAssetTask} object
+         */
+        AssetsManager.prototype.addCubeTextureTask = function (taskName, url, extensions, noMipmap, files) {
+            var task = new CubeTextureAssetTask(taskName, url, extensions, noMipmap, files);
+            this._tasks.push(task);
             return task;
         };
-        AssetsManager.prototype.addHDRCubeTextureTask = function (name, url, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator) {
+        /**
+         *
+         * Add a {BABYLON.HDRCubeTextureAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param url defines the url of the file to load
+         * @param size defines the size you want for the cubemap (can be null)
+         * @param noMipmap defines if the texture must not receive mipmaps (false by default)
+         * @param generateHarmonics defines if you want to automatically generate (true by default)
+         * @param useInGammaSpace defines if the texture must be considered in gamma space (false by default)
+         * @param usePMREMGenerator is a reserved parameter and must be set to false or ignored
+         * @returns a new {BABYLON.HDRCubeTextureAssetTask} object
+         */
+        AssetsManager.prototype.addHDRCubeTextureTask = function (taskName, url, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator) {
             if (noMipmap === void 0) { noMipmap = false; }
             if (generateHarmonics === void 0) { generateHarmonics = true; }
             if (useInGammaSpace === void 0) { useInGammaSpace = false; }
             if (usePMREMGenerator === void 0) { usePMREMGenerator = false; }
-            var task = new HDRCubeTextureAssetTask(name, url, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator);
-            this.tasks.push(task);
+            var task = new HDRCubeTextureAssetTask(taskName, url, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator);
+            this._tasks.push(task);
             return task;
         };
         AssetsManager.prototype._decreaseWaitingTasksCount = function (task) {
-            this.waitingTasksCount--;
+            var _this = this;
+            this._waitingTasksCount--;
             try {
+                if (task.taskState === AssetTaskState.DONE) {
+                    // Let's remove successfull tasks
+                    BABYLON.Tools.SetImmediate(function () {
+                        var index = _this._tasks.indexOf(task);
+                        if (index > -1) {
+                            _this._tasks.splice(index, 1);
+                        }
+                    });
+                }
                 if (this.onProgress) {
-                    this.onProgress(this.waitingTasksCount, this.tasks.length, task);
+                    this.onProgress(this._waitingTasksCount, this._totalTasksCount, task);
                 }
-                this.onProgressObservable.notifyObservers(new AssetsProgressEvent(this.waitingTasksCount, this.tasks.length, task));
+                this.onProgressObservable.notifyObservers(new AssetsProgressEvent(this._waitingTasksCount, this._totalTasksCount, task));
             }
             catch (e) {
                 BABYLON.Tools.Error("Error running progress callbacks.");
                 console.log(e);
             }
-            if (this.waitingTasksCount === 0) {
+            if (this._waitingTasksCount === 0) {
                 try {
                     if (this.onFinish) {
-                        this.onFinish(this.tasks);
+                        this.onFinish(this._tasks);
                     }
-                    this.onTasksDoneObservable.notifyObservers(this.tasks);
+                    this.onTasksDoneObservable.notifyObservers(this._tasks);
                 }
                 catch (e) {
                     BABYLON.Tools.Error("Error running tasks-done callbacks.");
@@ -78341,10 +78739,7 @@ var BABYLON;
                 }
             };
             var error = function (message, exception) {
-                task.errorObject = task.errorObject || {
-                    message: message,
-                    exception: exception
-                };
+                task._setErrorObject(message, exception);
                 if (_this.onTaskError) {
                     _this.onTaskError(task);
                 }
@@ -78353,30 +78748,38 @@ var BABYLON;
             };
             task.run(this._scene, done, error);
         };
+        /**
+         * Reset the {BABYLON.AssetsManager} and remove all tasks
+         * @return the current instance of the {BABYLON.AssetsManager}
+         */
         AssetsManager.prototype.reset = function () {
             this._isLoading = false;
-            this.tasks = new Array();
+            this._tasks = new Array();
             return this;
         };
+        /**
+         * Start the loading process
+         * @return the current instance of the {BABYLON.AssetsManager}
+         */
         AssetsManager.prototype.load = function () {
             if (this._isLoading) {
                 return this;
             }
             this._isLoading = true;
-            this.waitingTasksCount = this.tasks.length;
-            if (this.waitingTasksCount === 0) {
+            this._waitingTasksCount = this._tasks.length;
+            this._totalTasksCount = this._tasks.length;
+            if (this._waitingTasksCount === 0) {
                 if (this.onFinish) {
-                    this.onFinish(this.tasks);
+                    this.onFinish(this._tasks);
                 }
-                this.onTasksDoneObservable.notifyObservers(this.tasks);
-                this._isLoading = false;
+                this.onTasksDoneObservable.notifyObservers(this._tasks);
                 return this;
             }
             if (this.useDefaultLoadingScreen) {
                 this._scene.getEngine().displayLoadingUI();
             }
-            for (var index = 0; index < this.tasks.length; index++) {
-                var task = this.tasks[index];
+            for (var index = 0; index < this._tasks.length; index++) {
+                var task = this._tasks[index];
                 this._runTask(task);
             }
             return this;

+ 452 - 49
dist/preview release/customConfigurations/minimalGLTFViewer/es6.js

@@ -66303,9 +66303,9 @@ var BABYLON;
          * @param scene The scene the texture will be used in
          * @param size The cubemap desired size (the more it increases the longer the generation will be) If the size is omitted this implies you are using a preprocessed cubemap.
          * @param noMipmap Forces to not generate the mipmap if true
-         * @param generateHarmonics Specifies wether you want to extract the polynomial harmonics during the generation process
+         * @param generateHarmonics Specifies whether you want to extract the polynomial harmonics during the generation process
          * @param useInGammaSpace Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space)
-         * @param usePMREMGenerator Specifies wether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time.
+         * @param usePMREMGenerator Specifies whether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time.
          */
         function HDRCubeTexture(url, scene, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator, onLoad, onError) {
             if (noMipmap === void 0) { noMipmap = false; }
@@ -78003,34 +78003,114 @@ var BABYLON;
 
 var BABYLON;
 (function (BABYLON) {
+    /**
+     * Defines the list of states available for a task inside a {BABYLON.AssetsManager}
+     */
     var AssetTaskState;
     (function (AssetTaskState) {
+        /**
+         * Initialization
+         */
         AssetTaskState[AssetTaskState["INIT"] = 0] = "INIT";
+        /**
+         * Running
+         */
         AssetTaskState[AssetTaskState["RUNNING"] = 1] = "RUNNING";
+        /**
+         * Done
+         */
         AssetTaskState[AssetTaskState["DONE"] = 2] = "DONE";
+        /**
+         * Error
+         */
         AssetTaskState[AssetTaskState["ERROR"] = 3] = "ERROR";
     })(AssetTaskState = BABYLON.AssetTaskState || (BABYLON.AssetTaskState = {}));
+    /**
+     * Define an abstract asset task used with a {BABYLON.AssetsManager} class to load assets into a scene
+     */
     var AbstractAssetTask = /** @class */ (function () {
-        function AbstractAssetTask(name) {
+        /**
+         * Creates a new {BABYLON.AssetsManager}
+         * @param name defines the name of the task
+         */
+        function AbstractAssetTask(
+            /**
+             * Task name
+             */ name) {
             this.name = name;
-            this.isCompleted = false;
-            this.taskState = AssetTaskState.INIT;
+            this._isCompleted = false;
+            this._taskState = AssetTaskState.INIT;
         }
+        Object.defineProperty(AbstractAssetTask.prototype, "isCompleted", {
+            /**
+             * Get if the task is completed
+             */
+            get: function () {
+                return this._isCompleted;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(AbstractAssetTask.prototype, "taskState", {
+            /**
+             * Gets the current state of the task
+             */
+            get: function () {
+                return this._taskState;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(AbstractAssetTask.prototype, "errorObject", {
+            /**
+             * Gets the current error object (if task is in error)
+             */
+            get: function () {
+                return this._errorObject;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        /**
+         * Internal only
+         * @ignore
+         */
+        AbstractAssetTask.prototype._setErrorObject = function (message, exception) {
+            if (this._errorObject) {
+                return;
+            }
+            this._errorObject = {
+                message: message,
+                exception: exception
+            };
+        };
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         AbstractAssetTask.prototype.run = function (scene, onSuccess, onError) {
             var _this = this;
-            this.taskState = AssetTaskState.RUNNING;
+            this._taskState = AssetTaskState.RUNNING;
             this.runTask(scene, function () {
                 _this.onDoneCallback(onSuccess, onError);
             }, function (msg, exception) {
                 _this.onErrorCallback(onError, msg, exception);
             });
         };
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         AbstractAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
             throw new Error("runTask is not implemented");
         };
         AbstractAssetTask.prototype.onErrorCallback = function (onError, message, exception) {
-            this.taskState = AssetTaskState.ERROR;
-            this.errorObject = {
+            this._taskState = AssetTaskState.ERROR;
+            this._errorObject = {
                 message: message,
                 exception: exception
             };
@@ -78041,8 +78121,8 @@ var BABYLON;
         };
         AbstractAssetTask.prototype.onDoneCallback = function (onSuccess, onError) {
             try {
-                this.taskState = AssetTaskState.DONE;
-                this.isCompleted = true;
+                this._taskState = AssetTaskState.DONE;
+                this._isCompleted = true;
                 if (this.onSuccess) {
                     this.onSuccess(this);
                 }
@@ -78055,7 +78135,16 @@ var BABYLON;
         return AbstractAssetTask;
     }());
     BABYLON.AbstractAssetTask = AbstractAssetTask;
+    /**
+     * Class used to share progress information about assets loading
+     */
     var AssetsProgressEvent = /** @class */ (function () {
+        /**
+         * Creates a {BABYLON.AssetsProgressEvent}
+         * @param remainingCount defines the number of remaining tasks to process
+         * @param totalCount defines the total number of tasks
+         * @param task defines the task that was just processed
+         */
         function AssetsProgressEvent(remainingCount, totalCount, task) {
             this.remainingCount = remainingCount;
             this.totalCount = totalCount;
@@ -78064,9 +78153,35 @@ var BABYLON;
         return AssetsProgressEvent;
     }());
     BABYLON.AssetsProgressEvent = AssetsProgressEvent;
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load meshes
+     */
     var MeshAssetTask = /** @class */ (function (_super) {
         __extends(MeshAssetTask, _super);
-        function MeshAssetTask(name, meshesNames, rootUrl, sceneFilename) {
+        /**
+         * Creates a new {BABYLON.MeshAssetTask}
+         * @param name defines the name of the task
+         * @param meshesNames defines the list of mesh's names you want to load
+         * @param rootUrl defines the root url to use as a base to load your meshes and associated resources
+         * @param sceneFilename defines the filename of the scene to load from
+         */
+        function MeshAssetTask(
+            /**
+             * Defines the name of the task
+             */
+            name, 
+            /**
+             * Defines the list of mesh's names you want to load
+             */
+            meshesNames, 
+            /**
+             * Defines the root url to use as a base to load your meshes and associated resources
+             */
+            rootUrl, 
+            /**
+             * Defines the filename of the scene to load from
+             */
+            sceneFilename) {
             var _this = _super.call(this, name) || this;
             _this.name = name;
             _this.meshesNames = meshesNames;
@@ -78074,6 +78189,12 @@ var BABYLON;
             _this.sceneFilename = sceneFilename;
             return _this;
         }
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         MeshAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
             var _this = this;
             BABYLON.SceneLoader.ImportMesh(this.meshesNames, this.rootUrl, this.sceneFilename, scene, function (meshes, particleSystems, skeletons) {
@@ -78088,14 +78209,36 @@ var BABYLON;
         return MeshAssetTask;
     }(AbstractAssetTask));
     BABYLON.MeshAssetTask = MeshAssetTask;
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load text content
+     */
     var TextFileAssetTask = /** @class */ (function (_super) {
         __extends(TextFileAssetTask, _super);
-        function TextFileAssetTask(name, url) {
+        /**
+         * Creates a new TextFileAssetTask object
+         * @param name defines the name of the task
+         * @param url defines the location of the file to load
+         */
+        function TextFileAssetTask(
+            /**
+             * Defines the name of the task
+             */
+            name, 
+            /**
+             * Defines the location of the file to load
+             */
+            url) {
             var _this = _super.call(this, name) || this;
             _this.name = name;
             _this.url = url;
             return _this;
         }
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         TextFileAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
             var _this = this;
             scene._loadFile(this.url, function (data) {
@@ -78110,14 +78253,36 @@ var BABYLON;
         return TextFileAssetTask;
     }(AbstractAssetTask));
     BABYLON.TextFileAssetTask = TextFileAssetTask;
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load binary data
+     */
     var BinaryFileAssetTask = /** @class */ (function (_super) {
         __extends(BinaryFileAssetTask, _super);
-        function BinaryFileAssetTask(name, url) {
+        /**
+         * Creates a new BinaryFileAssetTask object
+         * @param name defines the name of the new task
+         * @param url defines the location of the file to load
+         */
+        function BinaryFileAssetTask(
+            /**
+             * Defines the name of the task
+             */
+            name, 
+            /**
+             * Defines the location of the file to load
+             */
+            url) {
             var _this = _super.call(this, name) || this;
             _this.name = name;
             _this.url = url;
             return _this;
         }
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         BinaryFileAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
             var _this = this;
             scene._loadFile(this.url, function (data) {
@@ -78132,14 +78297,36 @@ var BABYLON;
         return BinaryFileAssetTask;
     }(AbstractAssetTask));
     BABYLON.BinaryFileAssetTask = BinaryFileAssetTask;
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load images
+     */
     var ImageAssetTask = /** @class */ (function (_super) {
         __extends(ImageAssetTask, _super);
-        function ImageAssetTask(name, url) {
+        /**
+         * Creates a new ImageAssetTask
+         * @param name defines the name of the task
+         * @param url defines the location of the image to load
+         */
+        function ImageAssetTask(
+            /**
+             * Defines the name of the task
+             */
+            name, 
+            /**
+             * Defines the location of the image to load
+             */
+            url) {
             var _this = _super.call(this, name) || this;
             _this.name = name;
             _this.url = url;
             return _this;
         }
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         ImageAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
             var _this = this;
             var img = new Image();
@@ -78156,9 +78343,40 @@ var BABYLON;
         return ImageAssetTask;
     }(AbstractAssetTask));
     BABYLON.ImageAssetTask = ImageAssetTask;
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load 2D textures
+     */
     var TextureAssetTask = /** @class */ (function (_super) {
         __extends(TextureAssetTask, _super);
-        function TextureAssetTask(name, url, noMipmap, invertY, samplingMode) {
+        /**
+         * Creates a new TextureAssetTask object
+         * @param name defines the name of the task
+         * @param url defines the location of the file to load
+         * @param noMipmap defines if mipmap should not be generated (default is false)
+         * @param invertY defines if texture must be inverted on Y axis (default is false)
+         * @param samplingMode defines the sampling mode to use (default is BABYLON.Texture.TRILINEAR_SAMPLINGMODE)
+         */
+        function TextureAssetTask(
+            /**
+             * Defines the name of the task
+             */
+            name, 
+            /**
+             * Defines the location of the file to load
+             */
+            url, 
+            /**
+             * Defines if mipmap should not be generated (default is false)
+             */
+            noMipmap, 
+            /**
+             * Defines if texture must be inverted on Y axis (default is false)
+             */
+            invertY, 
+            /**
+             * Defines the sampling mode to use (default is BABYLON.Texture.TRILINEAR_SAMPLINGMODE)
+             */
+            samplingMode) {
             if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
             var _this = _super.call(this, name) || this;
             _this.name = name;
@@ -78168,6 +78386,12 @@ var BABYLON;
             _this.samplingMode = samplingMode;
             return _this;
         }
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         TextureAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
             var onload = function () {
                 onSuccess();
@@ -78180,9 +78404,40 @@ var BABYLON;
         return TextureAssetTask;
     }(AbstractAssetTask));
     BABYLON.TextureAssetTask = TextureAssetTask;
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load cube textures
+     */
     var CubeTextureAssetTask = /** @class */ (function (_super) {
         __extends(CubeTextureAssetTask, _super);
-        function CubeTextureAssetTask(name, url, extensions, noMipmap, files) {
+        /**
+         * Creates a new CubeTextureAssetTask
+         * @param name defines the name of the task
+         * @param url defines the location of the files to load (You have to specify the folder where the files are + filename with no extension)
+         * @param extensions defines the extensions to use to load files (["_px", "_py", "_pz", "_nx", "_ny", "_nz"] by default)
+         * @param noMipmap defines if mipmaps should not be generated (default is false)
+         * @param files defines the explicit list of files (undefined by default)
+         */
+        function CubeTextureAssetTask(
+            /**
+             * Defines the name of the task
+             */
+            name, 
+            /**
+             * Defines the location of the files to load (You have to specify the folder where the files are + filename with no extension)
+             */
+            url, 
+            /**
+             * Defines the extensions to use to load files (["_px", "_py", "_pz", "_nx", "_ny", "_nz"] by default)
+             */
+            extensions, 
+            /**
+             * Defines if mipmaps should not be generated (default is false)
+             */
+            noMipmap, 
+            /**
+             * Defines the explicit list of files (undefined by default)
+             */
+            files) {
             var _this = _super.call(this, name) || this;
             _this.name = name;
             _this.url = url;
@@ -78191,6 +78446,12 @@ var BABYLON;
             _this.files = files;
             return _this;
         }
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         CubeTextureAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
             var onload = function () {
                 onSuccess();
@@ -78203,9 +78464,50 @@ var BABYLON;
         return CubeTextureAssetTask;
     }(AbstractAssetTask));
     BABYLON.CubeTextureAssetTask = CubeTextureAssetTask;
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load HDR cube textures
+     */
     var HDRCubeTextureAssetTask = /** @class */ (function (_super) {
         __extends(HDRCubeTextureAssetTask, _super);
-        function HDRCubeTextureAssetTask(name, url, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator) {
+        /**
+         * Creates a new HDRCubeTextureAssetTask object
+         * @param name defines the name of the task
+         * @param url defines the location of the file to load
+         * @param size defines the desired size (the more it increases the longer the generation will be) If the size is omitted this implies you are using a preprocessed cubemap.
+         * @param noMipmap defines if mipmaps should not be generated (default is false)
+         * @param generateHarmonics specifies whether you want to extract the polynomial harmonics during the generation process (default is true)
+         * @param useInGammaSpace specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)
+         * @param usePMREMGenerator specifies whether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time (default is false)
+         */
+        function HDRCubeTextureAssetTask(
+            /**
+             * Defines the name of the task
+             */
+            name, 
+            /**
+             * Defines the location of the file to load
+             */
+            url, 
+            /**
+             * Defines the desired size (the more it increases the longer the generation will be) If the size is omitted this implies you are using a preprocessed cubemap.
+             */
+            size, 
+            /**
+             * Defines if mipmaps should not be generated (default is false)
+             */
+            noMipmap, 
+            /**
+             * Specifies whether you want to extract the polynomial harmonics during the generation process (default is true)
+             */
+            generateHarmonics, 
+            /**
+             * Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)
+             */
+            useInGammaSpace, 
+            /**
+             * Specifies whether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time (default is false)
+             */
+            usePMREMGenerator) {
             if (noMipmap === void 0) { noMipmap = false; }
             if (generateHarmonics === void 0) { generateHarmonics = true; }
             if (useInGammaSpace === void 0) { useInGammaSpace = false; }
@@ -78220,6 +78522,12 @@ var BABYLON;
             _this.usePMREMGenerator = usePMREMGenerator;
             return _this;
         }
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         HDRCubeTextureAssetTask.prototype.run = function (scene, onSuccess, onError) {
             var onload = function () {
                 onSuccess();
@@ -78232,77 +78540,167 @@ var BABYLON;
         return HDRCubeTextureAssetTask;
     }(AbstractAssetTask));
     BABYLON.HDRCubeTextureAssetTask = HDRCubeTextureAssetTask;
+    /**
+     * This class can be used to easily import assets into a scene
+     * @see http://doc.babylonjs.com/how_to/how_to_use_assetsmanager
+     */
     var AssetsManager = /** @class */ (function () {
+        /**
+         * Creates a new AssetsManager
+         * @param scene defines the scene to work on
+         */
         function AssetsManager(scene) {
             this._isLoading = false;
-            this.tasks = new Array();
-            this.waitingTasksCount = 0;
-            //Observables
+            this._tasks = new Array();
+            this._waitingTasksCount = 0;
+            this._totalTasksCount = 0;
+            /**
+             * Observable called when all tasks are processed
+             */
             this.onTaskSuccessObservable = new BABYLON.Observable();
+            /**
+             * Observable called when a task had an error
+             */
             this.onTaskErrorObservable = new BABYLON.Observable();
+            /**
+             * Observable called when a task is successful
+             */
             this.onTasksDoneObservable = new BABYLON.Observable();
+            /**
+             * Observable called when a task is done (whatever the result is)
+             */
             this.onProgressObservable = new BABYLON.Observable();
+            /**
+             * Gets or sets a boolean defining if the {BABYLON.AssetsManager} should use the default loading screen
+             * @see http://doc.babylonjs.com/how_to/creating_a_custom_loading_screen
+             */
             this.useDefaultLoadingScreen = true;
             this._scene = scene;
         }
+        /**
+         * Add a {BABYLON.MeshAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param meshesNames defines the name of meshes to load
+         * @param rootUrl defines the root url to use to locate files
+         * @param sceneFilename defines the filename of the scene file
+         * @returns a new {BABYLON.MeshAssetTask} object
+         */
         AssetsManager.prototype.addMeshTask = function (taskName, meshesNames, rootUrl, sceneFilename) {
             var task = new MeshAssetTask(taskName, meshesNames, rootUrl, sceneFilename);
-            this.tasks.push(task);
+            this._tasks.push(task);
             return task;
         };
+        /**
+         * Add a {BABYLON.TextFileAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param url defines the url of the file to load
+         * @returns a new {BABYLON.TextFileAssetTask} object
+         */
         AssetsManager.prototype.addTextFileTask = function (taskName, url) {
             var task = new TextFileAssetTask(taskName, url);
-            this.tasks.push(task);
+            this._tasks.push(task);
             return task;
         };
+        /**
+         * Add a {BABYLON.BinaryFileAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param url defines the url of the file to load
+         * @returns a new {BABYLON.BinaryFileAssetTask} object
+         */
         AssetsManager.prototype.addBinaryFileTask = function (taskName, url) {
             var task = new BinaryFileAssetTask(taskName, url);
-            this.tasks.push(task);
+            this._tasks.push(task);
             return task;
         };
+        /**
+         * Add a {BABYLON.ImageAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param url defines the url of the file to load
+         * @returns a new {BABYLON.ImageAssetTask} object
+         */
         AssetsManager.prototype.addImageTask = function (taskName, url) {
             var task = new ImageAssetTask(taskName, url);
-            this.tasks.push(task);
+            this._tasks.push(task);
             return task;
         };
+        /**
+         * Add a {BABYLON.TextureAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param url defines the url of the file to load
+         * @param noMipmap defines if the texture must not receive mipmaps (false by default)
+         * @param invertY defines if you want to invert Y axis of the loaded texture (false by default)
+         * @param samplingMode defines the sampling mode to use (BABYLON.Texture.TRILINEAR_SAMPLINGMODE by default)
+         * @returns a new {BABYLON.TextureAssetTask} object
+         */
         AssetsManager.prototype.addTextureTask = function (taskName, url, noMipmap, invertY, samplingMode) {
             if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
             var task = new TextureAssetTask(taskName, url, noMipmap, invertY, samplingMode);
-            this.tasks.push(task);
+            this._tasks.push(task);
             return task;
         };
-        AssetsManager.prototype.addCubeTextureTask = function (name, url, extensions, noMipmap, files) {
-            var task = new CubeTextureAssetTask(name, url, extensions, noMipmap, files);
-            this.tasks.push(task);
+        /**
+         * Add a {BABYLON.CubeTextureAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param url defines the url of the file to load
+         * @param extensions defines the extension to use to load the cube map (can be null)
+         * @param noMipmap defines if the texture must not receive mipmaps (false by default)
+         * @param files defines the list of files to load (can be null)
+         * @returns a new {BABYLON.CubeTextureAssetTask} object
+         */
+        AssetsManager.prototype.addCubeTextureTask = function (taskName, url, extensions, noMipmap, files) {
+            var task = new CubeTextureAssetTask(taskName, url, extensions, noMipmap, files);
+            this._tasks.push(task);
             return task;
         };
-        AssetsManager.prototype.addHDRCubeTextureTask = function (name, url, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator) {
+        /**
+         *
+         * Add a {BABYLON.HDRCubeTextureAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param url defines the url of the file to load
+         * @param size defines the size you want for the cubemap (can be null)
+         * @param noMipmap defines if the texture must not receive mipmaps (false by default)
+         * @param generateHarmonics defines if you want to automatically generate (true by default)
+         * @param useInGammaSpace defines if the texture must be considered in gamma space (false by default)
+         * @param usePMREMGenerator is a reserved parameter and must be set to false or ignored
+         * @returns a new {BABYLON.HDRCubeTextureAssetTask} object
+         */
+        AssetsManager.prototype.addHDRCubeTextureTask = function (taskName, url, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator) {
             if (noMipmap === void 0) { noMipmap = false; }
             if (generateHarmonics === void 0) { generateHarmonics = true; }
             if (useInGammaSpace === void 0) { useInGammaSpace = false; }
             if (usePMREMGenerator === void 0) { usePMREMGenerator = false; }
-            var task = new HDRCubeTextureAssetTask(name, url, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator);
-            this.tasks.push(task);
+            var task = new HDRCubeTextureAssetTask(taskName, url, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator);
+            this._tasks.push(task);
             return task;
         };
         AssetsManager.prototype._decreaseWaitingTasksCount = function (task) {
-            this.waitingTasksCount--;
+            var _this = this;
+            this._waitingTasksCount--;
             try {
+                if (task.taskState === AssetTaskState.DONE) {
+                    // Let's remove successfull tasks
+                    BABYLON.Tools.SetImmediate(function () {
+                        var index = _this._tasks.indexOf(task);
+                        if (index > -1) {
+                            _this._tasks.splice(index, 1);
+                        }
+                    });
+                }
                 if (this.onProgress) {
-                    this.onProgress(this.waitingTasksCount, this.tasks.length, task);
+                    this.onProgress(this._waitingTasksCount, this._totalTasksCount, task);
                 }
-                this.onProgressObservable.notifyObservers(new AssetsProgressEvent(this.waitingTasksCount, this.tasks.length, task));
+                this.onProgressObservable.notifyObservers(new AssetsProgressEvent(this._waitingTasksCount, this._totalTasksCount, task));
             }
             catch (e) {
                 BABYLON.Tools.Error("Error running progress callbacks.");
                 console.log(e);
             }
-            if (this.waitingTasksCount === 0) {
+            if (this._waitingTasksCount === 0) {
                 try {
                     if (this.onFinish) {
-                        this.onFinish(this.tasks);
+                        this.onFinish(this._tasks);
                     }
-                    this.onTasksDoneObservable.notifyObservers(this.tasks);
+                    this.onTasksDoneObservable.notifyObservers(this._tasks);
                 }
                 catch (e) {
                     BABYLON.Tools.Error("Error running tasks-done callbacks.");
@@ -78327,10 +78725,7 @@ var BABYLON;
                 }
             };
             var error = function (message, exception) {
-                task.errorObject = task.errorObject || {
-                    message: message,
-                    exception: exception
-                };
+                task._setErrorObject(message, exception);
                 if (_this.onTaskError) {
                     _this.onTaskError(task);
                 }
@@ -78339,30 +78734,38 @@ var BABYLON;
             };
             task.run(this._scene, done, error);
         };
+        /**
+         * Reset the {BABYLON.AssetsManager} and remove all tasks
+         * @return the current instance of the {BABYLON.AssetsManager}
+         */
         AssetsManager.prototype.reset = function () {
             this._isLoading = false;
-            this.tasks = new Array();
+            this._tasks = new Array();
             return this;
         };
+        /**
+         * Start the loading process
+         * @return the current instance of the {BABYLON.AssetsManager}
+         */
         AssetsManager.prototype.load = function () {
             if (this._isLoading) {
                 return this;
             }
             this._isLoading = true;
-            this.waitingTasksCount = this.tasks.length;
-            if (this.waitingTasksCount === 0) {
+            this._waitingTasksCount = this._tasks.length;
+            this._totalTasksCount = this._tasks.length;
+            if (this._waitingTasksCount === 0) {
                 if (this.onFinish) {
-                    this.onFinish(this.tasks);
+                    this.onFinish(this._tasks);
                 }
-                this.onTasksDoneObservable.notifyObservers(this.tasks);
-                this._isLoading = false;
+                this.onTasksDoneObservable.notifyObservers(this._tasks);
                 return this;
             }
             if (this.useDefaultLoadingScreen) {
                 this._scene.getEngine().displayLoadingUI();
             }
-            for (var index = 0; index < this.tasks.length; index++) {
-                var task = this.tasks[index];
+            for (var index = 0; index < this._tasks.length; index++) {
+                var task = this._tasks[index];
                 this._runTask(task);
             }
             return this;

+ 452 - 49
dist/preview release/es6.js

@@ -66457,9 +66457,9 @@ var BABYLON;
          * @param scene The scene the texture will be used in
          * @param size The cubemap desired size (the more it increases the longer the generation will be) If the size is omitted this implies you are using a preprocessed cubemap.
          * @param noMipmap Forces to not generate the mipmap if true
-         * @param generateHarmonics Specifies wether you want to extract the polynomial harmonics during the generation process
+         * @param generateHarmonics Specifies whether you want to extract the polynomial harmonics during the generation process
          * @param useInGammaSpace Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space)
-         * @param usePMREMGenerator Specifies wether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time.
+         * @param usePMREMGenerator Specifies whether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time.
          */
         function HDRCubeTexture(url, scene, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator, onLoad, onError) {
             if (noMipmap === void 0) { noMipmap = false; }
@@ -78157,34 +78157,114 @@ var BABYLON;
 
 var BABYLON;
 (function (BABYLON) {
+    /**
+     * Defines the list of states available for a task inside a {BABYLON.AssetsManager}
+     */
     var AssetTaskState;
     (function (AssetTaskState) {
+        /**
+         * Initialization
+         */
         AssetTaskState[AssetTaskState["INIT"] = 0] = "INIT";
+        /**
+         * Running
+         */
         AssetTaskState[AssetTaskState["RUNNING"] = 1] = "RUNNING";
+        /**
+         * Done
+         */
         AssetTaskState[AssetTaskState["DONE"] = 2] = "DONE";
+        /**
+         * Error
+         */
         AssetTaskState[AssetTaskState["ERROR"] = 3] = "ERROR";
     })(AssetTaskState = BABYLON.AssetTaskState || (BABYLON.AssetTaskState = {}));
+    /**
+     * Define an abstract asset task used with a {BABYLON.AssetsManager} class to load assets into a scene
+     */
     var AbstractAssetTask = /** @class */ (function () {
-        function AbstractAssetTask(name) {
+        /**
+         * Creates a new {BABYLON.AssetsManager}
+         * @param name defines the name of the task
+         */
+        function AbstractAssetTask(
+            /**
+             * Task name
+             */ name) {
             this.name = name;
-            this.isCompleted = false;
-            this.taskState = AssetTaskState.INIT;
+            this._isCompleted = false;
+            this._taskState = AssetTaskState.INIT;
         }
+        Object.defineProperty(AbstractAssetTask.prototype, "isCompleted", {
+            /**
+             * Get if the task is completed
+             */
+            get: function () {
+                return this._isCompleted;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(AbstractAssetTask.prototype, "taskState", {
+            /**
+             * Gets the current state of the task
+             */
+            get: function () {
+                return this._taskState;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(AbstractAssetTask.prototype, "errorObject", {
+            /**
+             * Gets the current error object (if task is in error)
+             */
+            get: function () {
+                return this._errorObject;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        /**
+         * Internal only
+         * @ignore
+         */
+        AbstractAssetTask.prototype._setErrorObject = function (message, exception) {
+            if (this._errorObject) {
+                return;
+            }
+            this._errorObject = {
+                message: message,
+                exception: exception
+            };
+        };
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         AbstractAssetTask.prototype.run = function (scene, onSuccess, onError) {
             var _this = this;
-            this.taskState = AssetTaskState.RUNNING;
+            this._taskState = AssetTaskState.RUNNING;
             this.runTask(scene, function () {
                 _this.onDoneCallback(onSuccess, onError);
             }, function (msg, exception) {
                 _this.onErrorCallback(onError, msg, exception);
             });
         };
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         AbstractAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
             throw new Error("runTask is not implemented");
         };
         AbstractAssetTask.prototype.onErrorCallback = function (onError, message, exception) {
-            this.taskState = AssetTaskState.ERROR;
-            this.errorObject = {
+            this._taskState = AssetTaskState.ERROR;
+            this._errorObject = {
                 message: message,
                 exception: exception
             };
@@ -78195,8 +78275,8 @@ var BABYLON;
         };
         AbstractAssetTask.prototype.onDoneCallback = function (onSuccess, onError) {
             try {
-                this.taskState = AssetTaskState.DONE;
-                this.isCompleted = true;
+                this._taskState = AssetTaskState.DONE;
+                this._isCompleted = true;
                 if (this.onSuccess) {
                     this.onSuccess(this);
                 }
@@ -78209,7 +78289,16 @@ var BABYLON;
         return AbstractAssetTask;
     }());
     BABYLON.AbstractAssetTask = AbstractAssetTask;
+    /**
+     * Class used to share progress information about assets loading
+     */
     var AssetsProgressEvent = /** @class */ (function () {
+        /**
+         * Creates a {BABYLON.AssetsProgressEvent}
+         * @param remainingCount defines the number of remaining tasks to process
+         * @param totalCount defines the total number of tasks
+         * @param task defines the task that was just processed
+         */
         function AssetsProgressEvent(remainingCount, totalCount, task) {
             this.remainingCount = remainingCount;
             this.totalCount = totalCount;
@@ -78218,9 +78307,35 @@ var BABYLON;
         return AssetsProgressEvent;
     }());
     BABYLON.AssetsProgressEvent = AssetsProgressEvent;
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load meshes
+     */
     var MeshAssetTask = /** @class */ (function (_super) {
         __extends(MeshAssetTask, _super);
-        function MeshAssetTask(name, meshesNames, rootUrl, sceneFilename) {
+        /**
+         * Creates a new {BABYLON.MeshAssetTask}
+         * @param name defines the name of the task
+         * @param meshesNames defines the list of mesh's names you want to load
+         * @param rootUrl defines the root url to use as a base to load your meshes and associated resources
+         * @param sceneFilename defines the filename of the scene to load from
+         */
+        function MeshAssetTask(
+            /**
+             * Defines the name of the task
+             */
+            name, 
+            /**
+             * Defines the list of mesh's names you want to load
+             */
+            meshesNames, 
+            /**
+             * Defines the root url to use as a base to load your meshes and associated resources
+             */
+            rootUrl, 
+            /**
+             * Defines the filename of the scene to load from
+             */
+            sceneFilename) {
             var _this = _super.call(this, name) || this;
             _this.name = name;
             _this.meshesNames = meshesNames;
@@ -78228,6 +78343,12 @@ var BABYLON;
             _this.sceneFilename = sceneFilename;
             return _this;
         }
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         MeshAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
             var _this = this;
             BABYLON.SceneLoader.ImportMesh(this.meshesNames, this.rootUrl, this.sceneFilename, scene, function (meshes, particleSystems, skeletons) {
@@ -78242,14 +78363,36 @@ var BABYLON;
         return MeshAssetTask;
     }(AbstractAssetTask));
     BABYLON.MeshAssetTask = MeshAssetTask;
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load text content
+     */
     var TextFileAssetTask = /** @class */ (function (_super) {
         __extends(TextFileAssetTask, _super);
-        function TextFileAssetTask(name, url) {
+        /**
+         * Creates a new TextFileAssetTask object
+         * @param name defines the name of the task
+         * @param url defines the location of the file to load
+         */
+        function TextFileAssetTask(
+            /**
+             * Defines the name of the task
+             */
+            name, 
+            /**
+             * Defines the location of the file to load
+             */
+            url) {
             var _this = _super.call(this, name) || this;
             _this.name = name;
             _this.url = url;
             return _this;
         }
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         TextFileAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
             var _this = this;
             scene._loadFile(this.url, function (data) {
@@ -78264,14 +78407,36 @@ var BABYLON;
         return TextFileAssetTask;
     }(AbstractAssetTask));
     BABYLON.TextFileAssetTask = TextFileAssetTask;
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load binary data
+     */
     var BinaryFileAssetTask = /** @class */ (function (_super) {
         __extends(BinaryFileAssetTask, _super);
-        function BinaryFileAssetTask(name, url) {
+        /**
+         * Creates a new BinaryFileAssetTask object
+         * @param name defines the name of the new task
+         * @param url defines the location of the file to load
+         */
+        function BinaryFileAssetTask(
+            /**
+             * Defines the name of the task
+             */
+            name, 
+            /**
+             * Defines the location of the file to load
+             */
+            url) {
             var _this = _super.call(this, name) || this;
             _this.name = name;
             _this.url = url;
             return _this;
         }
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         BinaryFileAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
             var _this = this;
             scene._loadFile(this.url, function (data) {
@@ -78286,14 +78451,36 @@ var BABYLON;
         return BinaryFileAssetTask;
     }(AbstractAssetTask));
     BABYLON.BinaryFileAssetTask = BinaryFileAssetTask;
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load images
+     */
     var ImageAssetTask = /** @class */ (function (_super) {
         __extends(ImageAssetTask, _super);
-        function ImageAssetTask(name, url) {
+        /**
+         * Creates a new ImageAssetTask
+         * @param name defines the name of the task
+         * @param url defines the location of the image to load
+         */
+        function ImageAssetTask(
+            /**
+             * Defines the name of the task
+             */
+            name, 
+            /**
+             * Defines the location of the image to load
+             */
+            url) {
             var _this = _super.call(this, name) || this;
             _this.name = name;
             _this.url = url;
             return _this;
         }
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         ImageAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
             var _this = this;
             var img = new Image();
@@ -78310,9 +78497,40 @@ var BABYLON;
         return ImageAssetTask;
     }(AbstractAssetTask));
     BABYLON.ImageAssetTask = ImageAssetTask;
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load 2D textures
+     */
     var TextureAssetTask = /** @class */ (function (_super) {
         __extends(TextureAssetTask, _super);
-        function TextureAssetTask(name, url, noMipmap, invertY, samplingMode) {
+        /**
+         * Creates a new TextureAssetTask object
+         * @param name defines the name of the task
+         * @param url defines the location of the file to load
+         * @param noMipmap defines if mipmap should not be generated (default is false)
+         * @param invertY defines if texture must be inverted on Y axis (default is false)
+         * @param samplingMode defines the sampling mode to use (default is BABYLON.Texture.TRILINEAR_SAMPLINGMODE)
+         */
+        function TextureAssetTask(
+            /**
+             * Defines the name of the task
+             */
+            name, 
+            /**
+             * Defines the location of the file to load
+             */
+            url, 
+            /**
+             * Defines if mipmap should not be generated (default is false)
+             */
+            noMipmap, 
+            /**
+             * Defines if texture must be inverted on Y axis (default is false)
+             */
+            invertY, 
+            /**
+             * Defines the sampling mode to use (default is BABYLON.Texture.TRILINEAR_SAMPLINGMODE)
+             */
+            samplingMode) {
             if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
             var _this = _super.call(this, name) || this;
             _this.name = name;
@@ -78322,6 +78540,12 @@ var BABYLON;
             _this.samplingMode = samplingMode;
             return _this;
         }
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         TextureAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
             var onload = function () {
                 onSuccess();
@@ -78334,9 +78558,40 @@ var BABYLON;
         return TextureAssetTask;
     }(AbstractAssetTask));
     BABYLON.TextureAssetTask = TextureAssetTask;
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load cube textures
+     */
     var CubeTextureAssetTask = /** @class */ (function (_super) {
         __extends(CubeTextureAssetTask, _super);
-        function CubeTextureAssetTask(name, url, extensions, noMipmap, files) {
+        /**
+         * Creates a new CubeTextureAssetTask
+         * @param name defines the name of the task
+         * @param url defines the location of the files to load (You have to specify the folder where the files are + filename with no extension)
+         * @param extensions defines the extensions to use to load files (["_px", "_py", "_pz", "_nx", "_ny", "_nz"] by default)
+         * @param noMipmap defines if mipmaps should not be generated (default is false)
+         * @param files defines the explicit list of files (undefined by default)
+         */
+        function CubeTextureAssetTask(
+            /**
+             * Defines the name of the task
+             */
+            name, 
+            /**
+             * Defines the location of the files to load (You have to specify the folder where the files are + filename with no extension)
+             */
+            url, 
+            /**
+             * Defines the extensions to use to load files (["_px", "_py", "_pz", "_nx", "_ny", "_nz"] by default)
+             */
+            extensions, 
+            /**
+             * Defines if mipmaps should not be generated (default is false)
+             */
+            noMipmap, 
+            /**
+             * Defines the explicit list of files (undefined by default)
+             */
+            files) {
             var _this = _super.call(this, name) || this;
             _this.name = name;
             _this.url = url;
@@ -78345,6 +78600,12 @@ var BABYLON;
             _this.files = files;
             return _this;
         }
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         CubeTextureAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
             var onload = function () {
                 onSuccess();
@@ -78357,9 +78618,50 @@ var BABYLON;
         return CubeTextureAssetTask;
     }(AbstractAssetTask));
     BABYLON.CubeTextureAssetTask = CubeTextureAssetTask;
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load HDR cube textures
+     */
     var HDRCubeTextureAssetTask = /** @class */ (function (_super) {
         __extends(HDRCubeTextureAssetTask, _super);
-        function HDRCubeTextureAssetTask(name, url, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator) {
+        /**
+         * Creates a new HDRCubeTextureAssetTask object
+         * @param name defines the name of the task
+         * @param url defines the location of the file to load
+         * @param size defines the desired size (the more it increases the longer the generation will be) If the size is omitted this implies you are using a preprocessed cubemap.
+         * @param noMipmap defines if mipmaps should not be generated (default is false)
+         * @param generateHarmonics specifies whether you want to extract the polynomial harmonics during the generation process (default is true)
+         * @param useInGammaSpace specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)
+         * @param usePMREMGenerator specifies whether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time (default is false)
+         */
+        function HDRCubeTextureAssetTask(
+            /**
+             * Defines the name of the task
+             */
+            name, 
+            /**
+             * Defines the location of the file to load
+             */
+            url, 
+            /**
+             * Defines the desired size (the more it increases the longer the generation will be) If the size is omitted this implies you are using a preprocessed cubemap.
+             */
+            size, 
+            /**
+             * Defines if mipmaps should not be generated (default is false)
+             */
+            noMipmap, 
+            /**
+             * Specifies whether you want to extract the polynomial harmonics during the generation process (default is true)
+             */
+            generateHarmonics, 
+            /**
+             * Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)
+             */
+            useInGammaSpace, 
+            /**
+             * Specifies whether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time (default is false)
+             */
+            usePMREMGenerator) {
             if (noMipmap === void 0) { noMipmap = false; }
             if (generateHarmonics === void 0) { generateHarmonics = true; }
             if (useInGammaSpace === void 0) { useInGammaSpace = false; }
@@ -78374,6 +78676,12 @@ var BABYLON;
             _this.usePMREMGenerator = usePMREMGenerator;
             return _this;
         }
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         HDRCubeTextureAssetTask.prototype.run = function (scene, onSuccess, onError) {
             var onload = function () {
                 onSuccess();
@@ -78386,77 +78694,167 @@ var BABYLON;
         return HDRCubeTextureAssetTask;
     }(AbstractAssetTask));
     BABYLON.HDRCubeTextureAssetTask = HDRCubeTextureAssetTask;
+    /**
+     * This class can be used to easily import assets into a scene
+     * @see http://doc.babylonjs.com/how_to/how_to_use_assetsmanager
+     */
     var AssetsManager = /** @class */ (function () {
+        /**
+         * Creates a new AssetsManager
+         * @param scene defines the scene to work on
+         */
         function AssetsManager(scene) {
             this._isLoading = false;
-            this.tasks = new Array();
-            this.waitingTasksCount = 0;
-            //Observables
+            this._tasks = new Array();
+            this._waitingTasksCount = 0;
+            this._totalTasksCount = 0;
+            /**
+             * Observable called when all tasks are processed
+             */
             this.onTaskSuccessObservable = new BABYLON.Observable();
+            /**
+             * Observable called when a task had an error
+             */
             this.onTaskErrorObservable = new BABYLON.Observable();
+            /**
+             * Observable called when a task is successful
+             */
             this.onTasksDoneObservable = new BABYLON.Observable();
+            /**
+             * Observable called when a task is done (whatever the result is)
+             */
             this.onProgressObservable = new BABYLON.Observable();
+            /**
+             * Gets or sets a boolean defining if the {BABYLON.AssetsManager} should use the default loading screen
+             * @see http://doc.babylonjs.com/how_to/creating_a_custom_loading_screen
+             */
             this.useDefaultLoadingScreen = true;
             this._scene = scene;
         }
+        /**
+         * Add a {BABYLON.MeshAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param meshesNames defines the name of meshes to load
+         * @param rootUrl defines the root url to use to locate files
+         * @param sceneFilename defines the filename of the scene file
+         * @returns a new {BABYLON.MeshAssetTask} object
+         */
         AssetsManager.prototype.addMeshTask = function (taskName, meshesNames, rootUrl, sceneFilename) {
             var task = new MeshAssetTask(taskName, meshesNames, rootUrl, sceneFilename);
-            this.tasks.push(task);
+            this._tasks.push(task);
             return task;
         };
+        /**
+         * Add a {BABYLON.TextFileAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param url defines the url of the file to load
+         * @returns a new {BABYLON.TextFileAssetTask} object
+         */
         AssetsManager.prototype.addTextFileTask = function (taskName, url) {
             var task = new TextFileAssetTask(taskName, url);
-            this.tasks.push(task);
+            this._tasks.push(task);
             return task;
         };
+        /**
+         * Add a {BABYLON.BinaryFileAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param url defines the url of the file to load
+         * @returns a new {BABYLON.BinaryFileAssetTask} object
+         */
         AssetsManager.prototype.addBinaryFileTask = function (taskName, url) {
             var task = new BinaryFileAssetTask(taskName, url);
-            this.tasks.push(task);
+            this._tasks.push(task);
             return task;
         };
+        /**
+         * Add a {BABYLON.ImageAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param url defines the url of the file to load
+         * @returns a new {BABYLON.ImageAssetTask} object
+         */
         AssetsManager.prototype.addImageTask = function (taskName, url) {
             var task = new ImageAssetTask(taskName, url);
-            this.tasks.push(task);
+            this._tasks.push(task);
             return task;
         };
+        /**
+         * Add a {BABYLON.TextureAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param url defines the url of the file to load
+         * @param noMipmap defines if the texture must not receive mipmaps (false by default)
+         * @param invertY defines if you want to invert Y axis of the loaded texture (false by default)
+         * @param samplingMode defines the sampling mode to use (BABYLON.Texture.TRILINEAR_SAMPLINGMODE by default)
+         * @returns a new {BABYLON.TextureAssetTask} object
+         */
         AssetsManager.prototype.addTextureTask = function (taskName, url, noMipmap, invertY, samplingMode) {
             if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
             var task = new TextureAssetTask(taskName, url, noMipmap, invertY, samplingMode);
-            this.tasks.push(task);
+            this._tasks.push(task);
             return task;
         };
-        AssetsManager.prototype.addCubeTextureTask = function (name, url, extensions, noMipmap, files) {
-            var task = new CubeTextureAssetTask(name, url, extensions, noMipmap, files);
-            this.tasks.push(task);
+        /**
+         * Add a {BABYLON.CubeTextureAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param url defines the url of the file to load
+         * @param extensions defines the extension to use to load the cube map (can be null)
+         * @param noMipmap defines if the texture must not receive mipmaps (false by default)
+         * @param files defines the list of files to load (can be null)
+         * @returns a new {BABYLON.CubeTextureAssetTask} object
+         */
+        AssetsManager.prototype.addCubeTextureTask = function (taskName, url, extensions, noMipmap, files) {
+            var task = new CubeTextureAssetTask(taskName, url, extensions, noMipmap, files);
+            this._tasks.push(task);
             return task;
         };
-        AssetsManager.prototype.addHDRCubeTextureTask = function (name, url, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator) {
+        /**
+         *
+         * Add a {BABYLON.HDRCubeTextureAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param url defines the url of the file to load
+         * @param size defines the size you want for the cubemap (can be null)
+         * @param noMipmap defines if the texture must not receive mipmaps (false by default)
+         * @param generateHarmonics defines if you want to automatically generate (true by default)
+         * @param useInGammaSpace defines if the texture must be considered in gamma space (false by default)
+         * @param usePMREMGenerator is a reserved parameter and must be set to false or ignored
+         * @returns a new {BABYLON.HDRCubeTextureAssetTask} object
+         */
+        AssetsManager.prototype.addHDRCubeTextureTask = function (taskName, url, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator) {
             if (noMipmap === void 0) { noMipmap = false; }
             if (generateHarmonics === void 0) { generateHarmonics = true; }
             if (useInGammaSpace === void 0) { useInGammaSpace = false; }
             if (usePMREMGenerator === void 0) { usePMREMGenerator = false; }
-            var task = new HDRCubeTextureAssetTask(name, url, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator);
-            this.tasks.push(task);
+            var task = new HDRCubeTextureAssetTask(taskName, url, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator);
+            this._tasks.push(task);
             return task;
         };
         AssetsManager.prototype._decreaseWaitingTasksCount = function (task) {
-            this.waitingTasksCount--;
+            var _this = this;
+            this._waitingTasksCount--;
             try {
+                if (task.taskState === AssetTaskState.DONE) {
+                    // Let's remove successfull tasks
+                    BABYLON.Tools.SetImmediate(function () {
+                        var index = _this._tasks.indexOf(task);
+                        if (index > -1) {
+                            _this._tasks.splice(index, 1);
+                        }
+                    });
+                }
                 if (this.onProgress) {
-                    this.onProgress(this.waitingTasksCount, this.tasks.length, task);
+                    this.onProgress(this._waitingTasksCount, this._totalTasksCount, task);
                 }
-                this.onProgressObservable.notifyObservers(new AssetsProgressEvent(this.waitingTasksCount, this.tasks.length, task));
+                this.onProgressObservable.notifyObservers(new AssetsProgressEvent(this._waitingTasksCount, this._totalTasksCount, task));
             }
             catch (e) {
                 BABYLON.Tools.Error("Error running progress callbacks.");
                 console.log(e);
             }
-            if (this.waitingTasksCount === 0) {
+            if (this._waitingTasksCount === 0) {
                 try {
                     if (this.onFinish) {
-                        this.onFinish(this.tasks);
+                        this.onFinish(this._tasks);
                     }
-                    this.onTasksDoneObservable.notifyObservers(this.tasks);
+                    this.onTasksDoneObservable.notifyObservers(this._tasks);
                 }
                 catch (e) {
                     BABYLON.Tools.Error("Error running tasks-done callbacks.");
@@ -78481,10 +78879,7 @@ var BABYLON;
                 }
             };
             var error = function (message, exception) {
-                task.errorObject = task.errorObject || {
-                    message: message,
-                    exception: exception
-                };
+                task._setErrorObject(message, exception);
                 if (_this.onTaskError) {
                     _this.onTaskError(task);
                 }
@@ -78493,30 +78888,38 @@ var BABYLON;
             };
             task.run(this._scene, done, error);
         };
+        /**
+         * Reset the {BABYLON.AssetsManager} and remove all tasks
+         * @return the current instance of the {BABYLON.AssetsManager}
+         */
         AssetsManager.prototype.reset = function () {
             this._isLoading = false;
-            this.tasks = new Array();
+            this._tasks = new Array();
             return this;
         };
+        /**
+         * Start the loading process
+         * @return the current instance of the {BABYLON.AssetsManager}
+         */
         AssetsManager.prototype.load = function () {
             if (this._isLoading) {
                 return this;
             }
             this._isLoading = true;
-            this.waitingTasksCount = this.tasks.length;
-            if (this.waitingTasksCount === 0) {
+            this._waitingTasksCount = this._tasks.length;
+            this._totalTasksCount = this._tasks.length;
+            if (this._waitingTasksCount === 0) {
                 if (this.onFinish) {
-                    this.onFinish(this.tasks);
+                    this.onFinish(this._tasks);
                 }
-                this.onTasksDoneObservable.notifyObservers(this.tasks);
-                this._isLoading = false;
+                this.onTasksDoneObservable.notifyObservers(this._tasks);
                 return this;
             }
             if (this.useDefaultLoadingScreen) {
                 this._scene.getEngine().displayLoadingUI();
             }
-            for (var index = 0; index < this.tasks.length; index++) {
-                var task = this.tasks[index];
+            for (var index = 0; index < this._tasks.length; index++) {
+                var task = this._tasks[index];
                 this._runTask(task);
             }
             return this;

File diff suppressed because it is too large
+ 2 - 2
dist/preview release/inspector/babylon.inspector.bundle.js


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


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


File diff suppressed because it is too large
+ 2 - 1169
dist/preview release/typedocValidationBaseline.json


File diff suppressed because it is too large
+ 11 - 11
dist/preview release/viewer/babylon.viewer.js


+ 5 - 4
src/Engine/babylon.engine.ts

@@ -818,11 +818,12 @@
 
         /**
          * @constructor
-         * @param {HTMLCanvasElement | WebGLRenderingContext} canvasOrContext - the canvas or the webgl context to be used for rendering
-         * @param {boolean} [antialias] - enable antialias
-         * @param options - further options to be sent to the getContext function
+         * @param {HTMLCanvasElement | WebGLRenderingContext} canvasOrContext - the canvas or WebGL context to use for rendering
+         * @param {boolean} [antialias] - enable antialiasing (default: false)
+         * @param {EngineOptions} [options] - further options to be sent to the getContext() function
+         * @param {boolean} [adaptToDeviceRatio] - whether to adapt to the device's viewport characteristics (default: false)
          */
-        constructor(canvasOrContext: Nullable<HTMLCanvasElement | WebGLRenderingContext>, antialias?: boolean, options?: EngineOptions, adaptToDeviceRatio = false) {
+        constructor(canvasOrContext: Nullable<HTMLCanvasElement | WebGLRenderingContext>, antialias?: boolean, options?: EngineOptions, adaptToDeviceRatio:boolean = false) {
             let canvas: Nullable<HTMLCanvasElement> = null;
             Engine.Instances.push(this);
 

+ 2 - 2
src/Materials/Textures/babylon.hdrCubeTexture.ts

@@ -64,9 +64,9 @@ module BABYLON {
          * @param scene The scene the texture will be used in
          * @param size The cubemap desired size (the more it increases the longer the generation will be) If the size is omitted this implies you are using a preprocessed cubemap.
          * @param noMipmap Forces to not generate the mipmap if true
-         * @param generateHarmonics Specifies wether you want to extract the polynomial harmonics during the generation process
+         * @param generateHarmonics Specifies whether you want to extract the polynomial harmonics during the generation process
          * @param useInGammaSpace Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space)
-         * @param usePMREMGenerator Specifies wether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time.
+         * @param usePMREMGenerator Specifies whether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time.
          */
         constructor(url: string, scene: Scene, size?: number, noMipmap = false, generateHarmonics = true, useInGammaSpace = false, usePMREMGenerator = false, onLoad: Nullable<() => void> = null, onError: Nullable<(message?: string, exception?: any) => void> = null) {
             super(scene);

+ 576 - 58
src/Tools/babylon.assetsManager.ts

@@ -1,26 +1,99 @@
 module BABYLON {
 
+    /**
+     * Defines the list of states available for a task inside a {BABYLON.AssetsManager}
+     */
     export enum AssetTaskState {
+        /**
+         * Initialization
+         */
         INIT,
+        /**
+         * Running
+         */
         RUNNING,
+        /**
+         * Done
+         */
         DONE,
+        /**
+         * Error
+         */
         ERROR
     }
 
+    /**
+     * Define an abstract asset task used with a {BABYLON.AssetsManager} class to load assets into a scene
+     */
     export abstract class AbstractAssetTask {
+        /**
+         * Callback called when the task is successful
+         */
         public onSuccess: (task: any) => void;
+
+        /**
+         * Callback called when the task is successful
+         */
         public onError: (task: any, message?: string, exception?: any) => void;
 
-        constructor(public name: string) {
-            this.taskState = AssetTaskState.INIT;
+        /**
+         * Creates a new {BABYLON.AssetsManager}
+         * @param name defines the name of the task
+         */
+        constructor(
+            /**
+             * Task name
+             */public name: string) {
         }
 
-        isCompleted: boolean = false;
-        taskState: AssetTaskState;
-        errorObject: { message?: string; exception?: any; };
+        private _isCompleted = false;
+        private _taskState = AssetTaskState.INIT;
+        private _errorObject: { message?: string; exception?: any; };
+
+        /**
+         * Get if the task is completed
+         */
+        public get isCompleted(): boolean {
+            return this._isCompleted;
+        }
+
+        /**
+         * Gets the current state of the task
+         */
+        public get taskState(): AssetTaskState {
+            return this._taskState;
+        }
+
+        /**
+         * Gets the current error object (if task is in error)
+         */
+        public get errorObject(): { message?: string; exception?: any; } {
+            return this._errorObject;
+        }
+
+        /**
+         * Internal only
+         * @ignore 
+         */
+        public _setErrorObject(message?: string, exception?: any) {
+            if (this._errorObject) {
+                return;
+            }
 
-        run(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {
-            this.taskState = AssetTaskState.RUNNING;
+            this._errorObject = {
+                message: message,
+                exception: exception
+            };
+        }
+
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
+        public run(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {
+            this._taskState = AssetTaskState.RUNNING;
             this.runTask(scene, () => {
                 this.onDoneCallback(onSuccess, onError);
             }, (msg, exception) => {
@@ -28,14 +101,20 @@ module BABYLON {
             });
         }
 
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {
             throw new Error("runTask is not implemented");
         }
 
         private onErrorCallback(onError: (message?: string, exception?: any) => void, message?: string, exception?: any) {
-            this.taskState = AssetTaskState.ERROR;
+            this._taskState = AssetTaskState.ERROR;
 
-            this.errorObject = {
+            this._errorObject = {
                 message: message,
                 exception: exception
             }
@@ -49,8 +128,8 @@ module BABYLON {
 
         private onDoneCallback(onSuccess: () => void, onError: (message?: string, exception?: any) => void) {
             try {
-                this.taskState = AssetTaskState.DONE;
-                this.isCompleted = true;
+                this._taskState = AssetTaskState.DONE;
+                this._isCompleted = true;
 
                 if (this.onSuccess) {
                     this.onSuccess(this);
@@ -64,17 +143,47 @@ module BABYLON {
 
     }
 
+    /**
+     * Define the interface used by progress events raised during assets loading
+     */
     export interface IAssetsProgressEvent {
+        /**
+         * Defines the number of remaining tasks to process
+         */
         remainingCount: number;
+        /**
+         * Defines the total number of tasks
+         */
         totalCount: number;
+        /**
+         * Defines the task that was just processed
+         */
         task: AbstractAssetTask;
     }
 
+    /**
+     * Class used to share progress information about assets loading
+     */
     export class AssetsProgressEvent implements IAssetsProgressEvent {
-        remainingCount: number;
-        totalCount: number;
-        task: AbstractAssetTask;
-
+        /**
+         * Defines the number of remaining tasks to process
+         */
+        public remainingCount: number;
+        /**
+         * Defines the total number of tasks
+         */
+        public totalCount: number;
+        /**
+         * Defines the task that was just processed
+         */
+        public task: AbstractAssetTask;
+
+        /**
+         * Creates a {BABYLON.AssetsProgressEvent}
+         * @param remainingCount defines the number of remaining tasks to process
+         * @param totalCount defines the total number of tasks
+         * @param task defines the task that was just processed
+         */
         constructor(remainingCount: number, totalCount: number, task: AbstractAssetTask) {
             this.remainingCount = remainingCount;
             this.totalCount = totalCount;
@@ -82,18 +191,66 @@ module BABYLON {
         }
     }
 
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load meshes
+     */
     export class MeshAssetTask extends AbstractAssetTask {
+        /**
+         * Gets the list of loaded meshes
+         */
         public loadedMeshes: Array<AbstractMesh>;
+        /**
+         * Gets the list of loaded particle systems
+         */
         public loadedParticleSystems: Array<ParticleSystem>;
+        /**
+         * Gets the list of loaded skeletons
+         */
         public loadedSkeletons: Array<Skeleton>;
 
+        /**
+         * Callback called when the task is successful
+         */
         public onSuccess: (task: MeshAssetTask) => void;
+
+        /**
+         * Callback called when the task is successful
+         */
         public onError: (task: MeshAssetTask, message?: string, exception?: any) => void;
 
-        constructor(public name: string, public meshesNames: any, public rootUrl: string, public sceneFilename: string) {
+        /**
+         * Creates a new {BABYLON.MeshAssetTask}
+         * @param name defines the name of the task
+         * @param meshesNames defines the list of mesh's names you want to load
+         * @param rootUrl defines the root url to use as a base to load your meshes and associated resources
+         * @param sceneFilename defines the filename of the scene to load from
+         */
+        constructor(
+            /**
+             * Defines the name of the task
+             */
+            public name: string,
+            /**
+             * Defines the list of mesh's names you want to load
+             */
+            public meshesNames: any,
+            /**
+             * Defines the root url to use as a base to load your meshes and associated resources
+             */
+            public rootUrl: string,
+            /**
+             * Defines the filename of the scene to load from
+             */
+            public sceneFilename: string) {
             super(name);
         }
 
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {
             SceneLoader.ImportMesh(this.meshesNames, this.rootUrl, this.sceneFilename, scene,
                 (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => {
@@ -108,16 +265,48 @@ module BABYLON {
         }
     }
 
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load text content
+     */
     export class TextFileAssetTask extends AbstractAssetTask {
+        /**
+         * Gets the loaded text string
+         */
         public text: string;
 
+        /**
+         * Callback called when the task is successful
+         */
         public onSuccess: (task: TextFileAssetTask) => void;
+
+        /**
+         * Callback called when the task is successful
+         */
         public onError: (task: TextFileAssetTask, message?: string, exception?: any) => void;
 
-        constructor(public name: string, public url: string) {
+        /**
+         * Creates a new TextFileAssetTask object
+         * @param name defines the name of the task
+         * @param url defines the location of the file to load
+         */
+        constructor(
+            /**
+             * Defines the name of the task
+             */
+            public name: string,
+            /**
+             * Defines the location of the file to load
+             */
+            public url: string) {
             super(name);
         }
 
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {
             scene._loadFile(this.url, (data) => {
                 this.text = data as string;
@@ -130,16 +319,47 @@ module BABYLON {
         }
     }
 
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load binary data
+     */
     export class BinaryFileAssetTask extends AbstractAssetTask {
+        /**
+         * Gets the lodaded data (as an array buffer)
+         */
         public data: ArrayBuffer;
 
+        /**
+         * Callback called when the task is successful
+         */
         public onSuccess: (task: BinaryFileAssetTask) => void;
+        /**
+         * Callback called when the task is successful
+         */
         public onError: (task: BinaryFileAssetTask, message?: string, exception?: any) => void;
 
-        constructor(public name: string, public url: string) {
+        /**
+         * Creates a new BinaryFileAssetTask object
+         * @param name defines the name of the new task
+         * @param url defines the location of the file to load
+         */
+        constructor(
+            /**
+             * Defines the name of the task
+             */
+            public name: string,
+            /**
+             * Defines the location of the file to load
+             */
+            public url: string) {
             super(name);
         }
 
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {
             scene._loadFile(this.url, (data) => {
                 this.data = data as ArrayBuffer;
@@ -152,16 +372,47 @@ module BABYLON {
         }
     }
 
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load images
+     */
     export class ImageAssetTask extends AbstractAssetTask {
+        /**
+         * Gets the loaded images
+         */
         public image: HTMLImageElement;
 
+        /**
+         * Callback called when the task is successful
+         */
         public onSuccess: (task: ImageAssetTask) => void;
+        /**
+         * Callback called when the task is successful
+         */
         public onError: (task: ImageAssetTask, message?: string, exception?: any) => void;
 
-        constructor(public name: string, public url: string) {
+        /**
+         * Creates a new ImageAssetTask
+         * @param name defines the name of the task
+         * @param url defines the location of the image to load
+         */
+        constructor(
+            /**
+             * Defines the name of the task
+             */
+            public name: string,
+            /**
+             * Defines the location of the image to load
+             */
+            public url: string) {
             super(name);
         }
 
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {
             var img = new Image();
 
@@ -180,20 +431,72 @@ module BABYLON {
         }
     }
 
+    /**
+     * Defines the interface used by texture loading tasks
+     */
     export interface ITextureAssetTask<TEX extends BaseTexture> {
+        /**
+         * Gets the loaded texture
+         */
         texture: TEX;
     }
 
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load 2D textures
+     */
     export class TextureAssetTask extends AbstractAssetTask implements ITextureAssetTask<Texture> {
+        /**
+         * Gets the loaded texture
+         */
         public texture: Texture;
 
+        /**
+         * Callback called when the task is successful
+         */
         public onSuccess: (task: TextureAssetTask) => void;
+        /**
+         * Callback called when the task is successful
+         */
         public onError: (task: TextureAssetTask, message?: string, exception?: any) => void;
 
-        constructor(public name: string, public url: string, public noMipmap?: boolean, public invertY?: boolean, public samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE) {
+        /**
+         * Creates a new TextureAssetTask object
+         * @param name defines the name of the task
+         * @param url defines the location of the file to load
+         * @param noMipmap defines if mipmap should not be generated (default is false)
+         * @param invertY defines if texture must be inverted on Y axis (default is false)
+         * @param samplingMode defines the sampling mode to use (default is BABYLON.Texture.TRILINEAR_SAMPLINGMODE)
+         */
+        constructor(
+            /**
+             * Defines the name of the task
+             */
+            public name: string,
+            /**
+             * Defines the location of the file to load
+             */
+            public url: string,
+            /**
+             * Defines if mipmap should not be generated (default is false)
+             */
+            public noMipmap?: boolean,
+            /**
+             * Defines if texture must be inverted on Y axis (default is false)
+             */
+            public invertY?: boolean,
+            /**
+             * Defines the sampling mode to use (default is BABYLON.Texture.TRILINEAR_SAMPLINGMODE)
+             */
+            public samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE) {
             super(name);
         }
 
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {
 
             var onload = () => {
@@ -208,16 +511,62 @@ module BABYLON {
         }
     }
 
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load cube textures
+     */
     export class CubeTextureAssetTask extends AbstractAssetTask implements ITextureAssetTask<CubeTexture> {
+        /**
+         * Gets the loaded texture
+         */
         public texture: CubeTexture;
 
+        /**
+         * Callback called when the task is successful
+         */
         public onSuccess: (task: CubeTextureAssetTask) => void;
+        /**
+         * Callback called when the task is successful
+         */
         public onError: (task: CubeTextureAssetTask, message?: string, exception?: any) => void;
 
-        constructor(public name: string, public url: string, public extensions?: string[], public noMipmap?: boolean, public files?: string[]) {
+        /**
+         * Creates a new CubeTextureAssetTask
+         * @param name defines the name of the task
+         * @param url defines the location of the files to load (You have to specify the folder where the files are + filename with no extension)
+         * @param extensions defines the extensions to use to load files (["_px", "_py", "_pz", "_nx", "_ny", "_nz"] by default)
+         * @param noMipmap defines if mipmaps should not be generated (default is false)
+         * @param files defines the explicit list of files (undefined by default)
+         */
+        constructor(
+            /**
+             * Defines the name of the task
+             */
+            public name: string,
+            /**
+             * Defines the location of the files to load (You have to specify the folder where the files are + filename with no extension)
+             */
+            public url: string,
+            /**
+             * Defines the extensions to use to load files (["_px", "_py", "_pz", "_nx", "_ny", "_nz"] by default)
+             */
+            public extensions?: string[],
+            /**
+             * Defines if mipmaps should not be generated (default is false)
+             */
+            public noMipmap?: boolean,
+            /**
+             * Defines the explicit list of files (undefined by default)
+             */
+            public files?: string[]) {
             super(name);
         }
 
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {
 
             var onload = () => {
@@ -232,16 +581,72 @@ module BABYLON {
         }
     }
 
+    /**
+     * Define a task used by {BABYLON.AssetsManager} to load HDR cube textures
+     */
     export class HDRCubeTextureAssetTask extends AbstractAssetTask implements ITextureAssetTask<HDRCubeTexture> {
+        /**
+         * Gets the loaded texture
+         */
         public texture: HDRCubeTexture;
 
+        /**
+         * Callback called when the task is successful
+         */
         public onSuccess: (task: HDRCubeTextureAssetTask) => void;
+        /**
+         * Callback called when the task is successful
+         */
         public onError: (task: HDRCubeTextureAssetTask, message?: string, exception?: any) => void;
 
-        constructor(public name: string, public url: string, public size?: number, public noMipmap = false, public generateHarmonics = true, public useInGammaSpace = false, public usePMREMGenerator = false) {
+        /**
+         * Creates a new HDRCubeTextureAssetTask object
+         * @param name defines the name of the task
+         * @param url defines the location of the file to load
+         * @param size defines the desired size (the more it increases the longer the generation will be) If the size is omitted this implies you are using a preprocessed cubemap.
+         * @param noMipmap defines if mipmaps should not be generated (default is false)
+         * @param generateHarmonics specifies whether you want to extract the polynomial harmonics during the generation process (default is true)
+         * @param useInGammaSpace specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)
+         * @param usePMREMGenerator specifies whether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time (default is false)
+         */
+        constructor(
+            /**
+             * Defines the name of the task
+             */
+            public name: string,
+            /**
+             * Defines the location of the file to load
+             */
+            public url: string,
+            /**
+             * Defines the desired size (the more it increases the longer the generation will be) If the size is omitted this implies you are using a preprocessed cubemap.
+             */
+            public size?: number,
+            /**
+             * Defines if mipmaps should not be generated (default is false)
+             */
+            public noMipmap = false,
+            /**
+             * Specifies whether you want to extract the polynomial harmonics during the generation process (default is true)
+             */
+            public generateHarmonics = true,
+            /**
+             * Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)
+             */
+            public useInGammaSpace = false,
+            /**
+             * Specifies whether or not to generate the CubeMap through CubeMapGen to avoid seams issue at run time (default is false)
+             */
+            public usePMREMGenerator = false) {
             super(name);
         }
 
+        /**
+         * Execute the current task
+         * @param scene defines the scene where you want your assets to be loaded
+         * @param onSuccess is a callback called when the task is successfully executed
+         * @param onError is a callback called if an error occurs
+         */
         public run(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {
 
             var onload = () => {
@@ -256,97 +661,204 @@ module BABYLON {
         }
     }
 
+    /**
+     * This class can be used to easily import assets into a scene
+     * @see http://doc.babylonjs.com/how_to/how_to_use_assetsmanager
+     */
     export class AssetsManager {
         private _scene: Scene;
         private _isLoading = false;
 
-        protected tasks = new Array<AbstractAssetTask>();
-        protected waitingTasksCount = 0;
+        protected _tasks = new Array<AbstractAssetTask>();
+        protected _waitingTasksCount = 0;
+        protected _totalTasksCount = 0;
 
+        /**
+         * Callback called when all tasks are processed
+         */
         public onFinish: (tasks: AbstractAssetTask[]) => void;
+
+        /**
+         * Callback called when a task is successful
+         */
         public onTaskSuccess: (task: AbstractAssetTask) => void;
+
+        /**
+         * Callback called when a task had an error
+         */
         public onTaskError: (task: AbstractAssetTask) => void;
-        public onProgress: (remainingCount: number, totalCount: number, task: AbstractAssetTask) => void;
 
-        //Observables
+        /**
+         * Callback called when a task is done (whatever the result is)
+         */
+        public onProgress: (remainingCount: number, totalCount: number, task: AbstractAssetTask) => void;
 
+        /**
+         * Observable called when all tasks are processed
+         */
         public onTaskSuccessObservable = new Observable<AbstractAssetTask>();
+
+        /**
+         * Observable called when a task had an error
+         */
         public onTaskErrorObservable = new Observable<AbstractAssetTask>();
+
+        /**
+         * Observable called when a task is successful
+         */
         public onTasksDoneObservable = new Observable<AbstractAssetTask[]>();
+
+        /**
+         * Observable called when a task is done (whatever the result is)
+         */
         public onProgressObservable = new Observable<IAssetsProgressEvent>();
 
+        /**
+         * Gets or sets a boolean defining if the {BABYLON.AssetsManager} should use the default loading screen
+         * @see http://doc.babylonjs.com/how_to/creating_a_custom_loading_screen
+         */
         public useDefaultLoadingScreen = true;
 
+        /**
+         * Creates a new AssetsManager
+         * @param scene defines the scene to work on
+         */
         constructor(scene: Scene) {
             this._scene = scene;
         }
 
+        /**
+         * Add a {BABYLON.MeshAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param meshesNames defines the name of meshes to load
+         * @param rootUrl defines the root url to use to locate files
+         * @param sceneFilename defines the filename of the scene file
+         * @returns a new {BABYLON.MeshAssetTask} object
+         */
         public addMeshTask(taskName: string, meshesNames: any, rootUrl: string, sceneFilename: string): MeshAssetTask {
             var task = new MeshAssetTask(taskName, meshesNames, rootUrl, sceneFilename);
-            this.tasks.push(task);
+            this._tasks.push(task);
 
             return task;
         }
 
+        /**
+         * Add a {BABYLON.TextFileAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param url defines the url of the file to load
+         * @returns a new {BABYLON.TextFileAssetTask} object
+         */
         public addTextFileTask(taskName: string, url: string): TextFileAssetTask {
             var task = new TextFileAssetTask(taskName, url);
-            this.tasks.push(task);
+            this._tasks.push(task);
 
             return task;
         }
 
+        /**
+         * Add a {BABYLON.BinaryFileAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param url defines the url of the file to load
+         * @returns a new {BABYLON.BinaryFileAssetTask} object
+         */
         public addBinaryFileTask(taskName: string, url: string): BinaryFileAssetTask {
             var task = new BinaryFileAssetTask(taskName, url);
-            this.tasks.push(task);
+            this._tasks.push(task);
 
             return task;
         }
 
+        /**
+         * Add a {BABYLON.ImageAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param url defines the url of the file to load
+         * @returns a new {BABYLON.ImageAssetTask} object
+         */
         public addImageTask(taskName: string, url: string): ImageAssetTask {
             var task = new ImageAssetTask(taskName, url);
-            this.tasks.push(task);
+            this._tasks.push(task);
 
             return task;
         }
 
+        /**
+         * Add a {BABYLON.TextureAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param url defines the url of the file to load
+         * @param noMipmap defines if the texture must not receive mipmaps (false by default)
+         * @param invertY defines if you want to invert Y axis of the loaded texture (false by default)
+         * @param samplingMode defines the sampling mode to use (BABYLON.Texture.TRILINEAR_SAMPLINGMODE by default)
+         * @returns a new {BABYLON.TextureAssetTask} object
+         */
         public addTextureTask(taskName: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE): TextureAssetTask {
             var task = new TextureAssetTask(taskName, url, noMipmap, invertY, samplingMode);
-            this.tasks.push(task);
+            this._tasks.push(task);
 
             return task;
         }
 
-
-        public addCubeTextureTask(name: string, url: string, extensions?: string[], noMipmap?: boolean, files?: string[]): CubeTextureAssetTask {
-            var task = new CubeTextureAssetTask(name, url, extensions, noMipmap, files);
-            this.tasks.push(task);
+        /**
+         * Add a {BABYLON.CubeTextureAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param url defines the url of the file to load
+         * @param extensions defines the extension to use to load the cube map (can be null)
+         * @param noMipmap defines if the texture must not receive mipmaps (false by default)
+         * @param files defines the list of files to load (can be null)
+         * @returns a new {BABYLON.CubeTextureAssetTask} object
+         */
+        public addCubeTextureTask(taskName: string, url: string, extensions?: string[], noMipmap?: boolean, files?: string[]): CubeTextureAssetTask {
+            var task = new CubeTextureAssetTask(taskName, url, extensions, noMipmap, files);
+            this._tasks.push(task);
 
             return task;
         }
 
-        public addHDRCubeTextureTask(name: string, url: string, size?: number, noMipmap = false, generateHarmonics = true, useInGammaSpace = false, usePMREMGenerator = false): HDRCubeTextureAssetTask {
-            var task = new HDRCubeTextureAssetTask(name, url, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator);
-            this.tasks.push(task);
+        /**
+         * 
+         * Add a {BABYLON.HDRCubeTextureAssetTask} to the list of active tasks
+         * @param taskName defines the name of the new task
+         * @param url defines the url of the file to load
+         * @param size defines the size you want for the cubemap (can be null)
+         * @param noMipmap defines if the texture must not receive mipmaps (false by default)
+         * @param generateHarmonics defines if you want to automatically generate (true by default)
+         * @param useInGammaSpace defines if the texture must be considered in gamma space (false by default)
+         * @param usePMREMGenerator is a reserved parameter and must be set to false or ignored
+         * @returns a new {BABYLON.HDRCubeTextureAssetTask} object
+         */
+        public addHDRCubeTextureTask(taskName: string, url: string, size?: number, noMipmap = false, generateHarmonics = true, useInGammaSpace = false, usePMREMGenerator = false): HDRCubeTextureAssetTask {
+            var task = new HDRCubeTextureAssetTask(taskName, url, size, noMipmap, generateHarmonics, useInGammaSpace, usePMREMGenerator);
+            this._tasks.push(task);
 
             return task;
         }
 
         private _decreaseWaitingTasksCount(task: AbstractAssetTask): void {
-            this.waitingTasksCount--;
+            this._waitingTasksCount--;
 
             try {
+                if (task.taskState === AssetTaskState.DONE) {
+                    // Let's remove successfull tasks
+                    Tools.SetImmediate(() => {
+                        let index = this._tasks.indexOf(task);
+
+                        if (index > -1) {
+                            this._tasks.splice(index, 1);
+                        }
+                    });
+                }
+
                 if (this.onProgress) {
                     this.onProgress(
-                        this.waitingTasksCount,
-                        this.tasks.length,
+                        this._waitingTasksCount,
+                        this._totalTasksCount,
                         task
                     );
                 }
 
                 this.onProgressObservable.notifyObservers(
                     new AssetsProgressEvent(
-                        this.waitingTasksCount,
-                        this.tasks.length,
+                        this._waitingTasksCount,
+                        this._totalTasksCount,
                         task
                     )
                 );
@@ -355,13 +867,13 @@ module BABYLON {
                 console.log(e);
             }
 
-            if (this.waitingTasksCount === 0) {
+            if (this._waitingTasksCount === 0) {
                 try {
                     if (this.onFinish) {
-                        this.onFinish(this.tasks);
+                        this.onFinish(this._tasks);
                     }
 
-                    this.onTasksDoneObservable.notifyObservers(this.tasks);
+                    this.onTasksDoneObservable.notifyObservers(this._tasks);
                 } catch (e) {
                     Tools.Error("Error running tasks-done callbacks.");
                     console.log(e);
@@ -387,10 +899,8 @@ module BABYLON {
             }
 
             let error = (message?: string, exception?: any) => {
-                task.errorObject = task.errorObject || {
-                    message: message,
-                    exception: exception
-                }
+                task._setErrorObject(message, exception);
+
                 if (this.onTaskError) {
                     this.onTaskError(task);
                 }
@@ -401,25 +911,33 @@ module BABYLON {
             task.run(this._scene, done, error);
         }
 
+        /**
+         * Reset the {BABYLON.AssetsManager} and remove all tasks
+         * @return the current instance of the {BABYLON.AssetsManager}
+         */
         public reset(): AssetsManager {
             this._isLoading = false;
-            this.tasks = new Array<AbstractAssetTask>();
+            this._tasks = new Array<AbstractAssetTask>();
             return this;
         }
 
+        /**
+         * Start the loading process
+         * @return the current instance of the {BABYLON.AssetsManager}
+         */
         public load(): AssetsManager {
             if (this._isLoading) {
                 return this;
             }
             this._isLoading = true;
-            this.waitingTasksCount = this.tasks.length;
+            this._waitingTasksCount = this._tasks.length;
+            this._totalTasksCount = this._tasks.length;
 
-            if (this.waitingTasksCount === 0) {
+            if (this._waitingTasksCount === 0) {
                 if (this.onFinish) {
-                    this.onFinish(this.tasks);
+                    this.onFinish(this._tasks);
                 }
-                this.onTasksDoneObservable.notifyObservers(this.tasks);
-                this._isLoading = false;
+                this.onTasksDoneObservable.notifyObservers(this._tasks);
                 return this;
             }
 
@@ -427,8 +945,8 @@ module BABYLON {
                 this._scene.getEngine().displayLoadingUI();
             }
 
-            for (var index = 0; index < this.tasks.length; index++) {
-                var task = this.tasks[index];
+            for (var index = 0; index < this._tasks.length; index++) {
+                var task = this._tasks[index];
                 this._runTask(task);
             }