David Catuhe 7 years ago
parent
commit
33cee61127

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


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


+ 4 - 5
dist/preview release/babylon.max.js

@@ -25746,9 +25746,6 @@ var BABYLON;
                 currentQuaternion.scaleAndAddToRef(scale, finalQuaternion);
                 currentQuaternion.scaleAndAddToRef(scale, finalQuaternion);
                 currentPosition.scaleAndAddToRef(scale, finalPosition);
                 currentPosition.scaleAndAddToRef(scale, finalPosition);
             }
             }
-            if (!originalAnimation._workValue) {
-                originalAnimation._workValue = BABYLON.Matrix.Identity();
-            }
             BABYLON.Matrix.ComposeToRef(finalScaling, finalQuaternion, finalPosition, originalAnimation._workValue);
             BABYLON.Matrix.ComposeToRef(finalScaling, finalQuaternion, finalPosition, originalAnimation._workValue);
             return originalAnimation._workValue;
             return originalAnimation._workValue;
         };
         };
@@ -50866,8 +50863,7 @@ var BABYLON;
                                 case Animation.ANIMATIONLOOPMODE_CYCLE:
                                 case Animation.ANIMATIONLOOPMODE_CYCLE:
                                 case Animation.ANIMATIONLOOPMODE_CONSTANT:
                                 case Animation.ANIMATIONLOOPMODE_CONSTANT:
                                     if (Animation.AllowMatricesInterpolation) {
                                     if (Animation.AllowMatricesInterpolation) {
-                                        workValue = this.matrixInterpolateFunction(startValue, endValue, gradient, workValue);
-                                        return workValue;
+                                        return this.matrixInterpolateFunction(startValue, endValue, gradient, workValue);
                                     }
                                     }
                                 case Animation.ANIMATIONLOOPMODE_RELATIVE:
                                 case Animation.ANIMATIONLOOPMODE_RELATIVE:
                                     return startValue;
                                     return startValue;
@@ -51694,6 +51690,9 @@ var BABYLON;
          */
          */
         RuntimeAnimation.prototype._interpolate = function (currentFrame, repeatCount, loopMode, offsetValue, highLimitValue) {
         RuntimeAnimation.prototype._interpolate = function (currentFrame, repeatCount, loopMode, offsetValue, highLimitValue) {
             this._currentFrame = currentFrame;
             this._currentFrame = currentFrame;
+            if (this._animation.dataType === BABYLON.Animation.ANIMATIONTYPE_MATRIX && !this._workValue) {
+                this._workValue = BABYLON.Matrix.Zero();
+            }
             return this._animation._interpolate(currentFrame, repeatCount, this._workValue, loopMode, offsetValue, highLimitValue);
             return this._animation._interpolate(currentFrame, repeatCount, this._workValue, loopMode, offsetValue, highLimitValue);
         };
         };
         /**
         /**

+ 4 - 5
dist/preview release/babylon.no-module.max.js

@@ -25713,9 +25713,6 @@ var BABYLON;
                 currentQuaternion.scaleAndAddToRef(scale, finalQuaternion);
                 currentQuaternion.scaleAndAddToRef(scale, finalQuaternion);
                 currentPosition.scaleAndAddToRef(scale, finalPosition);
                 currentPosition.scaleAndAddToRef(scale, finalPosition);
             }
             }
-            if (!originalAnimation._workValue) {
-                originalAnimation._workValue = BABYLON.Matrix.Identity();
-            }
             BABYLON.Matrix.ComposeToRef(finalScaling, finalQuaternion, finalPosition, originalAnimation._workValue);
             BABYLON.Matrix.ComposeToRef(finalScaling, finalQuaternion, finalPosition, originalAnimation._workValue);
             return originalAnimation._workValue;
             return originalAnimation._workValue;
         };
         };
@@ -50833,8 +50830,7 @@ var BABYLON;
                                 case Animation.ANIMATIONLOOPMODE_CYCLE:
                                 case Animation.ANIMATIONLOOPMODE_CYCLE:
                                 case Animation.ANIMATIONLOOPMODE_CONSTANT:
                                 case Animation.ANIMATIONLOOPMODE_CONSTANT:
                                     if (Animation.AllowMatricesInterpolation) {
                                     if (Animation.AllowMatricesInterpolation) {
-                                        workValue = this.matrixInterpolateFunction(startValue, endValue, gradient, workValue);
-                                        return workValue;
+                                        return this.matrixInterpolateFunction(startValue, endValue, gradient, workValue);
                                     }
                                     }
                                 case Animation.ANIMATIONLOOPMODE_RELATIVE:
                                 case Animation.ANIMATIONLOOPMODE_RELATIVE:
                                     return startValue;
                                     return startValue;
@@ -51661,6 +51657,9 @@ var BABYLON;
          */
          */
         RuntimeAnimation.prototype._interpolate = function (currentFrame, repeatCount, loopMode, offsetValue, highLimitValue) {
         RuntimeAnimation.prototype._interpolate = function (currentFrame, repeatCount, loopMode, offsetValue, highLimitValue) {
             this._currentFrame = currentFrame;
             this._currentFrame = currentFrame;
+            if (this._animation.dataType === BABYLON.Animation.ANIMATIONTYPE_MATRIX && !this._workValue) {
+                this._workValue = BABYLON.Matrix.Zero();
+            }
             return this._animation._interpolate(currentFrame, repeatCount, this._workValue, loopMode, offsetValue, highLimitValue);
             return this._animation._interpolate(currentFrame, repeatCount, this._workValue, loopMode, offsetValue, highLimitValue);
         };
         };
         /**
         /**

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


+ 4 - 5
dist/preview release/es6.js

@@ -25713,9 +25713,6 @@ var BABYLON;
                 currentQuaternion.scaleAndAddToRef(scale, finalQuaternion);
                 currentQuaternion.scaleAndAddToRef(scale, finalQuaternion);
                 currentPosition.scaleAndAddToRef(scale, finalPosition);
                 currentPosition.scaleAndAddToRef(scale, finalPosition);
             }
             }
-            if (!originalAnimation._workValue) {
-                originalAnimation._workValue = BABYLON.Matrix.Identity();
-            }
             BABYLON.Matrix.ComposeToRef(finalScaling, finalQuaternion, finalPosition, originalAnimation._workValue);
             BABYLON.Matrix.ComposeToRef(finalScaling, finalQuaternion, finalPosition, originalAnimation._workValue);
             return originalAnimation._workValue;
             return originalAnimation._workValue;
         };
         };
@@ -50833,8 +50830,7 @@ var BABYLON;
                                 case Animation.ANIMATIONLOOPMODE_CYCLE:
                                 case Animation.ANIMATIONLOOPMODE_CYCLE:
                                 case Animation.ANIMATIONLOOPMODE_CONSTANT:
                                 case Animation.ANIMATIONLOOPMODE_CONSTANT:
                                     if (Animation.AllowMatricesInterpolation) {
                                     if (Animation.AllowMatricesInterpolation) {
-                                        workValue = this.matrixInterpolateFunction(startValue, endValue, gradient, workValue);
-                                        return workValue;
+                                        return this.matrixInterpolateFunction(startValue, endValue, gradient, workValue);
                                     }
                                     }
                                 case Animation.ANIMATIONLOOPMODE_RELATIVE:
                                 case Animation.ANIMATIONLOOPMODE_RELATIVE:
                                     return startValue;
                                     return startValue;
@@ -51661,6 +51657,9 @@ var BABYLON;
          */
          */
         RuntimeAnimation.prototype._interpolate = function (currentFrame, repeatCount, loopMode, offsetValue, highLimitValue) {
         RuntimeAnimation.prototype._interpolate = function (currentFrame, repeatCount, loopMode, offsetValue, highLimitValue) {
             this._currentFrame = currentFrame;
             this._currentFrame = currentFrame;
+            if (this._animation.dataType === BABYLON.Animation.ANIMATIONTYPE_MATRIX && !this._workValue) {
+                this._workValue = BABYLON.Matrix.Zero();
+            }
             return this._animation._interpolate(currentFrame, repeatCount, this._workValue, loopMode, offsetValue, highLimitValue);
             return this._animation._interpolate(currentFrame, repeatCount, this._workValue, loopMode, offsetValue, highLimitValue);
         };
         };
         /**
         /**

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


+ 255 - 242
dist/preview release/viewer/babylon.viewer.max.js

@@ -25834,9 +25834,6 @@ var BABYLON;
                 currentQuaternion.scaleAndAddToRef(scale, finalQuaternion);
                 currentQuaternion.scaleAndAddToRef(scale, finalQuaternion);
                 currentPosition.scaleAndAddToRef(scale, finalPosition);
                 currentPosition.scaleAndAddToRef(scale, finalPosition);
             }
             }
-            if (!originalAnimation._workValue) {
-                originalAnimation._workValue = BABYLON.Matrix.Identity();
-            }
             BABYLON.Matrix.ComposeToRef(finalScaling, finalQuaternion, finalPosition, originalAnimation._workValue);
             BABYLON.Matrix.ComposeToRef(finalScaling, finalQuaternion, finalPosition, originalAnimation._workValue);
             return originalAnimation._workValue;
             return originalAnimation._workValue;
         };
         };
@@ -50954,8 +50951,7 @@ var BABYLON;
                                 case Animation.ANIMATIONLOOPMODE_CYCLE:
                                 case Animation.ANIMATIONLOOPMODE_CYCLE:
                                 case Animation.ANIMATIONLOOPMODE_CONSTANT:
                                 case Animation.ANIMATIONLOOPMODE_CONSTANT:
                                     if (Animation.AllowMatricesInterpolation) {
                                     if (Animation.AllowMatricesInterpolation) {
-                                        workValue = this.matrixInterpolateFunction(startValue, endValue, gradient, workValue);
-                                        return workValue;
+                                        return this.matrixInterpolateFunction(startValue, endValue, gradient, workValue);
                                     }
                                     }
                                 case Animation.ANIMATIONLOOPMODE_RELATIVE:
                                 case Animation.ANIMATIONLOOPMODE_RELATIVE:
                                     return startValue;
                                     return startValue;
@@ -51782,6 +51778,9 @@ var BABYLON;
          */
          */
         RuntimeAnimation.prototype._interpolate = function (currentFrame, repeatCount, loopMode, offsetValue, highLimitValue) {
         RuntimeAnimation.prototype._interpolate = function (currentFrame, repeatCount, loopMode, offsetValue, highLimitValue) {
             this._currentFrame = currentFrame;
             this._currentFrame = currentFrame;
+            if (this._animation.dataType === BABYLON.Animation.ANIMATIONTYPE_MATRIX && !this._workValue) {
+                this._workValue = BABYLON.Matrix.Zero();
+            }
             return this._animation._interpolate(currentFrame, repeatCount, this._workValue, loopMode, offsetValue, highLimitValue);
             return this._animation._interpolate(currentFrame, repeatCount, this._workValue, loopMode, offsetValue, highLimitValue);
         };
         };
         /**
         /**
@@ -102150,8 +102149,8 @@ var BABYLON;
 var BABYLON;
 var BABYLON;
 (function (BABYLON) {
 (function (BABYLON) {
     /**
     /**
-    * Coordinate system mode that will be used when loading from the gltf file
-    */
+     * Mode that determines the coordinate system to use.
+     */
     var GLTFLoaderCoordinateSystemMode;
     var GLTFLoaderCoordinateSystemMode;
     (function (GLTFLoaderCoordinateSystemMode) {
     (function (GLTFLoaderCoordinateSystemMode) {
         /**
         /**
@@ -102164,8 +102163,8 @@ var BABYLON;
         GLTFLoaderCoordinateSystemMode[GLTFLoaderCoordinateSystemMode["FORCE_RIGHT_HANDED"] = 1] = "FORCE_RIGHT_HANDED";
         GLTFLoaderCoordinateSystemMode[GLTFLoaderCoordinateSystemMode["FORCE_RIGHT_HANDED"] = 1] = "FORCE_RIGHT_HANDED";
     })(GLTFLoaderCoordinateSystemMode = BABYLON.GLTFLoaderCoordinateSystemMode || (BABYLON.GLTFLoaderCoordinateSystemMode = {}));
     })(GLTFLoaderCoordinateSystemMode = BABYLON.GLTFLoaderCoordinateSystemMode || (BABYLON.GLTFLoaderCoordinateSystemMode = {}));
     /**
     /**
-    * Animation mode that determines which animations should be started when a file is loaded
-    */
+     * Mode that determines what animations will start.
+     */
     var GLTFLoaderAnimationStartMode;
     var GLTFLoaderAnimationStartMode;
     (function (GLTFLoaderAnimationStartMode) {
     (function (GLTFLoaderAnimationStartMode) {
         /**
         /**
@@ -102182,8 +102181,8 @@ var BABYLON;
         GLTFLoaderAnimationStartMode[GLTFLoaderAnimationStartMode["ALL"] = 2] = "ALL";
         GLTFLoaderAnimationStartMode[GLTFLoaderAnimationStartMode["ALL"] = 2] = "ALL";
     })(GLTFLoaderAnimationStartMode = BABYLON.GLTFLoaderAnimationStartMode || (BABYLON.GLTFLoaderAnimationStartMode = {}));
     })(GLTFLoaderAnimationStartMode = BABYLON.GLTFLoaderAnimationStartMode || (BABYLON.GLTFLoaderAnimationStartMode = {}));
     /**
     /**
-    * Loading state
-    */
+     * Loader state.
+     */
     var GLTFLoaderState;
     var GLTFLoaderState;
     (function (GLTFLoaderState) {
     (function (GLTFLoaderState) {
         /**
         /**
@@ -102199,67 +102198,62 @@ var BABYLON;
          */
          */
         GLTFLoaderState[GLTFLoaderState["COMPLETE"] = 2] = "COMPLETE";
         GLTFLoaderState[GLTFLoaderState["COMPLETE"] = 2] = "COMPLETE";
     })(GLTFLoaderState = BABYLON.GLTFLoaderState || (BABYLON.GLTFLoaderState = {}));
     })(GLTFLoaderState = BABYLON.GLTFLoaderState || (BABYLON.GLTFLoaderState = {}));
-    /** File loader to load gltf files into a babylon scene */
+    /**
+     * File loader for loading glTF files into a scene.
+     */
     var GLTFFileLoader = /** @class */ (function () {
     var GLTFFileLoader = /** @class */ (function () {
         function GLTFFileLoader() {
         function GLTFFileLoader() {
             // #region Common options
             // #region Common options
             /**
             /**
-             * Raised when the asset has been parsed.
-             * The data.json property stores the glTF JSON.
-             * The data.bin property stores the BIN chunk from a glTF binary or null if the input is not a glTF binary.
+             * Raised when the asset has been parsed
              */
              */
             this.onParsedObservable = new BABYLON.Observable();
             this.onParsedObservable = new BABYLON.Observable();
             // #endregion
             // #endregion
             // #region V2 options
             // #region V2 options
             /**
             /**
-             * The coordinate system mode (AUTO, FORCE_RIGHT_HANDED). Defaults to AUTO.
-             * - AUTO - Automatically convert the glTF right-handed data to the appropriate system based on the current coordinate system mode of the scene.
-             * - FORCE_RIGHT_HANDED - Sets the useRightHandedSystem flag on the scene.
+             * The coordinate system mode. Defaults to AUTO.
              */
              */
             this.coordinateSystemMode = GLTFLoaderCoordinateSystemMode.AUTO;
             this.coordinateSystemMode = GLTFLoaderCoordinateSystemMode.AUTO;
             /**
             /**
-            * The animation start mode (NONE, FIRST, ALL). Defaults to FIRST.
-            * - NONE - No animation will start.
-            * - FIRST - The first animation will start.
-            * - ALL - All animations will start.
+            * The animation start mode. Defaults to FIRST.
             */
             */
             this.animationStartMode = GLTFLoaderAnimationStartMode.FIRST;
             this.animationStartMode = GLTFLoaderAnimationStartMode.FIRST;
             /**
             /**
-             * Set to true to compile materials before raising the success callback. Defaults to false.
+             * Defines if the loader should compile materials before raising the success callback. Defaults to false.
              */
              */
             this.compileMaterials = false;
             this.compileMaterials = false;
             /**
             /**
-             * Set to true to also compile materials with clip planes. Defaults to false.
+             * Defines if the loader should also compile materials with clip planes. Defaults to false.
              */
              */
             this.useClipPlane = false;
             this.useClipPlane = false;
             /**
             /**
-             * Set to true to compile shadow generators before raising the success callback. Defaults to false.
+             * Defines if the loader should compile shadow generators before raising the success callback. Defaults to false.
              */
              */
             this.compileShadowGenerators = false;
             this.compileShadowGenerators = false;
             /**
             /**
-             * Raised when the loader creates a mesh after parsing the glTF properties of the mesh.
+             * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
              */
              */
             this.onMeshLoadedObservable = new BABYLON.Observable();
             this.onMeshLoadedObservable = new BABYLON.Observable();
             /**
             /**
-             * Raised when the loader creates a texture after parsing the glTF properties of the texture.
+             * Observable raised when the loader creates a texture after parsing the glTF properties of the texture.
              */
              */
             this.onTextureLoadedObservable = new BABYLON.Observable();
             this.onTextureLoadedObservable = new BABYLON.Observable();
             /**
             /**
-             * Raised when the loader creates a material after parsing the glTF properties of the material.
+             * Observable raised when the loader creates a material after parsing the glTF properties of the material.
              */
              */
             this.onMaterialLoadedObservable = new BABYLON.Observable();
             this.onMaterialLoadedObservable = new BABYLON.Observable();
             /**
             /**
-             * Raised when the asset is completely loaded, immediately before the loader is disposed.
+             * Observable raised when the asset is completely loaded, immediately before the loader is disposed.
              * For assets with LODs, raised when all of the LODs are complete.
              * For assets with LODs, raised when all of the LODs are complete.
              * For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.
              * For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.
              */
              */
             this.onCompleteObservable = new BABYLON.Observable();
             this.onCompleteObservable = new BABYLON.Observable();
             /**
             /**
-            * Raised after the loader is disposed.
-            */
+             * Observable raised after the loader is disposed.
+             */
             this.onDisposeObservable = new BABYLON.Observable();
             this.onDisposeObservable = new BABYLON.Observable();
             /**
             /**
-             * Raised after a loader extension is created.
+             * Observable raised after a loader extension is created.
              * Set additional options for a loader extension in this event.
              * Set additional options for a loader extension in this event.
              */
              */
             this.onExtensionLoadedObservable = new BABYLON.Observable();
             this.onExtensionLoadedObservable = new BABYLON.Observable();
@@ -102278,7 +102272,9 @@ var BABYLON;
             };
             };
         }
         }
         Object.defineProperty(GLTFFileLoader.prototype, "onParsed", {
         Object.defineProperty(GLTFFileLoader.prototype, "onParsed", {
-            /** Raised when the asset has been parsed. */
+            /**
+             * Raised when the asset has been parsed
+             */
             set: function (callback) {
             set: function (callback) {
                 if (this._onParsedObserver) {
                 if (this._onParsedObserver) {
                     this.onParsedObservable.remove(this._onParsedObserver);
                     this.onParsedObservable.remove(this._onParsedObserver);
@@ -102290,7 +102286,7 @@ var BABYLON;
         });
         });
         Object.defineProperty(GLTFFileLoader.prototype, "onMeshLoaded", {
         Object.defineProperty(GLTFFileLoader.prototype, "onMeshLoaded", {
             /**
             /**
-             * Raised when the loader creates a mesh after parsing the glTF properties of the mesh. (onMeshLoadedObservable is likely desired instead.)
+             * Callback raised when the loader creates a mesh after parsing the glTF properties of the mesh.
              */
              */
             set: function (callback) {
             set: function (callback) {
                 if (this._onMeshLoadedObserver) {
                 if (this._onMeshLoadedObserver) {
@@ -102303,7 +102299,7 @@ var BABYLON;
         });
         });
         Object.defineProperty(GLTFFileLoader.prototype, "onTextureLoaded", {
         Object.defineProperty(GLTFFileLoader.prototype, "onTextureLoaded", {
             /**
             /**
-             * Method called when a texture has been loaded (onTextureLoadedObservable is likely desired instead.)
+             * Callback raised when the loader creates a texture after parsing the glTF properties of the texture.
              */
              */
             set: function (callback) {
             set: function (callback) {
                 if (this._onTextureLoadedObserver) {
                 if (this._onTextureLoadedObserver) {
@@ -102316,7 +102312,7 @@ var BABYLON;
         });
         });
         Object.defineProperty(GLTFFileLoader.prototype, "onMaterialLoaded", {
         Object.defineProperty(GLTFFileLoader.prototype, "onMaterialLoaded", {
             /**
             /**
-             * Method when the loader creates a material after parsing the glTF properties of the material. (onMaterialLoadedObservable is likely desired instead.)
+             * Callback raised when the loader creates a material after parsing the glTF properties of the material.
              */
              */
             set: function (callback) {
             set: function (callback) {
                 if (this._onMaterialLoadedObserver) {
                 if (this._onMaterialLoadedObserver) {
@@ -102329,7 +102325,7 @@ var BABYLON;
         });
         });
         Object.defineProperty(GLTFFileLoader.prototype, "onComplete", {
         Object.defineProperty(GLTFFileLoader.prototype, "onComplete", {
             /**
             /**
-             * Raised when the asset is completely loaded, immediately before the loader is disposed. (onCompleteObservable is likely desired instead.)
+             * Callback raised when the asset is completely loaded, immediately before the loader is disposed.
              */
              */
             set: function (callback) {
             set: function (callback) {
                 if (this._onCompleteObserver) {
                 if (this._onCompleteObserver) {
@@ -102342,7 +102338,7 @@ var BABYLON;
         });
         });
         Object.defineProperty(GLTFFileLoader.prototype, "onDispose", {
         Object.defineProperty(GLTFFileLoader.prototype, "onDispose", {
             /**
             /**
-             * Raised after the loader is disposed. (onDisposeObservable is likely desired instead.)
+             * Callback raised after the loader is disposed.
              */
              */
             set: function (callback) {
             set: function (callback) {
                 if (this._onDisposeObserver) {
                 if (this._onDisposeObserver) {
@@ -102355,7 +102351,7 @@ var BABYLON;
         });
         });
         Object.defineProperty(GLTFFileLoader.prototype, "onExtensionLoaded", {
         Object.defineProperty(GLTFFileLoader.prototype, "onExtensionLoaded", {
             /**
             /**
-             * Raised after a loader extension is created. (onExtensionLoadedObservable is likely desired instead.)
+             * Callback raised after a loader extension is created.
              */
              */
             set: function (callback) {
             set: function (callback) {
                 if (this._onExtensionLoadedObserver) {
                 if (this._onExtensionLoadedObserver) {
@@ -102368,7 +102364,7 @@ var BABYLON;
         });
         });
         /**
         /**
          * Returns a promise that resolves when the asset is completely loaded.
          * Returns a promise that resolves when the asset is completely loaded.
-         * @returns A promise that resolves when the asset is completely loaded.
+         * @returns a promise that resolves when the asset is completely loaded.
          */
          */
         GLTFFileLoader.prototype.whenCompleteAsync = function () {
         GLTFFileLoader.prototype.whenCompleteAsync = function () {
             var _this = this;
             var _this = this;
@@ -102380,7 +102376,7 @@ var BABYLON;
         };
         };
         Object.defineProperty(GLTFFileLoader.prototype, "loaderState", {
         Object.defineProperty(GLTFFileLoader.prototype, "loaderState", {
             /**
             /**
-             * The loader state (LOADING, READY, COMPLETE) or null if the loader is not active.
+             * The loader state or null if the loader is not active.
              */
              */
             get: function () {
             get: function () {
                 return this._loader ? this._loader.state : null;
                 return this._loader ? this._loader.state : null;
@@ -102403,14 +102399,14 @@ var BABYLON;
             this.onDisposeObservable.clear();
             this.onDisposeObservable.clear();
         };
         };
         /**
         /**
-        * Imports one or more meshes from a loaded gltf file and adds them to the scene
-        * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
-        * @param scene the scene the meshes should be added to
-        * @param data gltf data containing information of the meshes in a loaded file
-        * @param rootUrl root url to load from
-        * @param onProgress event that fires when loading progress has occured
-        * @returns a promise containg the loaded meshes, particles, skeletons and animations
-        */
+         * Imports one or more meshes from the loaded glTF data and adds them to the scene
+         * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
+         * @param scene the scene the meshes should be added to
+         * @param data the glTF data to load
+         * @param rootUrl root url to load from
+         * @param onProgress event that fires when loading progress has occured
+         * @returns a promise containg the loaded meshes, particles, skeletons and animations
+         */
         GLTFFileLoader.prototype.importMeshAsync = function (meshesNames, scene, data, rootUrl, onProgress) {
         GLTFFileLoader.prototype.importMeshAsync = function (meshesNames, scene, data, rootUrl, onProgress) {
             var _this = this;
             var _this = this;
             return Promise.resolve().then(function () {
             return Promise.resolve().then(function () {
@@ -102420,13 +102416,13 @@ var BABYLON;
             });
             });
         };
         };
         /**
         /**
-        * Imports all objects from a loaded gltf file and adds them to the scene
-        * @param scene the scene the objects should be added to
-        * @param data gltf data containing information of the meshes in a loaded file
-        * @param rootUrl root url to load from
-        * @param onProgress event that fires when loading progress has occured
-        * @returns a promise which completes when objects have been loaded to the scene
-        */
+         * Imports all objects from the loaded glTF data and adds them to the scene
+         * @param scene the scene the objects should be added to
+         * @param data the glTF data to load
+         * @param rootUrl root url to load from
+         * @param onProgress event that fires when loading progress has occured
+         * @returns a promise which completes when objects have been loaded to the scene
+         */
         GLTFFileLoader.prototype.loadAsync = function (scene, data, rootUrl, onProgress) {
         GLTFFileLoader.prototype.loadAsync = function (scene, data, rootUrl, onProgress) {
             var _this = this;
             var _this = this;
             return Promise.resolve().then(function () {
             return Promise.resolve().then(function () {
@@ -102460,7 +102456,7 @@ var BABYLON;
             });
             });
         };
         };
         /**
         /**
-         * If the data string can be loaded directly
+         * If the data string can be loaded directly.
          * @param data string contianing the file data
          * @param data string contianing the file data
          * @returns if the data can be loaded directly
          * @returns if the data can be loaded directly
          */
          */
@@ -102468,7 +102464,7 @@ var BABYLON;
             return ((data.indexOf("scene") !== -1) && (data.indexOf("node") !== -1));
             return ((data.indexOf("scene") !== -1) && (data.indexOf("node") !== -1));
         };
         };
         /**
         /**
-         * Instantiates a gltf file loader plugin
+         * Instantiates a glTF file loader plugin.
          * @returns the created plugin
          * @returns the created plugin
          */
          */
         GLTFFileLoader.prototype.createPlugin = function () {
         GLTFFileLoader.prototype.createPlugin = function () {
@@ -102655,11 +102651,14 @@ var BABYLON;
         // #endregion
         // #endregion
         // #region V1 options
         // #region V1 options
         /**
         /**
-         * Set this property to false to disable incremental loading which delays the loader from calling the success callback until after loading the meshes and shaders. Textures always loads asynchronously. For example, the success callback can compute the bounding information of the loaded meshes when incremental loading is disabled. Defaults to true.
+         * Set this property to false to disable incremental loading which delays the loader from calling the success callback until after loading the meshes and shaders.
+         * Textures always loads asynchronously. For example, the success callback can compute the bounding information of the loaded meshes when incremental loading is disabled.
+         * Defaults to true.
          */
          */
         GLTFFileLoader.IncrementalLoading = true;
         GLTFFileLoader.IncrementalLoading = true;
         /**
         /**
-         * Set this property to true in order to work with homogeneous coordinates, available with some converters and exporters. Defaults to false. See https://en.wikipedia.org/wiki/Homogeneous_coordinates
+         * Set this property to true in order to work with homogeneous coordinates, available with some converters and exporters.
+         * Defaults to false. See https://en.wikipedia.org/wiki/Homogeneous_coordinates.
          */
          */
         GLTFFileLoader.HomogeneousCoordinates = false;
         GLTFFileLoader.HomogeneousCoordinates = false;
         return GLTFFileLoader;
         return GLTFFileLoader;
@@ -104901,21 +104900,21 @@ var BABYLON;
 (function (BABYLON) {
 (function (BABYLON) {
     var GLTF2;
     var GLTF2;
     (function (GLTF2) {
     (function (GLTF2) {
-        /** Array item helper methods */
-        var ArrayItem = /** @class */ (function () {
-            function ArrayItem() {
+        /** @ignore */
+        var _ArrayItem = /** @class */ (function () {
+            function _ArrayItem() {
             }
             }
-            /** Sets the index of each array element to its index in the array */
-            ArrayItem.Assign = function (values) {
+            /** @ignore */
+            _ArrayItem.Assign = function (values) {
                 if (values) {
                 if (values) {
                     for (var index = 0; index < values.length; index++) {
                     for (var index = 0; index < values.length; index++) {
                         values[index]._index = index;
                         values[index]._index = index;
                     }
                     }
                 }
                 }
             };
             };
-            return ArrayItem;
+            return _ArrayItem;
         }());
         }());
-        GLTF2.ArrayItem = ArrayItem;
+        GLTF2._ArrayItem = _ArrayItem;
     })(GLTF2 = BABYLON.GLTF2 || (BABYLON.GLTF2 = {}));
     })(GLTF2 = BABYLON.GLTF2 || (BABYLON.GLTF2 = {}));
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));
 
 
@@ -104928,20 +104927,18 @@ var BABYLON;
 
 
 
 
 /**
 /**
-* Defines the GLTF2 module used to import/export GLTF 2.0 files
-*/
+ * Defines the module used to import/export glTF 2.0 assets
+ */
 var BABYLON;
 var BABYLON;
 (function (BABYLON) {
 (function (BABYLON) {
     var GLTF2;
     var GLTF2;
     (function (GLTF2) {
     (function (GLTF2) {
         /**
         /**
-        * Used to load from a GLTF2 file
-        */
+         * Loader for loading a glTF 2.0 asset
+         */
         var GLTFLoader = /** @class */ (function () {
         var GLTFLoader = /** @class */ (function () {
             function GLTFLoader() {
             function GLTFLoader() {
-                /**
-                * @ignore
-                */
+                /** @ignore */
                 this._completePromises = new Array();
                 this._completePromises = new Array();
                 this._disposed = false;
                 this._disposed = false;
                 this._state = null;
                 this._state = null;
@@ -104950,55 +104947,54 @@ var BABYLON;
                 this._defaultBabylonMaterials = {};
                 this._defaultBabylonMaterials = {};
                 this._requests = new Array();
                 this._requests = new Array();
                 /**
                 /**
-                * Coordinate system that will be used when loading from the gltf file
-                */
+                 * Mode that determines the coordinate system to use.
+                 */
                 this.coordinateSystemMode = BABYLON.GLTFLoaderCoordinateSystemMode.AUTO;
                 this.coordinateSystemMode = BABYLON.GLTFLoaderCoordinateSystemMode.AUTO;
                 /**
                 /**
-                * Animation mode that determines which animations should be started when a file is loaded
-                */
+                 * Mode that determines what animations will start.
+                 */
                 this.animationStartMode = BABYLON.GLTFLoaderAnimationStartMode.FIRST;
                 this.animationStartMode = BABYLON.GLTFLoaderAnimationStartMode.FIRST;
                 /**
                 /**
-                * If the materials in the file should automatically be compiled
-                */
+                 * Defines if the loader should compile materials.
+                 */
                 this.compileMaterials = false;
                 this.compileMaterials = false;
                 /**
                 /**
-                * If a clip plane should be usede when loading meshes in the file
-                */
+                 * Defines if the loader should also compile materials with clip planes.
+                 */
                 this.useClipPlane = false;
                 this.useClipPlane = false;
                 /**
                 /**
-                * If shadow generators should automatically be compiled
-                */
+                 * Defines if the loader should compile shadow generators.
+                 */
                 this.compileShadowGenerators = false;
                 this.compileShadowGenerators = false;
                 /**
                 /**
-                * Observable that fires when the loader is disposed
-                */
-                this.onDisposeObservable = new BABYLON.Observable();
-                /**
-                * Observable that fires each time a mesh is loaded
-                */
+                 * Observable raised when the loader creates a mesh after parsing the glTF properties of the mesh.
+                 */
                 this.onMeshLoadedObservable = new BABYLON.Observable();
                 this.onMeshLoadedObservable = new BABYLON.Observable();
                 /**
                 /**
-                * Observable that fires each time a texture is loaded
-                */
+                 * Observable raised when the loader creates a texture after parsing the glTF properties of the texture.
+                 */
                 this.onTextureLoadedObservable = new BABYLON.Observable();
                 this.onTextureLoadedObservable = new BABYLON.Observable();
                 /**
                 /**
-                * Observable that fires each time a material is loaded
-                */
+                 * Observable raised when the loader creates a material after parsing the glTF properties of the material.
+                 */
                 this.onMaterialLoadedObservable = new BABYLON.Observable();
                 this.onMaterialLoadedObservable = new BABYLON.Observable();
                 /**
                 /**
-                * Observable that fires each time an extension is loaded
-                */
-                this.onExtensionLoadedObservable = new BABYLON.Observable();
-                /**
-                * Observable that fires when the load has completed
-                */
+                 * Observable raised when the asset is completely loaded, immediately before the loader is disposed.
+                 * For assets with LODs, raised when all of the LODs are complete.
+                 * For assets without LODs, raised when the model is complete, immediately after the loader resolves the returned promise.
+                 */
                 this.onCompleteObservable = new BABYLON.Observable();
                 this.onCompleteObservable = new BABYLON.Observable();
+                /**
+                 * Observable raised after the loader is disposed.
+                 */
+                this.onDisposeObservable = new BABYLON.Observable();
+                /**
+                 * Observable raised after a loader extension is created.
+                 * Set additional options for a loader extension in this event.
+                 */
+                this.onExtensionLoadedObservable = new BABYLON.Observable();
             }
             }
-            /**
-            * @ignore, registers the loader
-            * @param name name of the loader
-            * @param factory function that converts a loader to a loader extension
-            */
+            /** @ignore */
             GLTFLoader._Register = function (name, factory) {
             GLTFLoader._Register = function (name, factory) {
                 if (GLTFLoader._Factories[name]) {
                 if (GLTFLoader._Factories[name]) {
                     BABYLON.Tools.Error("Extension with the name '" + name + "' already exists");
                     BABYLON.Tools.Error("Extension with the name '" + name + "' already exists");
@@ -105010,8 +105006,8 @@ var BABYLON;
             };
             };
             Object.defineProperty(GLTFLoader.prototype, "state", {
             Object.defineProperty(GLTFLoader.prototype, "state", {
                 /**
                 /**
-                * The current state of the loader
-                */
+                 * Loader state or null if the loader is not active.
+                 */
                 get: function () {
                 get: function () {
                     return this._state;
                     return this._state;
                 },
                 },
@@ -105019,8 +105015,8 @@ var BABYLON;
                 configurable: true
                 configurable: true
             });
             });
             /**
             /**
-            * Disposes of the loader
-            */
+             * Disposes the loader, releases resources during load, and cancels any outstanding requests.
+             */
             GLTFLoader.prototype.dispose = function () {
             GLTFLoader.prototype.dispose = function () {
                 if (this._disposed) {
                 if (this._disposed) {
                     return;
                     return;
@@ -105031,14 +105027,14 @@ var BABYLON;
                 this._clear();
                 this._clear();
             };
             };
             /**
             /**
-            * Imports one or more meshes from a loaded gltf file and adds them to the scene
-            * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
-            * @param scene the scene the meshes should be added to
-            * @param data gltf data containing information of the meshes in a loaded file
-            * @param rootUrl root url to load from
-            * @param onProgress event that fires when loading progress has occured
-            * @returns a promise containg the loaded meshes, particles, skeletons and animations
-            */
+             * Imports one or more meshes from the loaded glTF data and adds them to the scene
+             * @param meshesNames a string or array of strings of the mesh names that should be loaded from the file
+             * @param scene the scene the meshes should be added to
+             * @param data the glTF data to load
+             * @param rootUrl root url to load from
+             * @param onProgress event that fires when loading progress has occured
+             * @returns a promise containg the loaded meshes, particles, skeletons and animations
+             */
             GLTFLoader.prototype.importMeshAsync = function (meshesNames, scene, data, rootUrl, onProgress) {
             GLTFLoader.prototype.importMeshAsync = function (meshesNames, scene, data, rootUrl, onProgress) {
                 var _this = this;
                 var _this = this;
                 return Promise.resolve().then(function () {
                 return Promise.resolve().then(function () {
@@ -105073,13 +105069,13 @@ var BABYLON;
                 });
                 });
             };
             };
             /**
             /**
-            * Imports all objects from a loaded gltf file and adds them to the scene
-            * @param scene the scene the objects should be added to
-            * @param data gltf data containing information of the meshes in a loaded file
-            * @param rootUrl root url to load from
-            * @param onProgress event that fires when loading progress has occured
-            * @returns a promise which completes when objects have been loaded to the scene
-            */
+             * Imports all objects from the loaded glTF data and adds them to the scene
+             * @param scene the scene the objects should be added to
+             * @param data the glTF data to load
+             * @param rootUrl root url to load from
+             * @param onProgress event that fires when loading progress has occured
+             * @returns a promise which completes when objects have been loaded to the scene
+             */
             GLTFLoader.prototype.loadAsync = function (scene, data, rootUrl, onProgress) {
             GLTFLoader.prototype.loadAsync = function (scene, data, rootUrl, onProgress) {
                 return this._loadAsync(null, scene, data, rootUrl, onProgress);
                 return this._loadAsync(null, scene, data, rootUrl, onProgress);
             };
             };
@@ -105161,19 +105157,19 @@ var BABYLON;
                 }
                 }
             };
             };
             GLTFLoader.prototype._setupData = function () {
             GLTFLoader.prototype._setupData = function () {
-                GLTF2.ArrayItem.Assign(this._gltf.accessors);
-                GLTF2.ArrayItem.Assign(this._gltf.animations);
-                GLTF2.ArrayItem.Assign(this._gltf.buffers);
-                GLTF2.ArrayItem.Assign(this._gltf.bufferViews);
-                GLTF2.ArrayItem.Assign(this._gltf.cameras);
-                GLTF2.ArrayItem.Assign(this._gltf.images);
-                GLTF2.ArrayItem.Assign(this._gltf.materials);
-                GLTF2.ArrayItem.Assign(this._gltf.meshes);
-                GLTF2.ArrayItem.Assign(this._gltf.nodes);
-                GLTF2.ArrayItem.Assign(this._gltf.samplers);
-                GLTF2.ArrayItem.Assign(this._gltf.scenes);
-                GLTF2.ArrayItem.Assign(this._gltf.skins);
-                GLTF2.ArrayItem.Assign(this._gltf.textures);
+                GLTF2._ArrayItem.Assign(this._gltf.accessors);
+                GLTF2._ArrayItem.Assign(this._gltf.animations);
+                GLTF2._ArrayItem.Assign(this._gltf.buffers);
+                GLTF2._ArrayItem.Assign(this._gltf.bufferViews);
+                GLTF2._ArrayItem.Assign(this._gltf.cameras);
+                GLTF2._ArrayItem.Assign(this._gltf.images);
+                GLTF2._ArrayItem.Assign(this._gltf.materials);
+                GLTF2._ArrayItem.Assign(this._gltf.meshes);
+                GLTF2._ArrayItem.Assign(this._gltf.nodes);
+                GLTF2._ArrayItem.Assign(this._gltf.samplers);
+                GLTF2._ArrayItem.Assign(this._gltf.scenes);
+                GLTF2._ArrayItem.Assign(this._gltf.skins);
+                GLTF2._ArrayItem.Assign(this._gltf.textures);
                 if (this._gltf.nodes) {
                 if (this._gltf.nodes) {
                     var nodeParents = {};
                     var nodeParents = {};
                     for (var _i = 0, _a = this._gltf.nodes; _i < _a.length; _i++) {
                     for (var _i = 0, _a = this._gltf.nodes; _i < _a.length; _i++) {
@@ -105237,9 +105233,7 @@ var BABYLON;
                 promises.push(this._loadAnimationsAsync());
                 promises.push(this._loadAnimationsAsync());
                 return Promise.all(promises).then(function () { });
                 return Promise.all(promises).then(function () { });
             };
             };
-            /**
-            * @ignore
-            */
+            /** @ignore */
             GLTFLoader.prototype._loadSceneAsync = function (context, scene) {
             GLTFLoader.prototype._loadSceneAsync = function (context, scene) {
                 var promise = GLTF2.GLTFLoaderExtension._LoadSceneAsync(this, context, scene);
                 var promise = GLTF2.GLTFLoaderExtension._LoadSceneAsync(this, context, scene);
                 if (promise) {
                 if (promise) {
@@ -105339,9 +105333,7 @@ var BABYLON;
                     }
                     }
                 }
                 }
             };
             };
-            /**
-            * @ignore
-            */
+            /** @ignore */
             GLTFLoader.prototype._loadNodeAsync = function (context, node) {
             GLTFLoader.prototype._loadNodeAsync = function (context, node) {
                 var promise = GLTF2.GLTFLoaderExtension._LoadNodeAsync(this, context, node);
                 var promise = GLTF2.GLTFLoaderExtension._LoadNodeAsync(this, context, node);
                 if (promise) {
                 if (promise) {
@@ -105377,7 +105369,7 @@ var BABYLON;
                 if (!primitives || primitives.length === 0) {
                 if (!primitives || primitives.length === 0) {
                     throw new Error(context + ": Primitives are missing");
                     throw new Error(context + ": Primitives are missing");
                 }
                 }
-                GLTF2.ArrayItem.Assign(primitives);
+                GLTF2._ArrayItem.Assign(primitives);
                 if (primitives.length === 1) {
                 if (primitives.length === 1) {
                     var primitive = primitives[0];
                     var primitive = primitives[0];
                     promises.push(this._loadPrimitiveAsync(context + "/primitives/" + primitive._index, node, mesh, primitive, babylonMesh));
                     promises.push(this._loadPrimitiveAsync(context + "/primitives/" + primitive._index, node, mesh, primitive, babylonMesh));
@@ -105440,7 +105432,7 @@ var BABYLON;
                 }
                 }
                 else {
                 else {
                     var accessor = GLTFLoader._GetProperty(context + "/indices", this._gltf.accessors, primitive.indices);
                     var accessor = GLTFLoader._GetProperty(context + "/indices", this._gltf.accessors, primitive.indices);
-                    promises.push(this._loadAccessorAsync("#/accessors/" + accessor._index, accessor).then(function (data) {
+                    promises.push(this._loadIndicesAccessorAsync("#/accessors/" + accessor._index, accessor).then(function (data) {
                         babylonGeometry.setIndices(data);
                         babylonGeometry.setIndices(data);
                     }));
                     }));
                 }
                 }
@@ -105517,10 +105509,7 @@ var BABYLON;
                         return;
                         return;
                     }
                     }
                     var accessor = GLTFLoader._GetProperty(context + "/" + attribute, _this._gltf.accessors, attributes[attribute]);
                     var accessor = GLTFLoader._GetProperty(context + "/" + attribute, _this._gltf.accessors, attributes[attribute]);
-                    promises.push(_this._loadAccessorAsync("#/accessors/" + accessor._index, accessor).then(function (data) {
-                        if (!(data instanceof Float32Array)) {
-                            throw new Error(context + ": Morph target accessor must have float data");
-                        }
+                    promises.push(_this._loadFloatAccessorAsync("#/accessors/" + accessor._index, accessor).then(function (data) {
                         setData(babylonVertexBuffer, data);
                         setData(babylonVertexBuffer, data);
                     }));
                     }));
                 };
                 };
@@ -105626,9 +105615,7 @@ var BABYLON;
                     return Promise.resolve(null);
                     return Promise.resolve(null);
                 }
                 }
                 var accessor = GLTFLoader._GetProperty(context + "/inverseBindMatrices", this._gltf.accessors, skin.inverseBindMatrices);
                 var accessor = GLTFLoader._GetProperty(context + "/inverseBindMatrices", this._gltf.accessors, skin.inverseBindMatrices);
-                return this._loadAccessorAsync("#/accessors/" + accessor._index, accessor).then(function (data) {
-                    return data;
-                });
+                return this._loadFloatAccessorAsync("#/accessors/" + accessor._index, accessor);
             };
             };
             GLTFLoader.prototype._updateBoneMatrices = function (babylonSkeleton, inverseBindMatricesData) {
             GLTFLoader.prototype._updateBoneMatrices = function (babylonSkeleton, inverseBindMatricesData) {
                 for (var _i = 0, _a = babylonSkeleton.bones; _i < _a.length; _i++) {
                 for (var _i = 0, _a = babylonSkeleton.bones; _i < _a.length; _i++) {
@@ -105668,8 +105655,8 @@ var BABYLON;
                 var babylonAnimationGroup = new BABYLON.AnimationGroup(animation.name || "animation" + animation._index, this._babylonScene);
                 var babylonAnimationGroup = new BABYLON.AnimationGroup(animation.name || "animation" + animation._index, this._babylonScene);
                 animation._babylonAnimationGroup = babylonAnimationGroup;
                 animation._babylonAnimationGroup = babylonAnimationGroup;
                 var promises = new Array();
                 var promises = new Array();
-                GLTF2.ArrayItem.Assign(animation.channels);
-                GLTF2.ArrayItem.Assign(animation.samplers);
+                GLTF2._ArrayItem.Assign(animation.channels);
+                GLTF2._ArrayItem.Assign(animation.samplers);
                 for (var _i = 0, _a = animation.channels; _i < _a.length; _i++) {
                 for (var _i = 0, _a = animation.channels; _i < _a.length; _i++) {
                     var channel = _a[_i];
                     var channel = _a[_i];
                     promises.push(this._loadAnimationChannelAsync(context + "/channels/" + channel._index, context, animation, channel, babylonAnimationGroup));
                     promises.push(this._loadAnimationChannelAsync(context + "/channels/" + channel._index, context, animation, channel, babylonAnimationGroup));
@@ -105838,18 +105825,13 @@ var BABYLON;
                         throw new Error(context + ": Invalid interpolation (" + sampler.interpolation + ")");
                         throw new Error(context + ": Invalid interpolation (" + sampler.interpolation + ")");
                     }
                     }
                 }
                 }
-                var inputData;
-                var outputData;
                 var inputAccessor = GLTFLoader._GetProperty(context + "/input", this._gltf.accessors, sampler.input);
                 var inputAccessor = GLTFLoader._GetProperty(context + "/input", this._gltf.accessors, sampler.input);
                 var outputAccessor = GLTFLoader._GetProperty(context + "/output", this._gltf.accessors, sampler.output);
                 var outputAccessor = GLTFLoader._GetProperty(context + "/output", this._gltf.accessors, sampler.output);
                 sampler._data = Promise.all([
                 sampler._data = Promise.all([
-                    this._loadAccessorAsync("#/accessors/" + inputAccessor._index, inputAccessor).then(function (data) {
-                        inputData = data;
-                    }),
-                    this._loadAccessorAsync("#/accessors/" + outputAccessor._index, outputAccessor).then(function (data) {
-                        outputData = data;
-                    })
-                ]).then(function () {
+                    this._loadFloatAccessorAsync("#/accessors/" + inputAccessor._index, inputAccessor),
+                    this._loadFloatAccessorAsync("#/accessors/" + outputAccessor._index, outputAccessor)
+                ]).then(function (_a) {
+                    var inputData = _a[0], outputData = _a[1];
                     return {
                     return {
                         input: inputData,
                         input: inputData,
                         interpolation: interpolation,
                         interpolation: interpolation,
@@ -105868,9 +105850,7 @@ var BABYLON;
                 buffer._data = this._loadUriAsync(context, buffer.uri);
                 buffer._data = this._loadUriAsync(context, buffer.uri);
                 return buffer._data;
                 return buffer._data;
             };
             };
-            /**
-            * @ignore
-            */
+            /** @ignore */
             GLTFLoader.prototype._loadBufferViewAsync = function (context, bufferView) {
             GLTFLoader.prototype._loadBufferViewAsync = function (context, bufferView) {
                 if (bufferView._data) {
                 if (bufferView._data) {
                     return bufferView._data;
                     return bufferView._data;
@@ -105886,52 +105866,70 @@ var BABYLON;
                 });
                 });
                 return bufferView._data;
                 return bufferView._data;
             };
             };
-            GLTFLoader.prototype._loadAccessorAsync = function (context, accessor) {
-                if (accessor.sparse) {
-                    throw new Error(context + ": Sparse accessors are not currently supported");
+            GLTFLoader.prototype._loadIndicesAccessorAsync = function (context, accessor) {
+                if (accessor.type !== "SCALAR" /* SCALAR */) {
+                    throw new Error(context + ": Invalid type " + accessor.type);
+                }
+                if (accessor.componentType !== 5121 /* UNSIGNED_BYTE */ &&
+                    accessor.componentType !== 5123 /* UNSIGNED_SHORT */ &&
+                    accessor.componentType !== 5125 /* UNSIGNED_INT */) {
+                    throw new Error(context + ": Invalid component type " + accessor.componentType);
                 }
                 }
                 if (accessor._data) {
                 if (accessor._data) {
                     return accessor._data;
                     return accessor._data;
                 }
                 }
                 var bufferView = GLTFLoader._GetProperty(context + "/bufferView", this._gltf.bufferViews, accessor.bufferView);
                 var bufferView = GLTFLoader._GetProperty(context + "/bufferView", this._gltf.bufferViews, accessor.bufferView);
                 accessor._data = this._loadBufferViewAsync("#/bufferViews/" + bufferView._index, bufferView).then(function (data) {
                 accessor._data = this._loadBufferViewAsync("#/bufferViews/" + bufferView._index, bufferView).then(function (data) {
-                    var buffer = data.buffer;
-                    var byteOffset = data.byteOffset + (accessor.byteOffset || 0);
-                    var length = GLTFLoader._GetNumComponents(context, accessor.type) * accessor.count;
-                    try {
-                        switch (accessor.componentType) {
-                            case 5120 /* BYTE */: {
-                                return new Int8Array(buffer, byteOffset, length);
-                            }
-                            case 5121 /* UNSIGNED_BYTE */: {
-                                return new Uint8Array(buffer, byteOffset, length);
-                            }
-                            case 5122 /* SHORT */: {
-                                return new Int16Array(buffer, byteOffset, length);
-                            }
-                            case 5123 /* UNSIGNED_SHORT */: {
-                                return new Uint16Array(buffer, byteOffset, length);
-                            }
-                            case 5125 /* UNSIGNED_INT */: {
-                                return new Uint32Array(buffer, byteOffset, length);
-                            }
-                            case 5126 /* FLOAT */: {
-                                return new Float32Array(buffer, byteOffset, length);
-                            }
-                            default: {
-                                throw new Error(context + ": Invalid accessor component type " + accessor.componentType);
-                            }
-                        }
-                    }
-                    catch (e) {
-                        throw new Error(context + ": " + e);
-                    }
+                    return GLTFLoader._GetTypedArray(context, accessor.componentType, data, accessor.byteOffset, accessor.count);
                 });
                 });
                 return accessor._data;
                 return accessor._data;
             };
             };
-            /**
-            * @ignore
-            */
+            GLTFLoader.prototype._loadFloatAccessorAsync = function (context, accessor) {
+                // TODO: support normalized and stride
+                var _this = this;
+                if (accessor.componentType !== 5126 /* FLOAT */) {
+                    throw new Error("Invalid component type " + accessor.componentType);
+                }
+                if (accessor._data) {
+                    return accessor._data;
+                }
+                var numComponents = GLTFLoader._GetNumComponents(context, accessor.type);
+                var length = numComponents * accessor.count;
+                if (accessor.bufferView == undefined) {
+                    accessor._data = Promise.resolve(new Float32Array(length));
+                }
+                else {
+                    var bufferView = GLTFLoader._GetProperty(context + "/bufferView", this._gltf.bufferViews, accessor.bufferView);
+                    accessor._data = this._loadBufferViewAsync("#/bufferViews/" + bufferView._index, bufferView).then(function (data) {
+                        return GLTFLoader._GetTypedArray(context, accessor.componentType, data, accessor.byteOffset, length);
+                    });
+                }
+                if (accessor.sparse) {
+                    var sparse_1 = accessor.sparse;
+                    accessor._data = accessor._data.then(function (data) {
+                        var indicesBufferView = GLTFLoader._GetProperty(context + "/sparse/indices/bufferView", _this._gltf.bufferViews, sparse_1.indices.bufferView);
+                        var valuesBufferView = GLTFLoader._GetProperty(context + "/sparse/values/bufferView", _this._gltf.bufferViews, sparse_1.values.bufferView);
+                        return Promise.all([
+                            _this._loadBufferViewAsync("#/bufferViews/" + indicesBufferView._index, indicesBufferView),
+                            _this._loadBufferViewAsync("#/bufferViews/" + valuesBufferView._index, valuesBufferView)
+                        ]).then(function (_a) {
+                            var indicesData = _a[0], valuesData = _a[1];
+                            var indices = GLTFLoader._GetTypedArray(context + "/sparse/indices", sparse_1.indices.componentType, indicesData, sparse_1.indices.byteOffset, sparse_1.count);
+                            var values = GLTFLoader._GetTypedArray(context + "/sparse/values", accessor.componentType, valuesData, sparse_1.values.byteOffset, numComponents * sparse_1.count);
+                            var valuesIndex = 0;
+                            for (var indicesIndex = 0; indicesIndex < indices.length; indicesIndex++) {
+                                var dataIndex = indices[indicesIndex] * numComponents;
+                                for (var componentIndex = 0; componentIndex < numComponents; componentIndex++) {
+                                    data[dataIndex++] = values[valuesIndex++];
+                                }
+                            }
+                            return data;
+                        });
+                    });
+                }
+                return accessor._data;
+            };
+            /** @ignore */
             GLTFLoader.prototype._loadVertexBufferViewAsync = function (context, bufferView, kind) {
             GLTFLoader.prototype._loadVertexBufferViewAsync = function (context, bufferView, kind) {
                 var _this = this;
                 var _this = this;
                 if (bufferView._babylonBuffer) {
                 if (bufferView._babylonBuffer) {
@@ -105944,17 +105942,21 @@ var BABYLON;
             };
             };
             GLTFLoader.prototype._loadVertexAccessorAsync = function (context, accessor, kind) {
             GLTFLoader.prototype._loadVertexAccessorAsync = function (context, accessor, kind) {
                 var _this = this;
                 var _this = this;
-                if (accessor.sparse) {
-                    throw new Error(context + ": Sparse accessors are not currently supported");
-                }
                 if (accessor._babylonVertexBuffer) {
                 if (accessor._babylonVertexBuffer) {
                     return accessor._babylonVertexBuffer;
                     return accessor._babylonVertexBuffer;
                 }
                 }
-                var bufferView = GLTFLoader._GetProperty(context + "/bufferView", this._gltf.bufferViews, accessor.bufferView);
-                accessor._babylonVertexBuffer = this._loadVertexBufferViewAsync("#/bufferViews/" + bufferView._index, bufferView, kind).then(function (buffer) {
-                    var size = GLTFLoader._GetNumComponents(context, accessor.type);
-                    return new BABYLON.VertexBuffer(_this._babylonScene.getEngine(), buffer, kind, false, false, bufferView.byteStride, false, accessor.byteOffset, size, accessor.componentType, accessor.normalized, true);
-                });
+                if (accessor.sparse) {
+                    accessor._babylonVertexBuffer = this._loadFloatAccessorAsync(context, accessor).then(function (data) {
+                        return new BABYLON.VertexBuffer(_this._babylonScene.getEngine(), data, kind, false);
+                    });
+                }
+                else {
+                    var bufferView_1 = GLTFLoader._GetProperty(context + "/bufferView", this._gltf.bufferViews, accessor.bufferView);
+                    accessor._babylonVertexBuffer = this._loadVertexBufferViewAsync("#/bufferViews/" + bufferView_1._index, bufferView_1, kind).then(function (buffer) {
+                        var size = GLTFLoader._GetNumComponents(context, accessor.type);
+                        return new BABYLON.VertexBuffer(_this._babylonScene.getEngine(), buffer, kind, false, false, bufferView_1.byteStride, false, accessor.byteOffset, size, accessor.componentType, accessor.normalized, true);
+                    });
+                }
                 return accessor._babylonVertexBuffer;
                 return accessor._babylonVertexBuffer;
             };
             };
             GLTFLoader.prototype._getDefaultMaterial = function (drawMode) {
             GLTFLoader.prototype._getDefaultMaterial = function (drawMode) {
@@ -106001,9 +106003,7 @@ var BABYLON;
                 this._loadMaterialAlphaProperties(context, material, babylonMaterial);
                 this._loadMaterialAlphaProperties(context, material, babylonMaterial);
                 return Promise.all(promises).then(function () { });
                 return Promise.all(promises).then(function () { });
             };
             };
-            /**
-            * @ignore
-            */
+            /** @ignore */
             GLTFLoader.prototype._loadMaterialAsync = function (context, material, babylonMesh, babylonDrawMode, assign) {
             GLTFLoader.prototype._loadMaterialAsync = function (context, material, babylonMesh, babylonDrawMode, assign) {
                 var promise = GLTF2.GLTFLoaderExtension._LoadMaterialAsync(this, context, material, babylonMesh, babylonDrawMode, assign);
                 var promise = GLTF2.GLTFLoaderExtension._LoadMaterialAsync(this, context, material, babylonMesh, babylonDrawMode, assign);
                 if (promise) {
                 if (promise) {
@@ -106029,18 +106029,14 @@ var BABYLON;
                 assign(babylonData.material);
                 assign(babylonData.material);
                 return babylonData.loaded;
                 return babylonData.loaded;
             };
             };
-            /**
-            * @ignore
-            */
+            /** @ignore */
             GLTFLoader.prototype._createMaterial = function (type, name, drawMode) {
             GLTFLoader.prototype._createMaterial = function (type, name, drawMode) {
                 var babylonMaterial = new type(name, this._babylonScene);
                 var babylonMaterial = new type(name, this._babylonScene);
                 babylonMaterial.sideOrientation = this._babylonScene.useRightHandedSystem ? BABYLON.Material.CounterClockWiseSideOrientation : BABYLON.Material.ClockWiseSideOrientation;
                 babylonMaterial.sideOrientation = this._babylonScene.useRightHandedSystem ? BABYLON.Material.CounterClockWiseSideOrientation : BABYLON.Material.ClockWiseSideOrientation;
                 babylonMaterial.fillMode = drawMode;
                 babylonMaterial.fillMode = drawMode;
                 return babylonMaterial;
                 return babylonMaterial;
             };
             };
-            /**
-            * @ignore
-            */
+            /** @ignore */
             GLTFLoader.prototype._loadMaterialBasePropertiesAsync = function (context, material, babylonMaterial) {
             GLTFLoader.prototype._loadMaterialBasePropertiesAsync = function (context, material, babylonMaterial) {
                 var promises = new Array();
                 var promises = new Array();
                 babylonMaterial.emissiveColor = material.emissiveFactor ? BABYLON.Color3.FromArray(material.emissiveFactor) : new BABYLON.Color3(0, 0, 0);
                 babylonMaterial.emissiveColor = material.emissiveFactor ? BABYLON.Color3.FromArray(material.emissiveFactor) : new BABYLON.Color3(0, 0, 0);
@@ -106074,9 +106070,7 @@ var BABYLON;
                 }
                 }
                 return Promise.all(promises).then(function () { });
                 return Promise.all(promises).then(function () { });
             };
             };
-            /**
-            * @ignore
-            */
+            /** @ignore */
             GLTFLoader.prototype._loadMaterialAlphaProperties = function (context, material, babylonMaterial) {
             GLTFLoader.prototype._loadMaterialAlphaProperties = function (context, material, babylonMaterial) {
                 var alphaMode = material.alphaMode || "OPAQUE" /* OPAQUE */;
                 var alphaMode = material.alphaMode || "OPAQUE" /* OPAQUE */;
                 switch (alphaMode) {
                 switch (alphaMode) {
@@ -106105,9 +106099,7 @@ var BABYLON;
                     }
                     }
                 }
                 }
             };
             };
-            /**
-            * @ignore
-            */
+            /** @ignore */
             GLTFLoader.prototype._loadTextureAsync = function (context, textureInfo, assign) {
             GLTFLoader.prototype._loadTextureAsync = function (context, textureInfo, assign) {
                 var _this = this;
                 var _this = this;
                 var texture = GLTFLoader._GetProperty(context + "/index", this._gltf.textures, textureInfo.index);
                 var texture = GLTFLoader._GetProperty(context + "/index", this._gltf.textures, textureInfo.index);
@@ -106167,9 +106159,7 @@ var BABYLON;
                 });
                 });
                 return image._objectURL;
                 return image._objectURL;
             };
             };
-            /**
-            * @ignore
-            */
+            /** @ignore */
             GLTFLoader.prototype._loadUriAsync = function (context, uri) {
             GLTFLoader.prototype._loadUriAsync = function (context, uri) {
                 var _this = this;
                 var _this = this;
                 var promise = GLTF2.GLTFLoaderExtension._LoadUriAsync(this, context, uri);
                 var promise = GLTF2.GLTFLoaderExtension._LoadUriAsync(this, context, uri);
@@ -106227,9 +106217,7 @@ var BABYLON;
                 }
                 }
                 this._progressCallback(new BABYLON.SceneLoaderProgressEvent(lengthComputable, loaded, lengthComputable ? total : 0));
                 this._progressCallback(new BABYLON.SceneLoaderProgressEvent(lengthComputable, loaded, lengthComputable ? total : 0));
             };
             };
-            /**
-            * @ignore
-            */
+            /** @ignore */
             GLTFLoader._GetProperty = function (context, array, index) {
             GLTFLoader._GetProperty = function (context, array, index) {
                 if (!array || index == undefined || !array[index]) {
                 if (!array || index == undefined || !array[index]) {
                     throw new Error(context + ": Failed to find index (" + index + ")");
                     throw new Error(context + ": Failed to find index (" + index + ")");
@@ -106282,6 +106270,24 @@ var BABYLON;
                     }
                     }
                 }
                 }
             };
             };
+            GLTFLoader._GetTypedArray = function (context, componentType, bufferView, byteOffset, length) {
+                var buffer = bufferView.buffer;
+                byteOffset = bufferView.byteOffset + (byteOffset || 0);
+                try {
+                    switch (componentType) {
+                        case 5120 /* BYTE */: return new Int8Array(buffer, byteOffset, length);
+                        case 5121 /* UNSIGNED_BYTE */: return new Uint8Array(buffer, byteOffset, length);
+                        case 5122 /* SHORT */: return new Int16Array(buffer, byteOffset, length);
+                        case 5123 /* UNSIGNED_SHORT */: return new Uint16Array(buffer, byteOffset, length);
+                        case 5125 /* UNSIGNED_INT */: return new Uint32Array(buffer, byteOffset, length);
+                        case 5126 /* FLOAT */: return new Float32Array(buffer, byteOffset, length);
+                        default: throw new Error("Invalid component type " + componentType);
+                    }
+                }
+                catch (e) {
+                    throw new Error(context + ": " + e);
+                }
+            };
             GLTFLoader._GetNumComponents = function (context, type) {
             GLTFLoader._GetNumComponents = function (context, type) {
                 switch (type) {
                 switch (type) {
                     case "SCALAR": return 1;
                     case "SCALAR": return 1;
@@ -106378,9 +106384,7 @@ var BABYLON;
                 this.onTextureLoadedObservable.clear();
                 this.onTextureLoadedObservable.clear();
                 this.onMaterialLoadedObservable.clear();
                 this.onMaterialLoadedObservable.clear();
             };
             };
-            /**
-            * @ignore
-            */
+            /** @ignore */
             GLTFLoader.prototype._applyExtensions = function (actionAsync) {
             GLTFLoader.prototype._applyExtensions = function (actionAsync) {
                 for (var _i = 0, _a = GLTFLoader._Names; _i < _a.length; _i++) {
                 for (var _i = 0, _a = GLTFLoader._Names; _i < _a.length; _i++) {
                     var name_5 = _a[_i];
                     var name_5 = _a[_i];
@@ -106411,7 +106415,7 @@ var BABYLON;
     var GLTF2;
     var GLTF2;
     (function (GLTF2) {
     (function (GLTF2) {
         /**
         /**
-         * Abstract class that can be implemented to extend existing gltf loader behavior.
+         * Abstract class that can be implemented to extend existing glTF loader behavior.
          */
          */
         var GLTFLoaderExtension = /** @class */ (function () {
         var GLTFLoaderExtension = /** @class */ (function () {
             function GLTFLoaderExtension(loader) {
             function GLTFLoaderExtension(loader) {
@@ -106489,8 +106493,10 @@ var BABYLON;
     (function (GLTF2) {
     (function (GLTF2) {
         var Extensions;
         var Extensions;
         (function (Extensions) {
         (function (Extensions) {
-            // https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_lod
             var NAME = "MSFT_lod";
             var NAME = "MSFT_lod";
+            /**
+             * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_lod)
+             */
             var MSFT_lod = /** @class */ (function (_super) {
             var MSFT_lod = /** @class */ (function (_super) {
                 __extends(MSFT_lod, _super);
                 __extends(MSFT_lod, _super);
                 function MSFT_lod() {
                 function MSFT_lod() {
@@ -106644,15 +106650,16 @@ var BABYLON;
 
 
 
 
 
 
-/** Module defining extensions to gltf */
 var BABYLON;
 var BABYLON;
 (function (BABYLON) {
 (function (BABYLON) {
     var GLTF2;
     var GLTF2;
     (function (GLTF2) {
     (function (GLTF2) {
         var Extensions;
         var Extensions;
         (function (Extensions) {
         (function (Extensions) {
-            // https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression
             var NAME = "KHR_draco_mesh_compression";
             var NAME = "KHR_draco_mesh_compression";
+            /**
+             * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression)
+             */
             var KHR_draco_mesh_compression = /** @class */ (function (_super) {
             var KHR_draco_mesh_compression = /** @class */ (function (_super) {
                 __extends(KHR_draco_mesh_compression, _super);
                 __extends(KHR_draco_mesh_compression, _super);
                 function KHR_draco_mesh_compression(loader) {
                 function KHR_draco_mesh_compression(loader) {
@@ -106740,8 +106747,10 @@ var BABYLON;
     (function (GLTF2) {
     (function (GLTF2) {
         var Extensions;
         var Extensions;
         (function (Extensions) {
         (function (Extensions) {
-            // https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness
             var NAME = "KHR_materials_pbrSpecularGlossiness";
             var NAME = "KHR_materials_pbrSpecularGlossiness";
+            /**
+             * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_pbrSpecularGlossiness)
+             */
             var KHR_materials_pbrSpecularGlossiness = /** @class */ (function (_super) {
             var KHR_materials_pbrSpecularGlossiness = /** @class */ (function (_super) {
                 __extends(KHR_materials_pbrSpecularGlossiness, _super);
                 __extends(KHR_materials_pbrSpecularGlossiness, _super);
                 function KHR_materials_pbrSpecularGlossiness() {
                 function KHR_materials_pbrSpecularGlossiness() {
@@ -106817,8 +106826,10 @@ var BABYLON;
     (function (GLTF2) {
     (function (GLTF2) {
         var Extensions;
         var Extensions;
         (function (Extensions) {
         (function (Extensions) {
-            // https://github.com/donmccurdy/glTF/tree/feat-khr-materials-cmnConstant/extensions/2.0/Khronos/KHR_materials_unlit
             var NAME = "KHR_materials_unlit";
             var NAME = "KHR_materials_unlit";
+            /**
+             * [Specification](https://github.com/donmccurdy/glTF/tree/feat-khr-materials-cmnConstant/extensions/2.0/Khronos/KHR_materials_unlit) (Experimental)
+             */
             var KHR_materials_unlit = /** @class */ (function (_super) {
             var KHR_materials_unlit = /** @class */ (function (_super) {
                 __extends(KHR_materials_unlit, _super);
                 __extends(KHR_materials_unlit, _super);
                 function KHR_materials_unlit() {
                 function KHR_materials_unlit() {
@@ -106894,7 +106905,6 @@ var BABYLON;
     (function (GLTF2) {
     (function (GLTF2) {
         var Extensions;
         var Extensions;
         (function (Extensions) {
         (function (Extensions) {
-            // https://github.com/MiiBond/glTF/tree/khr_lights_v1/extensions/Khronos/KHR_lights
             var NAME = "KHR_lights";
             var NAME = "KHR_lights";
             var LightType;
             var LightType;
             (function (LightType) {
             (function (LightType) {
@@ -106903,6 +106913,9 @@ var BABYLON;
                 LightType["POINT"] = "point";
                 LightType["POINT"] = "point";
                 LightType["SPOT"] = "spot";
                 LightType["SPOT"] = "spot";
             })(LightType || (LightType = {}));
             })(LightType || (LightType = {}));
+            /**
+             * [Specification](https://github.com/MiiBond/glTF/tree/khr_lights_v1/extensions/Khronos/KHR_lights) (Experimental)
+             */
             var KHR_lights = /** @class */ (function (_super) {
             var KHR_lights = /** @class */ (function (_super) {
                 __extends(KHR_lights, _super);
                 __extends(KHR_lights, _super);
                 function KHR_lights() {
                 function KHR_lights() {

+ 1 - 2
src/Animations/babylon.animation.ts

@@ -866,8 +866,7 @@
                                 case Animation.ANIMATIONLOOPMODE_CYCLE:
                                 case Animation.ANIMATIONLOOPMODE_CYCLE:
                                 case Animation.ANIMATIONLOOPMODE_CONSTANT:
                                 case Animation.ANIMATIONLOOPMODE_CONSTANT:
                                     if (Animation.AllowMatricesInterpolation) {
                                     if (Animation.AllowMatricesInterpolation) {
-                                        workValue = this.matrixInterpolateFunction(startValue, endValue, gradient, workValue);
-                                        return workValue;
+                                        return this.matrixInterpolateFunction(startValue, endValue, gradient, workValue);
                                     }
                                     }
                                 case Animation.ANIMATIONLOOPMODE_RELATIVE:
                                 case Animation.ANIMATIONLOOPMODE_RELATIVE:
                                     return startValue;
                                     return startValue;

+ 5 - 0
src/Animations/babylon.runtimeAnimation.ts

@@ -203,6 +203,11 @@
          */
          */
         private _interpolate(currentFrame: number, repeatCount: number, loopMode?: number, offsetValue?: any, highLimitValue?: any): any {
         private _interpolate(currentFrame: number, repeatCount: number, loopMode?: number, offsetValue?: any, highLimitValue?: any): any {
             this._currentFrame = currentFrame;
             this._currentFrame = currentFrame;
+
+            if (this._animation.dataType === Animation.ANIMATIONTYPE_MATRIX && !this._workValue) {
+                this._workValue = Matrix.Zero();
+            }
+
             return this._animation._interpolate(currentFrame, repeatCount, this._workValue, loopMode, offsetValue, highLimitValue);
             return this._animation._interpolate(currentFrame, repeatCount, this._workValue, loopMode, offsetValue, highLimitValue);
         }
         }
 
 

+ 0 - 4
src/babylon.scene.ts

@@ -2743,10 +2743,6 @@
                 currentPosition.scaleAndAddToRef(scale, finalPosition);
                 currentPosition.scaleAndAddToRef(scale, finalPosition);
             }  
             }  
             
             
-            if (!originalAnimation._workValue) {
-                originalAnimation._workValue = Matrix.Identity();
-            }
-
             Matrix.ComposeToRef(finalScaling, finalQuaternion, finalPosition, originalAnimation._workValue);
             Matrix.ComposeToRef(finalScaling, finalQuaternion, finalPosition, originalAnimation._workValue);
             return originalAnimation._workValue;
             return originalAnimation._workValue;
         }
         }