Преглед изворни кода

Nightly + physics partially moved to component

David Catuhe пре 7 година
родитељ
комит
2853c14acd
34 измењених фајлова са 7267 додато и 6921 уклоњено
  1. 1757 1540
      Playground/babylon.d.txt
  2. 2 1
      Tools/Gulp/config.json
  3. 3006 2849
      dist/preview release/babylon.d.ts
  4. 1 1
      dist/preview release/babylon.js
  5. 121 69
      dist/preview release/babylon.max.js
  6. 121 69
      dist/preview release/babylon.no-module.max.js
  7. 1 1
      dist/preview release/babylon.worker.js
  8. 121 69
      dist/preview release/es6.js
  9. 1 1
      dist/preview release/inspector/babylon.inspector.bundle.js
  10. 1 1
      dist/preview release/inspector/babylon.inspector.bundle.js.map
  11. 5 2
      dist/preview release/inspector/babylon.inspector.d.ts
  12. 11 4
      dist/preview release/inspector/babylon.inspector.module.d.ts
  13. 30 17
      dist/preview release/loaders/babylon.glTF1FileLoader.d.ts
  14. 117 65
      dist/preview release/loaders/babylon.glTF1FileLoader.js
  15. 1 1
      dist/preview release/loaders/babylon.glTF1FileLoader.min.js
  16. 62 50
      dist/preview release/loaders/babylon.glTF2FileLoader.d.ts
  17. 447 397
      dist/preview release/loaders/babylon.glTF2FileLoader.js
  18. 1 1
      dist/preview release/loaders/babylon.glTF2FileLoader.min.js
  19. 62 50
      dist/preview release/loaders/babylon.glTFFileLoader.d.ts
  20. 447 397
      dist/preview release/loaders/babylon.glTFFileLoader.js
  21. 1 1
      dist/preview release/loaders/babylon.glTFFileLoader.min.js
  22. 62 50
      dist/preview release/loaders/babylonjs.loaders.d.ts
  23. 447 397
      dist/preview release/loaders/babylonjs.loaders.js
  24. 1 1
      dist/preview release/loaders/babylonjs.loaders.min.js
  25. 62 50
      dist/preview release/loaders/babylonjs.loaders.module.d.ts
  26. 49 702
      dist/preview release/typedocValidationBaseline.json
  27. 1 1
      dist/preview release/viewer/babylon.viewer.js
  28. 2 2
      dist/preview release/viewer/babylon.viewer.max.js
  29. 158 0
      src/Physics/babylon.IPhysicsEngine.ts
  30. 66 65
      src/Physics/babylon.physicsEngine.ts
  31. 98 0
      src/Physics/babylon.physicsEngineComponent.ts
  32. 1 1
      src/Physics/babylon.physicsHelper.ts
  33. 1 1
      src/Physics/babylon.physicsImpostor.ts
  34. 3 65
      src/babylon.scene.ts

Разлика између датотеке није приказан због своје велике величине
+ 1757 - 1540
Playground/babylon.d.txt


+ 2 - 1
Tools/Gulp/config.json

@@ -1087,7 +1087,8 @@
                 "../../src/Physics/babylon.physicsEngine.js",
                 "../../src/Physics/babylon.physicsEngine.js",
                 "../../src/Physics/babylon.physicsHelper.js",
                 "../../src/Physics/babylon.physicsHelper.js",
                 "../../src/Physics/Plugins/babylon.cannonJSPlugin.js",
                 "../../src/Physics/Plugins/babylon.cannonJSPlugin.js",
-                "../../src/Physics/Plugins/babylon.oimoJSPlugin.js"
+                "../../src/Physics/Plugins/babylon.oimoJSPlugin.js",
+                "../../src/Physics/babylon.physicsEngineComponent.js"
             ],
             ],
             "dependUpon": [
             "dependUpon": [
                 "core",
                 "core",

Разлика између датотеке није приказан због своје велике величине
+ 3006 - 2849
dist/preview release/babylon.d.ts


Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
dist/preview release/babylon.js


+ 121 - 69
dist/preview release/babylon.max.js

@@ -27804,7 +27804,7 @@ var BABYLON;
                     // Physics
                     // Physics
                     if (this._physicsEngine) {
                     if (this._physicsEngine) {
                         this.onBeforePhysicsObservable.notifyObservers(this);
                         this.onBeforePhysicsObservable.notifyObservers(this);
-                        this._physicsEngine._step(defaultFrameTime / 1000);
+                        this._physicsEngine.step(defaultFrameTime / 1000);
                         this.onAfterPhysicsObservable.notifyObservers(this);
                         this.onAfterPhysicsObservable.notifyObservers(this);
                     }
                     }
                     this.onAfterStepObservable.notifyObservers(this);
                     this.onAfterStepObservable.notifyObservers(this);
@@ -27823,7 +27823,7 @@ var BABYLON;
                 // Physics
                 // Physics
                 if (this._physicsEngine) {
                 if (this._physicsEngine) {
                     this.onBeforePhysicsObservable.notifyObservers(this);
                     this.onBeforePhysicsObservable.notifyObservers(this);
-                    this._physicsEngine._step(deltaTime / 1000.0);
+                    this._physicsEngine.step(deltaTime / 1000.0);
                     this.onAfterPhysicsObservable.notifyObservers(this);
                     this.onAfterPhysicsObservable.notifyObservers(this);
                 }
                 }
             }
             }
@@ -28552,61 +28552,6 @@ var BABYLON;
             return this._pointerOverMesh;
             return this._pointerOverMesh;
         };
         };
         // Physics
         // Physics
-        /**
-         * Gets the current physics engine
-         * @returns a PhysicsEngine or null if none attached
-         */
-        Scene.prototype.getPhysicsEngine = function () {
-            return this._physicsEngine;
-        };
-        /**
-         * Enables physics to the current scene
-         * @param gravity defines the scene's gravity for the physics engine
-         * @param plugin defines the physics engine to be used. defaults to OimoJS.
-         * @return a boolean indicating if the physics engine was initialized
-         */
-        Scene.prototype.enablePhysics = function (gravity, plugin) {
-            if (gravity === void 0) { gravity = null; }
-            if (this._physicsEngine) {
-                return true;
-            }
-            try {
-                this._physicsEngine = new BABYLON.PhysicsEngine(gravity, plugin);
-                return true;
-            }
-            catch (e) {
-                BABYLON.Tools.Error(e.message);
-                return false;
-            }
-        };
-        /**
-         * Disables and disposes the physics engine associated with the scene
-         */
-        Scene.prototype.disablePhysicsEngine = function () {
-            if (!this._physicsEngine) {
-                return;
-            }
-            this._physicsEngine.dispose();
-            this._physicsEngine = null;
-        };
-        /**
-         * Gets a boolean indicating if there is an active physics engine
-         * @returns a boolean indicating if there is an active physics engine
-         */
-        Scene.prototype.isPhysicsEnabled = function () {
-            return this._physicsEngine !== undefined;
-        };
-        /**
-         * Deletes a physics compound impostor
-         * @param compound defines the compound to delete
-         */
-        Scene.prototype.deleteCompoundImpostor = function (compound) {
-            var mesh = compound.parts[0].mesh;
-            if (mesh.physicsImpostor) {
-                mesh.physicsImpostor.dispose( /*true*/);
-                mesh.physicsImpostor = null;
-            }
-        };
         // Misc.
         // Misc.
         /** @hidden */
         /** @hidden */
         Scene.prototype._rebuildGeometries = function () {
         Scene.prototype._rebuildGeometries = function () {
@@ -89685,11 +89630,19 @@ var BABYLON;
 
 
 var BABYLON;
 var BABYLON;
 (function (BABYLON) {
 (function (BABYLON) {
+    /**
+     * Class used to control physics engine
+     * @see http://doc.babylonjs.com/how_to/using_the_physics_engine
+     */
     var PhysicsEngine = /** @class */ (function () {
     var PhysicsEngine = /** @class */ (function () {
+        /**
+         * Creates a new Physics Engine
+         * @param gravity defines the gravity vector used by the simulation
+         * @param _physicsPlugin defines the plugin to use (CannonJS by default)
+         */
         function PhysicsEngine(gravity, _physicsPlugin) {
         function PhysicsEngine(gravity, _physicsPlugin) {
             if (_physicsPlugin === void 0) { _physicsPlugin = new BABYLON.CannonJSPlugin(); }
             if (_physicsPlugin === void 0) { _physicsPlugin = new BABYLON.CannonJSPlugin(); }
             this._physicsPlugin = _physicsPlugin;
             this._physicsPlugin = _physicsPlugin;
-            //new methods and parameters
             this._impostors = [];
             this._impostors = [];
             this._joints = [];
             this._joints = [];
             if (!this._physicsPlugin.isSupported()) {
             if (!this._physicsPlugin.isSupported()) {
@@ -89700,16 +89653,20 @@ var BABYLON;
             this.setGravity(gravity);
             this.setGravity(gravity);
             this.setTimeStep();
             this.setTimeStep();
         }
         }
+        /**
+         * Sets the gravity vector used by the simulation
+         * @param gravity defines the gravity vector to use
+         */
         PhysicsEngine.prototype.setGravity = function (gravity) {
         PhysicsEngine.prototype.setGravity = function (gravity) {
             this.gravity = gravity;
             this.gravity = gravity;
             this._physicsPlugin.setGravity(this.gravity);
             this._physicsPlugin.setGravity(this.gravity);
         };
         };
         /**
         /**
          * Set the time step of the physics engine.
          * Set the time step of the physics engine.
-         * default is 1/60.
+         * Default is 1/60.
          * To slow it down, enter 1/600 for example.
          * To slow it down, enter 1/600 for example.
          * To speed it up, 1/30
          * To speed it up, 1/30
-         * @param {number} newTimeStep the new timestep to apply to this world.
+         * @param newTimeStep defines the new timestep to apply to this world.
          */
          */
         PhysicsEngine.prototype.setTimeStep = function (newTimeStep) {
         PhysicsEngine.prototype.setTimeStep = function (newTimeStep) {
             if (newTimeStep === void 0) { newTimeStep = 1 / 60; }
             if (newTimeStep === void 0) { newTimeStep = 1 / 60; }
@@ -89717,23 +89674,31 @@ var BABYLON;
         };
         };
         /**
         /**
          * Get the time step of the physics engine.
          * Get the time step of the physics engine.
+         * @returns the current time step
          */
          */
         PhysicsEngine.prototype.getTimeStep = function () {
         PhysicsEngine.prototype.getTimeStep = function () {
             return this._physicsPlugin.getTimeStep();
             return this._physicsPlugin.getTimeStep();
         };
         };
+        /**
+         * Release all resources
+         */
         PhysicsEngine.prototype.dispose = function () {
         PhysicsEngine.prototype.dispose = function () {
             this._impostors.forEach(function (impostor) {
             this._impostors.forEach(function (impostor) {
                 impostor.dispose();
                 impostor.dispose();
             });
             });
             this._physicsPlugin.dispose();
             this._physicsPlugin.dispose();
         };
         };
+        /**
+         * Gets the name of the current physics plugin
+         * @returns the name of the plugin
+         */
         PhysicsEngine.prototype.getPhysicsPluginName = function () {
         PhysicsEngine.prototype.getPhysicsPluginName = function () {
             return this._physicsPlugin.name;
             return this._physicsPlugin.name;
         };
         };
         /**
         /**
          * Adding a new impostor for the impostor tracking.
          * Adding a new impostor for the impostor tracking.
          * This will be done by the impostor itself.
          * This will be done by the impostor itself.
-         * @param {PhysicsImpostor} impostor the impostor to add
+         * @param impostor the impostor to add
          */
          */
         PhysicsEngine.prototype.addImpostor = function (impostor) {
         PhysicsEngine.prototype.addImpostor = function (impostor) {
             impostor.uniqueId = this._impostors.push(impostor);
             impostor.uniqueId = this._impostors.push(impostor);
@@ -89745,7 +89710,7 @@ var BABYLON;
         /**
         /**
          * Remove an impostor from the engine.
          * Remove an impostor from the engine.
          * This impostor and its mesh will not longer be updated by the physics engine.
          * This impostor and its mesh will not longer be updated by the physics engine.
-         * @param {PhysicsImpostor} impostor the impostor to remove
+         * @param impostor the impostor to remove
          */
          */
         PhysicsEngine.prototype.removeImpostor = function (impostor) {
         PhysicsEngine.prototype.removeImpostor = function (impostor) {
             var index = this._impostors.indexOf(impostor);
             var index = this._impostors.indexOf(impostor);
@@ -89760,9 +89725,9 @@ var BABYLON;
         };
         };
         /**
         /**
          * Add a joint to the physics engine
          * Add a joint to the physics engine
-         * @param {PhysicsImpostor} mainImpostor the main impostor to which the joint is added.
-         * @param {PhysicsImpostor} connectedImpostor the impostor that is connected to the main impostor using this joint
-         * @param {PhysicsJoint} the joint that will connect both impostors.
+         * @param mainImpostor defines the main impostor to which the joint is added.
+         * @param connectedImpostor defines the impostor that is connected to the main impostor using this joint
+         * @param joint defines the joint that will connect both impostors.
          */
          */
         PhysicsEngine.prototype.addJoint = function (mainImpostor, connectedImpostor, joint) {
         PhysicsEngine.prototype.addJoint = function (mainImpostor, connectedImpostor, joint) {
             var impostorJoint = {
             var impostorJoint = {
@@ -89774,6 +89739,12 @@ var BABYLON;
             this._joints.push(impostorJoint);
             this._joints.push(impostorJoint);
             this._physicsPlugin.generateJoint(impostorJoint);
             this._physicsPlugin.generateJoint(impostorJoint);
         };
         };
+        /**
+         * Removes a joint from the simulation
+         * @param mainImpostor defines the impostor used with the joint
+         * @param connectedImpostor defines the other impostor connected to the main one by the joint
+         * @param joint defines the joint to remove
+         */
         PhysicsEngine.prototype.removeJoint = function (mainImpostor, connectedImpostor, joint) {
         PhysicsEngine.prototype.removeJoint = function (mainImpostor, connectedImpostor, joint) {
             var matchingJoints = this._joints.filter(function (impostorJoint) {
             var matchingJoints = this._joints.filter(function (impostorJoint) {
                 return (impostorJoint.connectedImpostor === connectedImpostor
                 return (impostorJoint.connectedImpostor === connectedImpostor
@@ -89786,10 +89757,10 @@ var BABYLON;
             }
             }
         };
         };
         /**
         /**
-         * Called by the scene. no need to call it.
-         * @hidden
+         * Called by the scene. No need to call it.
+         * @param delta defines the timespam between frames
          */
          */
-        PhysicsEngine.prototype._step = function (delta) {
+        PhysicsEngine.prototype.step = function (delta) {
             var _this = this;
             var _this = this;
             //check if any mesh has no body / requires an update
             //check if any mesh has no body / requires an update
             this._impostors.forEach(function (impostor) {
             this._impostors.forEach(function (impostor) {
@@ -89805,12 +89776,25 @@ var BABYLON;
             }
             }
             this._physicsPlugin.executeStep(delta, this._impostors);
             this._physicsPlugin.executeStep(delta, this._impostors);
         };
         };
+        /**
+         * Gets the current plugin used to run the simulation
+         * @returns current plugin
+         */
         PhysicsEngine.prototype.getPhysicsPlugin = function () {
         PhysicsEngine.prototype.getPhysicsPlugin = function () {
             return this._physicsPlugin;
             return this._physicsPlugin;
         };
         };
+        /**
+         * Gets the list of physic impostors
+         * @returns an array of PhysicsImpostor
+         */
         PhysicsEngine.prototype.getImpostors = function () {
         PhysicsEngine.prototype.getImpostors = function () {
             return this._impostors;
             return this._impostors;
         };
         };
+        /**
+         * Gets the impostor for a physics enabled object
+         * @param object defines the object impersonated by the impostor
+         * @returns the PhysicsImpostor or null if not found
+         */
         PhysicsEngine.prototype.getImpostorForPhysicsObject = function (object) {
         PhysicsEngine.prototype.getImpostorForPhysicsObject = function (object) {
             for (var i = 0; i < this._impostors.length; ++i) {
             for (var i = 0; i < this._impostors.length; ++i) {
                 if (this._impostors[i].object === object) {
                 if (this._impostors[i].object === object) {
@@ -89819,6 +89803,11 @@ var BABYLON;
             }
             }
             return null;
             return null;
         };
         };
+        /**
+         * Gets the impostor for a physics body object
+         * @param body defines physics body used by the impostor
+         * @returns the PhysicsImpostor or null if not found
+         */
         PhysicsEngine.prototype.getImpostorWithPhysicsBody = function (body) {
         PhysicsEngine.prototype.getImpostorWithPhysicsBody = function (body) {
             for (var i = 0; i < this._impostors.length; ++i) {
             for (var i = 0; i < this._impostors.length; ++i) {
                 if (this._impostors[i].physicsBody === body) {
                 if (this._impostors[i].physicsBody === body) {
@@ -89827,7 +89816,9 @@ var BABYLON;
             }
             }
             return null;
             return null;
         };
         };
-        // Statics
+        /**
+         * Global value used to control the smallest number supported by the simulation
+         */
         PhysicsEngine.Epsilon = 0.001;
         PhysicsEngine.Epsilon = 0.001;
         return PhysicsEngine;
         return PhysicsEngine;
     }());
     }());
@@ -91353,6 +91344,67 @@ var BABYLON;
 
 
 var BABYLON;
 var BABYLON;
 (function (BABYLON) {
 (function (BABYLON) {
+    /**
+     * Gets the current physics engine
+     * @returns a IPhysicsEngine or null if none attached
+     */
+    BABYLON.Scene.prototype.getPhysicsEngine = function () {
+        return this._physicsEngine;
+    };
+    /**
+     * Enables physics to the current scene
+     * @param gravity defines the scene's gravity for the physics engine
+     * @param plugin defines the physics engine to be used. defaults to OimoJS.
+     * @return a boolean indicating if the physics engine was initialized
+     */
+    BABYLON.Scene.prototype.enablePhysics = function (gravity, plugin) {
+        if (gravity === void 0) { gravity = null; }
+        if (this._physicsEngine) {
+            return true;
+        }
+        try {
+            this._physicsEngine = new BABYLON.PhysicsEngine(gravity, plugin);
+            return true;
+        }
+        catch (e) {
+            BABYLON.Tools.Error(e.message);
+            return false;
+        }
+    };
+    /**
+     * Disables and disposes the physics engine associated with the scene
+     */
+    BABYLON.Scene.prototype.disablePhysicsEngine = function () {
+        if (!this._physicsEngine) {
+            return;
+        }
+        this._physicsEngine.dispose();
+        this._physicsEngine = null;
+    };
+    /**
+     * Gets a boolean indicating if there is an active physics engine
+     * @returns a boolean indicating if there is an active physics engine
+     */
+    BABYLON.Scene.prototype.isPhysicsEnabled = function () {
+        return this._physicsEngine !== undefined;
+    };
+    /**
+     * Deletes a physics compound impostor
+     * @param compound defines the compound to delete
+     */
+    BABYLON.Scene.prototype.deleteCompoundImpostor = function (compound) {
+        var mesh = compound.parts[0].mesh;
+        if (mesh.physicsImpostor) {
+            mesh.physicsImpostor.dispose( /*true*/);
+            mesh.physicsImpostor = null;
+        }
+    };
+})(BABYLON || (BABYLON = {}));
+
+//# sourceMappingURL=babylon.physicsEngineComponent.js.map
+
+var BABYLON;
+(function (BABYLON) {
     // Based on demo done by Brandon Jones - http://media.tojicode.com/webgl-samples/dds.html
     // Based on demo done by Brandon Jones - http://media.tojicode.com/webgl-samples/dds.html
     // All values and structures referenced from:
     // All values and structures referenced from:
     // http://msdn.microsoft.com/en-us/library/bb943991.aspx/
     // http://msdn.microsoft.com/en-us/library/bb943991.aspx/

+ 121 - 69
dist/preview release/babylon.no-module.max.js

@@ -27771,7 +27771,7 @@ var BABYLON;
                     // Physics
                     // Physics
                     if (this._physicsEngine) {
                     if (this._physicsEngine) {
                         this.onBeforePhysicsObservable.notifyObservers(this);
                         this.onBeforePhysicsObservable.notifyObservers(this);
-                        this._physicsEngine._step(defaultFrameTime / 1000);
+                        this._physicsEngine.step(defaultFrameTime / 1000);
                         this.onAfterPhysicsObservable.notifyObservers(this);
                         this.onAfterPhysicsObservable.notifyObservers(this);
                     }
                     }
                     this.onAfterStepObservable.notifyObservers(this);
                     this.onAfterStepObservable.notifyObservers(this);
@@ -27790,7 +27790,7 @@ var BABYLON;
                 // Physics
                 // Physics
                 if (this._physicsEngine) {
                 if (this._physicsEngine) {
                     this.onBeforePhysicsObservable.notifyObservers(this);
                     this.onBeforePhysicsObservable.notifyObservers(this);
-                    this._physicsEngine._step(deltaTime / 1000.0);
+                    this._physicsEngine.step(deltaTime / 1000.0);
                     this.onAfterPhysicsObservable.notifyObservers(this);
                     this.onAfterPhysicsObservable.notifyObservers(this);
                 }
                 }
             }
             }
@@ -28519,61 +28519,6 @@ var BABYLON;
             return this._pointerOverMesh;
             return this._pointerOverMesh;
         };
         };
         // Physics
         // Physics
-        /**
-         * Gets the current physics engine
-         * @returns a PhysicsEngine or null if none attached
-         */
-        Scene.prototype.getPhysicsEngine = function () {
-            return this._physicsEngine;
-        };
-        /**
-         * Enables physics to the current scene
-         * @param gravity defines the scene's gravity for the physics engine
-         * @param plugin defines the physics engine to be used. defaults to OimoJS.
-         * @return a boolean indicating if the physics engine was initialized
-         */
-        Scene.prototype.enablePhysics = function (gravity, plugin) {
-            if (gravity === void 0) { gravity = null; }
-            if (this._physicsEngine) {
-                return true;
-            }
-            try {
-                this._physicsEngine = new BABYLON.PhysicsEngine(gravity, plugin);
-                return true;
-            }
-            catch (e) {
-                BABYLON.Tools.Error(e.message);
-                return false;
-            }
-        };
-        /**
-         * Disables and disposes the physics engine associated with the scene
-         */
-        Scene.prototype.disablePhysicsEngine = function () {
-            if (!this._physicsEngine) {
-                return;
-            }
-            this._physicsEngine.dispose();
-            this._physicsEngine = null;
-        };
-        /**
-         * Gets a boolean indicating if there is an active physics engine
-         * @returns a boolean indicating if there is an active physics engine
-         */
-        Scene.prototype.isPhysicsEnabled = function () {
-            return this._physicsEngine !== undefined;
-        };
-        /**
-         * Deletes a physics compound impostor
-         * @param compound defines the compound to delete
-         */
-        Scene.prototype.deleteCompoundImpostor = function (compound) {
-            var mesh = compound.parts[0].mesh;
-            if (mesh.physicsImpostor) {
-                mesh.physicsImpostor.dispose( /*true*/);
-                mesh.physicsImpostor = null;
-            }
-        };
         // Misc.
         // Misc.
         /** @hidden */
         /** @hidden */
         Scene.prototype._rebuildGeometries = function () {
         Scene.prototype._rebuildGeometries = function () {
@@ -89652,11 +89597,19 @@ var BABYLON;
 
 
 var BABYLON;
 var BABYLON;
 (function (BABYLON) {
 (function (BABYLON) {
+    /**
+     * Class used to control physics engine
+     * @see http://doc.babylonjs.com/how_to/using_the_physics_engine
+     */
     var PhysicsEngine = /** @class */ (function () {
     var PhysicsEngine = /** @class */ (function () {
+        /**
+         * Creates a new Physics Engine
+         * @param gravity defines the gravity vector used by the simulation
+         * @param _physicsPlugin defines the plugin to use (CannonJS by default)
+         */
         function PhysicsEngine(gravity, _physicsPlugin) {
         function PhysicsEngine(gravity, _physicsPlugin) {
             if (_physicsPlugin === void 0) { _physicsPlugin = new BABYLON.CannonJSPlugin(); }
             if (_physicsPlugin === void 0) { _physicsPlugin = new BABYLON.CannonJSPlugin(); }
             this._physicsPlugin = _physicsPlugin;
             this._physicsPlugin = _physicsPlugin;
-            //new methods and parameters
             this._impostors = [];
             this._impostors = [];
             this._joints = [];
             this._joints = [];
             if (!this._physicsPlugin.isSupported()) {
             if (!this._physicsPlugin.isSupported()) {
@@ -89667,16 +89620,20 @@ var BABYLON;
             this.setGravity(gravity);
             this.setGravity(gravity);
             this.setTimeStep();
             this.setTimeStep();
         }
         }
+        /**
+         * Sets the gravity vector used by the simulation
+         * @param gravity defines the gravity vector to use
+         */
         PhysicsEngine.prototype.setGravity = function (gravity) {
         PhysicsEngine.prototype.setGravity = function (gravity) {
             this.gravity = gravity;
             this.gravity = gravity;
             this._physicsPlugin.setGravity(this.gravity);
             this._physicsPlugin.setGravity(this.gravity);
         };
         };
         /**
         /**
          * Set the time step of the physics engine.
          * Set the time step of the physics engine.
-         * default is 1/60.
+         * Default is 1/60.
          * To slow it down, enter 1/600 for example.
          * To slow it down, enter 1/600 for example.
          * To speed it up, 1/30
          * To speed it up, 1/30
-         * @param {number} newTimeStep the new timestep to apply to this world.
+         * @param newTimeStep defines the new timestep to apply to this world.
          */
          */
         PhysicsEngine.prototype.setTimeStep = function (newTimeStep) {
         PhysicsEngine.prototype.setTimeStep = function (newTimeStep) {
             if (newTimeStep === void 0) { newTimeStep = 1 / 60; }
             if (newTimeStep === void 0) { newTimeStep = 1 / 60; }
@@ -89684,23 +89641,31 @@ var BABYLON;
         };
         };
         /**
         /**
          * Get the time step of the physics engine.
          * Get the time step of the physics engine.
+         * @returns the current time step
          */
          */
         PhysicsEngine.prototype.getTimeStep = function () {
         PhysicsEngine.prototype.getTimeStep = function () {
             return this._physicsPlugin.getTimeStep();
             return this._physicsPlugin.getTimeStep();
         };
         };
+        /**
+         * Release all resources
+         */
         PhysicsEngine.prototype.dispose = function () {
         PhysicsEngine.prototype.dispose = function () {
             this._impostors.forEach(function (impostor) {
             this._impostors.forEach(function (impostor) {
                 impostor.dispose();
                 impostor.dispose();
             });
             });
             this._physicsPlugin.dispose();
             this._physicsPlugin.dispose();
         };
         };
+        /**
+         * Gets the name of the current physics plugin
+         * @returns the name of the plugin
+         */
         PhysicsEngine.prototype.getPhysicsPluginName = function () {
         PhysicsEngine.prototype.getPhysicsPluginName = function () {
             return this._physicsPlugin.name;
             return this._physicsPlugin.name;
         };
         };
         /**
         /**
          * Adding a new impostor for the impostor tracking.
          * Adding a new impostor for the impostor tracking.
          * This will be done by the impostor itself.
          * This will be done by the impostor itself.
-         * @param {PhysicsImpostor} impostor the impostor to add
+         * @param impostor the impostor to add
          */
          */
         PhysicsEngine.prototype.addImpostor = function (impostor) {
         PhysicsEngine.prototype.addImpostor = function (impostor) {
             impostor.uniqueId = this._impostors.push(impostor);
             impostor.uniqueId = this._impostors.push(impostor);
@@ -89712,7 +89677,7 @@ var BABYLON;
         /**
         /**
          * Remove an impostor from the engine.
          * Remove an impostor from the engine.
          * This impostor and its mesh will not longer be updated by the physics engine.
          * This impostor and its mesh will not longer be updated by the physics engine.
-         * @param {PhysicsImpostor} impostor the impostor to remove
+         * @param impostor the impostor to remove
          */
          */
         PhysicsEngine.prototype.removeImpostor = function (impostor) {
         PhysicsEngine.prototype.removeImpostor = function (impostor) {
             var index = this._impostors.indexOf(impostor);
             var index = this._impostors.indexOf(impostor);
@@ -89727,9 +89692,9 @@ var BABYLON;
         };
         };
         /**
         /**
          * Add a joint to the physics engine
          * Add a joint to the physics engine
-         * @param {PhysicsImpostor} mainImpostor the main impostor to which the joint is added.
-         * @param {PhysicsImpostor} connectedImpostor the impostor that is connected to the main impostor using this joint
-         * @param {PhysicsJoint} the joint that will connect both impostors.
+         * @param mainImpostor defines the main impostor to which the joint is added.
+         * @param connectedImpostor defines the impostor that is connected to the main impostor using this joint
+         * @param joint defines the joint that will connect both impostors.
          */
          */
         PhysicsEngine.prototype.addJoint = function (mainImpostor, connectedImpostor, joint) {
         PhysicsEngine.prototype.addJoint = function (mainImpostor, connectedImpostor, joint) {
             var impostorJoint = {
             var impostorJoint = {
@@ -89741,6 +89706,12 @@ var BABYLON;
             this._joints.push(impostorJoint);
             this._joints.push(impostorJoint);
             this._physicsPlugin.generateJoint(impostorJoint);
             this._physicsPlugin.generateJoint(impostorJoint);
         };
         };
+        /**
+         * Removes a joint from the simulation
+         * @param mainImpostor defines the impostor used with the joint
+         * @param connectedImpostor defines the other impostor connected to the main one by the joint
+         * @param joint defines the joint to remove
+         */
         PhysicsEngine.prototype.removeJoint = function (mainImpostor, connectedImpostor, joint) {
         PhysicsEngine.prototype.removeJoint = function (mainImpostor, connectedImpostor, joint) {
             var matchingJoints = this._joints.filter(function (impostorJoint) {
             var matchingJoints = this._joints.filter(function (impostorJoint) {
                 return (impostorJoint.connectedImpostor === connectedImpostor
                 return (impostorJoint.connectedImpostor === connectedImpostor
@@ -89753,10 +89724,10 @@ var BABYLON;
             }
             }
         };
         };
         /**
         /**
-         * Called by the scene. no need to call it.
-         * @hidden
+         * Called by the scene. No need to call it.
+         * @param delta defines the timespam between frames
          */
          */
-        PhysicsEngine.prototype._step = function (delta) {
+        PhysicsEngine.prototype.step = function (delta) {
             var _this = this;
             var _this = this;
             //check if any mesh has no body / requires an update
             //check if any mesh has no body / requires an update
             this._impostors.forEach(function (impostor) {
             this._impostors.forEach(function (impostor) {
@@ -89772,12 +89743,25 @@ var BABYLON;
             }
             }
             this._physicsPlugin.executeStep(delta, this._impostors);
             this._physicsPlugin.executeStep(delta, this._impostors);
         };
         };
+        /**
+         * Gets the current plugin used to run the simulation
+         * @returns current plugin
+         */
         PhysicsEngine.prototype.getPhysicsPlugin = function () {
         PhysicsEngine.prototype.getPhysicsPlugin = function () {
             return this._physicsPlugin;
             return this._physicsPlugin;
         };
         };
+        /**
+         * Gets the list of physic impostors
+         * @returns an array of PhysicsImpostor
+         */
         PhysicsEngine.prototype.getImpostors = function () {
         PhysicsEngine.prototype.getImpostors = function () {
             return this._impostors;
             return this._impostors;
         };
         };
+        /**
+         * Gets the impostor for a physics enabled object
+         * @param object defines the object impersonated by the impostor
+         * @returns the PhysicsImpostor or null if not found
+         */
         PhysicsEngine.prototype.getImpostorForPhysicsObject = function (object) {
         PhysicsEngine.prototype.getImpostorForPhysicsObject = function (object) {
             for (var i = 0; i < this._impostors.length; ++i) {
             for (var i = 0; i < this._impostors.length; ++i) {
                 if (this._impostors[i].object === object) {
                 if (this._impostors[i].object === object) {
@@ -89786,6 +89770,11 @@ var BABYLON;
             }
             }
             return null;
             return null;
         };
         };
+        /**
+         * Gets the impostor for a physics body object
+         * @param body defines physics body used by the impostor
+         * @returns the PhysicsImpostor or null if not found
+         */
         PhysicsEngine.prototype.getImpostorWithPhysicsBody = function (body) {
         PhysicsEngine.prototype.getImpostorWithPhysicsBody = function (body) {
             for (var i = 0; i < this._impostors.length; ++i) {
             for (var i = 0; i < this._impostors.length; ++i) {
                 if (this._impostors[i].physicsBody === body) {
                 if (this._impostors[i].physicsBody === body) {
@@ -89794,7 +89783,9 @@ var BABYLON;
             }
             }
             return null;
             return null;
         };
         };
-        // Statics
+        /**
+         * Global value used to control the smallest number supported by the simulation
+         */
         PhysicsEngine.Epsilon = 0.001;
         PhysicsEngine.Epsilon = 0.001;
         return PhysicsEngine;
         return PhysicsEngine;
     }());
     }());
@@ -91320,6 +91311,67 @@ var BABYLON;
 
 
 var BABYLON;
 var BABYLON;
 (function (BABYLON) {
 (function (BABYLON) {
+    /**
+     * Gets the current physics engine
+     * @returns a IPhysicsEngine or null if none attached
+     */
+    BABYLON.Scene.prototype.getPhysicsEngine = function () {
+        return this._physicsEngine;
+    };
+    /**
+     * Enables physics to the current scene
+     * @param gravity defines the scene's gravity for the physics engine
+     * @param plugin defines the physics engine to be used. defaults to OimoJS.
+     * @return a boolean indicating if the physics engine was initialized
+     */
+    BABYLON.Scene.prototype.enablePhysics = function (gravity, plugin) {
+        if (gravity === void 0) { gravity = null; }
+        if (this._physicsEngine) {
+            return true;
+        }
+        try {
+            this._physicsEngine = new BABYLON.PhysicsEngine(gravity, plugin);
+            return true;
+        }
+        catch (e) {
+            BABYLON.Tools.Error(e.message);
+            return false;
+        }
+    };
+    /**
+     * Disables and disposes the physics engine associated with the scene
+     */
+    BABYLON.Scene.prototype.disablePhysicsEngine = function () {
+        if (!this._physicsEngine) {
+            return;
+        }
+        this._physicsEngine.dispose();
+        this._physicsEngine = null;
+    };
+    /**
+     * Gets a boolean indicating if there is an active physics engine
+     * @returns a boolean indicating if there is an active physics engine
+     */
+    BABYLON.Scene.prototype.isPhysicsEnabled = function () {
+        return this._physicsEngine !== undefined;
+    };
+    /**
+     * Deletes a physics compound impostor
+     * @param compound defines the compound to delete
+     */
+    BABYLON.Scene.prototype.deleteCompoundImpostor = function (compound) {
+        var mesh = compound.parts[0].mesh;
+        if (mesh.physicsImpostor) {
+            mesh.physicsImpostor.dispose( /*true*/);
+            mesh.physicsImpostor = null;
+        }
+    };
+})(BABYLON || (BABYLON = {}));
+
+//# sourceMappingURL=babylon.physicsEngineComponent.js.map
+
+var BABYLON;
+(function (BABYLON) {
     // Based on demo done by Brandon Jones - http://media.tojicode.com/webgl-samples/dds.html
     // Based on demo done by Brandon Jones - http://media.tojicode.com/webgl-samples/dds.html
     // All values and structures referenced from:
     // All values and structures referenced from:
     // http://msdn.microsoft.com/en-us/library/bb943991.aspx/
     // http://msdn.microsoft.com/en-us/library/bb943991.aspx/

Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
dist/preview release/babylon.worker.js


+ 121 - 69
dist/preview release/es6.js

@@ -27771,7 +27771,7 @@ var BABYLON;
                     // Physics
                     // Physics
                     if (this._physicsEngine) {
                     if (this._physicsEngine) {
                         this.onBeforePhysicsObservable.notifyObservers(this);
                         this.onBeforePhysicsObservable.notifyObservers(this);
-                        this._physicsEngine._step(defaultFrameTime / 1000);
+                        this._physicsEngine.step(defaultFrameTime / 1000);
                         this.onAfterPhysicsObservable.notifyObservers(this);
                         this.onAfterPhysicsObservable.notifyObservers(this);
                     }
                     }
                     this.onAfterStepObservable.notifyObservers(this);
                     this.onAfterStepObservable.notifyObservers(this);
@@ -27790,7 +27790,7 @@ var BABYLON;
                 // Physics
                 // Physics
                 if (this._physicsEngine) {
                 if (this._physicsEngine) {
                     this.onBeforePhysicsObservable.notifyObservers(this);
                     this.onBeforePhysicsObservable.notifyObservers(this);
-                    this._physicsEngine._step(deltaTime / 1000.0);
+                    this._physicsEngine.step(deltaTime / 1000.0);
                     this.onAfterPhysicsObservable.notifyObservers(this);
                     this.onAfterPhysicsObservable.notifyObservers(this);
                 }
                 }
             }
             }
@@ -28519,61 +28519,6 @@ var BABYLON;
             return this._pointerOverMesh;
             return this._pointerOverMesh;
         };
         };
         // Physics
         // Physics
-        /**
-         * Gets the current physics engine
-         * @returns a PhysicsEngine or null if none attached
-         */
-        Scene.prototype.getPhysicsEngine = function () {
-            return this._physicsEngine;
-        };
-        /**
-         * Enables physics to the current scene
-         * @param gravity defines the scene's gravity for the physics engine
-         * @param plugin defines the physics engine to be used. defaults to OimoJS.
-         * @return a boolean indicating if the physics engine was initialized
-         */
-        Scene.prototype.enablePhysics = function (gravity, plugin) {
-            if (gravity === void 0) { gravity = null; }
-            if (this._physicsEngine) {
-                return true;
-            }
-            try {
-                this._physicsEngine = new BABYLON.PhysicsEngine(gravity, plugin);
-                return true;
-            }
-            catch (e) {
-                BABYLON.Tools.Error(e.message);
-                return false;
-            }
-        };
-        /**
-         * Disables and disposes the physics engine associated with the scene
-         */
-        Scene.prototype.disablePhysicsEngine = function () {
-            if (!this._physicsEngine) {
-                return;
-            }
-            this._physicsEngine.dispose();
-            this._physicsEngine = null;
-        };
-        /**
-         * Gets a boolean indicating if there is an active physics engine
-         * @returns a boolean indicating if there is an active physics engine
-         */
-        Scene.prototype.isPhysicsEnabled = function () {
-            return this._physicsEngine !== undefined;
-        };
-        /**
-         * Deletes a physics compound impostor
-         * @param compound defines the compound to delete
-         */
-        Scene.prototype.deleteCompoundImpostor = function (compound) {
-            var mesh = compound.parts[0].mesh;
-            if (mesh.physicsImpostor) {
-                mesh.physicsImpostor.dispose( /*true*/);
-                mesh.physicsImpostor = null;
-            }
-        };
         // Misc.
         // Misc.
         /** @hidden */
         /** @hidden */
         Scene.prototype._rebuildGeometries = function () {
         Scene.prototype._rebuildGeometries = function () {
@@ -89652,11 +89597,19 @@ var BABYLON;
 
 
 var BABYLON;
 var BABYLON;
 (function (BABYLON) {
 (function (BABYLON) {
+    /**
+     * Class used to control physics engine
+     * @see http://doc.babylonjs.com/how_to/using_the_physics_engine
+     */
     var PhysicsEngine = /** @class */ (function () {
     var PhysicsEngine = /** @class */ (function () {
+        /**
+         * Creates a new Physics Engine
+         * @param gravity defines the gravity vector used by the simulation
+         * @param _physicsPlugin defines the plugin to use (CannonJS by default)
+         */
         function PhysicsEngine(gravity, _physicsPlugin) {
         function PhysicsEngine(gravity, _physicsPlugin) {
             if (_physicsPlugin === void 0) { _physicsPlugin = new BABYLON.CannonJSPlugin(); }
             if (_physicsPlugin === void 0) { _physicsPlugin = new BABYLON.CannonJSPlugin(); }
             this._physicsPlugin = _physicsPlugin;
             this._physicsPlugin = _physicsPlugin;
-            //new methods and parameters
             this._impostors = [];
             this._impostors = [];
             this._joints = [];
             this._joints = [];
             if (!this._physicsPlugin.isSupported()) {
             if (!this._physicsPlugin.isSupported()) {
@@ -89667,16 +89620,20 @@ var BABYLON;
             this.setGravity(gravity);
             this.setGravity(gravity);
             this.setTimeStep();
             this.setTimeStep();
         }
         }
+        /**
+         * Sets the gravity vector used by the simulation
+         * @param gravity defines the gravity vector to use
+         */
         PhysicsEngine.prototype.setGravity = function (gravity) {
         PhysicsEngine.prototype.setGravity = function (gravity) {
             this.gravity = gravity;
             this.gravity = gravity;
             this._physicsPlugin.setGravity(this.gravity);
             this._physicsPlugin.setGravity(this.gravity);
         };
         };
         /**
         /**
          * Set the time step of the physics engine.
          * Set the time step of the physics engine.
-         * default is 1/60.
+         * Default is 1/60.
          * To slow it down, enter 1/600 for example.
          * To slow it down, enter 1/600 for example.
          * To speed it up, 1/30
          * To speed it up, 1/30
-         * @param {number} newTimeStep the new timestep to apply to this world.
+         * @param newTimeStep defines the new timestep to apply to this world.
          */
          */
         PhysicsEngine.prototype.setTimeStep = function (newTimeStep) {
         PhysicsEngine.prototype.setTimeStep = function (newTimeStep) {
             if (newTimeStep === void 0) { newTimeStep = 1 / 60; }
             if (newTimeStep === void 0) { newTimeStep = 1 / 60; }
@@ -89684,23 +89641,31 @@ var BABYLON;
         };
         };
         /**
         /**
          * Get the time step of the physics engine.
          * Get the time step of the physics engine.
+         * @returns the current time step
          */
          */
         PhysicsEngine.prototype.getTimeStep = function () {
         PhysicsEngine.prototype.getTimeStep = function () {
             return this._physicsPlugin.getTimeStep();
             return this._physicsPlugin.getTimeStep();
         };
         };
+        /**
+         * Release all resources
+         */
         PhysicsEngine.prototype.dispose = function () {
         PhysicsEngine.prototype.dispose = function () {
             this._impostors.forEach(function (impostor) {
             this._impostors.forEach(function (impostor) {
                 impostor.dispose();
                 impostor.dispose();
             });
             });
             this._physicsPlugin.dispose();
             this._physicsPlugin.dispose();
         };
         };
+        /**
+         * Gets the name of the current physics plugin
+         * @returns the name of the plugin
+         */
         PhysicsEngine.prototype.getPhysicsPluginName = function () {
         PhysicsEngine.prototype.getPhysicsPluginName = function () {
             return this._physicsPlugin.name;
             return this._physicsPlugin.name;
         };
         };
         /**
         /**
          * Adding a new impostor for the impostor tracking.
          * Adding a new impostor for the impostor tracking.
          * This will be done by the impostor itself.
          * This will be done by the impostor itself.
-         * @param {PhysicsImpostor} impostor the impostor to add
+         * @param impostor the impostor to add
          */
          */
         PhysicsEngine.prototype.addImpostor = function (impostor) {
         PhysicsEngine.prototype.addImpostor = function (impostor) {
             impostor.uniqueId = this._impostors.push(impostor);
             impostor.uniqueId = this._impostors.push(impostor);
@@ -89712,7 +89677,7 @@ var BABYLON;
         /**
         /**
          * Remove an impostor from the engine.
          * Remove an impostor from the engine.
          * This impostor and its mesh will not longer be updated by the physics engine.
          * This impostor and its mesh will not longer be updated by the physics engine.
-         * @param {PhysicsImpostor} impostor the impostor to remove
+         * @param impostor the impostor to remove
          */
          */
         PhysicsEngine.prototype.removeImpostor = function (impostor) {
         PhysicsEngine.prototype.removeImpostor = function (impostor) {
             var index = this._impostors.indexOf(impostor);
             var index = this._impostors.indexOf(impostor);
@@ -89727,9 +89692,9 @@ var BABYLON;
         };
         };
         /**
         /**
          * Add a joint to the physics engine
          * Add a joint to the physics engine
-         * @param {PhysicsImpostor} mainImpostor the main impostor to which the joint is added.
-         * @param {PhysicsImpostor} connectedImpostor the impostor that is connected to the main impostor using this joint
-         * @param {PhysicsJoint} the joint that will connect both impostors.
+         * @param mainImpostor defines the main impostor to which the joint is added.
+         * @param connectedImpostor defines the impostor that is connected to the main impostor using this joint
+         * @param joint defines the joint that will connect both impostors.
          */
          */
         PhysicsEngine.prototype.addJoint = function (mainImpostor, connectedImpostor, joint) {
         PhysicsEngine.prototype.addJoint = function (mainImpostor, connectedImpostor, joint) {
             var impostorJoint = {
             var impostorJoint = {
@@ -89741,6 +89706,12 @@ var BABYLON;
             this._joints.push(impostorJoint);
             this._joints.push(impostorJoint);
             this._physicsPlugin.generateJoint(impostorJoint);
             this._physicsPlugin.generateJoint(impostorJoint);
         };
         };
+        /**
+         * Removes a joint from the simulation
+         * @param mainImpostor defines the impostor used with the joint
+         * @param connectedImpostor defines the other impostor connected to the main one by the joint
+         * @param joint defines the joint to remove
+         */
         PhysicsEngine.prototype.removeJoint = function (mainImpostor, connectedImpostor, joint) {
         PhysicsEngine.prototype.removeJoint = function (mainImpostor, connectedImpostor, joint) {
             var matchingJoints = this._joints.filter(function (impostorJoint) {
             var matchingJoints = this._joints.filter(function (impostorJoint) {
                 return (impostorJoint.connectedImpostor === connectedImpostor
                 return (impostorJoint.connectedImpostor === connectedImpostor
@@ -89753,10 +89724,10 @@ var BABYLON;
             }
             }
         };
         };
         /**
         /**
-         * Called by the scene. no need to call it.
-         * @hidden
+         * Called by the scene. No need to call it.
+         * @param delta defines the timespam between frames
          */
          */
-        PhysicsEngine.prototype._step = function (delta) {
+        PhysicsEngine.prototype.step = function (delta) {
             var _this = this;
             var _this = this;
             //check if any mesh has no body / requires an update
             //check if any mesh has no body / requires an update
             this._impostors.forEach(function (impostor) {
             this._impostors.forEach(function (impostor) {
@@ -89772,12 +89743,25 @@ var BABYLON;
             }
             }
             this._physicsPlugin.executeStep(delta, this._impostors);
             this._physicsPlugin.executeStep(delta, this._impostors);
         };
         };
+        /**
+         * Gets the current plugin used to run the simulation
+         * @returns current plugin
+         */
         PhysicsEngine.prototype.getPhysicsPlugin = function () {
         PhysicsEngine.prototype.getPhysicsPlugin = function () {
             return this._physicsPlugin;
             return this._physicsPlugin;
         };
         };
+        /**
+         * Gets the list of physic impostors
+         * @returns an array of PhysicsImpostor
+         */
         PhysicsEngine.prototype.getImpostors = function () {
         PhysicsEngine.prototype.getImpostors = function () {
             return this._impostors;
             return this._impostors;
         };
         };
+        /**
+         * Gets the impostor for a physics enabled object
+         * @param object defines the object impersonated by the impostor
+         * @returns the PhysicsImpostor or null if not found
+         */
         PhysicsEngine.prototype.getImpostorForPhysicsObject = function (object) {
         PhysicsEngine.prototype.getImpostorForPhysicsObject = function (object) {
             for (var i = 0; i < this._impostors.length; ++i) {
             for (var i = 0; i < this._impostors.length; ++i) {
                 if (this._impostors[i].object === object) {
                 if (this._impostors[i].object === object) {
@@ -89786,6 +89770,11 @@ var BABYLON;
             }
             }
             return null;
             return null;
         };
         };
+        /**
+         * Gets the impostor for a physics body object
+         * @param body defines physics body used by the impostor
+         * @returns the PhysicsImpostor or null if not found
+         */
         PhysicsEngine.prototype.getImpostorWithPhysicsBody = function (body) {
         PhysicsEngine.prototype.getImpostorWithPhysicsBody = function (body) {
             for (var i = 0; i < this._impostors.length; ++i) {
             for (var i = 0; i < this._impostors.length; ++i) {
                 if (this._impostors[i].physicsBody === body) {
                 if (this._impostors[i].physicsBody === body) {
@@ -89794,7 +89783,9 @@ var BABYLON;
             }
             }
             return null;
             return null;
         };
         };
-        // Statics
+        /**
+         * Global value used to control the smallest number supported by the simulation
+         */
         PhysicsEngine.Epsilon = 0.001;
         PhysicsEngine.Epsilon = 0.001;
         return PhysicsEngine;
         return PhysicsEngine;
     }());
     }());
@@ -91320,6 +91311,67 @@ var BABYLON;
 
 
 var BABYLON;
 var BABYLON;
 (function (BABYLON) {
 (function (BABYLON) {
+    /**
+     * Gets the current physics engine
+     * @returns a IPhysicsEngine or null if none attached
+     */
+    BABYLON.Scene.prototype.getPhysicsEngine = function () {
+        return this._physicsEngine;
+    };
+    /**
+     * Enables physics to the current scene
+     * @param gravity defines the scene's gravity for the physics engine
+     * @param plugin defines the physics engine to be used. defaults to OimoJS.
+     * @return a boolean indicating if the physics engine was initialized
+     */
+    BABYLON.Scene.prototype.enablePhysics = function (gravity, plugin) {
+        if (gravity === void 0) { gravity = null; }
+        if (this._physicsEngine) {
+            return true;
+        }
+        try {
+            this._physicsEngine = new BABYLON.PhysicsEngine(gravity, plugin);
+            return true;
+        }
+        catch (e) {
+            BABYLON.Tools.Error(e.message);
+            return false;
+        }
+    };
+    /**
+     * Disables and disposes the physics engine associated with the scene
+     */
+    BABYLON.Scene.prototype.disablePhysicsEngine = function () {
+        if (!this._physicsEngine) {
+            return;
+        }
+        this._physicsEngine.dispose();
+        this._physicsEngine = null;
+    };
+    /**
+     * Gets a boolean indicating if there is an active physics engine
+     * @returns a boolean indicating if there is an active physics engine
+     */
+    BABYLON.Scene.prototype.isPhysicsEnabled = function () {
+        return this._physicsEngine !== undefined;
+    };
+    /**
+     * Deletes a physics compound impostor
+     * @param compound defines the compound to delete
+     */
+    BABYLON.Scene.prototype.deleteCompoundImpostor = function (compound) {
+        var mesh = compound.parts[0].mesh;
+        if (mesh.physicsImpostor) {
+            mesh.physicsImpostor.dispose( /*true*/);
+            mesh.physicsImpostor = null;
+        }
+    };
+})(BABYLON || (BABYLON = {}));
+
+//# sourceMappingURL=babylon.physicsEngineComponent.js.map
+
+var BABYLON;
+(function (BABYLON) {
     // Based on demo done by Brandon Jones - http://media.tojicode.com/webgl-samples/dds.html
     // Based on demo done by Brandon Jones - http://media.tojicode.com/webgl-samples/dds.html
     // All values and structures referenced from:
     // All values and structures referenced from:
     // http://msdn.microsoft.com/en-us/library/bb943991.aspx/
     // http://msdn.microsoft.com/en-us/library/bb943991.aspx/

Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
dist/preview release/inspector/babylon.inspector.bundle.js


Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
dist/preview release/inspector/babylon.inspector.bundle.js.map


+ 5 - 2
dist/preview release/inspector/babylon.inspector.d.ts

@@ -33,7 +33,7 @@ declare module INSPECTOR {
                 * If the parameter 'popup' is false, the inspector is created as a right panel on the main window.
                 * If the parameter 'popup' is false, the inspector is created as a right panel on the main window.
                 * If the parameter 'popup' is true, the inspector is created in another popup.
                 * If the parameter 'popup' is true, the inspector is created in another popup.
                 */
                 */
-            constructor(scene: BABYLON.Scene, popup?: boolean, initialTab?: number, parentElement?: BABYLON.Nullable<HTMLElement>, newColors?: {
+            constructor(scene: BABYLON.Scene, popup?: boolean, initialTab?: number | string, parentElement?: BABYLON.Nullable<HTMLElement>, newColors?: {
                     backgroundColor?: string;
                     backgroundColor?: string;
                     backgroundColorLighter?: string;
                     backgroundColorLighter?: string;
                     backgroundColorLighter2?: string;
                     backgroundColorLighter2?: string;
@@ -660,6 +660,8 @@ declare module INSPECTOR {
         static _Initialize(): void;
         static _Initialize(): void;
         constructor(tabbar: TabBar, inspector: Inspector);
         constructor(tabbar: TabBar, inspector: Inspector);
         dispose(): void;
         dispose(): void;
+        /** @hidden */
+        static _GetLoaderDefaultsAsync(): Promise<any>;
     }
     }
 }
 }
 declare module INSPECTOR {
 declare module INSPECTOR {
@@ -778,7 +780,7 @@ declare module INSPECTOR {
         * The default active tab is the first one of the list.
         * The default active tab is the first one of the list.
         */
         */
     export class TabBar extends BasicElement {
     export class TabBar extends BasicElement {
-            constructor(inspector: Inspector, initialTab?: number);
+            constructor(inspector: Inspector, initialTab?: number | string);
             update(): void;
             update(): void;
             protected _build(): void;
             protected _build(): void;
             /** Dispose the current tab, set the given tab as active, and refresh the treeview */
             /** Dispose the current tab, set the given tab as active, and refresh the treeview */
@@ -790,6 +792,7 @@ declare module INSPECTOR {
             /** Returns the active tab */
             /** Returns the active tab */
             getActiveTab(): BABYLON.Nullable<Tab>;
             getActiveTab(): BABYLON.Nullable<Tab>;
             getActiveTabIndex(): number;
             getActiveTabIndex(): number;
+            getTabIndex(name: string): number;
             readonly inspector: Inspector;
             readonly inspector: Inspector;
             /**
             /**
                 * Returns the total width in pixel of the tabbar,
                 * Returns the total width in pixel of the tabbar,

+ 11 - 4
dist/preview release/inspector/babylon.inspector.module.d.ts

@@ -113,7 +113,7 @@ declare module 'babylonjs-inspector/Inspector' {
                 * If the parameter 'popup' is false, the inspector is created as a right panel on the main window.
                 * If the parameter 'popup' is false, the inspector is created as a right panel on the main window.
                 * If the parameter 'popup' is true, the inspector is created in another popup.
                 * If the parameter 'popup' is true, the inspector is created in another popup.
                 */
                 */
-            constructor(scene: Scene, popup?: boolean, initialTab?: number, parentElement?: Nullable<HTMLElement>, newColors?: {
+            constructor(scene: Scene, popup?: boolean, initialTab?: number | string, parentElement?: Nullable<HTMLElement>, newColors?: {
                     backgroundColor?: string;
                     backgroundColor?: string;
                     backgroundColorLighter?: string;
                     backgroundColorLighter?: string;
                     backgroundColorLighter2?: string;
                     backgroundColorLighter2?: string;
@@ -835,12 +835,15 @@ declare module 'babylonjs-inspector/tabs/GLTFTab' {
     import { Inspector } from "babylonjs-inspector/Inspector";
     import { Inspector } from "babylonjs-inspector/Inspector";
     import { Tab } from "babylonjs-inspector/tabs/Tab";
     import { Tab } from "babylonjs-inspector/tabs/Tab";
     import { TabBar } from "babylonjs-inspector/tabs/TabBar";
     import { TabBar } from "babylonjs-inspector/tabs/TabBar";
+    import "babylonjs-gltf2interface";
     export class GLTFTab extends Tab {
     export class GLTFTab extends Tab {
         static readonly IsSupported: boolean;
         static readonly IsSupported: boolean;
         /** @hidden */
         /** @hidden */
         static _Initialize(): void;
         static _Initialize(): void;
         constructor(tabbar: TabBar, inspector: Inspector);
         constructor(tabbar: TabBar, inspector: Inspector);
         dispose(): void;
         dispose(): void;
+        /** @hidden */
+        static _GetLoaderDefaultsAsync(): Promise<any>;
     }
     }
 }
 }
 
 
@@ -1014,7 +1017,7 @@ declare module 'babylonjs-inspector/tabs/TabBar' {
         * The default active tab is the first one of the list.
         * The default active tab is the first one of the list.
         */
         */
     export class TabBar extends BasicElement {
     export class TabBar extends BasicElement {
-            constructor(inspector: Inspector, initialTab?: number);
+            constructor(inspector: Inspector, initialTab?: number | string);
             update(): void;
             update(): void;
             protected _build(): void;
             protected _build(): void;
             /** Dispose the current tab, set the given tab as active, and refresh the treeview */
             /** Dispose the current tab, set the given tab as active, and refresh the treeview */
@@ -1026,6 +1029,7 @@ declare module 'babylonjs-inspector/tabs/TabBar' {
             /** Returns the active tab */
             /** Returns the active tab */
             getActiveTab(): Nullable<Tab>;
             getActiveTab(): Nullable<Tab>;
             getActiveTabIndex(): number;
             getActiveTabIndex(): number;
+            getTabIndex(name: string): number;
             readonly inspector: Inspector;
             readonly inspector: Inspector;
             /**
             /**
                 * Returns the total width in pixel of the tabbar,
                 * Returns the total width in pixel of the tabbar,
@@ -1373,7 +1377,7 @@ declare module INSPECTOR {
                 * If the parameter 'popup' is false, the inspector is created as a right panel on the main window.
                 * If the parameter 'popup' is false, the inspector is created as a right panel on the main window.
                 * If the parameter 'popup' is true, the inspector is created in another popup.
                 * If the parameter 'popup' is true, the inspector is created in another popup.
                 */
                 */
-            constructor(scene: BABYLON.Scene, popup?: boolean, initialTab?: number, parentElement?: BABYLON.Nullable<HTMLElement>, newColors?: {
+            constructor(scene: BABYLON.Scene, popup?: boolean, initialTab?: number | string, parentElement?: BABYLON.Nullable<HTMLElement>, newColors?: {
                     backgroundColor?: string;
                     backgroundColor?: string;
                     backgroundColorLighter?: string;
                     backgroundColorLighter?: string;
                     backgroundColorLighter2?: string;
                     backgroundColorLighter2?: string;
@@ -2000,6 +2004,8 @@ declare module INSPECTOR {
         static _Initialize(): void;
         static _Initialize(): void;
         constructor(tabbar: TabBar, inspector: Inspector);
         constructor(tabbar: TabBar, inspector: Inspector);
         dispose(): void;
         dispose(): void;
+        /** @hidden */
+        static _GetLoaderDefaultsAsync(): Promise<any>;
     }
     }
 }
 }
 declare module INSPECTOR {
 declare module INSPECTOR {
@@ -2118,7 +2124,7 @@ declare module INSPECTOR {
         * The default active tab is the first one of the list.
         * The default active tab is the first one of the list.
         */
         */
     export class TabBar extends BasicElement {
     export class TabBar extends BasicElement {
-            constructor(inspector: Inspector, initialTab?: number);
+            constructor(inspector: Inspector, initialTab?: number | string);
             update(): void;
             update(): void;
             protected _build(): void;
             protected _build(): void;
             /** Dispose the current tab, set the given tab as active, and refresh the treeview */
             /** Dispose the current tab, set the given tab as active, and refresh the treeview */
@@ -2130,6 +2136,7 @@ declare module INSPECTOR {
             /** Returns the active tab */
             /** Returns the active tab */
             getActiveTab(): BABYLON.Nullable<Tab>;
             getActiveTab(): BABYLON.Nullable<Tab>;
             getActiveTabIndex(): number;
             getActiveTabIndex(): number;
+            getTabIndex(name: string): number;
             readonly inspector: Inspector;
             readonly inspector: Inspector;
             /**
             /**
                 * Returns the total width in pixel of the tabbar,
                 * Returns the total width in pixel of the tabbar,

+ 30 - 17
dist/preview release/loaders/babylon.glTF1FileLoader.d.ts

@@ -1,4 +1,5 @@
 
 
+
 declare module BABYLON {
 declare module BABYLON {
     /**
     /**
      * Mode that determines the coordinate system to use.
      * Mode that determines the coordinate system to use.
@@ -35,11 +36,11 @@ declare module BABYLON {
      */
      */
     interface IGLTFLoaderData {
     interface IGLTFLoaderData {
         /**
         /**
-         * JSON that represents the glTF.
+         * Object that represents the glTF JSON.
          */
          */
         json: Object;
         json: Object;
         /**
         /**
-         * The BIN chunk of a binary glTF
+         * The BIN chunk of a binary glTF.
          */
          */
         bin: Nullable<ArrayBufferView>;
         bin: Nullable<ArrayBufferView>;
     }
     }
@@ -140,8 +141,6 @@ declare module BABYLON {
          * If true, no extra effects are applied to transparent pixels.
          * If true, no extra effects are applied to transparent pixels.
          */
          */
         transparencyAsCoverage: boolean;
         transparencyAsCoverage: boolean;
-        /** @hidden */
-        _normalizeAnimationGroupsToBeginAtZero: boolean;
         /**
         /**
          * Function called before loading a url referenced by the asset.
          * Function called before loading a url referenced by the asset.
          */
          */
@@ -224,15 +223,6 @@ declare module BABYLON {
          */
          */
         onExtensionLoaded: (extension: IGLTFLoaderExtension) => void;
         onExtensionLoaded: (extension: IGLTFLoaderExtension) => void;
         /**
         /**
-         * Returns a promise that resolves when the asset is completely loaded.
-         * @returns a promise that resolves when the asset is completely loaded.
-         */
-        whenCompleteAsync(): Promise<void>;
-        /**
-         * The loader state or null if the loader is not active.
-         */
-        readonly loaderState: Nullable<GLTFLoaderState>;
-        /**
          * Defines if the loader logging is enabled.
          * Defines if the loader logging is enabled.
          */
          */
         loggingEnabled: boolean;
         loggingEnabled: boolean;
@@ -240,6 +230,19 @@ declare module BABYLON {
          * Defines if the loader should capture performance counters.
          * Defines if the loader should capture performance counters.
          */
          */
         capturePerformanceCounters: boolean;
         capturePerformanceCounters: boolean;
+        /**
+         * Defines if the loader should validate the asset.
+         */
+        validate: boolean;
+        /**
+         * Observable raised after validation when validate is set to true. The event data is the result of the validation.
+         */
+        readonly onValidatedObservable: Observable<IGLTFValidationResults>;
+        private _onValidatedObserver;
+        /**
+         * Callback raised after a loader extension is created.
+         */
+        onValidated: (results: IGLTFValidationResults) => void;
         private _loader;
         private _loader;
         /**
         /**
          * Name of the loader ("gltf")
          * Name of the loader ("gltf")
@@ -306,11 +309,21 @@ declare module BABYLON {
          * @returns the created plugin
          * @returns the created plugin
          */
          */
         createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
         createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
-        private _parse;
+        /**
+         * The loader state or null if the loader is not active.
+         */
+        readonly loaderState: Nullable<GLTFLoaderState>;
+        /**
+         * Returns a promise that resolves when the asset is completely loaded.
+         * @returns a promise that resolves when the asset is completely loaded.
+         */
+        whenCompleteAsync(): Promise<void>;
+        private _parseAsync;
+        private _validateAsync;
         private _getLoader;
         private _getLoader;
-        private _parseBinary;
-        private _parseV1;
-        private _parseV2;
+        private _unpackBinary;
+        private _unpackBinaryV1;
+        private _unpackBinaryV2;
         private static _parseVersion;
         private static _parseVersion;
         private static _compareVersion;
         private static _compareVersion;
         private static _decodeBufferToText;
         private static _decodeBufferToText;

+ 117 - 65
dist/preview release/loaders/babylon.glTF1FileLoader.js

@@ -1,4 +1,5 @@
 /// <reference path="../../../dist/preview release/babylon.d.ts"/>
 /// <reference path="../../../dist/preview release/babylon.d.ts"/>
+/// <reference path="../../../dist/preview release/glTF2Interface/babylon.glTF2Interface.d.ts"/>
 var BABYLON;
 var BABYLON;
 (function (BABYLON) {
 (function (BABYLON) {
     /**
     /**
@@ -56,13 +57,16 @@ var BABYLON;
      */
      */
     var GLTFFileLoader = /** @class */ (function () {
     var GLTFFileLoader = /** @class */ (function () {
         function GLTFFileLoader() {
         function GLTFFileLoader() {
-            // #region Common options
+            // --------------
+            // Common options
+            // --------------
             /**
             /**
              * Raised when the asset has been parsed
              * Raised when the asset has been parsed
              */
              */
             this.onParsedObservable = new BABYLON.Observable();
             this.onParsedObservable = new BABYLON.Observable();
-            // #endregion
-            // #region V2 options
+            // ----------
+            // V2 options
+            // ----------
             /**
             /**
              * The coordinate system mode. Defaults to AUTO.
              * The coordinate system mode. Defaults to AUTO.
              */
              */
@@ -89,8 +93,6 @@ var BABYLON;
              * If true, no extra effects are applied to transparent pixels.
              * If true, no extra effects are applied to transparent pixels.
              */
              */
             this.transparencyAsCoverage = false;
             this.transparencyAsCoverage = false;
-            /** @hidden */
-            this._normalizeAnimationGroupsToBeginAtZero = true;
             /**
             /**
              * Function called before loading a url referenced by the asset.
              * Function called before loading a url referenced by the asset.
              */
              */
@@ -130,7 +132,14 @@ var BABYLON;
              * 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();
-            // #endregion
+            /**
+             * Defines if the loader should validate the asset.
+             */
+            this.validate = false;
+            /**
+             * Observable raised after validation when validate is set to true. The event data is the result of the validation.
+             */
+            this.onValidatedObservable = new BABYLON.Observable();
             this._loader = null;
             this._loader = null;
             /**
             /**
              * Name of the loader ("gltf")
              * Name of the loader ("gltf")
@@ -272,31 +281,6 @@ var BABYLON;
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
         });
         });
-        /**
-         * 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 () {
-            var _this = this;
-            return new Promise(function (resolve, reject) {
-                _this.onCompleteObservable.addOnce(function () {
-                    resolve();
-                });
-                _this.onErrorObservable.addOnce(function (reason) {
-                    reject(reason);
-                });
-            });
-        };
-        Object.defineProperty(GLTFFileLoader.prototype, "loaderState", {
-            /**
-             * The loader state or null if the loader is not active.
-             */
-            get: function () {
-                return this._loader ? this._loader.state : null;
-            },
-            enumerable: true,
-            configurable: true
-        });
         Object.defineProperty(GLTFFileLoader.prototype, "loggingEnabled", {
         Object.defineProperty(GLTFFileLoader.prototype, "loggingEnabled", {
             /**
             /**
              * Defines if the loader logging is enabled.
              * Defines if the loader logging is enabled.
@@ -343,6 +327,19 @@ var BABYLON;
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
         });
         });
+        Object.defineProperty(GLTFFileLoader.prototype, "onValidated", {
+            /**
+             * Callback raised after a loader extension is created.
+             */
+            set: function (callback) {
+                if (this._onValidatedObserver) {
+                    this.onValidatedObservable.remove(this._onValidatedObserver);
+                }
+                this._onValidatedObserver = this.onValidatedObservable.add(callback);
+            },
+            enumerable: true,
+            configurable: true
+        });
         /**
         /**
          * Disposes the loader, releases resources during load, and cancels any outstanding requests.
          * Disposes the loader, releases resources during load, and cancels any outstanding requests.
          */
          */
@@ -377,9 +374,8 @@ var BABYLON;
          */
          */
         GLTFFileLoader.prototype.importMeshAsync = function (meshesNames, scene, data, rootUrl, onProgress, fileName) {
         GLTFFileLoader.prototype.importMeshAsync = function (meshesNames, scene, data, rootUrl, onProgress, fileName) {
             var _this = this;
             var _this = this;
-            return Promise.resolve().then(function () {
+            return this._parseAsync(scene, data, rootUrl, fileName).then(function (loaderData) {
                 _this._log("Loading " + (fileName || ""));
                 _this._log("Loading " + (fileName || ""));
-                var loaderData = _this._parse(data);
                 _this._loader = _this._getLoader(loaderData);
                 _this._loader = _this._getLoader(loaderData);
                 return _this._loader.importMeshAsync(meshesNames, scene, loaderData, rootUrl, onProgress, fileName);
                 return _this._loader.importMeshAsync(meshesNames, scene, loaderData, rootUrl, onProgress, fileName);
             });
             });
@@ -395,9 +391,8 @@ var BABYLON;
          */
          */
         GLTFFileLoader.prototype.loadAsync = function (scene, data, rootUrl, onProgress, fileName) {
         GLTFFileLoader.prototype.loadAsync = function (scene, data, rootUrl, onProgress, fileName) {
             var _this = this;
             var _this = this;
-            return Promise.resolve().then(function () {
+            return this._parseAsync(scene, data, rootUrl, fileName).then(function (loaderData) {
                 _this._log("Loading " + (fileName || ""));
                 _this._log("Loading " + (fileName || ""));
-                var loaderData = _this._parse(data);
                 _this._loader = _this._getLoader(loaderData);
                 _this._loader = _this._getLoader(loaderData);
                 return _this._loader.loadAsync(scene, loaderData, rootUrl, onProgress, fileName);
                 return _this._loader.loadAsync(scene, loaderData, rootUrl, onProgress, fileName);
             });
             });
@@ -413,9 +408,8 @@ var BABYLON;
          */
          */
         GLTFFileLoader.prototype.loadAssetContainerAsync = function (scene, data, rootUrl, onProgress, fileName) {
         GLTFFileLoader.prototype.loadAssetContainerAsync = function (scene, data, rootUrl, onProgress, fileName) {
             var _this = this;
             var _this = this;
-            return Promise.resolve().then(function () {
+            return this._parseAsync(scene, data, rootUrl, fileName).then(function (loaderData) {
                 _this._log("Loading " + (fileName || ""));
                 _this._log("Loading " + (fileName || ""));
-                var loaderData = _this._parse(data);
                 _this._loader = _this._getLoader(loaderData);
                 _this._loader = _this._getLoader(loaderData);
                 return _this._loader.importMeshAsync(null, scene, loaderData, rootUrl, onProgress, fileName).then(function (result) {
                 return _this._loader.importMeshAsync(null, scene, loaderData, rootUrl, onProgress, fileName).then(function (result) {
                     var container = new BABYLON.AssetContainer(scene);
                     var container = new BABYLON.AssetContainer(scene);
@@ -443,25 +437,70 @@ var BABYLON;
         GLTFFileLoader.prototype.createPlugin = function () {
         GLTFFileLoader.prototype.createPlugin = function () {
             return new GLTFFileLoader();
             return new GLTFFileLoader();
         };
         };
-        GLTFFileLoader.prototype._parse = function (data) {
-            this._startPerformanceCounter("Parse");
-            var parsedData;
-            if (data instanceof ArrayBuffer) {
-                this._log("Parsing binary");
-                parsedData = this._parseBinary(data);
+        Object.defineProperty(GLTFFileLoader.prototype, "loaderState", {
+            /**
+             * The loader state or null if the loader is not active.
+             */
+            get: function () {
+                return this._loader ? this._loader.state : null;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        /**
+         * 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 () {
+            var _this = this;
+            return new Promise(function (resolve, reject) {
+                _this.onCompleteObservable.addOnce(function () {
+                    resolve();
+                });
+                _this.onErrorObservable.addOnce(function (reason) {
+                    reject(reason);
+                });
+            });
+        };
+        GLTFFileLoader.prototype._parseAsync = function (scene, data, rootUrl, fileName) {
+            var _this = this;
+            return Promise.resolve().then(function () {
+                var unpacked = (data instanceof ArrayBuffer) ? _this._unpackBinary(data) : { json: data, bin: null };
+                return _this._validateAsync(scene, unpacked.json, rootUrl, fileName).then(function () {
+                    _this._startPerformanceCounter("Parse JSON");
+                    _this._log("JSON length: " + unpacked.json.length);
+                    var loaderData = {
+                        json: JSON.parse(unpacked.json),
+                        bin: unpacked.bin
+                    };
+                    _this._endPerformanceCounter("Parse JSON");
+                    _this.onParsedObservable.notifyObservers(loaderData);
+                    _this.onParsedObservable.clear();
+                    return loaderData;
+                });
+            });
+        };
+        GLTFFileLoader.prototype._validateAsync = function (scene, json, rootUrl, fileName) {
+            var _this = this;
+            if (!this.validate || typeof GLTFValidator === "undefined") {
+                return Promise.resolve();
             }
             }
-            else {
-                this._log("Parsing JSON");
-                this._log("JSON length: " + data.length);
-                parsedData = {
-                    json: JSON.parse(data),
-                    bin: null
-                };
+            this._startPerformanceCounter("Validate JSON");
+            var options = {
+                externalResourceFunction: function (uri) {
+                    return _this.preprocessUrlAsync(rootUrl + uri)
+                        .then(function (url) { return scene._loadFileAsync(url, true, true); })
+                        .then(function (data) { return new Uint8Array(data); });
+                }
+            };
+            if (fileName && fileName.substr(0, 5) !== "data:") {
+                options.uri = (rootUrl === "file:" ? fileName : "" + rootUrl + fileName);
             }
             }
-            this.onParsedObservable.notifyObservers(parsedData);
-            this.onParsedObservable.clear();
-            this._endPerformanceCounter("Parse");
-            return parsedData;
+            return GLTFValidator.validateString(json, options).then(function (result) {
+                _this._endPerformanceCounter("Validate JSON");
+                _this.onValidatedObservable.notifyObservers(result);
+                _this.onValidatedObservable.clear();
+            });
         };
         };
         GLTFFileLoader.prototype._getLoader = function (loaderData) {
         GLTFFileLoader.prototype._getLoader = function (loaderData) {
             var asset = loaderData.json.asset || {};
             var asset = loaderData.json.asset || {};
@@ -491,11 +530,12 @@ var BABYLON;
             }
             }
             return createLoader(this);
             return createLoader(this);
         };
         };
-        GLTFFileLoader.prototype._parseBinary = function (data) {
+        GLTFFileLoader.prototype._unpackBinary = function (data) {
+            this._startPerformanceCounter("Unpack binary");
+            this._log("Binary length: " + data.byteLength);
             var Binary = {
             var Binary = {
                 Magic: 0x46546C67
                 Magic: 0x46546C67
             };
             };
-            this._log("Binary length: " + data.byteLength);
             var binaryReader = new BinaryReader(data);
             var binaryReader = new BinaryReader(data);
             var magic = binaryReader.readUint32();
             var magic = binaryReader.readUint32();
             if (magic !== Binary.Magic) {
             if (magic !== Binary.Magic) {
@@ -505,13 +545,24 @@ var BABYLON;
             if (this.loggingEnabled) {
             if (this.loggingEnabled) {
                 this._log("Binary version: " + version);
                 this._log("Binary version: " + version);
             }
             }
+            var unpacked;
             switch (version) {
             switch (version) {
-                case 1: return this._parseV1(binaryReader);
-                case 2: return this._parseV2(binaryReader);
+                case 1: {
+                    unpacked = this._unpackBinaryV1(binaryReader);
+                    break;
+                }
+                case 2: {
+                    unpacked = this._unpackBinaryV2(binaryReader);
+                    break;
+                }
+                default: {
+                    throw new Error("Unsupported version: " + version);
+                }
             }
             }
-            throw new Error("Unsupported version: " + version);
+            this._endPerformanceCounter("Unpack binary");
+            return unpacked;
         };
         };
-        GLTFFileLoader.prototype._parseV1 = function (binaryReader) {
+        GLTFFileLoader.prototype._unpackBinaryV1 = function (binaryReader) {
             var ContentFormat = {
             var ContentFormat = {
                 JSON: 0
                 JSON: 0
             };
             };
@@ -524,7 +575,7 @@ var BABYLON;
             var content;
             var content;
             switch (contentFormat) {
             switch (contentFormat) {
                 case ContentFormat.JSON: {
                 case ContentFormat.JSON: {
-                    content = JSON.parse(GLTFFileLoader._decodeBufferToText(binaryReader.readUint8Array(contentLength)));
+                    content = GLTFFileLoader._decodeBufferToText(binaryReader.readUint8Array(contentLength));
                     break;
                     break;
                 }
                 }
                 default: {
                 default: {
@@ -538,7 +589,7 @@ var BABYLON;
                 bin: body
                 bin: body
             };
             };
         };
         };
-        GLTFFileLoader.prototype._parseV2 = function (binaryReader) {
+        GLTFFileLoader.prototype._unpackBinaryV2 = function (binaryReader) {
             var ChunkFormat = {
             var ChunkFormat = {
                 JSON: 0x4E4F534A,
                 JSON: 0x4E4F534A,
                 BIN: 0x004E4942
                 BIN: 0x004E4942
@@ -553,7 +604,7 @@ var BABYLON;
             if (chunkFormat !== ChunkFormat.JSON) {
             if (chunkFormat !== ChunkFormat.JSON) {
                 throw new Error("First chunk format is not JSON");
                 throw new Error("First chunk format is not JSON");
             }
             }
-            var json = JSON.parse(GLTFFileLoader._decodeBufferToText(binaryReader.readUint8Array(chunkLength)));
+            var json = GLTFFileLoader._decodeBufferToText(binaryReader.readUint8Array(chunkLength));
             // Look for BIN chunk
             // Look for BIN chunk
             var bin = null;
             var bin = null;
             while (binaryReader.getPosition() < binaryReader.getLength()) {
             while (binaryReader.getPosition() < binaryReader.getLength()) {
@@ -639,8 +690,9 @@ var BABYLON;
         };
         };
         GLTFFileLoader.prototype._endPerformanceCounterDisabled = function (counterName) {
         GLTFFileLoader.prototype._endPerformanceCounterDisabled = function (counterName) {
         };
         };
-        // #endregion
-        // #region V1 options
+        // ----------
+        // 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.
          * 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.
          * Textures always loads asynchronously. For example, the success callback can compute the bounding information of the loaded meshes when incremental loading is disabled.

Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
dist/preview release/loaders/babylon.glTF1FileLoader.min.js


+ 62 - 50
dist/preview release/loaders/babylon.glTF2FileLoader.d.ts

@@ -1,4 +1,5 @@
 
 
+
 declare module BABYLON {
 declare module BABYLON {
     /**
     /**
      * Mode that determines the coordinate system to use.
      * Mode that determines the coordinate system to use.
@@ -35,11 +36,11 @@ declare module BABYLON {
      */
      */
     interface IGLTFLoaderData {
     interface IGLTFLoaderData {
         /**
         /**
-         * JSON that represents the glTF.
+         * Object that represents the glTF JSON.
          */
          */
         json: Object;
         json: Object;
         /**
         /**
-         * The BIN chunk of a binary glTF
+         * The BIN chunk of a binary glTF.
          */
          */
         bin: Nullable<ArrayBufferView>;
         bin: Nullable<ArrayBufferView>;
     }
     }
@@ -140,8 +141,6 @@ declare module BABYLON {
          * If true, no extra effects are applied to transparent pixels.
          * If true, no extra effects are applied to transparent pixels.
          */
          */
         transparencyAsCoverage: boolean;
         transparencyAsCoverage: boolean;
-        /** @hidden */
-        _normalizeAnimationGroupsToBeginAtZero: boolean;
         /**
         /**
          * Function called before loading a url referenced by the asset.
          * Function called before loading a url referenced by the asset.
          */
          */
@@ -224,15 +223,6 @@ declare module BABYLON {
          */
          */
         onExtensionLoaded: (extension: IGLTFLoaderExtension) => void;
         onExtensionLoaded: (extension: IGLTFLoaderExtension) => void;
         /**
         /**
-         * Returns a promise that resolves when the asset is completely loaded.
-         * @returns a promise that resolves when the asset is completely loaded.
-         */
-        whenCompleteAsync(): Promise<void>;
-        /**
-         * The loader state or null if the loader is not active.
-         */
-        readonly loaderState: Nullable<GLTFLoaderState>;
-        /**
          * Defines if the loader logging is enabled.
          * Defines if the loader logging is enabled.
          */
          */
         loggingEnabled: boolean;
         loggingEnabled: boolean;
@@ -240,6 +230,19 @@ declare module BABYLON {
          * Defines if the loader should capture performance counters.
          * Defines if the loader should capture performance counters.
          */
          */
         capturePerformanceCounters: boolean;
         capturePerformanceCounters: boolean;
+        /**
+         * Defines if the loader should validate the asset.
+         */
+        validate: boolean;
+        /**
+         * Observable raised after validation when validate is set to true. The event data is the result of the validation.
+         */
+        readonly onValidatedObservable: Observable<IGLTFValidationResults>;
+        private _onValidatedObserver;
+        /**
+         * Callback raised after a loader extension is created.
+         */
+        onValidated: (results: IGLTFValidationResults) => void;
         private _loader;
         private _loader;
         /**
         /**
          * Name of the loader ("gltf")
          * Name of the loader ("gltf")
@@ -306,11 +309,21 @@ declare module BABYLON {
          * @returns the created plugin
          * @returns the created plugin
          */
          */
         createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
         createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
-        private _parse;
+        /**
+         * The loader state or null if the loader is not active.
+         */
+        readonly loaderState: Nullable<GLTFLoaderState>;
+        /**
+         * Returns a promise that resolves when the asset is completely loaded.
+         * @returns a promise that resolves when the asset is completely loaded.
+         */
+        whenCompleteAsync(): Promise<void>;
+        private _parseAsync;
+        private _validateAsync;
         private _getLoader;
         private _getLoader;
-        private _parseBinary;
-        private _parseV1;
-        private _parseV2;
+        private _unpackBinary;
+        private _unpackBinaryV1;
+        private _unpackBinaryV2;
         private static _parseVersion;
         private static _parseVersion;
         private static _compareVersion;
         private static _compareVersion;
         private static _decodeBufferToText;
         private static _decodeBufferToText;
@@ -338,7 +351,6 @@ declare module BABYLON {
 }
 }
 
 
 
 
-
 declare module BABYLON.GLTF2 {
 declare module BABYLON.GLTF2 {
     /**
     /**
      * Loader interface with an index field.
      * Loader interface with an index field.
@@ -908,38 +920,6 @@ declare module BABYLON.GLTF2.Extensions {
 
 
 declare module BABYLON.GLTF2.Extensions {
 declare module BABYLON.GLTF2.Extensions {
     /**
     /**
-     * [Specification](https://github.com/najadojo/glTF/tree/MSFT_audio_emitter/extensions/2.0/Vendor/MSFT_audio_emitter)
-     */
-    class MSFT_audio_emitter implements IGLTFLoaderExtension {
-        /** The name of this extension. */
-        readonly name: string;
-        /** Defines whether this extension is enabled. */
-        enabled: boolean;
-        private _loader;
-        private _clips;
-        private _emitters;
-        /** @hidden */
-        constructor(loader: GLTFLoader);
-        /** @hidden */
-        dispose(): void;
-        /** @hidden */
-        onLoading(): void;
-        /** @hidden */
-        loadSceneAsync(context: string, scene: ILoaderScene): Nullable<Promise<void>>;
-        /** @hidden */
-        loadNodeAsync(context: string, node: ILoaderNode, assign: (babylonMesh: Mesh) => void): Nullable<Promise<Mesh>>;
-        /** @hidden */
-        loadAnimationAsync(context: string, animation: ILoaderAnimation): Nullable<Promise<AnimationGroup>>;
-        private _loadClipAsync;
-        private _loadEmitterAsync;
-        private _getEventAction;
-        private _loadAnimationEventAsync;
-    }
-}
-
-
-declare module BABYLON.GLTF2.Extensions {
-    /**
      * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_lod)
      * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_lod)
      */
      */
     class MSFT_lod implements IGLTFLoaderExtension {
     class MSFT_lod implements IGLTFLoaderExtension {
@@ -1019,6 +999,38 @@ declare module BABYLON.GLTF2.Extensions {
 
 
 declare module BABYLON.GLTF2.Extensions {
 declare module BABYLON.GLTF2.Extensions {
     /**
     /**
+     * [Specification](https://github.com/najadojo/glTF/tree/MSFT_audio_emitter/extensions/2.0/Vendor/MSFT_audio_emitter)
+     */
+    class MSFT_audio_emitter implements IGLTFLoaderExtension {
+        /** The name of this extension. */
+        readonly name: string;
+        /** Defines whether this extension is enabled. */
+        enabled: boolean;
+        private _loader;
+        private _clips;
+        private _emitters;
+        /** @hidden */
+        constructor(loader: GLTFLoader);
+        /** @hidden */
+        dispose(): void;
+        /** @hidden */
+        onLoading(): void;
+        /** @hidden */
+        loadSceneAsync(context: string, scene: ILoaderScene): Nullable<Promise<void>>;
+        /** @hidden */
+        loadNodeAsync(context: string, node: ILoaderNode, assign: (babylonMesh: Mesh) => void): Nullable<Promise<Mesh>>;
+        /** @hidden */
+        loadAnimationAsync(context: string, animation: ILoaderAnimation): Nullable<Promise<AnimationGroup>>;
+        private _loadClipAsync;
+        private _loadEmitterAsync;
+        private _getEventAction;
+        private _loadAnimationEventAsync;
+    }
+}
+
+
+declare module BABYLON.GLTF2.Extensions {
+    /**
      * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression)
      * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression)
      */
      */
     class KHR_draco_mesh_compression implements IGLTFLoaderExtension {
     class KHR_draco_mesh_compression implements IGLTFLoaderExtension {

Разлика између датотеке није приказан због своје велике величине
+ 447 - 397
dist/preview release/loaders/babylon.glTF2FileLoader.js


Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
dist/preview release/loaders/babylon.glTF2FileLoader.min.js


+ 62 - 50
dist/preview release/loaders/babylon.glTFFileLoader.d.ts

@@ -1,4 +1,5 @@
 
 
+
 declare module BABYLON {
 declare module BABYLON {
     /**
     /**
      * Mode that determines the coordinate system to use.
      * Mode that determines the coordinate system to use.
@@ -35,11 +36,11 @@ declare module BABYLON {
      */
      */
     interface IGLTFLoaderData {
     interface IGLTFLoaderData {
         /**
         /**
-         * JSON that represents the glTF.
+         * Object that represents the glTF JSON.
          */
          */
         json: Object;
         json: Object;
         /**
         /**
-         * The BIN chunk of a binary glTF
+         * The BIN chunk of a binary glTF.
          */
          */
         bin: Nullable<ArrayBufferView>;
         bin: Nullable<ArrayBufferView>;
     }
     }
@@ -140,8 +141,6 @@ declare module BABYLON {
          * If true, no extra effects are applied to transparent pixels.
          * If true, no extra effects are applied to transparent pixels.
          */
          */
         transparencyAsCoverage: boolean;
         transparencyAsCoverage: boolean;
-        /** @hidden */
-        _normalizeAnimationGroupsToBeginAtZero: boolean;
         /**
         /**
          * Function called before loading a url referenced by the asset.
          * Function called before loading a url referenced by the asset.
          */
          */
@@ -224,15 +223,6 @@ declare module BABYLON {
          */
          */
         onExtensionLoaded: (extension: IGLTFLoaderExtension) => void;
         onExtensionLoaded: (extension: IGLTFLoaderExtension) => void;
         /**
         /**
-         * Returns a promise that resolves when the asset is completely loaded.
-         * @returns a promise that resolves when the asset is completely loaded.
-         */
-        whenCompleteAsync(): Promise<void>;
-        /**
-         * The loader state or null if the loader is not active.
-         */
-        readonly loaderState: Nullable<GLTFLoaderState>;
-        /**
          * Defines if the loader logging is enabled.
          * Defines if the loader logging is enabled.
          */
          */
         loggingEnabled: boolean;
         loggingEnabled: boolean;
@@ -240,6 +230,19 @@ declare module BABYLON {
          * Defines if the loader should capture performance counters.
          * Defines if the loader should capture performance counters.
          */
          */
         capturePerformanceCounters: boolean;
         capturePerformanceCounters: boolean;
+        /**
+         * Defines if the loader should validate the asset.
+         */
+        validate: boolean;
+        /**
+         * Observable raised after validation when validate is set to true. The event data is the result of the validation.
+         */
+        readonly onValidatedObservable: Observable<IGLTFValidationResults>;
+        private _onValidatedObserver;
+        /**
+         * Callback raised after a loader extension is created.
+         */
+        onValidated: (results: IGLTFValidationResults) => void;
         private _loader;
         private _loader;
         /**
         /**
          * Name of the loader ("gltf")
          * Name of the loader ("gltf")
@@ -306,11 +309,21 @@ declare module BABYLON {
          * @returns the created plugin
          * @returns the created plugin
          */
          */
         createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
         createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
-        private _parse;
+        /**
+         * The loader state or null if the loader is not active.
+         */
+        readonly loaderState: Nullable<GLTFLoaderState>;
+        /**
+         * Returns a promise that resolves when the asset is completely loaded.
+         * @returns a promise that resolves when the asset is completely loaded.
+         */
+        whenCompleteAsync(): Promise<void>;
+        private _parseAsync;
+        private _validateAsync;
         private _getLoader;
         private _getLoader;
-        private _parseBinary;
-        private _parseV1;
-        private _parseV2;
+        private _unpackBinary;
+        private _unpackBinaryV1;
+        private _unpackBinaryV2;
         private static _parseVersion;
         private static _parseVersion;
         private static _compareVersion;
         private static _compareVersion;
         private static _decodeBufferToText;
         private static _decodeBufferToText;
@@ -900,7 +913,6 @@ declare module BABYLON.GLTF1 {
 }
 }
 
 
 
 
-
 declare module BABYLON.GLTF2 {
 declare module BABYLON.GLTF2 {
     /**
     /**
      * Loader interface with an index field.
      * Loader interface with an index field.
@@ -1470,38 +1482,6 @@ declare module BABYLON.GLTF2.Extensions {
 
 
 declare module BABYLON.GLTF2.Extensions {
 declare module BABYLON.GLTF2.Extensions {
     /**
     /**
-     * [Specification](https://github.com/najadojo/glTF/tree/MSFT_audio_emitter/extensions/2.0/Vendor/MSFT_audio_emitter)
-     */
-    class MSFT_audio_emitter implements IGLTFLoaderExtension {
-        /** The name of this extension. */
-        readonly name: string;
-        /** Defines whether this extension is enabled. */
-        enabled: boolean;
-        private _loader;
-        private _clips;
-        private _emitters;
-        /** @hidden */
-        constructor(loader: GLTFLoader);
-        /** @hidden */
-        dispose(): void;
-        /** @hidden */
-        onLoading(): void;
-        /** @hidden */
-        loadSceneAsync(context: string, scene: ILoaderScene): Nullable<Promise<void>>;
-        /** @hidden */
-        loadNodeAsync(context: string, node: ILoaderNode, assign: (babylonMesh: Mesh) => void): Nullable<Promise<Mesh>>;
-        /** @hidden */
-        loadAnimationAsync(context: string, animation: ILoaderAnimation): Nullable<Promise<AnimationGroup>>;
-        private _loadClipAsync;
-        private _loadEmitterAsync;
-        private _getEventAction;
-        private _loadAnimationEventAsync;
-    }
-}
-
-
-declare module BABYLON.GLTF2.Extensions {
-    /**
      * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_lod)
      * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_lod)
      */
      */
     class MSFT_lod implements IGLTFLoaderExtension {
     class MSFT_lod implements IGLTFLoaderExtension {
@@ -1581,6 +1561,38 @@ declare module BABYLON.GLTF2.Extensions {
 
 
 declare module BABYLON.GLTF2.Extensions {
 declare module BABYLON.GLTF2.Extensions {
     /**
     /**
+     * [Specification](https://github.com/najadojo/glTF/tree/MSFT_audio_emitter/extensions/2.0/Vendor/MSFT_audio_emitter)
+     */
+    class MSFT_audio_emitter implements IGLTFLoaderExtension {
+        /** The name of this extension. */
+        readonly name: string;
+        /** Defines whether this extension is enabled. */
+        enabled: boolean;
+        private _loader;
+        private _clips;
+        private _emitters;
+        /** @hidden */
+        constructor(loader: GLTFLoader);
+        /** @hidden */
+        dispose(): void;
+        /** @hidden */
+        onLoading(): void;
+        /** @hidden */
+        loadSceneAsync(context: string, scene: ILoaderScene): Nullable<Promise<void>>;
+        /** @hidden */
+        loadNodeAsync(context: string, node: ILoaderNode, assign: (babylonMesh: Mesh) => void): Nullable<Promise<Mesh>>;
+        /** @hidden */
+        loadAnimationAsync(context: string, animation: ILoaderAnimation): Nullable<Promise<AnimationGroup>>;
+        private _loadClipAsync;
+        private _loadEmitterAsync;
+        private _getEventAction;
+        private _loadAnimationEventAsync;
+    }
+}
+
+
+declare module BABYLON.GLTF2.Extensions {
+    /**
      * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression)
      * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression)
      */
      */
     class KHR_draco_mesh_compression implements IGLTFLoaderExtension {
     class KHR_draco_mesh_compression implements IGLTFLoaderExtension {

Разлика између датотеке није приказан због своје велике величине
+ 447 - 397
dist/preview release/loaders/babylon.glTFFileLoader.js


Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
dist/preview release/loaders/babylon.glTFFileLoader.min.js


+ 62 - 50
dist/preview release/loaders/babylonjs.loaders.d.ts

@@ -129,6 +129,7 @@ declare module BABYLON {
 }
 }
 
 
 
 
+
 declare module BABYLON {
 declare module BABYLON {
     /**
     /**
      * Mode that determines the coordinate system to use.
      * Mode that determines the coordinate system to use.
@@ -165,11 +166,11 @@ declare module BABYLON {
      */
      */
     interface IGLTFLoaderData {
     interface IGLTFLoaderData {
         /**
         /**
-         * JSON that represents the glTF.
+         * Object that represents the glTF JSON.
          */
          */
         json: Object;
         json: Object;
         /**
         /**
-         * The BIN chunk of a binary glTF
+         * The BIN chunk of a binary glTF.
          */
          */
         bin: Nullable<ArrayBufferView>;
         bin: Nullable<ArrayBufferView>;
     }
     }
@@ -270,8 +271,6 @@ declare module BABYLON {
          * If true, no extra effects are applied to transparent pixels.
          * If true, no extra effects are applied to transparent pixels.
          */
          */
         transparencyAsCoverage: boolean;
         transparencyAsCoverage: boolean;
-        /** @hidden */
-        _normalizeAnimationGroupsToBeginAtZero: boolean;
         /**
         /**
          * Function called before loading a url referenced by the asset.
          * Function called before loading a url referenced by the asset.
          */
          */
@@ -354,15 +353,6 @@ declare module BABYLON {
          */
          */
         onExtensionLoaded: (extension: IGLTFLoaderExtension) => void;
         onExtensionLoaded: (extension: IGLTFLoaderExtension) => void;
         /**
         /**
-         * Returns a promise that resolves when the asset is completely loaded.
-         * @returns a promise that resolves when the asset is completely loaded.
-         */
-        whenCompleteAsync(): Promise<void>;
-        /**
-         * The loader state or null if the loader is not active.
-         */
-        readonly loaderState: Nullable<GLTFLoaderState>;
-        /**
          * Defines if the loader logging is enabled.
          * Defines if the loader logging is enabled.
          */
          */
         loggingEnabled: boolean;
         loggingEnabled: boolean;
@@ -370,6 +360,19 @@ declare module BABYLON {
          * Defines if the loader should capture performance counters.
          * Defines if the loader should capture performance counters.
          */
          */
         capturePerformanceCounters: boolean;
         capturePerformanceCounters: boolean;
+        /**
+         * Defines if the loader should validate the asset.
+         */
+        validate: boolean;
+        /**
+         * Observable raised after validation when validate is set to true. The event data is the result of the validation.
+         */
+        readonly onValidatedObservable: Observable<IGLTFValidationResults>;
+        private _onValidatedObserver;
+        /**
+         * Callback raised after a loader extension is created.
+         */
+        onValidated: (results: IGLTFValidationResults) => void;
         private _loader;
         private _loader;
         /**
         /**
          * Name of the loader ("gltf")
          * Name of the loader ("gltf")
@@ -436,11 +439,21 @@ declare module BABYLON {
          * @returns the created plugin
          * @returns the created plugin
          */
          */
         createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
         createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
-        private _parse;
+        /**
+         * The loader state or null if the loader is not active.
+         */
+        readonly loaderState: Nullable<GLTFLoaderState>;
+        /**
+         * Returns a promise that resolves when the asset is completely loaded.
+         * @returns a promise that resolves when the asset is completely loaded.
+         */
+        whenCompleteAsync(): Promise<void>;
+        private _parseAsync;
+        private _validateAsync;
         private _getLoader;
         private _getLoader;
-        private _parseBinary;
-        private _parseV1;
-        private _parseV2;
+        private _unpackBinary;
+        private _unpackBinaryV1;
+        private _unpackBinaryV2;
         private static _parseVersion;
         private static _parseVersion;
         private static _compareVersion;
         private static _compareVersion;
         private static _decodeBufferToText;
         private static _decodeBufferToText;
@@ -1030,7 +1043,6 @@ declare module BABYLON.GLTF1 {
 }
 }
 
 
 
 
-
 declare module BABYLON.GLTF2 {
 declare module BABYLON.GLTF2 {
     /**
     /**
      * Loader interface with an index field.
      * Loader interface with an index field.
@@ -1600,38 +1612,6 @@ declare module BABYLON.GLTF2.Extensions {
 
 
 declare module BABYLON.GLTF2.Extensions {
 declare module BABYLON.GLTF2.Extensions {
     /**
     /**
-     * [Specification](https://github.com/najadojo/glTF/tree/MSFT_audio_emitter/extensions/2.0/Vendor/MSFT_audio_emitter)
-     */
-    class MSFT_audio_emitter implements IGLTFLoaderExtension {
-        /** The name of this extension. */
-        readonly name: string;
-        /** Defines whether this extension is enabled. */
-        enabled: boolean;
-        private _loader;
-        private _clips;
-        private _emitters;
-        /** @hidden */
-        constructor(loader: GLTFLoader);
-        /** @hidden */
-        dispose(): void;
-        /** @hidden */
-        onLoading(): void;
-        /** @hidden */
-        loadSceneAsync(context: string, scene: ILoaderScene): Nullable<Promise<void>>;
-        /** @hidden */
-        loadNodeAsync(context: string, node: ILoaderNode, assign: (babylonMesh: Mesh) => void): Nullable<Promise<Mesh>>;
-        /** @hidden */
-        loadAnimationAsync(context: string, animation: ILoaderAnimation): Nullable<Promise<AnimationGroup>>;
-        private _loadClipAsync;
-        private _loadEmitterAsync;
-        private _getEventAction;
-        private _loadAnimationEventAsync;
-    }
-}
-
-
-declare module BABYLON.GLTF2.Extensions {
-    /**
      * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_lod)
      * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_lod)
      */
      */
     class MSFT_lod implements IGLTFLoaderExtension {
     class MSFT_lod implements IGLTFLoaderExtension {
@@ -1711,6 +1691,38 @@ declare module BABYLON.GLTF2.Extensions {
 
 
 declare module BABYLON.GLTF2.Extensions {
 declare module BABYLON.GLTF2.Extensions {
     /**
     /**
+     * [Specification](https://github.com/najadojo/glTF/tree/MSFT_audio_emitter/extensions/2.0/Vendor/MSFT_audio_emitter)
+     */
+    class MSFT_audio_emitter implements IGLTFLoaderExtension {
+        /** The name of this extension. */
+        readonly name: string;
+        /** Defines whether this extension is enabled. */
+        enabled: boolean;
+        private _loader;
+        private _clips;
+        private _emitters;
+        /** @hidden */
+        constructor(loader: GLTFLoader);
+        /** @hidden */
+        dispose(): void;
+        /** @hidden */
+        onLoading(): void;
+        /** @hidden */
+        loadSceneAsync(context: string, scene: ILoaderScene): Nullable<Promise<void>>;
+        /** @hidden */
+        loadNodeAsync(context: string, node: ILoaderNode, assign: (babylonMesh: Mesh) => void): Nullable<Promise<Mesh>>;
+        /** @hidden */
+        loadAnimationAsync(context: string, animation: ILoaderAnimation): Nullable<Promise<AnimationGroup>>;
+        private _loadClipAsync;
+        private _loadEmitterAsync;
+        private _getEventAction;
+        private _loadAnimationEventAsync;
+    }
+}
+
+
+declare module BABYLON.GLTF2.Extensions {
+    /**
      * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression)
      * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression)
      */
      */
     class KHR_draco_mesh_compression implements IGLTFLoaderExtension {
     class KHR_draco_mesh_compression implements IGLTFLoaderExtension {

Разлика између датотеке није приказан због своје велике величине
+ 447 - 397
dist/preview release/loaders/babylonjs.loaders.js


Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
dist/preview release/loaders/babylonjs.loaders.min.js


+ 62 - 50
dist/preview release/loaders/babylonjs.loaders.module.d.ts

@@ -136,6 +136,7 @@ declare module BABYLON {
 }
 }
 
 
 
 
+
 declare module BABYLON {
 declare module BABYLON {
     /**
     /**
      * Mode that determines the coordinate system to use.
      * Mode that determines the coordinate system to use.
@@ -172,11 +173,11 @@ declare module BABYLON {
      */
      */
     interface IGLTFLoaderData {
     interface IGLTFLoaderData {
         /**
         /**
-         * JSON that represents the glTF.
+         * Object that represents the glTF JSON.
          */
          */
         json: Object;
         json: Object;
         /**
         /**
-         * The BIN chunk of a binary glTF
+         * The BIN chunk of a binary glTF.
          */
          */
         bin: Nullable<ArrayBufferView>;
         bin: Nullable<ArrayBufferView>;
     }
     }
@@ -277,8 +278,6 @@ declare module BABYLON {
          * If true, no extra effects are applied to transparent pixels.
          * If true, no extra effects are applied to transparent pixels.
          */
          */
         transparencyAsCoverage: boolean;
         transparencyAsCoverage: boolean;
-        /** @hidden */
-        _normalizeAnimationGroupsToBeginAtZero: boolean;
         /**
         /**
          * Function called before loading a url referenced by the asset.
          * Function called before loading a url referenced by the asset.
          */
          */
@@ -361,15 +360,6 @@ declare module BABYLON {
          */
          */
         onExtensionLoaded: (extension: IGLTFLoaderExtension) => void;
         onExtensionLoaded: (extension: IGLTFLoaderExtension) => void;
         /**
         /**
-         * Returns a promise that resolves when the asset is completely loaded.
-         * @returns a promise that resolves when the asset is completely loaded.
-         */
-        whenCompleteAsync(): Promise<void>;
-        /**
-         * The loader state or null if the loader is not active.
-         */
-        readonly loaderState: Nullable<GLTFLoaderState>;
-        /**
          * Defines if the loader logging is enabled.
          * Defines if the loader logging is enabled.
          */
          */
         loggingEnabled: boolean;
         loggingEnabled: boolean;
@@ -377,6 +367,19 @@ declare module BABYLON {
          * Defines if the loader should capture performance counters.
          * Defines if the loader should capture performance counters.
          */
          */
         capturePerformanceCounters: boolean;
         capturePerformanceCounters: boolean;
+        /**
+         * Defines if the loader should validate the asset.
+         */
+        validate: boolean;
+        /**
+         * Observable raised after validation when validate is set to true. The event data is the result of the validation.
+         */
+        readonly onValidatedObservable: Observable<IGLTFValidationResults>;
+        private _onValidatedObserver;
+        /**
+         * Callback raised after a loader extension is created.
+         */
+        onValidated: (results: IGLTFValidationResults) => void;
         private _loader;
         private _loader;
         /**
         /**
          * Name of the loader ("gltf")
          * Name of the loader ("gltf")
@@ -443,11 +446,21 @@ declare module BABYLON {
          * @returns the created plugin
          * @returns the created plugin
          */
          */
         createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
         createPlugin(): ISceneLoaderPlugin | ISceneLoaderPluginAsync;
-        private _parse;
+        /**
+         * The loader state or null if the loader is not active.
+         */
+        readonly loaderState: Nullable<GLTFLoaderState>;
+        /**
+         * Returns a promise that resolves when the asset is completely loaded.
+         * @returns a promise that resolves when the asset is completely loaded.
+         */
+        whenCompleteAsync(): Promise<void>;
+        private _parseAsync;
+        private _validateAsync;
         private _getLoader;
         private _getLoader;
-        private _parseBinary;
-        private _parseV1;
-        private _parseV2;
+        private _unpackBinary;
+        private _unpackBinaryV1;
+        private _unpackBinaryV2;
         private static _parseVersion;
         private static _parseVersion;
         private static _compareVersion;
         private static _compareVersion;
         private static _decodeBufferToText;
         private static _decodeBufferToText;
@@ -1037,7 +1050,6 @@ declare module BABYLON.GLTF1 {
 }
 }
 
 
 
 
-
 declare module BABYLON.GLTF2 {
 declare module BABYLON.GLTF2 {
     /**
     /**
      * Loader interface with an index field.
      * Loader interface with an index field.
@@ -1607,38 +1619,6 @@ declare module BABYLON.GLTF2.Extensions {
 
 
 declare module BABYLON.GLTF2.Extensions {
 declare module BABYLON.GLTF2.Extensions {
     /**
     /**
-     * [Specification](https://github.com/najadojo/glTF/tree/MSFT_audio_emitter/extensions/2.0/Vendor/MSFT_audio_emitter)
-     */
-    class MSFT_audio_emitter implements IGLTFLoaderExtension {
-        /** The name of this extension. */
-        readonly name: string;
-        /** Defines whether this extension is enabled. */
-        enabled: boolean;
-        private _loader;
-        private _clips;
-        private _emitters;
-        /** @hidden */
-        constructor(loader: GLTFLoader);
-        /** @hidden */
-        dispose(): void;
-        /** @hidden */
-        onLoading(): void;
-        /** @hidden */
-        loadSceneAsync(context: string, scene: ILoaderScene): Nullable<Promise<void>>;
-        /** @hidden */
-        loadNodeAsync(context: string, node: ILoaderNode, assign: (babylonMesh: Mesh) => void): Nullable<Promise<Mesh>>;
-        /** @hidden */
-        loadAnimationAsync(context: string, animation: ILoaderAnimation): Nullable<Promise<AnimationGroup>>;
-        private _loadClipAsync;
-        private _loadEmitterAsync;
-        private _getEventAction;
-        private _loadAnimationEventAsync;
-    }
-}
-
-
-declare module BABYLON.GLTF2.Extensions {
-    /**
      * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_lod)
      * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_lod)
      */
      */
     class MSFT_lod implements IGLTFLoaderExtension {
     class MSFT_lod implements IGLTFLoaderExtension {
@@ -1718,6 +1698,38 @@ declare module BABYLON.GLTF2.Extensions {
 
 
 declare module BABYLON.GLTF2.Extensions {
 declare module BABYLON.GLTF2.Extensions {
     /**
     /**
+     * [Specification](https://github.com/najadojo/glTF/tree/MSFT_audio_emitter/extensions/2.0/Vendor/MSFT_audio_emitter)
+     */
+    class MSFT_audio_emitter implements IGLTFLoaderExtension {
+        /** The name of this extension. */
+        readonly name: string;
+        /** Defines whether this extension is enabled. */
+        enabled: boolean;
+        private _loader;
+        private _clips;
+        private _emitters;
+        /** @hidden */
+        constructor(loader: GLTFLoader);
+        /** @hidden */
+        dispose(): void;
+        /** @hidden */
+        onLoading(): void;
+        /** @hidden */
+        loadSceneAsync(context: string, scene: ILoaderScene): Nullable<Promise<void>>;
+        /** @hidden */
+        loadNodeAsync(context: string, node: ILoaderNode, assign: (babylonMesh: Mesh) => void): Nullable<Promise<Mesh>>;
+        /** @hidden */
+        loadAnimationAsync(context: string, animation: ILoaderAnimation): Nullable<Promise<AnimationGroup>>;
+        private _loadClipAsync;
+        private _loadEmitterAsync;
+        private _getEventAction;
+        private _loadAnimationEventAsync;
+    }
+}
+
+
+declare module BABYLON.GLTF2.Extensions {
+    /**
      * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression)
      * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression)
      */
      */
     class KHR_draco_mesh_compression implements IGLTFLoaderExtension {
     class KHR_draco_mesh_compression implements IGLTFLoaderExtension {

+ 49 - 702
dist/preview release/typedocValidationBaseline.json

@@ -1,7 +1,7 @@
 {
 {
-  "errors": 3866,
+  "errors": 3753,
   "babylon.typedoc.json": {
   "babylon.typedoc.json": {
-    "errors": 3866,
+    "errors": 3753,
     "AnimationGroup": {
     "AnimationGroup": {
       "Constructor": {
       "Constructor": {
         "new AnimationGroup": {
         "new AnimationGroup": {
@@ -9908,141 +9908,6 @@
         }
         }
       }
       }
     },
     },
-    "PhysicsEngine": {
-      "Class": {
-        "Comments": {
-          "MissingText": true
-        }
-      },
-      "Constructor": {
-        "new PhysicsEngine": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "gravity": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "_physicsPlugin": {
-              "Comments": {
-                "MissingText": true
-              },
-              "Naming": {
-                "NotCamelCase": true
-              }
-            }
-          }
-        }
-      },
-      "Property": {
-        "gravity": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "Epsilon": {
-          "Comments": {
-            "MissingText": true
-          }
-        }
-      },
-      "Method": {
-        "addJoint": {
-          "Parameter": {
-            "joint": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "dispose": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "getImpostorForPhysicsObject": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "object": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "getImpostorWithPhysicsBody": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "body": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "getImpostors": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "getPhysicsPlugin": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "getPhysicsPluginName": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "getTimeStep": {
-          "Comments": {
-            "MissingReturn": true
-          }
-        },
-        "removeJoint": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "mainImpostor": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "connectedImpostor": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "joint": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "setGravity": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "gravity": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        }
-      }
-    },
     "PhysicsGravitationalFieldEvent": {
     "PhysicsGravitationalFieldEvent": {
       "Constructor": {
       "Constructor": {
         "new PhysicsGravitationalFieldEvent": {
         "new PhysicsGravitationalFieldEvent": {
@@ -20819,589 +20684,95 @@
         }
         }
       }
       }
     },
     },
-    "IPhysicsEnginePlugin": {
+    "ISceneLoaderPlugin": {
+      "Interface": {
+        "Comments": {
+          "MissingText": true
+        }
+      }
+    },
+    "ISceneLoaderPluginAsync": {
+      "Interface": {
+        "Comments": {
+          "MissingText": true
+        }
+      }
+    },
+    "ISceneLoaderPluginExtensions": {
+      "Interface": {
+        "Comments": {
+          "MissingText": true
+        }
+      }
+    },
+    "ISceneLoaderPluginFactory": {
       "Interface": {
       "Interface": {
         "Comments": {
         "Comments": {
           "MissingText": true
           "MissingText": true
         }
         }
       },
       },
       "Property": {
       "Property": {
-        "name": {
+        "canDirectLoad": {
           "Comments": {
           "Comments": {
             "MissingText": true
             "MissingText": true
           }
           }
         },
         },
-        "world": {
+        "name": {
           "Comments": {
           "Comments": {
             "MissingText": true
             "MissingText": true
           }
           }
         }
         }
       },
       },
       "Method": {
       "Method": {
-        "applyForce": {
+        "createPlugin": {
           "Comments": {
           "Comments": {
             "MissingText": true
             "MissingText": true
-          },
-          "Parameter": {
-            "impostor": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "force": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "contactPoint": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
           }
           }
-        },
-        "applyImpulse": {
+        }
+      }
+    },
+    "ISimplificationSettings": {
+      "Property": {
+        "distance": {
           "Comments": {
           "Comments": {
             "MissingText": true
             "MissingText": true
-          },
-          "Parameter": {
-            "impostor": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "force": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "contactPoint": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
           }
           }
         },
         },
-        "dispose": {
+        "optimizeMesh": {
           "Comments": {
           "Comments": {
             "MissingText": true
             "MissingText": true
           }
           }
         },
         },
-        "executeStep": {
+        "quality": {
           "Comments": {
           "Comments": {
             "MissingText": true
             "MissingText": true
-          },
-          "Parameter": {
-            "delta": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "impostors": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
           }
           }
-        },
-        "generateJoint": {
+        }
+      }
+    },
+    "ISimplificationTask": {
+      "Interface": {
+        "Comments": {
+          "MissingText": true
+        }
+      },
+      "Property": {
+        "mesh": {
           "Comments": {
           "Comments": {
             "MissingText": true
             "MissingText": true
-          },
-          "Parameter": {
-            "joint": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
           }
           }
         },
         },
-        "generatePhysicsBody": {
+        "parallelProcessing": {
           "Comments": {
           "Comments": {
             "MissingText": true
             "MissingText": true
-          },
-          "Parameter": {
-            "impostor": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
           }
           }
         },
         },
-        "getAngularVelocity": {
+        "settings": {
           "Comments": {
           "Comments": {
             "MissingText": true
             "MissingText": true
-          },
-          "Parameter": {
-            "impostor": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
           }
           }
         },
         },
-        "getBodyFriction": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "impostor": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "getBodyMass": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "impostor": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "getBodyRestitution": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "impostor": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "getBoxSizeToRef": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "impostor": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "result": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "getLinearVelocity": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "impostor": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "getRadius": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "impostor": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "getTimeStep": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "isSupported": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "removeJoint": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "joint": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "removePhysicsBody": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "impostor": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "setAngularVelocity": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "impostor": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "velocity": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "setBodyFriction": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "impostor": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "friction": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "setBodyMass": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "impostor": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "mass": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "setBodyRestitution": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "impostor": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "restitution": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "setGravity": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "gravity": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "setLimit": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "joint": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "upperLimit": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "lowerLimit": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "motorIndex": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "setLinearVelocity": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "impostor": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "velocity": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "setMotor": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "joint": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "speed": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "maxForce": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "motorIndex": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "setPhysicsBodyTransformation": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "impostor": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "newPosition": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "newRotation": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "setTimeStep": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "timeStep": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "setTransformationFromPhysicsBody": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "impostor": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "sleepBody": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "impostor": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "syncMeshWithImpostor": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "mesh": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "impostor": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "updateDistanceJoint": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "joint": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "maxDistance": {
-              "Comments": {
-                "MissingText": true
-              }
-            },
-            "minDistance": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
-        "wakeUpBody": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "impostor": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        }
-      }
-    },
-    "ISceneLoaderPlugin": {
-      "Interface": {
-        "Comments": {
-          "MissingText": true
-        }
-      }
-    },
-    "ISceneLoaderPluginAsync": {
-      "Interface": {
-        "Comments": {
-          "MissingText": true
-        }
-      }
-    },
-    "ISceneLoaderPluginExtensions": {
-      "Interface": {
-        "Comments": {
-          "MissingText": true
-        }
-      }
-    },
-    "ISceneLoaderPluginFactory": {
-      "Interface": {
-        "Comments": {
-          "MissingText": true
-        }
-      },
-      "Property": {
-        "canDirectLoad": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "name": {
-          "Comments": {
-            "MissingText": true
-          }
-        }
-      },
-      "Method": {
-        "createPlugin": {
-          "Comments": {
-            "MissingText": true
-          }
-        }
-      }
-    },
-    "ISimplificationSettings": {
-      "Property": {
-        "distance": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "optimizeMesh": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "quality": {
-          "Comments": {
-            "MissingText": true
-          }
-        }
-      }
-    },
-    "ISimplificationTask": {
-      "Interface": {
-        "Comments": {
-          "MissingText": true
-        }
-      },
-      "Property": {
-        "mesh": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "parallelProcessing": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "settings": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "simplificationType": {
+        "simplificationType": {
           "Comments": {
           "Comments": {
             "MissingText": true
             "MissingText": true
           }
           }
@@ -21467,30 +20838,6 @@
         }
         }
       }
       }
     },
     },
-    "PhysicsImpostorJoint": {
-      "Interface": {
-        "Comments": {
-          "MissingText": true
-        }
-      },
-      "Property": {
-        "connectedImpostor": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "joint": {
-          "Comments": {
-            "MissingText": true
-          }
-        },
-        "mainImpostor": {
-          "Comments": {
-            "MissingText": true
-          }
-        }
-      }
-    },
     "PhysicsImpostorParameters": {
     "PhysicsImpostorParameters": {
       "Interface": {
       "Interface": {
         "Comments": {
         "Comments": {

Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
dist/preview release/viewer/babylon.viewer.js


Разлика између датотеке није приказан због своје велике величине
+ 2 - 2
dist/preview release/viewer/babylon.viewer.max.js


+ 158 - 0
src/Physics/babylon.IPhysicsEngine.ts

@@ -0,0 +1,158 @@
+module BABYLON {
+    /**
+     * Interface used to describe a physics joint
+     */
+    export interface PhysicsImpostorJoint {
+        /** Defines the main impostor to which the joint is linked */
+        mainImpostor: PhysicsImpostor;
+        /** Defines the impostor that is connected to the main impostor using this joint */
+        connectedImpostor: PhysicsImpostor;
+        /** Defines the joint itself */
+        joint: PhysicsJoint;
+    }
+
+    /** @hidden */
+    export interface IPhysicsEnginePlugin {
+        world: any;
+        name: string;
+        setGravity(gravity: Vector3): void;
+        setTimeStep(timeStep: number): void;
+        getTimeStep(): number;
+        executeStep(delta: number, impostors: Array<PhysicsImpostor>): void; //not forgetting pre and post events
+        applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
+        applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
+        generatePhysicsBody(impostor: PhysicsImpostor): void;
+        removePhysicsBody(impostor: PhysicsImpostor): void;
+        generateJoint(joint: PhysicsImpostorJoint): void;
+        removeJoint(joint: PhysicsImpostorJoint): void;
+        isSupported(): boolean;
+        setTransformationFromPhysicsBody(impostor: PhysicsImpostor): void;
+        setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): void;
+        setLinearVelocity(impostor: PhysicsImpostor, velocity: Nullable<Vector3>): void;
+        setAngularVelocity(impostor: PhysicsImpostor, velocity: Nullable<Vector3>): void;
+        getLinearVelocity(impostor: PhysicsImpostor): Nullable<Vector3>;
+        getAngularVelocity(impostor: PhysicsImpostor): Nullable<Vector3>;
+        setBodyMass(impostor: PhysicsImpostor, mass: number): void;
+        getBodyMass(impostor: PhysicsImpostor): number;
+        getBodyFriction(impostor: PhysicsImpostor): number;
+        setBodyFriction(impostor: PhysicsImpostor, friction: number): void;
+        getBodyRestitution(impostor: PhysicsImpostor): number;
+        setBodyRestitution(impostor: PhysicsImpostor, restitution: number): void;
+        sleepBody(impostor: PhysicsImpostor): void;
+        wakeUpBody(impostor: PhysicsImpostor): void;
+        //Joint Update
+        updateDistanceJoint(joint: PhysicsJoint, maxDistance: number, minDistance?: number): void;
+        setMotor(joint: IMotorEnabledJoint, speed: number, maxForce?: number, motorIndex?: number): void;
+        setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number, motorIndex?: number): void;
+        getRadius(impostor: PhysicsImpostor): number;
+        getBoxSizeToRef(impostor: PhysicsImpostor, result: Vector3): void;
+        syncMeshWithImpostor(mesh: AbstractMesh, impostor: PhysicsImpostor): void;
+        dispose(): void;
+    }
+
+    /**
+     * Interface used to define a physics engine
+     * @see http://doc.babylonjs.com/how_to/using_the_physics_engine
+     */
+    export interface IPhysicsEngine {
+        /**
+         * Gets the gravity vector used by the simulation
+         */
+        gravity: Vector3;
+
+        /**
+         * Sets the gravity vector used by the simulation
+         * @param gravity defines the gravity vector to use
+         */
+        setGravity(gravity: Vector3): void;
+
+        /**
+         * Set the time step of the physics engine.
+         * Default is 1/60.
+         * To slow it down, enter 1/600 for example.
+         * To speed it up, 1/30
+         * @param newTimeStep the new timestep to apply to this world.
+         */
+        setTimeStep(newTimeStep: number): void;
+
+        /**
+         * Get the time step of the physics engine.
+         * @returns the current time step
+         */
+        getTimeStep(): number;
+
+        /**
+         * Release all resources
+         */
+        dispose(): void;
+
+        /**
+         * Gets the name of the current physics plugin
+         * @returns the name of the plugin
+         */
+        getPhysicsPluginName(): string;
+
+        /**
+         * Adding a new impostor for the impostor tracking.
+         * This will be done by the impostor itself.
+         * @param impostor the impostor to add
+         */
+        addImpostor(impostor: PhysicsImpostor): void;
+
+        /**
+         * Remove an impostor from the engine.
+         * This impostor and its mesh will not longer be updated by the physics engine.
+         * @param impostor the impostor to remove
+         */
+        removeImpostor(impostor: PhysicsImpostor): void;
+
+        /**
+         * Add a joint to the physics engine
+         * @param mainImpostor defines the main impostor to which the joint is added.
+         * @param connectedImpostor defines the impostor that is connected to the main impostor using this joint
+         * @param joint defines the joint that will connect both impostors.
+         */
+        addJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint): void;
+
+        /**
+         * Removes a joint from the simulation
+         * @param mainImpostor defines the impostor used with the joint
+         * @param connectedImpostor defines the other impostor connected to the main one by the joint
+         * @param joint defines the joint to remove
+         */
+        removeJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint): void;
+
+        /**
+         * Gets the current plugin used to run the simulation
+         * @returns current plugin
+         */
+        getPhysicsPlugin(): IPhysicsEnginePlugin;
+
+        /**
+         * Gets the list of physic impostors
+         * @returns an array of PhysicsImpostor
+         */
+        getImpostors(): Array<PhysicsImpostor>;
+
+        /**
+         * Gets the impostor for a physics enabled object
+         * @param object defines the object impersonated by the impostor
+         * @returns the PhysicsImpostor or null if not found
+         */
+        getImpostorForPhysicsObject(object: IPhysicsEnabledObject): Nullable<PhysicsImpostor>;
+
+        /**
+         * Gets the impostor for a physics body object
+         * @param body defines physics body used by the impostor
+         * @returns the PhysicsImpostor or null if not found
+         */        
+        getImpostorWithPhysicsBody(body: any): Nullable<PhysicsImpostor>;
+
+        /**
+         * Called by the scene. No need to call it.
+         * @param delta defines the timespam between frames
+         */
+        step(delta: number): void;
+    }
+
+}

+ 66 - 65
src/Physics/babylon.physicsEngine.ts

@@ -1,15 +1,28 @@
 module BABYLON {
 module BABYLON {
+    
+    /**
+     * Class used to control physics engine
+     * @see http://doc.babylonjs.com/how_to/using_the_physics_engine
+     */
+    export class PhysicsEngine implements IPhysicsEngine {
+        /**
+         * Global value used to control the smallest number supported by the simulation
+         */
+        public static Epsilon = 0.001;
 
 
-    export interface PhysicsImpostorJoint {
-        mainImpostor: PhysicsImpostor;
-        connectedImpostor: PhysicsImpostor;
-        joint: PhysicsJoint;
-    }
-
-    export class PhysicsEngine {
+        private _impostors: Array<PhysicsImpostor> = [];
+        private _joints: Array<PhysicsImpostorJoint> = [];
 
 
+        /**
+         * Gets the gravity vector used by the simulation
+         */
         public gravity: Vector3;
         public gravity: Vector3;
 
 
+        /**
+         * Creates a new Physics Engine
+         * @param gravity defines the gravity vector used by the simulation
+         * @param _physicsPlugin defines the plugin to use (CannonJS by default)
+         */
         constructor(gravity: Nullable<Vector3>, private _physicsPlugin: IPhysicsEnginePlugin = new CannonJSPlugin()) {
         constructor(gravity: Nullable<Vector3>, private _physicsPlugin: IPhysicsEnginePlugin = new CannonJSPlugin()) {
             if (!this._physicsPlugin.isSupported()) {
             if (!this._physicsPlugin.isSupported()) {
                 throw new Error("Physics Engine " + this._physicsPlugin.name + " cannot be found. "
                 throw new Error("Physics Engine " + this._physicsPlugin.name + " cannot be found. "
@@ -20,6 +33,10 @@
             this.setTimeStep();
             this.setTimeStep();
         }
         }
 
 
+        /**
+         * Sets the gravity vector used by the simulation
+         * @param gravity defines the gravity vector to use
+         */
         public setGravity(gravity: Vector3): void {
         public setGravity(gravity: Vector3): void {
             this.gravity = gravity;
             this.gravity = gravity;
             this._physicsPlugin.setGravity(this.gravity);
             this._physicsPlugin.setGravity(this.gravity);
@@ -27,10 +44,10 @@
 
 
         /**
         /**
          * Set the time step of the physics engine.
          * Set the time step of the physics engine.
-         * default is 1/60.
+         * Default is 1/60.
          * To slow it down, enter 1/600 for example.
          * To slow it down, enter 1/600 for example.
          * To speed it up, 1/30
          * To speed it up, 1/30
-         * @param {number} newTimeStep the new timestep to apply to this world.
+         * @param newTimeStep defines the new timestep to apply to this world.
          */
          */
         public setTimeStep(newTimeStep: number = 1 / 60) {
         public setTimeStep(newTimeStep: number = 1 / 60) {
             this._physicsPlugin.setTimeStep(newTimeStep);
             this._physicsPlugin.setTimeStep(newTimeStep);
@@ -38,11 +55,15 @@
 
 
         /**
         /**
          * Get the time step of the physics engine.
          * Get the time step of the physics engine.
+         * @returns the current time step
          */
          */
         public getTimeStep(): number {
         public getTimeStep(): number {
             return this._physicsPlugin.getTimeStep();
             return this._physicsPlugin.getTimeStep();
         }
         }
 
 
+        /**
+         * Release all resources
+         */
         public dispose(): void {
         public dispose(): void {
             this._impostors.forEach(function (impostor) {
             this._impostors.forEach(function (impostor) {
                 impostor.dispose();
                 impostor.dispose();
@@ -50,22 +71,18 @@
             this._physicsPlugin.dispose();
             this._physicsPlugin.dispose();
         }
         }
 
 
+        /**
+         * Gets the name of the current physics plugin
+         * @returns the name of the plugin
+         */        
         public getPhysicsPluginName(): string {
         public getPhysicsPluginName(): string {
             return this._physicsPlugin.name;
             return this._physicsPlugin.name;
         }
         }
 
 
-        // Statics
-        public static Epsilon = 0.001;
-
-        //new methods and parameters
-
-        private _impostors: Array<PhysicsImpostor> = [];
-        private _joints: Array<PhysicsImpostorJoint> = [];
-
         /**
         /**
          * Adding a new impostor for the impostor tracking.
          * Adding a new impostor for the impostor tracking.
          * This will be done by the impostor itself.
          * This will be done by the impostor itself.
-         * @param {PhysicsImpostor} impostor the impostor to add
+         * @param impostor the impostor to add
          */
          */
         public addImpostor(impostor: PhysicsImpostor) {
         public addImpostor(impostor: PhysicsImpostor) {
             impostor.uniqueId = this._impostors.push(impostor);
             impostor.uniqueId = this._impostors.push(impostor);
@@ -78,7 +95,7 @@
         /**
         /**
          * Remove an impostor from the engine.
          * Remove an impostor from the engine.
          * This impostor and its mesh will not longer be updated by the physics engine.
          * This impostor and its mesh will not longer be updated by the physics engine.
-         * @param {PhysicsImpostor} impostor the impostor to remove
+         * @param impostor the impostor to remove
          */
          */
         public removeImpostor(impostor: PhysicsImpostor) {
         public removeImpostor(impostor: PhysicsImpostor) {
             var index = this._impostors.indexOf(impostor);
             var index = this._impostors.indexOf(impostor);
@@ -94,9 +111,9 @@
 
 
         /**
         /**
          * Add a joint to the physics engine
          * Add a joint to the physics engine
-         * @param {PhysicsImpostor} mainImpostor the main impostor to which the joint is added.
-         * @param {PhysicsImpostor} connectedImpostor the impostor that is connected to the main impostor using this joint
-         * @param {PhysicsJoint} the joint that will connect both impostors.
+         * @param mainImpostor defines the main impostor to which the joint is added.
+         * @param connectedImpostor defines the impostor that is connected to the main impostor using this joint
+         * @param joint defines the joint that will connect both impostors.
          */
          */
         public addJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint) {
         public addJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint) {
             var impostorJoint = {
             var impostorJoint = {
@@ -109,6 +126,12 @@
             this._physicsPlugin.generateJoint(impostorJoint);
             this._physicsPlugin.generateJoint(impostorJoint);
         }
         }
 
 
+        /**
+         * Removes a joint from the simulation
+         * @param mainImpostor defines the impostor used with the joint
+         * @param connectedImpostor defines the other impostor connected to the main one by the joint
+         * @param joint defines the joint to remove
+         */
         public removeJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint) {
         public removeJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint) {
             var matchingJoints = this._joints.filter(function (impostorJoint) {
             var matchingJoints = this._joints.filter(function (impostorJoint) {
                 return (impostorJoint.connectedImpostor === connectedImpostor
                 return (impostorJoint.connectedImpostor === connectedImpostor
@@ -123,10 +146,10 @@
         }
         }
 
 
         /**
         /**
-         * Called by the scene. no need to call it.
-         * @hidden
+         * Called by the scene. No need to call it.
+         * @param delta defines the timespam between frames
          */
          */
-        public _step(delta: number) {
+        public step(delta: number) {
             //check if any mesh has no body / requires an update
             //check if any mesh has no body / requires an update
             this._impostors.forEach((impostor) => {
             this._impostors.forEach((impostor) => {
 
 
@@ -144,14 +167,27 @@
             this._physicsPlugin.executeStep(delta, this._impostors);
             this._physicsPlugin.executeStep(delta, this._impostors);
         }
         }
 
 
+        /**
+         * Gets the current plugin used to run the simulation
+         * @returns current plugin
+         */
         public getPhysicsPlugin(): IPhysicsEnginePlugin {
         public getPhysicsPlugin(): IPhysicsEnginePlugin {
             return this._physicsPlugin;
             return this._physicsPlugin;
         }
         }
 
 
+        /**
+         * Gets the list of physic impostors
+         * @returns an array of PhysicsImpostor
+         */
         public getImpostors(): Array<PhysicsImpostor> {
         public getImpostors(): Array<PhysicsImpostor> {
             return this._impostors;
             return this._impostors;
         }
         }
 
 
+        /**
+         * Gets the impostor for a physics enabled object
+         * @param object defines the object impersonated by the impostor
+         * @returns the PhysicsImpostor or null if not found
+         */
         public getImpostorForPhysicsObject(object: IPhysicsEnabledObject): Nullable<PhysicsImpostor> {
         public getImpostorForPhysicsObject(object: IPhysicsEnabledObject): Nullable<PhysicsImpostor> {
             for (var i = 0; i < this._impostors.length; ++i) {
             for (var i = 0; i < this._impostors.length; ++i) {
                 if (this._impostors[i].object === object) {
                 if (this._impostors[i].object === object) {
@@ -162,6 +198,11 @@
             return null;
             return null;
         }
         }
 
 
+        /**
+         * Gets the impostor for a physics body object
+         * @param body defines physics body used by the impostor
+         * @returns the PhysicsImpostor or null if not found
+         */        
         public getImpostorWithPhysicsBody(body: any): Nullable<PhysicsImpostor> {
         public getImpostorWithPhysicsBody(body: any): Nullable<PhysicsImpostor> {
             for (var i = 0; i < this._impostors.length; ++i) {
             for (var i = 0; i < this._impostors.length; ++i) {
                 if (this._impostors[i].physicsBody === body) {
                 if (this._impostors[i].physicsBody === body) {
@@ -171,45 +212,5 @@
 
 
             return null;
             return null;
         }
         }
-
-    }
-
-    export interface IPhysicsEnginePlugin {
-        world: any;
-        name: string;
-        setGravity(gravity: Vector3): void;
-        setTimeStep(timeStep: number): void;
-        getTimeStep(): number;
-        executeStep(delta: number, impostors: Array<PhysicsImpostor>): void; //not forgetting pre and post events
-        applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
-        applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
-        generatePhysicsBody(impostor: PhysicsImpostor): void;
-        removePhysicsBody(impostor: PhysicsImpostor): void;
-        generateJoint(joint: PhysicsImpostorJoint): void;
-        removeJoint(joint: PhysicsImpostorJoint): void;
-        isSupported(): boolean;
-        setTransformationFromPhysicsBody(impostor: PhysicsImpostor): void;
-        setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): void;
-        setLinearVelocity(impostor: PhysicsImpostor, velocity: Nullable<Vector3>): void;
-        setAngularVelocity(impostor: PhysicsImpostor, velocity: Nullable<Vector3>): void;
-        getLinearVelocity(impostor: PhysicsImpostor): Nullable<Vector3>;
-        getAngularVelocity(impostor: PhysicsImpostor): Nullable<Vector3>;
-        setBodyMass(impostor: PhysicsImpostor, mass: number): void;
-        getBodyMass(impostor: PhysicsImpostor): number;
-        getBodyFriction(impostor: PhysicsImpostor): number;
-        setBodyFriction(impostor: PhysicsImpostor, friction: number): void;
-        getBodyRestitution(impostor: PhysicsImpostor): number;
-        setBodyRestitution(impostor: PhysicsImpostor, restitution: number): void;
-        sleepBody(impostor: PhysicsImpostor): void;
-        wakeUpBody(impostor: PhysicsImpostor): void;
-        //Joint Update
-        updateDistanceJoint(joint: PhysicsJoint, maxDistance: number, minDistance?: number): void;
-        setMotor(joint: IMotorEnabledJoint, speed: number, maxForce?: number, motorIndex?: number): void;
-        setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number, motorIndex?: number): void;
-        getRadius(impostor: PhysicsImpostor): number;
-        getBoxSizeToRef(impostor: PhysicsImpostor, result: Vector3): void;
-        syncMeshWithImpostor(mesh: AbstractMesh, impostor: PhysicsImpostor): void;
-        dispose(): void;
     }
     }
-
 }
 }

+ 98 - 0
src/Physics/babylon.physicsEngineComponent.ts

@@ -0,0 +1,98 @@
+module BABYLON {
+    export interface Scene {
+        /** @hidden (Backing field) */        
+        _physicsEngine: Nullable<IPhysicsEngine>;
+
+        /**
+         * Gets the current physics engine
+         * @returns a IPhysicsEngine or null if none attached
+         */
+        getPhysicsEngine(): Nullable<IPhysicsEngine>;
+
+        /**
+         * Enables physics to the current scene
+         * @param gravity defines the scene's gravity for the physics engine
+         * @param plugin defines the physics engine to be used. defaults to OimoJS.
+         * @return a boolean indicating if the physics engine was initialized
+         */
+        enablePhysics(gravity: Nullable<Vector3>, plugin?: IPhysicsEnginePlugin): boolean;
+
+        /** 
+         * Disables and disposes the physics engine associated with the scene
+         */
+        disablePhysicsEngine(): void;
+
+        /**
+         * Gets a boolean indicating if there is an active physics engine
+         * @returns a boolean indicating if there is an active physics engine
+         */
+        isPhysicsEnabled(): boolean;   
+
+        /**
+         * Deletes a physics compound impostor
+         * @param compound defines the compound to delete
+         */
+        deleteCompoundImpostor(compound: any): void;
+    }
+
+    /** 
+     * Gets the current physics engine
+     * @returns a IPhysicsEngine or null if none attached
+     */
+    Scene.prototype.getPhysicsEngine = function(): Nullable<IPhysicsEngine> {
+        return this._physicsEngine;
+    }
+
+    /**
+     * Enables physics to the current scene
+     * @param gravity defines the scene's gravity for the physics engine
+     * @param plugin defines the physics engine to be used. defaults to OimoJS.
+     * @return a boolean indicating if the physics engine was initialized
+     */
+    Scene.prototype.enablePhysics = function(gravity: Nullable<Vector3> = null, plugin?: IPhysicsEnginePlugin): boolean {
+        if (this._physicsEngine) {
+            return true;
+        }
+
+        try {
+            this._physicsEngine = new PhysicsEngine(gravity, plugin);
+            return true;
+        } catch (e) {
+            Tools.Error(e.message);
+            return false;
+        }
+    }
+
+    /** 
+     * Disables and disposes the physics engine associated with the scene
+     */
+    Scene.prototype.disablePhysicsEngine = function(): void {
+        if (!this._physicsEngine) {
+            return;
+        }
+
+        this._physicsEngine.dispose();
+        this._physicsEngine = null;
+    }
+
+    /**
+     * Gets a boolean indicating if there is an active physics engine
+     * @returns a boolean indicating if there is an active physics engine
+     */
+    Scene.prototype.isPhysicsEnabled = function(): boolean {
+        return this._physicsEngine !== undefined;
+    }
+
+    /**
+     * Deletes a physics compound impostor
+     * @param compound defines the compound to delete
+     */
+    Scene.prototype.deleteCompoundImpostor = function(compound: any): void {
+        var mesh: AbstractMesh = compound.parts[0].mesh;
+
+        if (mesh.physicsImpostor) {
+            mesh.physicsImpostor.dispose(/*true*/);
+            mesh.physicsImpostor = null;
+        }
+    }
+}

+ 1 - 1
src/Physics/babylon.physicsHelper.ts

@@ -3,7 +3,7 @@ module BABYLON {
     export class PhysicsHelper {
     export class PhysicsHelper {
 
 
         private _scene: Scene;
         private _scene: Scene;
-        private _physicsEngine: Nullable<PhysicsEngine>;
+        private _physicsEngine: Nullable<IPhysicsEngine>;
 
 
         constructor(scene: Scene) {
         constructor(scene: Scene) {
             this._scene = scene;
             this._scene = scene;

+ 1 - 1
src/Physics/babylon.physicsImpostor.ts

@@ -36,7 +36,7 @@ module BABYLON {
 
 
         public static IDENTITY_QUATERNION = Quaternion.Identity();
         public static IDENTITY_QUATERNION = Quaternion.Identity();
 
 
-        private _physicsEngine: Nullable<PhysicsEngine>;
+        private _physicsEngine: Nullable<IPhysicsEngine>;
         //The native cannon/oimo/energy physics body object.
         //The native cannon/oimo/energy physics body object.
         private _physicsBody: any;
         private _physicsBody: any;
         private _bodyUpdateRequired: boolean = false;
         private _bodyUpdateRequired: boolean = false;

+ 3 - 65
src/babylon.scene.ts

@@ -963,7 +963,6 @@
         private _softwareSkinnedMeshes = new SmartArrayNoDuplicate<Mesh>(32);
         private _softwareSkinnedMeshes = new SmartArrayNoDuplicate<Mesh>(32);
 
 
         private _renderingManager: RenderingManager;
         private _renderingManager: RenderingManager;
-        private _physicsEngine: Nullable<PhysicsEngine>;
 
 
         /** @hidden */
         /** @hidden */
         public _activeAnimatables = new Array<Animatable>();
         public _activeAnimatables = new Array<Animatable>();
@@ -4437,7 +4436,7 @@
                     // Physics
                     // Physics
                     if (this._physicsEngine) {
                     if (this._physicsEngine) {
                         this.onBeforePhysicsObservable.notifyObservers(this);
                         this.onBeforePhysicsObservable.notifyObservers(this);
-                        this._physicsEngine._step(defaultFrameTime / 1000);
+                        this._physicsEngine.step(defaultFrameTime / 1000);
                         this.onAfterPhysicsObservable.notifyObservers(this);
                         this.onAfterPhysicsObservable.notifyObservers(this);
                     }
                     }
 
 
@@ -4462,7 +4461,7 @@
                 // Physics
                 // Physics
                 if (this._physicsEngine) {
                 if (this._physicsEngine) {
                     this.onBeforePhysicsObservable.notifyObservers(this);
                     this.onBeforePhysicsObservable.notifyObservers(this);
-                    this._physicsEngine._step(deltaTime / 1000.0);
+                    this._physicsEngine.step(deltaTime / 1000.0);
                     this.onAfterPhysicsObservable.notifyObservers(this);
                     this.onAfterPhysicsObservable.notifyObservers(this);
                 }
                 }
             }
             }
@@ -5301,68 +5300,7 @@
 
 
         // Physics
         // Physics
 
 
-        /** 
-         * Gets the current physics engine
-         * @returns a PhysicsEngine or null if none attached
-         */
-        public getPhysicsEngine(): Nullable<PhysicsEngine> {
-            return this._physicsEngine;
-        }
-
-        /**
-         * Enables physics to the current scene
-         * @param gravity defines the scene's gravity for the physics engine
-         * @param plugin defines the physics engine to be used. defaults to OimoJS.
-         * @return a boolean indicating if the physics engine was initialized
-         */
-        public enablePhysics(gravity: Nullable<Vector3> = null, plugin?: IPhysicsEnginePlugin): boolean {
-            if (this._physicsEngine) {
-                return true;
-            }
-
-            try {
-                this._physicsEngine = new PhysicsEngine(gravity, plugin);
-                return true;
-            } catch (e) {
-                Tools.Error(e.message);
-                return false;
-            }
-
-        }
-
-        /** 
-         * Disables and disposes the physics engine associated with the scene
-         */
-        public disablePhysicsEngine(): void {
-            if (!this._physicsEngine) {
-                return;
-            }
-
-            this._physicsEngine.dispose();
-            this._physicsEngine = null;
-        }
-
-        /**
-         * Gets a boolean indicating if there is an active physics engine
-         * @returns a boolean indicating if there is an active physics engine
-         */
-        public isPhysicsEnabled(): boolean {
-            return this._physicsEngine !== undefined;
-        }
-
-        /**
-         * Deletes a physics compound impostor
-         * @param compound defines the compound to delete
-         */
-        public deleteCompoundImpostor(compound: any): void {
-            var mesh: AbstractMesh = compound.parts[0].mesh;
-
-            if (mesh.physicsImpostor) {
-                mesh.physicsImpostor.dispose(/*true*/);
-                mesh.physicsImpostor = null;
-            }
-        }
-
+      
         // Misc.
         // Misc.
         /** @hidden */
         /** @hidden */
         public _rebuildGeometries(): void {
         public _rebuildGeometries(): void {