Browse Source

Adding compensateDistorsion parameter to VR cameras

David Catuhe 10 years ago
parent
commit
4243f4cd2e
65 changed files with 1002 additions and 1021 deletions
  1. 1 2
      Babylon/Actions/babylon.actionManager.js
  2. 2 1
      Babylon/Actions/babylon.interpolateValueAction.js
  3. 0 17
      Babylon/Animations/babylon.animation.js
  4. 0 1
      Babylon/Audio/babylon.analyser.js
  5. 9 3
      Babylon/Audio/babylon.sound.js
  6. 5 2
      Babylon/Cameras/VR/babylon.vrDeviceOrientationCamera.js
  7. 4 2
      Babylon/Cameras/VR/babylon.vrDeviceOrientationCamera.ts
  8. 5 3
      Babylon/Cameras/VR/babylon.webVRCamera.js
  9. 5 3
      Babylon/Cameras/VR/babylon.webVRCamera.ts
  10. 3 14
      Babylon/Cameras/babylon.arcRotateCamera.js
  11. 5 17
      Babylon/Cameras/babylon.camera.js
  12. 2 9
      Babylon/Cameras/babylon.freeCamera.js
  13. 3 1
      Babylon/Cameras/babylon.gamepadCamera.js
  14. 1 2
      Babylon/Cameras/babylon.targetCamera.js
  15. 4 4
      Babylon/Cameras/babylon.virtualJoysticksCamera.js
  16. 19 14
      Babylon/Collisions/babylon.collisionCoordinator.js
  17. 9 10
      Babylon/Collisions/babylon.collisionWorker.js
  18. 0 1
      Babylon/Culling/Octrees/babylon.octree.js
  19. 0 1
      Babylon/Culling/babylon.boundingBox.js
  20. 88 69
      Babylon/Debug/babylon.debugLayer.js
  21. 1 1
      Babylon/Debug/babylon.debugLayer.js.map
  22. 0 1
      Babylon/LensFlare/babylon.lensFlareSystem.js
  23. 1 3
      Babylon/Lights/Shadows/babylon.shadowGenerator.js
  24. 0 1
      Babylon/Lights/babylon.directionalLight.js
  25. 8 11
      Babylon/Loading/Plugins/babylon.babylonFileLoader.js
  26. 0 8
      Babylon/Materials/Textures/Procedurals/babylon.proceduralTexture.js
  27. 2 12
      Babylon/Materials/Textures/babylon.texture.js
  28. 0 8
      Babylon/Materials/babylon.shaderMaterial.js
  29. 2 18
      Babylon/Materials/babylon.standardMaterial.js
  30. 54 53
      Babylon/Math/babylon.math.js
  31. 5 4
      Babylon/Math/babylon.math.ts
  32. 2 5
      Babylon/Mesh/babylon.abstractMesh.js
  33. 7 9
      Babylon/Mesh/babylon.csg.js
  34. 2 2
      Babylon/Mesh/babylon.geometry.js
  35. 0 1
      Babylon/Mesh/babylon.instancedMesh.js
  36. 14 17
      Babylon/Mesh/babylon.mesh.js
  37. 0 15
      Babylon/Mesh/babylon.mesh.vertexData.js
  38. 7 8
      Babylon/Mesh/babylon.meshSimplification.js
  39. 0 1
      Babylon/Mesh/babylon.subMesh.js
  40. 0 1
      Babylon/Mesh/babylon.vertexBuffer.js
  41. 0 2
      Babylon/Physics/Plugins/babylon.cannonJSPlugin.js
  42. 0 2
      Babylon/Physics/Plugins/babylon.oimoJSPlugin.js
  43. 6 2
      Babylon/PostProcess/RenderPipeline/babylon.postProcessRenderPipeline.js
  44. 66 20
      Babylon/PostProcess/babylon.lensRenderingPipeline.js
  45. 63 21
      Babylon/PostProcess/babylon.ssaoRenderingPipeline.js
  46. 0 1
      Babylon/PostProcess/babylon.volumetricLightScatteringPostProcess.js
  47. 1 3
      Babylon/Rendering/babylon.boundingBoxRenderer.js
  48. 3 1
      Babylon/Rendering/babylon.outlineRenderer.js
  49. 0 1
      Babylon/Rendering/babylon.renderingGroup.js
  50. 6 4
      Babylon/Tools/babylon.database.js
  51. 13 7
      Babylon/Tools/babylon.filesInput.js
  52. 24 20
      Babylon/Tools/babylon.gamepads.js
  53. 0 1
      Babylon/Tools/babylon.sceneOptimizer.js
  54. 0 1
      Babylon/Tools/babylon.smartCollection.js
  55. 1 4
      Babylon/Tools/babylon.tools.dds.js
  56. 0 3
      Babylon/Tools/babylon.tools.js
  57. 0 3
      Babylon/Tools/babylon.tools.tga.js
  58. 2 2
      Babylon/Tools/babylon.tools.ts
  59. 22 18
      Babylon/Tools/babylon.virtualJoystick.js
  60. 9 19
      Babylon/babylon.engine.js
  61. 5 0
      Babylon/babylon.mixins.ts
  62. 3 12
      Babylon/babylon.scene.js
  63. 464 481
      babylon.2.1-beta.debug.js
  64. 23 20
      babylon.2.1-beta.js
  65. 21 18
      babylon.2.1-beta.noworker.js

+ 1 - 2
Babylon/Actions/babylon.actionManager.js

@@ -242,8 +242,7 @@ var BABYLON;
             for (var index = 0; index < this.actions.length; index++) {
             for (var index = 0; index < this.actions.length; index++) {
                 var action = this.actions[index];
                 var action = this.actions[index];
                 if (action.trigger === trigger) {
                 if (action.trigger === trigger) {
-                    if (trigger === ActionManager.OnKeyUpTrigger
-                        || trigger === ActionManager.OnKeyDownTrigger) {
+                    if (trigger === ActionManager.OnKeyUpTrigger || trigger === ActionManager.OnKeyDownTrigger) {
                         var parameter = action.getTriggerParameter();
                         var parameter = action.getTriggerParameter();
                         if (parameter) {
                         if (parameter) {
                             var unicode = evt.sourceEvent.charCode ? evt.sourceEvent.charCode : evt.sourceEvent.keyCode;
                             var unicode = evt.sourceEvent.charCode ? evt.sourceEvent.charCode : evt.sourceEvent.keyCode;

+ 2 - 1
Babylon/Actions/babylon.interpolateValueAction.js

@@ -27,7 +27,8 @@ var BABYLON;
                 {
                 {
                     frame: 0,
                     frame: 0,
                     value: this._target[this._property]
                     value: this._target[this._property]
-                }, {
+                },
+                {
                     frame: 100,
                     frame: 100,
                     value: this.value
                     value: this.value
                 }
                 }

+ 0 - 17
Babylon/Animations/babylon.animation.js

@@ -124,7 +124,6 @@ var BABYLON;
                         gradient = this._easingFunction.ease(gradient);
                         gradient = this._easingFunction.ease(gradient);
                     }
                     }
                     switch (this.dataType) {
                     switch (this.dataType) {
-                        // Float
                         case Animation.ANIMATIONTYPE_FLOAT:
                         case Animation.ANIMATIONTYPE_FLOAT:
                             switch (loopMode) {
                             switch (loopMode) {
                                 case Animation.ANIMATIONLOOPMODE_CYCLE:
                                 case Animation.ANIMATIONLOOPMODE_CYCLE:
@@ -134,7 +133,6 @@ var BABYLON;
                                     return offsetValue * repeatCount + this.floatInterpolateFunction(startValue, endValue, gradient);
                                     return offsetValue * repeatCount + this.floatInterpolateFunction(startValue, endValue, gradient);
                             }
                             }
                             break;
                             break;
-                        // Quaternion
                         case Animation.ANIMATIONTYPE_QUATERNION:
                         case Animation.ANIMATIONTYPE_QUATERNION:
                             var quaternion = null;
                             var quaternion = null;
                             switch (loopMode) {
                             switch (loopMode) {
@@ -147,7 +145,6 @@ var BABYLON;
                                     break;
                                     break;
                             }
                             }
                             return quaternion;
                             return quaternion;
-                        // Vector3
                         case Animation.ANIMATIONTYPE_VECTOR3:
                         case Animation.ANIMATIONTYPE_VECTOR3:
                             switch (loopMode) {
                             switch (loopMode) {
                                 case Animation.ANIMATIONLOOPMODE_CYCLE:
                                 case Animation.ANIMATIONLOOPMODE_CYCLE:
@@ -156,7 +153,6 @@ var BABYLON;
                                 case Animation.ANIMATIONLOOPMODE_RELATIVE:
                                 case Animation.ANIMATIONLOOPMODE_RELATIVE:
                                     return this.vector3InterpolateFunction(startValue, endValue, gradient).add(offsetValue.scale(repeatCount));
                                     return this.vector3InterpolateFunction(startValue, endValue, gradient).add(offsetValue.scale(repeatCount));
                             }
                             }
-                        // Vector2
                         case Animation.ANIMATIONTYPE_VECTOR2:
                         case Animation.ANIMATIONTYPE_VECTOR2:
                             switch (loopMode) {
                             switch (loopMode) {
                                 case Animation.ANIMATIONLOOPMODE_CYCLE:
                                 case Animation.ANIMATIONLOOPMODE_CYCLE:
@@ -165,7 +161,6 @@ var BABYLON;
                                 case Animation.ANIMATIONLOOPMODE_RELATIVE:
                                 case Animation.ANIMATIONLOOPMODE_RELATIVE:
                                     return this.vector2InterpolateFunction(startValue, endValue, gradient).add(offsetValue.scale(repeatCount));
                                     return this.vector2InterpolateFunction(startValue, endValue, gradient).add(offsetValue.scale(repeatCount));
                             }
                             }
-                        // Color3
                         case Animation.ANIMATIONTYPE_COLOR3:
                         case Animation.ANIMATIONTYPE_COLOR3:
                             switch (loopMode) {
                             switch (loopMode) {
                                 case Animation.ANIMATIONLOOPMODE_CYCLE:
                                 case Animation.ANIMATIONLOOPMODE_CYCLE:
@@ -174,12 +169,10 @@ var BABYLON;
                                 case Animation.ANIMATIONLOOPMODE_RELATIVE:
                                 case Animation.ANIMATIONLOOPMODE_RELATIVE:
                                     return this.color3InterpolateFunction(startValue, endValue, gradient).add(offsetValue.scale(repeatCount));
                                     return this.color3InterpolateFunction(startValue, endValue, gradient).add(offsetValue.scale(repeatCount));
                             }
                             }
-                        // Matrix
                         case Animation.ANIMATIONTYPE_MATRIX:
                         case Animation.ANIMATIONTYPE_MATRIX:
                             switch (loopMode) {
                             switch (loopMode) {
                                 case Animation.ANIMATIONLOOPMODE_CYCLE:
                                 case Animation.ANIMATIONLOOPMODE_CYCLE:
                                 case Animation.ANIMATIONLOOPMODE_CONSTANT:
                                 case Animation.ANIMATIONLOOPMODE_CONSTANT:
-                                // return this.matrixInterpolateFunction(startValue, endValue, gradient);
                                 case Animation.ANIMATIONLOOPMODE_RELATIVE:
                                 case Animation.ANIMATIONLOOPMODE_RELATIVE:
                                     return startValue;
                                     return startValue;
                             }
                             }
@@ -227,21 +220,16 @@ var BABYLON;
                         var fromValue = this._interpolate(from, 0, Animation.ANIMATIONLOOPMODE_CYCLE);
                         var fromValue = this._interpolate(from, 0, Animation.ANIMATIONLOOPMODE_CYCLE);
                         var toValue = this._interpolate(to, 0, Animation.ANIMATIONLOOPMODE_CYCLE);
                         var toValue = this._interpolate(to, 0, Animation.ANIMATIONLOOPMODE_CYCLE);
                         switch (this.dataType) {
                         switch (this.dataType) {
-                            // Float
                             case Animation.ANIMATIONTYPE_FLOAT:
                             case Animation.ANIMATIONTYPE_FLOAT:
                                 this._offsetsCache[keyOffset] = toValue - fromValue;
                                 this._offsetsCache[keyOffset] = toValue - fromValue;
                                 break;
                                 break;
-                            // Quaternion
                             case Animation.ANIMATIONTYPE_QUATERNION:
                             case Animation.ANIMATIONTYPE_QUATERNION:
                                 this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
                                 this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
                                 break;
                                 break;
-                            // Vector3
                             case Animation.ANIMATIONTYPE_VECTOR3:
                             case Animation.ANIMATIONTYPE_VECTOR3:
                                 this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
                                 this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
-                            // Vector2
                             case Animation.ANIMATIONTYPE_VECTOR2:
                             case Animation.ANIMATIONTYPE_VECTOR2:
                                 this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
                                 this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
-                            // Color3
                             case Animation.ANIMATIONTYPE_COLOR3:
                             case Animation.ANIMATIONTYPE_COLOR3:
                                 this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
                                 this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
                             default:
                             default:
@@ -255,23 +243,18 @@ var BABYLON;
             }
             }
             if (offsetValue === undefined) {
             if (offsetValue === undefined) {
                 switch (this.dataType) {
                 switch (this.dataType) {
-                    // Float
                     case Animation.ANIMATIONTYPE_FLOAT:
                     case Animation.ANIMATIONTYPE_FLOAT:
                         offsetValue = 0;
                         offsetValue = 0;
                         break;
                         break;
-                    // Quaternion
                     case Animation.ANIMATIONTYPE_QUATERNION:
                     case Animation.ANIMATIONTYPE_QUATERNION:
                         offsetValue = new BABYLON.Quaternion(0, 0, 0, 0);
                         offsetValue = new BABYLON.Quaternion(0, 0, 0, 0);
                         break;
                         break;
-                    // Vector3
                     case Animation.ANIMATIONTYPE_VECTOR3:
                     case Animation.ANIMATIONTYPE_VECTOR3:
                         offsetValue = BABYLON.Vector3.Zero();
                         offsetValue = BABYLON.Vector3.Zero();
                         break;
                         break;
-                    // Vector2
                     case Animation.ANIMATIONTYPE_VECTOR2:
                     case Animation.ANIMATIONTYPE_VECTOR2:
                         offsetValue = BABYLON.Vector2.Zero();
                         offsetValue = BABYLON.Vector2.Zero();
                         break;
                         break;
-                    // Color3
                     case Animation.ANIMATIONTYPE_COLOR3:
                     case Animation.ANIMATIONTYPE_COLOR3:
                         offsetValue = BABYLON.Color3.Black();
                         offsetValue = BABYLON.Color3.Black();
                 }
                 }

+ 0 - 1
Babylon/Audio/babylon.analyser.js

@@ -71,7 +71,6 @@ var BABYLON;
                     var workingArray = this.getByteFrequencyData();
                     var workingArray = this.getByteFrequencyData();
                     this._debugCanvasContext.fillStyle = 'rgb(0, 0, 0)';
                     this._debugCanvasContext.fillStyle = 'rgb(0, 0, 0)';
                     this._debugCanvasContext.fillRect(0, 0, this.DEBUGCANVASSIZE.width, this.DEBUGCANVASSIZE.height);
                     this._debugCanvasContext.fillRect(0, 0, this.DEBUGCANVASSIZE.width, this.DEBUGCANVASSIZE.height);
-                    // Draw the frequency domain chart.
                     for (var i = 0; i < this.getFrequencyBinCount(); i++) {
                     for (var i = 0; i < this.getFrequencyBinCount(); i++) {
                         var value = workingArray[i];
                         var value = workingArray[i];
                         var percent = value / this.BARGRAPHAMPLITUDE;
                         var percent = value / this.BARGRAPHAMPLITUDE;

+ 9 - 3
Babylon/Audio/babylon.sound.js

@@ -75,7 +75,9 @@ var BABYLON;
                 if (urlOrArrayBuffer) {
                 if (urlOrArrayBuffer) {
                     // If it's an URL
                     // If it's an URL
                     if (typeof (urlOrArrayBuffer) === "string") {
                     if (typeof (urlOrArrayBuffer) === "string") {
-                        BABYLON.Tools.LoadFile(urlOrArrayBuffer, function (data) { _this._soundLoaded(data); }, null, null, true);
+                        BABYLON.Tools.LoadFile(urlOrArrayBuffer, function (data) {
+                            _this._soundLoaded(data);
+                        }, null, null, true);
                     }
                     }
                     else {
                     else {
                         if (urlOrArrayBuffer instanceof ArrayBuffer) {
                         if (urlOrArrayBuffer instanceof ArrayBuffer) {
@@ -145,7 +147,9 @@ var BABYLON;
                 if (_this._readyToPlayCallback) {
                 if (_this._readyToPlayCallback) {
                     _this._readyToPlayCallback();
                     _this._readyToPlayCallback();
                 }
                 }
-            }, function (error) { BABYLON.Tools.Error("Error while decoding audio data: " + error.err); });
+            }, function (error) {
+                BABYLON.Tools.Error("Error while decoding audio data: " + error.err);
+            });
         };
         };
         Sound.prototype.setAudioBuffer = function (audioBuffer) {
         Sound.prototype.setAudioBuffer = function (audioBuffer) {
             if (BABYLON.Engine.audioEngine.canUseWebAudio) {
             if (BABYLON.Engine.audioEngine.canUseWebAudio) {
@@ -286,7 +290,9 @@ var BABYLON;
                     this._soundSource.loop = this.loop;
                     this._soundSource.loop = this.loop;
                     this._soundSource.playbackRate.value = this._playbackRate;
                     this._soundSource.playbackRate.value = this._playbackRate;
                     this._startTime = startTime;
                     this._startTime = startTime;
-                    this._soundSource.onended = function () { _this._onended(); };
+                    this._soundSource.onended = function () {
+                        _this._onended();
+                    };
                     this._soundSource.start(this._startTime, this.isPaused ? this._startOffset % this._soundSource.buffer.duration : 0);
                     this._soundSource.start(this._startTime, this.isPaused ? this._startOffset % this._soundSource.buffer.duration : 0);
                     this.isPlaying = true;
                     this.isPlaying = true;
                     this.isPaused = false;
                     this.isPaused = false;

+ 5 - 2
Babylon/Cameras/VR/babylon.vrDeviceOrientationCamera.js

@@ -8,12 +8,15 @@ var BABYLON;
 (function (BABYLON) {
 (function (BABYLON) {
     var VRDeviceOrientationFreeCamera = (function (_super) {
     var VRDeviceOrientationFreeCamera = (function (_super) {
         __extends(VRDeviceOrientationFreeCamera, _super);
         __extends(VRDeviceOrientationFreeCamera, _super);
-        function VRDeviceOrientationFreeCamera(name, position, scene) {
+        function VRDeviceOrientationFreeCamera(name, position, scene, compensateDistorsion) {
+            if (compensateDistorsion === void 0) { compensateDistorsion = true; }
             _super.call(this, name, position, scene);
             _super.call(this, name, position, scene);
             this._alpha = 0;
             this._alpha = 0;
             this._beta = 0;
             this._beta = 0;
             this._gamma = 0;
             this._gamma = 0;
-            this.setSubCameraMode(BABYLON.Camera.SUB_CAMERA_MODE_VR);
+            var metrics = BABYLON.VRCameraMetrics.GetDefault();
+            metrics.compensateDistorsion = compensateDistorsion;
+            this.setSubCameraMode(BABYLON.Camera.SUB_CAMERA_MODE_VR, 0, metrics);
             this._deviceOrientationHandler = this._onOrientationEvent.bind(this);
             this._deviceOrientationHandler = this._onOrientationEvent.bind(this);
         }
         }
         VRDeviceOrientationFreeCamera.prototype._onOrientationEvent = function (evt) {
         VRDeviceOrientationFreeCamera.prototype._onOrientationEvent = function (evt) {

+ 4 - 2
Babylon/Cameras/VR/babylon.vrDeviceOrientationCamera.ts

@@ -7,10 +7,12 @@ module BABYLON {
         private _offsetOrientation: { yaw: number; pitch: number; roll: number };
         private _offsetOrientation: { yaw: number; pitch: number; roll: number };
         private _deviceOrientationHandler;
         private _deviceOrientationHandler;
 
 
-        constructor(name: string, position: Vector3, scene: Scene) {
+        constructor(name: string, position: Vector3, scene: Scene, compensateDistorsion = true) {
             super(name, position, scene);
             super(name, position, scene);
 
 
-            this.setSubCameraMode(Camera.SUB_CAMERA_MODE_VR);
+            var metrics = VRCameraMetrics.GetDefault();
+            metrics.compensateDistorsion = compensateDistorsion;
+            this.setSubCameraMode(Camera.SUB_CAMERA_MODE_VR, 0, metrics);
 
 
             this._deviceOrientationHandler = this._onOrientationEvent.bind(this);
             this._deviceOrientationHandler = this._onOrientationEvent.bind(this);
         }
         }

+ 5 - 3
Babylon/Cameras/VR/babylon.webVRCamera.js

@@ -8,7 +8,8 @@ var BABYLON;
 (function (BABYLON) {
 (function (BABYLON) {
     var WebVRFreeCamera = (function (_super) {
     var WebVRFreeCamera = (function (_super) {
         __extends(WebVRFreeCamera, _super);
         __extends(WebVRFreeCamera, _super);
-        function WebVRFreeCamera(name, position, scene) {
+        function WebVRFreeCamera(name, position, scene, compensateDistorsion) {
+            if (compensateDistorsion === void 0) { compensateDistorsion = true; }
             _super.call(this, name, position, scene);
             _super.call(this, name, position, scene);
             this._hmdDevice = null;
             this._hmdDevice = null;
             this._sensorDevice = null;
             this._sensorDevice = null;
@@ -16,7 +17,9 @@ var BABYLON;
             this._cacheQuaternion = new BABYLON.Quaternion();
             this._cacheQuaternion = new BABYLON.Quaternion();
             this._cacheRotation = BABYLON.Vector3.Zero();
             this._cacheRotation = BABYLON.Vector3.Zero();
             this._vrEnabled = false;
             this._vrEnabled = false;
-            this.setSubCameraMode(BABYLON.Camera.SUB_CAMERA_MODE_VR);
+            var metrics = BABYLON.VRCameraMetrics.GetDefault();
+            metrics.compensateDistorsion = compensateDistorsion;
+            this.setSubCameraMode(BABYLON.Camera.SUB_CAMERA_MODE_VR, 0, metrics);
             this._getWebVRDevices = this._getWebVRDevices.bind(this);
             this._getWebVRDevices = this._getWebVRDevices.bind(this);
         }
         }
         WebVRFreeCamera.prototype._getWebVRDevices = function (devices) {
         WebVRFreeCamera.prototype._getWebVRDevices = function (devices) {
@@ -25,7 +28,6 @@ var BABYLON;
             // Reset devices.
             // Reset devices.
             this._sensorDevice = null;
             this._sensorDevice = null;
             this._hmdDevice = null;
             this._hmdDevice = null;
-            // Search for a HmdDevice.
             while (i < size && this._hmdDevice === null) {
             while (i < size && this._hmdDevice === null) {
                 if (devices[i] instanceof HMDVRDevice) {
                 if (devices[i] instanceof HMDVRDevice) {
                     this._hmdDevice = devices[i];
                     this._hmdDevice = devices[i];

+ 5 - 3
Babylon/Cameras/VR/babylon.webVRCamera.ts

@@ -10,10 +10,12 @@ module BABYLON {
         public _cacheRotation = Vector3.Zero();
         public _cacheRotation = Vector3.Zero();
         public _vrEnabled = false;
         public _vrEnabled = false;
 
 
-        constructor(name: string, position: Vector3, scene: Scene) {
+        constructor(name: string, position: Vector3, scene: Scene, compensateDistorsion = true) {
             super(name, position, scene);
             super(name, position, scene);
-
-            this.setSubCameraMode(Camera.SUB_CAMERA_MODE_VR);
+            
+            var metrics = VRCameraMetrics.GetDefault();
+            metrics.compensateDistorsion = compensateDistorsion;
+            this.setSubCameraMode(Camera.SUB_CAMERA_MODE_VR, 0, metrics);
 
 
             this._getWebVRDevices = this._getWebVRDevices.bind(this);
             this._getWebVRDevices = this._getWebVRDevices.bind(this);
         }
         }

+ 3 - 14
Babylon/Cameras/babylon.arcRotateCamera.js

@@ -89,11 +89,7 @@ var BABYLON;
         ArcRotateCamera.prototype._isSynchronizedViewMatrix = function () {
         ArcRotateCamera.prototype._isSynchronizedViewMatrix = function () {
             if (!_super.prototype._isSynchronizedViewMatrix.call(this))
             if (!_super.prototype._isSynchronizedViewMatrix.call(this))
                 return false;
                 return false;
-            return this._cache.target.equals(this._getTargetPosition())
-                && this._cache.alpha === this.alpha
-                && this._cache.beta === this.beta
-                && this._cache.radius === this.radius
-                && this._cache.targetScreenOffset.equals(this.targetScreenOffset);
+            return this._cache.target.equals(this._getTargetPosition()) && this._cache.alpha === this.alpha && this._cache.beta === this.beta && this._cache.radius === this.radius && this._cache.targetScreenOffset.equals(this.targetScreenOffset);
         };
         };
         // Methods
         // Methods
         ArcRotateCamera.prototype.attachControl = function (element, noPreventDefault) {
         ArcRotateCamera.prototype.attachControl = function (element, noPreventDefault) {
@@ -192,10 +188,7 @@ var BABYLON;
                     }
                     }
                 };
                 };
                 this._onKeyDown = function (evt) {
                 this._onKeyDown = function (evt) {
-                    if (_this.keysUp.indexOf(evt.keyCode) !== -1 ||
-                        _this.keysDown.indexOf(evt.keyCode) !== -1 ||
-                        _this.keysLeft.indexOf(evt.keyCode) !== -1 ||
-                        _this.keysRight.indexOf(evt.keyCode) !== -1) {
+                    if (_this.keysUp.indexOf(evt.keyCode) !== -1 || _this.keysDown.indexOf(evt.keyCode) !== -1 || _this.keysLeft.indexOf(evt.keyCode) !== -1 || _this.keysRight.indexOf(evt.keyCode) !== -1) {
                         var index = _this._keys.indexOf(evt.keyCode);
                         var index = _this._keys.indexOf(evt.keyCode);
                         if (index === -1) {
                         if (index === -1) {
                             _this._keys.push(evt.keyCode);
                             _this._keys.push(evt.keyCode);
@@ -208,10 +201,7 @@ var BABYLON;
                     }
                     }
                 };
                 };
                 this._onKeyUp = function (evt) {
                 this._onKeyUp = function (evt) {
-                    if (_this.keysUp.indexOf(evt.keyCode) !== -1 ||
-                        _this.keysDown.indexOf(evt.keyCode) !== -1 ||
-                        _this.keysLeft.indexOf(evt.keyCode) !== -1 ||
-                        _this.keysRight.indexOf(evt.keyCode) !== -1) {
+                    if (_this.keysUp.indexOf(evt.keyCode) !== -1 || _this.keysDown.indexOf(evt.keyCode) !== -1 || _this.keysLeft.indexOf(evt.keyCode) !== -1 || _this.keysRight.indexOf(evt.keyCode) !== -1) {
                         var index = _this._keys.indexOf(evt.keyCode);
                         var index = _this._keys.indexOf(evt.keyCode);
                         if (index >= 0) {
                         if (index >= 0) {
                             _this._keys.splice(index, 1);
                             _this._keys.splice(index, 1);
@@ -302,7 +292,6 @@ var BABYLON;
             if (this._collisionTriggered) {
             if (this._collisionTriggered) {
                 return;
                 return;
             }
             }
-            // Keyboard
             for (var index = 0; index < this._keys.length; index++) {
             for (var index = 0; index < this._keys.length; index++) {
                 var keyCode = this._keys[index];
                 var keyCode = this._keys[index];
                 if (this.keysLeft.indexOf(keyCode) !== -1) {
                 if (this.keysLeft.indexOf(keyCode) !== -1) {

+ 5 - 17
Babylon/Cameras/babylon.camera.js

@@ -62,8 +62,7 @@ var BABYLON;
             result.vResolution = 800;
             result.vResolution = 800;
             result.hScreenSize = 0.149759993;
             result.hScreenSize = 0.149759993;
             result.vScreenSize = 0.0935999975;
             result.vScreenSize = 0.0935999975;
-            result.vScreenCenter = 0.0467999987,
-                result.eyeToScreenDistance = 0.0410000011;
+            result.vScreenCenter = 0.0467999987, result.eyeToScreenDistance = 0.0410000011;
             result.lensSeparationDistance = 0.0635000020;
             result.lensSeparationDistance = 0.0635000020;
             result.interpupillaryDistance = 0.0640000030;
             result.interpupillaryDistance = 0.0640000030;
             result.distortionK = [1.0, 0.219999999, 0.239999995, 0.0];
             result.distortionK = [1.0, 0.219999999, 0.239999995, 0.0];
@@ -247,29 +246,19 @@ var BABYLON;
         Camera.prototype._isSynchronizedViewMatrix = function () {
         Camera.prototype._isSynchronizedViewMatrix = function () {
             if (!_super.prototype._isSynchronized.call(this))
             if (!_super.prototype._isSynchronized.call(this))
                 return false;
                 return false;
-            return this._cache.position.equals(this.position)
-                && this._cache.upVector.equals(this.upVector)
-                && this.isSynchronizedWithParent();
+            return this._cache.position.equals(this.position) && this._cache.upVector.equals(this.upVector) && this.isSynchronizedWithParent();
         };
         };
         Camera.prototype._isSynchronizedProjectionMatrix = function () {
         Camera.prototype._isSynchronizedProjectionMatrix = function () {
-            var check = this._cache.mode === this.mode
-                && this._cache.minZ === this.minZ
-                && this._cache.maxZ === this.maxZ;
+            var check = this._cache.mode === this.mode && this._cache.minZ === this.minZ && this._cache.maxZ === this.maxZ;
             if (!check) {
             if (!check) {
                 return false;
                 return false;
             }
             }
             var engine = this.getEngine();
             var engine = this.getEngine();
             if (this.mode === Camera.PERSPECTIVE_CAMERA) {
             if (this.mode === Camera.PERSPECTIVE_CAMERA) {
-                check = this._cache.fov === this.fov
-                    && this._cache.aspectRatio === engine.getAspectRatio(this);
+                check = this._cache.fov === this.fov && this._cache.aspectRatio === engine.getAspectRatio(this);
             }
             }
             else {
             else {
-                check = this._cache.orthoLeft === this.orthoLeft
-                    && this._cache.orthoRight === this.orthoRight
-                    && this._cache.orthoBottom === this.orthoBottom
-                    && this._cache.orthoTop === this.orthoTop
-                    && this._cache.renderWidth === engine.getRenderWidth()
-                    && this._cache.renderHeight === engine.getRenderHeight();
+                check = this._cache.orthoLeft === this.orthoLeft && this._cache.orthoRight === this.orthoRight && this._cache.orthoBottom === this.orthoBottom && this._cache.orthoTop === this.orthoTop && this._cache.renderWidth === engine.getRenderWidth() && this._cache.renderHeight === engine.getRenderHeight();
             }
             }
             return check;
             return check;
         };
         };
@@ -415,7 +404,6 @@ var BABYLON;
             while (this.subCameras.length > 0) {
             while (this.subCameras.length > 0) {
                 this.subCameras.pop().dispose();
                 this.subCameras.pop().dispose();
             }
             }
-            // Postprocesses
             for (var i = 0; i < this._postProcessesTakenIndices.length; ++i) {
             for (var i = 0; i < this._postProcessesTakenIndices.length; ++i) {
                 this._postProcesses[this._postProcessesTakenIndices[i]].dispose(this);
                 this._postProcesses[this._postProcessesTakenIndices[i]].dispose(this);
             }
             }

+ 2 - 9
Babylon/Cameras/babylon.freeCamera.js

@@ -101,10 +101,7 @@ var BABYLON;
                     }
                     }
                 };
                 };
                 this._onKeyDown = function (evt) {
                 this._onKeyDown = function (evt) {
-                    if (_this.keysUp.indexOf(evt.keyCode) !== -1 ||
-                        _this.keysDown.indexOf(evt.keyCode) !== -1 ||
-                        _this.keysLeft.indexOf(evt.keyCode) !== -1 ||
-                        _this.keysRight.indexOf(evt.keyCode) !== -1) {
+                    if (_this.keysUp.indexOf(evt.keyCode) !== -1 || _this.keysDown.indexOf(evt.keyCode) !== -1 || _this.keysLeft.indexOf(evt.keyCode) !== -1 || _this.keysRight.indexOf(evt.keyCode) !== -1) {
                         var index = _this._keys.indexOf(evt.keyCode);
                         var index = _this._keys.indexOf(evt.keyCode);
                         if (index === -1) {
                         if (index === -1) {
                             _this._keys.push(evt.keyCode);
                             _this._keys.push(evt.keyCode);
@@ -115,10 +112,7 @@ var BABYLON;
                     }
                     }
                 };
                 };
                 this._onKeyUp = function (evt) {
                 this._onKeyUp = function (evt) {
-                    if (_this.keysUp.indexOf(evt.keyCode) !== -1 ||
-                        _this.keysDown.indexOf(evt.keyCode) !== -1 ||
-                        _this.keysLeft.indexOf(evt.keyCode) !== -1 ||
-                        _this.keysRight.indexOf(evt.keyCode) !== -1) {
+                    if (_this.keysUp.indexOf(evt.keyCode) !== -1 || _this.keysDown.indexOf(evt.keyCode) !== -1 || _this.keysLeft.indexOf(evt.keyCode) !== -1 || _this.keysRight.indexOf(evt.keyCode) !== -1) {
                         var index = _this._keys.indexOf(evt.keyCode);
                         var index = _this._keys.indexOf(evt.keyCode);
                         if (index >= 0) {
                         if (index >= 0) {
                             _this._keys.splice(index, 1);
                             _this._keys.splice(index, 1);
@@ -187,7 +181,6 @@ var BABYLON;
                 this._localDirection = BABYLON.Vector3.Zero();
                 this._localDirection = BABYLON.Vector3.Zero();
                 this._transformedDirection = BABYLON.Vector3.Zero();
                 this._transformedDirection = BABYLON.Vector3.Zero();
             }
             }
-            // Keyboard
             for (var index = 0; index < this._keys.length; index++) {
             for (var index = 0; index < this._keys.length; index++) {
                 var keyCode = this._keys[index];
                 var keyCode = this._keys[index];
                 var speed = this._computeLocalCameraSpeed();
                 var speed = this._computeLocalCameraSpeed();

+ 3 - 1
Babylon/Cameras/babylon.gamepadCamera.js

@@ -14,7 +14,9 @@ var BABYLON;
             _super.call(this, name, position, scene);
             _super.call(this, name, position, scene);
             this.angularSensibility = 200;
             this.angularSensibility = 200;
             this.moveSensibility = 75;
             this.moveSensibility = 75;
-            this._gamepads = new BABYLON.Gamepads(function (gamepad) { _this._onNewGameConnected(gamepad); });
+            this._gamepads = new BABYLON.Gamepads(function (gamepad) {
+                _this._onNewGameConnected(gamepad);
+            });
         }
         }
         GamepadCamera.prototype._onNewGameConnected = function (gamepad) {
         GamepadCamera.prototype._onNewGameConnected = function (gamepad) {
             // Only the first gamepad can control the camera
             // Only the first gamepad can control the camera

+ 1 - 2
Babylon/Cameras/babylon.targetCamera.js

@@ -62,8 +62,7 @@ var BABYLON;
                 return false;
                 return false;
             }
             }
             var lockedTargetPosition = this._getLockedTargetPosition();
             var lockedTargetPosition = this._getLockedTargetPosition();
-            return (this._cache.lockedTarget ? this._cache.lockedTarget.equals(lockedTargetPosition) : !lockedTargetPosition)
-                && this._cache.rotation.equals(this.rotation);
+            return (this._cache.lockedTarget ? this._cache.lockedTarget.equals(lockedTargetPosition) : !lockedTargetPosition) && this._cache.rotation.equals(this.rotation);
         };
         };
         // Methods
         // Methods
         TargetCamera.prototype._computeLocalCameraSpeed = function () {
         TargetCamera.prototype._computeLocalCameraSpeed = function () {

+ 4 - 4
Babylon/Cameras/babylon.virtualJoysticksCamera.js

@@ -12,12 +12,12 @@ var BABYLON;
         function VirtualJoysticksCamera(name, position, scene) {
         function VirtualJoysticksCamera(name, position, scene) {
             _super.call(this, name, position, scene);
             _super.call(this, name, position, scene);
             this._leftjoystick = new BABYLON.VirtualJoystick(true);
             this._leftjoystick = new BABYLON.VirtualJoystick(true);
-            this._leftjoystick.setAxisForUpDown(BABYLON.JoystickAxis.Z);
-            this._leftjoystick.setAxisForLeftRight(BABYLON.JoystickAxis.X);
+            this._leftjoystick.setAxisForUpDown(2 /* Z */);
+            this._leftjoystick.setAxisForLeftRight(0 /* X */);
             this._leftjoystick.setJoystickSensibility(0.15);
             this._leftjoystick.setJoystickSensibility(0.15);
             this._rightjoystick = new BABYLON.VirtualJoystick(false);
             this._rightjoystick = new BABYLON.VirtualJoystick(false);
-            this._rightjoystick.setAxisForUpDown(BABYLON.JoystickAxis.X);
-            this._rightjoystick.setAxisForLeftRight(BABYLON.JoystickAxis.Y);
+            this._rightjoystick.setAxisForUpDown(0 /* X */);
+            this._rightjoystick.setAxisForLeftRight(1 /* Y */);
             this._rightjoystick.reverseUpDown = true;
             this._rightjoystick.reverseUpDown = true;
             this._rightjoystick.setJoystickSensibility(0.05);
             this._rightjoystick.setJoystickSensibility(0.05);
             this._rightjoystick.setJoystickColor("yellow");
             this._rightjoystick.setJoystickColor("yellow");

+ 19 - 14
Babylon/Collisions/babylon.collisionCoordinator.js

@@ -44,7 +44,7 @@ var BABYLON;
                 };
                 };
                 var message = {
                 var message = {
                     payload: payload,
                     payload: payload,
-                    taskType: WorkerTaskType.UPDATE
+                    taskType: 1 /* UPDATE */
                 };
                 };
                 var serializable = [];
                 var serializable = [];
                 for (var id in payload.updatedGeometries) {
                 for (var id in payload.updatedGeometries) {
@@ -63,13 +63,13 @@ var BABYLON;
             };
             };
             this._onMessageFromWorker = function (e) {
             this._onMessageFromWorker = function (e) {
                 var returnData = e.data;
                 var returnData = e.data;
-                if (returnData.error != WorkerReplyType.SUCCESS) {
+                if (returnData.error != 0 /* SUCCESS */) {
                     //TODO what errors can be returned from the worker?
                     //TODO what errors can be returned from the worker?
                     BABYLON.Tools.Warn("error returned from worker!");
                     BABYLON.Tools.Warn("error returned from worker!");
                     return;
                     return;
                 }
                 }
                 switch (returnData.taskType) {
                 switch (returnData.taskType) {
-                    case WorkerTaskType.INIT:
+                    case 0 /* INIT */:
                         _this._init = true;
                         _this._init = true;
                         //Update the worked with ALL of the scene's current state
                         //Update the worked with ALL of the scene's current state
                         _this._scene.meshes.forEach(function (mesh) {
                         _this._scene.meshes.forEach(function (mesh) {
@@ -79,10 +79,10 @@ var BABYLON;
                             _this.onGeometryAdded(geometry);
                             _this.onGeometryAdded(geometry);
                         });
                         });
                         break;
                         break;
-                    case WorkerTaskType.UPDATE:
+                    case 1 /* UPDATE */:
                         _this._runningUpdated--;
                         _this._runningUpdated--;
                         break;
                         break;
-                    case WorkerTaskType.COLLIDE:
+                    case 2 /* COLLIDE */:
                         _this._runningCollisionTask = false;
                         _this._runningCollisionTask = false;
                         var returnPayload = returnData.payload;
                         var returnPayload = returnData.payload;
                         if (!_this._collisionsCallbackArray[returnPayload.collisionId])
                         if (!_this._collisionsCallbackArray[returnPayload.collisionId])
@@ -122,7 +122,7 @@ var BABYLON;
             };
             };
             var message = {
             var message = {
                 payload: payload,
                 payload: payload,
-                taskType: WorkerTaskType.COLLIDE
+                taskType: 2 /* COLLIDE */
             };
             };
             this._worker.postMessage(message);
             this._worker.postMessage(message);
         };
         };
@@ -134,7 +134,7 @@ var BABYLON;
             this._worker.onmessage = this._onMessageFromWorker;
             this._worker.onmessage = this._onMessageFromWorker;
             var message = {
             var message = {
                 payload: {},
                 payload: {},
-                taskType: WorkerTaskType.INIT
+                taskType: 0 /* INIT */
             };
             };
             this._worker.postMessage(message);
             this._worker.postMessage(message);
         };
         };
@@ -225,12 +225,18 @@ var BABYLON;
             //Legacy need no destruction method.
             //Legacy need no destruction method.
         };
         };
         //No update in legacy mode
         //No update in legacy mode
-        CollisionCoordinatorLegacy.prototype.onMeshAdded = function (mesh) { };
-        CollisionCoordinatorLegacy.prototype.onMeshUpdated = function (mesh) { };
-        CollisionCoordinatorLegacy.prototype.onMeshRemoved = function (mesh) { };
-        CollisionCoordinatorLegacy.prototype.onGeometryAdded = function (geometry) { };
-        CollisionCoordinatorLegacy.prototype.onGeometryUpdated = function (geometry) { };
-        CollisionCoordinatorLegacy.prototype.onGeometryDeleted = function (geometry) { };
+        CollisionCoordinatorLegacy.prototype.onMeshAdded = function (mesh) {
+        };
+        CollisionCoordinatorLegacy.prototype.onMeshUpdated = function (mesh) {
+        };
+        CollisionCoordinatorLegacy.prototype.onMeshRemoved = function (mesh) {
+        };
+        CollisionCoordinatorLegacy.prototype.onGeometryAdded = function (geometry) {
+        };
+        CollisionCoordinatorLegacy.prototype.onGeometryUpdated = function (geometry) {
+        };
+        CollisionCoordinatorLegacy.prototype.onGeometryDeleted = function (geometry) {
+        };
         CollisionCoordinatorLegacy.prototype._collideWithWorld = function (position, velocity, collider, maximumRetry, finalPosition, excludedMesh) {
         CollisionCoordinatorLegacy.prototype._collideWithWorld = function (position, velocity, collider, maximumRetry, finalPosition, excludedMesh) {
             if (excludedMesh === void 0) { excludedMesh = null; }
             if (excludedMesh === void 0) { excludedMesh = null; }
             var closeDistance = BABYLON.Engine.CollisionsEpsilon * 10.0;
             var closeDistance = BABYLON.Engine.CollisionsEpsilon * 10.0;
@@ -239,7 +245,6 @@ var BABYLON;
                 return;
                 return;
             }
             }
             collider._initialize(position, velocity, closeDistance);
             collider._initialize(position, velocity, closeDistance);
-            // Check all meshes
             for (var index = 0; index < this._scene.meshes.length; index++) {
             for (var index = 0; index < this._scene.meshes.length; index++) {
                 var mesh = this._scene.meshes[index];
                 var mesh = this._scene.meshes[index];
                 if (mesh.isEnabled() && mesh.checkCollisions && mesh.subMeshes && mesh !== excludedMesh) {
                 if (mesh.isEnabled() && mesh.checkCollisions && mesh.subMeshes && mesh !== excludedMesh) {

+ 9 - 10
Babylon/Collisions/babylon.collisionWorker.js

@@ -147,8 +147,8 @@ var BABYLON;
         CollisionDetectorTransferable.prototype.onInit = function (payload) {
         CollisionDetectorTransferable.prototype.onInit = function (payload) {
             this._collisionCache = new CollisionCache();
             this._collisionCache = new CollisionCache();
             var reply = {
             var reply = {
-                error: BABYLON.WorkerReplyType.SUCCESS,
-                taskType: BABYLON.WorkerTaskType.INIT
+                error: 0 /* SUCCESS */,
+                taskType: 0 /* INIT */
             };
             };
             postMessage(reply, undefined);
             postMessage(reply, undefined);
         };
         };
@@ -164,8 +164,8 @@ var BABYLON;
                 }
                 }
             }
             }
             var replay = {
             var replay = {
-                error: BABYLON.WorkerReplyType.SUCCESS,
-                taskType: BABYLON.WorkerTaskType.UPDATE
+                error: 0 /* SUCCESS */,
+                taskType: 1 /* UPDATE */
             };
             };
             postMessage(replay, undefined);
             postMessage(replay, undefined);
         };
         };
@@ -182,8 +182,8 @@ var BABYLON;
                 newPosition: finalPosition.asArray()
                 newPosition: finalPosition.asArray()
             };
             };
             var reply = {
             var reply = {
-                error: BABYLON.WorkerReplyType.SUCCESS,
-                taskType: BABYLON.WorkerTaskType.COLLIDE,
+                error: 0 /* SUCCESS */,
+                taskType: 2 /* COLLIDE */,
                 payload: replyPayload
                 payload: replyPayload
             };
             };
             postMessage(reply, undefined);
             postMessage(reply, undefined);
@@ -191,7 +191,6 @@ var BABYLON;
         return CollisionDetectorTransferable;
         return CollisionDetectorTransferable;
     })();
     })();
     BABYLON.CollisionDetectorTransferable = CollisionDetectorTransferable;
     BABYLON.CollisionDetectorTransferable = CollisionDetectorTransferable;
-    //check if we are in a web worker, as this code should NOT run on the main UI thread
     try {
     try {
         if (self && self instanceof WorkerGlobalScope) {
         if (self && self instanceof WorkerGlobalScope) {
             //Window hack to allow including babylonjs native code. the <any> is for typescript.
             //Window hack to allow including babylonjs native code. the <any> is for typescript.
@@ -206,13 +205,13 @@ var BABYLON;
             var onNewMessage = function (event) {
             var onNewMessage = function (event) {
                 var message = event.data;
                 var message = event.data;
                 switch (message.taskType) {
                 switch (message.taskType) {
-                    case BABYLON.WorkerTaskType.INIT:
+                    case 0 /* INIT */:
                         collisionDetector.onInit(message.payload);
                         collisionDetector.onInit(message.payload);
                         break;
                         break;
-                    case BABYLON.WorkerTaskType.COLLIDE:
+                    case 2 /* COLLIDE */:
                         collisionDetector.onCollision(message.payload);
                         collisionDetector.onCollision(message.payload);
                         break;
                         break;
-                    case BABYLON.WorkerTaskType.UPDATE:
+                    case 1 /* UPDATE */:
                         collisionDetector.onUpdate(message.payload);
                         collisionDetector.onUpdate(message.payload);
                         break;
                         break;
                 }
                 }

+ 0 - 1
Babylon/Culling/Octrees/babylon.octree.js

@@ -59,7 +59,6 @@ var BABYLON;
         Octree._CreateBlocks = function (worldMin, worldMax, entries, maxBlockCapacity, currentDepth, maxDepth, target, creationFunc) {
         Octree._CreateBlocks = function (worldMin, worldMax, entries, maxBlockCapacity, currentDepth, maxDepth, target, creationFunc) {
             target.blocks = new Array();
             target.blocks = new Array();
             var blockSize = new BABYLON.Vector3((worldMax.x - worldMin.x) / 2, (worldMax.y - worldMin.y) / 2, (worldMax.z - worldMin.z) / 2);
             var blockSize = new BABYLON.Vector3((worldMax.x - worldMin.x) / 2, (worldMax.y - worldMin.y) / 2, (worldMax.z - worldMin.z) / 2);
-            // Segmenting space
             for (var x = 0; x < 2; x++) {
             for (var x = 0; x < 2; x++) {
                 for (var y = 0; y < 2; y++) {
                 for (var y = 0; y < 2; y++) {
                     for (var z = 0; z < 2; z++) {
                     for (var z = 0; z < 2; z++) {

+ 0 - 1
Babylon/Culling/babylon.boundingBox.js

@@ -25,7 +25,6 @@ var BABYLON;
             this.center = this.maximum.add(this.minimum).scale(0.5);
             this.center = this.maximum.add(this.minimum).scale(0.5);
             this.extendSize = this.maximum.subtract(this.minimum).scale(0.5);
             this.extendSize = this.maximum.subtract(this.minimum).scale(0.5);
             this.directions = [BABYLON.Vector3.Zero(), BABYLON.Vector3.Zero(), BABYLON.Vector3.Zero()];
             this.directions = [BABYLON.Vector3.Zero(), BABYLON.Vector3.Zero(), BABYLON.Vector3.Zero()];
-            // World
             for (var index = 0; index < this.vectors.length; index++) {
             for (var index = 0; index < this.vectors.length; index++) {
                 this.vectorsWorld[index] = BABYLON.Vector3.Zero();
                 this.vectorsWorld[index] = BABYLON.Vector3.Zero();
             }
             }

File diff suppressed because it is too large
+ 88 - 69
Babylon/Debug/babylon.debugLayer.js


File diff suppressed because it is too large
+ 1 - 1
Babylon/Debug/babylon.debugLayer.js.map


+ 0 - 1
Babylon/LensFlare/babylon.lensFlareSystem.js

@@ -134,7 +134,6 @@ var BABYLON;
             engine.setAlphaMode(BABYLON.Engine.ALPHA_ADD);
             engine.setAlphaMode(BABYLON.Engine.ALPHA_ADD);
             // VBOs
             // VBOs
             engine.bindBuffers(this._vertexBuffer, this._indexBuffer, this._vertexDeclaration, this._vertexStrideSize, this._effect);
             engine.bindBuffers(this._vertexBuffer, this._indexBuffer, this._vertexDeclaration, this._vertexStrideSize, this._effect);
-            // Flares
             for (var index = 0; index < this.lensFlares.length; index++) {
             for (var index = 0; index < this.lensFlares.length; index++) {
                 var flare = this.lensFlares[index];
                 var flare = this.lensFlares[index];
                 var x = centerX - (distX * flare.position);
                 var x = centerX - (distX * flare.position);

+ 1 - 3
Babylon/Lights/Shadows/babylon.shadowGenerator.js

@@ -194,9 +194,7 @@ var BABYLON;
         });
         });
         Object.defineProperty(ShadowGenerator.prototype, "usePoissonSampling", {
         Object.defineProperty(ShadowGenerator.prototype, "usePoissonSampling", {
             get: function () {
             get: function () {
-                return this.filter === ShadowGenerator.FILTER_POISSONSAMPLING ||
-                    (!this._light.supportsVSM() && (this.filter === ShadowGenerator.FILTER_VARIANCESHADOWMAP ||
-                        this.filter === ShadowGenerator.FILTER_BLURVARIANCESHADOWMAP));
+                return this.filter === ShadowGenerator.FILTER_POISSONSAMPLING || (!this._light.supportsVSM() && (this.filter === ShadowGenerator.FILTER_VARIANCESHADOWMAP || this.filter === ShadowGenerator.FILTER_BLURVARIANCESHADOWMAP));
             },
             },
             set: function (value) {
             set: function (value) {
                 this.filter = (value ? ShadowGenerator.FILTER_POISSONSAMPLING : ShadowGenerator.FILTER_NONE);
                 this.filter = (value ? ShadowGenerator.FILTER_POISSONSAMPLING : ShadowGenerator.FILTER_NONE);

+ 0 - 1
Babylon/Lights/babylon.directionalLight.js

@@ -28,7 +28,6 @@ var BABYLON;
             var orthoBottom = Number.MAX_VALUE;
             var orthoBottom = Number.MAX_VALUE;
             var tempVector3 = BABYLON.Vector3.Zero();
             var tempVector3 = BABYLON.Vector3.Zero();
             var activeCamera = this.getScene().activeCamera;
             var activeCamera = this.getScene().activeCamera;
-            // Check extends
             for (var meshIndex = 0; meshIndex < renderList.length; meshIndex++) {
             for (var meshIndex = 0; meshIndex < renderList.length; meshIndex++) {
                 var mesh = renderList[meshIndex];
                 var mesh = renderList[meshIndex];
                 if (!mesh) {
                 if (!mesh) {

+ 8 - 11
Babylon/Loading/Plugins/babylon.babylonFileLoader.js

@@ -677,7 +677,6 @@ var BABYLON;
                 }
                 }
                 var effectiveTarget = propertyPath.split(".");
                 var effectiveTarget = propertyPath.split(".");
                 var values = value.split(",");
                 var values = value.split(",");
-                // Get effective Target
                 for (var i = 0; i < effectiveTarget.length; i++) {
                 for (var i = 0; i < effectiveTarget.length; i++) {
                     target = target[effectiveTarget[i]];
                     target = target[effectiveTarget[i]];
                 }
                 }
@@ -780,7 +779,6 @@ var BABYLON;
                 for (var i = 0; i < parsedAction.children.length; i++)
                 for (var i = 0; i < parsedAction.children.length; i++)
                     traverse(parsedAction.children[i], trigger, condition, newAction, null);
                     traverse(parsedAction.children[i], trigger, condition, newAction, null);
             };
             };
-            // triggers
             for (var i = 0; i < parsedActions.children.length; i++) {
             for (var i = 0; i < parsedActions.children.length; i++) {
                 var triggerParams;
                 var triggerParams;
                 var trigger = parsedActions.children[i];
                 var trigger = parsedActions.children[i];
@@ -801,14 +799,19 @@ var BABYLON;
             var soundName = parsedSound.name;
             var soundName = parsedSound.name;
             var soundUrl = rootUrl + soundName;
             var soundUrl = rootUrl + soundName;
             var options = {
             var options = {
-                autoplay: parsedSound.autoplay, loop: parsedSound.loop, volume: parsedSound.volume,
-                spatialSound: parsedSound.spatialSound, maxDistance: parsedSound.maxDistance,
+                autoplay: parsedSound.autoplay,
+                loop: parsedSound.loop,
+                volume: parsedSound.volume,
+                spatialSound: parsedSound.spatialSound,
+                maxDistance: parsedSound.maxDistance,
                 rolloffFactor: parsedSound.rolloffFactor,
                 rolloffFactor: parsedSound.rolloffFactor,
                 refDistance: parsedSound.refDistance,
                 refDistance: parsedSound.refDistance,
                 distanceModel: parsedSound.distanceModel,
                 distanceModel: parsedSound.distanceModel,
                 playbackRate: parsedSound.playbackRate
                 playbackRate: parsedSound.playbackRate
             };
             };
-            var newSound = new BABYLON.Sound(soundName, soundUrl, scene, function () { scene._removePendingData(newSound); }, options);
+            var newSound = new BABYLON.Sound(soundName, soundUrl, scene, function () {
+                scene._removePendingData(newSound);
+            }, options);
             scene._addPendingData(newSound);
             scene._addPendingData(newSound);
             if (parsedSound.position) {
             if (parsedSound.position) {
                 var soundPosition = BABYLON.Vector3.FromArray(parsedSound.position);
                 var soundPosition = BABYLON.Vector3.FromArray(parsedSound.position);
@@ -1098,7 +1101,6 @@ var BABYLON;
                         meshes.push(mesh);
                         meshes.push(mesh);
                     }
                     }
                 }
                 }
-                // Connecting parents
                 for (index = 0; index < scene.meshes.length; index++) {
                 for (index = 0; index < scene.meshes.length; index++) {
                     var currentMesh = scene.meshes[index];
                     var currentMesh = scene.meshes[index];
                     if (currentMesh._waitingParentId) {
                     if (currentMesh._waitingParentId) {
@@ -1133,7 +1135,6 @@ var BABYLON;
                     scene.fogEnd = parsedData.fogEnd;
                     scene.fogEnd = parsedData.fogEnd;
                     scene.fogDensity = parsedData.fogDensity;
                     scene.fogDensity = parsedData.fogDensity;
                 }
                 }
-                // Lights
                 for (var index = 0; index < parsedData.lights.length; index++) {
                 for (var index = 0; index < parsedData.lights.length; index++) {
                     var parsedLight = parsedData.lights[index];
                     var parsedLight = parsedData.lights[index];
                     parseLight(parsedLight, scene);
                     parseLight(parsedLight, scene);
@@ -1226,12 +1227,10 @@ var BABYLON;
                         }
                         }
                     }
                     }
                 }
                 }
-                // Meshes
                 for (index = 0; index < parsedData.meshes.length; index++) {
                 for (index = 0; index < parsedData.meshes.length; index++) {
                     var parsedMesh = parsedData.meshes[index];
                     var parsedMesh = parsedData.meshes[index];
                     parseMesh(parsedMesh, scene, rootUrl);
                     parseMesh(parsedMesh, scene, rootUrl);
                 }
                 }
-                // Cameras
                 for (index = 0; index < parsedData.cameras.length; index++) {
                 for (index = 0; index < parsedData.cameras.length; index++) {
                     var parsedCamera = parsedData.cameras[index];
                     var parsedCamera = parsedData.cameras[index];
                     parseCamera(parsedCamera, scene);
                     parseCamera(parsedCamera, scene);
@@ -1239,7 +1238,6 @@ var BABYLON;
                 if (parsedData.activeCameraID) {
                 if (parsedData.activeCameraID) {
                     scene.setActiveCameraByID(parsedData.activeCameraID);
                     scene.setActiveCameraByID(parsedData.activeCameraID);
                 }
                 }
-                // Browsing all the graph to connect the dots
                 for (index = 0; index < scene.cameras.length; index++) {
                 for (index = 0; index < scene.cameras.length; index++) {
                     var camera = scene.cameras[index];
                     var camera = scene.cameras[index];
                     if (camera._waitingParentId) {
                     if (camera._waitingParentId) {
@@ -1266,7 +1264,6 @@ var BABYLON;
                         }
                         }
                     }
                     }
                 }
                 }
-                // Connect parents & children and parse actions
                 for (index = 0; index < scene.meshes.length; index++) {
                 for (index = 0; index < scene.meshes.length; index++) {
                     var mesh = scene.meshes[index];
                     var mesh = scene.meshes[index];
                     if (mesh._waitingParentId) {
                     if (mesh._waitingParentId) {

+ 0 - 8
Babylon/Materials/Textures/Procedurals/babylon.proceduralTexture.js

@@ -186,36 +186,28 @@ var BABYLON;
             // Render
             // Render
             engine.enableEffect(this._effect);
             engine.enableEffect(this._effect);
             engine.setState(false);
             engine.setState(false);
-            // Texture
             for (var name in this._textures) {
             for (var name in this._textures) {
                 this._effect.setTexture(name, this._textures[name]);
                 this._effect.setTexture(name, this._textures[name]);
             }
             }
-            // Float    
             for (name in this._floats) {
             for (name in this._floats) {
                 this._effect.setFloat(name, this._floats[name]);
                 this._effect.setFloat(name, this._floats[name]);
             }
             }
-            // Floats   
             for (name in this._floatsArrays) {
             for (name in this._floatsArrays) {
                 this._effect.setArray(name, this._floatsArrays[name]);
                 this._effect.setArray(name, this._floatsArrays[name]);
             }
             }
-            // Color3        
             for (name in this._colors3) {
             for (name in this._colors3) {
                 this._effect.setColor3(name, this._colors3[name]);
                 this._effect.setColor3(name, this._colors3[name]);
             }
             }
-            // Color4      
             for (name in this._colors4) {
             for (name in this._colors4) {
                 var color = this._colors4[name];
                 var color = this._colors4[name];
                 this._effect.setFloat4(name, color.r, color.g, color.b, color.a);
                 this._effect.setFloat4(name, color.r, color.g, color.b, color.a);
             }
             }
-            // Vector2        
             for (name in this._vectors2) {
             for (name in this._vectors2) {
                 this._effect.setVector2(name, this._vectors2[name]);
                 this._effect.setVector2(name, this._vectors2[name]);
             }
             }
-            // Vector3        
             for (name in this._vectors3) {
             for (name in this._vectors3) {
                 this._effect.setVector3(name, this._vectors3[name]);
                 this._effect.setVector3(name, this._vectors3[name]);
             }
             }
-            // Matrix      
             for (name in this._matrices) {
             for (name in this._matrices) {
                 this._effect.setMatrix(name, this._matrices[name]);
                 this._effect.setMatrix(name, this._matrices[name]);
             }
             }

+ 2 - 12
Babylon/Materials/Textures/babylon.texture.js

@@ -83,13 +83,7 @@ var BABYLON;
             t.z += 0.5;
             t.z += 0.5;
         };
         };
         Texture.prototype.getTextureMatrix = function () {
         Texture.prototype.getTextureMatrix = function () {
-            if (this.uOffset === this._cachedUOffset &&
-                this.vOffset === this._cachedVOffset &&
-                this.uScale === this._cachedUScale &&
-                this.vScale === this._cachedVScale &&
-                this.uAng === this._cachedUAng &&
-                this.vAng === this._cachedVAng &&
-                this.wAng === this._cachedWAng) {
+            if (this.uOffset === this._cachedUOffset && this.vOffset === this._cachedVOffset && this.uScale === this._cachedUScale && this.vScale === this._cachedVScale && this.uAng === this._cachedUAng && this.vAng === this._cachedVAng && this.wAng === this._cachedWAng) {
                 return this._cachedTextureMatrix;
                 return this._cachedTextureMatrix;
             }
             }
             this._cachedUOffset = this.uOffset;
             this._cachedUOffset = this.uOffset;
@@ -125,11 +119,7 @@ var BABYLON;
             return this._cachedTextureMatrix;
             return this._cachedTextureMatrix;
         };
         };
         Texture.prototype.getReflectionTextureMatrix = function () {
         Texture.prototype.getReflectionTextureMatrix = function () {
-            if (this.uOffset === this._cachedUOffset &&
-                this.vOffset === this._cachedVOffset &&
-                this.uScale === this._cachedUScale &&
-                this.vScale === this._cachedVScale &&
-                this.coordinatesMode === this._cachedCoordinatesMode) {
+            if (this.uOffset === this._cachedUOffset && this.vOffset === this._cachedVOffset && this.uScale === this._cachedUScale && this.vScale === this._cachedVScale && this.coordinatesMode === this._cachedCoordinatesMode) {
                 return this._cachedTextureMatrix;
                 return this._cachedTextureMatrix;
             }
             }
             if (!this._cachedTextureMatrix) {
             if (!this._cachedTextureMatrix) {

+ 0 - 8
Babylon/Materials/babylon.shaderMaterial.js

@@ -147,36 +147,28 @@ var BABYLON;
                 if (mesh && mesh.useBones) {
                 if (mesh && mesh.useBones) {
                     this._effect.setMatrices("mBones", mesh.skeleton.getTransformMatrices());
                     this._effect.setMatrices("mBones", mesh.skeleton.getTransformMatrices());
                 }
                 }
-                // Texture
                 for (var name in this._textures) {
                 for (var name in this._textures) {
                     this._effect.setTexture(name, this._textures[name]);
                     this._effect.setTexture(name, this._textures[name]);
                 }
                 }
-                // Float    
                 for (name in this._floats) {
                 for (name in this._floats) {
                     this._effect.setFloat(name, this._floats[name]);
                     this._effect.setFloat(name, this._floats[name]);
                 }
                 }
-                // Float s   
                 for (name in this._floatsArrays) {
                 for (name in this._floatsArrays) {
                     this._effect.setArray(name, this._floatsArrays[name]);
                     this._effect.setArray(name, this._floatsArrays[name]);
                 }
                 }
-                // Color3        
                 for (name in this._colors3) {
                 for (name in this._colors3) {
                     this._effect.setColor3(name, this._colors3[name]);
                     this._effect.setColor3(name, this._colors3[name]);
                 }
                 }
-                // Color4      
                 for (name in this._colors4) {
                 for (name in this._colors4) {
                     var color = this._colors4[name];
                     var color = this._colors4[name];
                     this._effect.setFloat4(name, color.r, color.g, color.b, color.a);
                     this._effect.setFloat4(name, color.r, color.g, color.b, color.a);
                 }
                 }
-                // Vector2        
                 for (name in this._vectors2) {
                 for (name in this._vectors2) {
                     this._effect.setVector2(name, this._vectors2[name]);
                     this._effect.setVector2(name, this._vectors2[name]);
                 }
                 }
-                // Vector3        
                 for (name in this._vectors3) {
                 for (name in this._vectors3) {
                     this._effect.setVector3(name, this._vectors3[name]);
                     this._effect.setVector3(name, this._vectors3[name]);
                 }
                 }
-                // Matrix      
                 for (name in this._matrices) {
                 for (name in this._matrices) {
                     this._effect.setMatrix(name, this._matrices[name]);
                     this._effect.setMatrix(name, this._matrices[name]);
                 }
                 }

File diff suppressed because it is too large
+ 2 - 18
Babylon/Materials/babylon.standardMaterial.js


+ 54 - 53
Babylon/Math/babylon.math.js

@@ -102,15 +102,33 @@ var BABYLON;
             var b = start.b + ((end.b - start.b) * amount);
             var b = start.b + ((end.b - start.b) * amount);
             return new Color3(r, g, b);
             return new Color3(r, g, b);
         };
         };
-        Color3.Red = function () { return new Color3(1, 0, 0); };
-        Color3.Green = function () { return new Color3(0, 1, 0); };
-        Color3.Blue = function () { return new Color3(0, 0, 1); };
-        Color3.Black = function () { return new Color3(0, 0, 0); };
-        Color3.White = function () { return new Color3(1, 1, 1); };
-        Color3.Purple = function () { return new Color3(0.5, 0, 0.5); };
-        Color3.Magenta = function () { return new Color3(1, 0, 1); };
-        Color3.Yellow = function () { return new Color3(1, 1, 0); };
-        Color3.Gray = function () { return new Color3(0.5, 0.5, 0.5); };
+        Color3.Red = function () {
+            return new Color3(1, 0, 0);
+        };
+        Color3.Green = function () {
+            return new Color3(0, 1, 0);
+        };
+        Color3.Blue = function () {
+            return new Color3(0, 0, 1);
+        };
+        Color3.Black = function () {
+            return new Color3(0, 0, 0);
+        };
+        Color3.White = function () {
+            return new Color3(1, 1, 1);
+        };
+        Color3.Purple = function () {
+            return new Color3(0.5, 0, 0.5);
+        };
+        Color3.Magenta = function () {
+            return new Color3(1, 0, 1);
+        };
+        Color3.Yellow = function () {
+            return new Color3(1, 1, 0);
+        };
+        Color3.Gray = function () {
+            return new Color3(0.5, 0.5, 0.5);
+        };
         return Color3;
         return Color3;
     })();
     })();
     BABYLON.Color3 = Color3;
     BABYLON.Color3 = Color3;
@@ -322,12 +340,8 @@ var BABYLON;
         Vector2.CatmullRom = function (value1, value2, value3, value4, amount) {
         Vector2.CatmullRom = function (value1, value2, value3, value4, amount) {
             var squared = amount * amount;
             var squared = amount * amount;
             var cubed = amount * squared;
             var cubed = amount * squared;
-            var x = 0.5 * ((((2.0 * value2.x) + ((-value1.x + value3.x) * amount)) +
-                (((((2.0 * value1.x) - (5.0 * value2.x)) + (4.0 * value3.x)) - value4.x) * squared)) +
-                ((((-value1.x + (3.0 * value2.x)) - (3.0 * value3.x)) + value4.x) * cubed));
-            var y = 0.5 * ((((2.0 * value2.y) + ((-value1.y + value3.y) * amount)) +
-                (((((2.0 * value1.y) - (5.0 * value2.y)) + (4.0 * value3.y)) - value4.y) * squared)) +
-                ((((-value1.y + (3.0 * value2.y)) - (3.0 * value3.y)) + value4.y) * cubed));
+            var x = 0.5 * ((((2.0 * value2.x) + ((-value1.x + value3.x) * amount)) + (((((2.0 * value1.x) - (5.0 * value2.x)) + (4.0 * value3.x)) - value4.x) * squared)) + ((((-value1.x + (3.0 * value2.x)) - (3.0 * value3.x)) + value4.x) * cubed));
+            var y = 0.5 * ((((2.0 * value2.y) + ((-value1.y + value3.y) * amount)) + (((((2.0 * value1.y) - (5.0 * value2.y)) + (4.0 * value3.y)) - value4.y) * squared)) + ((((-value1.y + (3.0 * value2.y)) - (3.0 * value3.y)) + value4.y) * cubed));
             return new Vector2(x, y);
             return new Vector2(x, y);
         };
         };
         Vector2.Clamp = function (value, min, max) {
         Vector2.Clamp = function (value, min, max) {
@@ -665,15 +679,9 @@ var BABYLON;
         Vector3.CatmullRom = function (value1, value2, value3, value4, amount) {
         Vector3.CatmullRom = function (value1, value2, value3, value4, amount) {
             var squared = amount * amount;
             var squared = amount * amount;
             var cubed = amount * squared;
             var cubed = amount * squared;
-            var x = 0.5 * ((((2.0 * value2.x) + ((-value1.x + value3.x) * amount)) +
-                (((((2.0 * value1.x) - (5.0 * value2.x)) + (4.0 * value3.x)) - value4.x) * squared)) +
-                ((((-value1.x + (3.0 * value2.x)) - (3.0 * value3.x)) + value4.x) * cubed));
-            var y = 0.5 * ((((2.0 * value2.y) + ((-value1.y + value3.y) * amount)) +
-                (((((2.0 * value1.y) - (5.0 * value2.y)) + (4.0 * value3.y)) - value4.y) * squared)) +
-                ((((-value1.y + (3.0 * value2.y)) - (3.0 * value3.y)) + value4.y) * cubed));
-            var z = 0.5 * ((((2.0 * value2.z) + ((-value1.z + value3.z) * amount)) +
-                (((((2.0 * value1.z) - (5.0 * value2.z)) + (4.0 * value3.z)) - value4.z) * squared)) +
-                ((((-value1.z + (3.0 * value2.z)) - (3.0 * value3.z)) + value4.z) * cubed));
+            var x = 0.5 * ((((2.0 * value2.x) + ((-value1.x + value3.x) * amount)) + (((((2.0 * value1.x) - (5.0 * value2.x)) + (4.0 * value3.x)) - value4.x) * squared)) + ((((-value1.x + (3.0 * value2.x)) - (3.0 * value3.x)) + value4.x) * cubed));
+            var y = 0.5 * ((((2.0 * value2.y) + ((-value1.y + value3.y) * amount)) + (((((2.0 * value1.y) - (5.0 * value2.y)) + (4.0 * value3.y)) - value4.y) * squared)) + ((((-value1.y + (3.0 * value2.y)) - (3.0 * value3.y)) + value4.y) * cubed));
+            var z = 0.5 * ((((2.0 * value2.z) + ((-value1.z + value3.z) * amount)) + (((((2.0 * value1.z) - (5.0 * value2.z)) + (4.0 * value3.z)) - value4.z) * squared)) + ((((-value1.z + (3.0 * value2.z)) - (3.0 * value3.z)) + value4.z) * cubed));
             return new Vector3(x, y, z);
             return new Vector3(x, y, z);
         };
         };
         Vector3.Clamp = function (value, min, max) {
         Vector3.Clamp = function (value, min, max) {
@@ -983,10 +991,7 @@ var BABYLON;
             return otherVector && this.x === otherVector.x && this.y === otherVector.y && this.z === otherVector.z && this.w === otherVector.w;
             return otherVector && this.x === otherVector.x && this.y === otherVector.y && this.z === otherVector.z && this.w === otherVector.w;
         };
         };
         Vector4.prototype.equalsWithEpsilon = function (otherVector) {
         Vector4.prototype.equalsWithEpsilon = function (otherVector) {
-            return Math.abs(this.x - otherVector.x) < BABYLON.Engine.Epsilon &&
-                Math.abs(this.y - otherVector.y) < BABYLON.Engine.Epsilon &&
-                Math.abs(this.z - otherVector.z) < BABYLON.Engine.Epsilon &&
-                Math.abs(this.w - otherVector.w) < BABYLON.Engine.Epsilon;
+            return Math.abs(this.x - otherVector.x) < BABYLON.Engine.Epsilon && Math.abs(this.y - otherVector.y) < BABYLON.Engine.Epsilon && Math.abs(this.z - otherVector.z) < BABYLON.Engine.Epsilon && Math.abs(this.w - otherVector.w) < BABYLON.Engine.Epsilon;
         };
         };
         Vector4.prototype.equalsToFloats = function (x, y, z, w) {
         Vector4.prototype.equalsToFloats = function (x, y, z, w) {
             return this.x === x && this.y === y && this.z === z && this.w === w;
             return this.x === x && this.y === y && this.z === z && this.w === w;
@@ -1196,10 +1201,11 @@ var BABYLON;
             return result;
             return result;
         };
         };
         Quaternion.prototype.multiplyToRef = function (q1, result) {
         Quaternion.prototype.multiplyToRef = function (q1, result) {
-            result.x = this.x * q1.w + this.y * q1.z - this.z * q1.y + this.w * q1.x;
-            result.y = -this.x * q1.z + this.y * q1.w + this.z * q1.x + this.w * q1.y;
-            result.z = this.x * q1.y - this.y * q1.x + this.z * q1.w + this.w * q1.z;
-            result.w = -this.x * q1.x - this.y * q1.y - this.z * q1.z + this.w * q1.w;
+            var x = this.x * q1.w + this.y * q1.z - this.z * q1.y + this.w * q1.x;
+            var y = -this.x * q1.z + this.y * q1.w + this.z * q1.x + this.w * q1.y;
+            var z = this.x * q1.y - this.y * q1.x + this.z * q1.w + this.w * q1.z;
+            var w = -this.x * q1.x - this.y * q1.y - this.z * q1.z + this.w * q1.w;
+            result.copyFromFloats(x, y, z, w);
             return this;
             return this;
         };
         };
         Quaternion.prototype.length = function () {
         Quaternion.prototype.length = function () {
@@ -1416,10 +1422,7 @@ var BABYLON;
         Matrix.prototype.isIdentity = function () {
         Matrix.prototype.isIdentity = function () {
             if (this.m[0] !== 1.0 || this.m[5] !== 1.0 || this.m[10] !== 1.0 || this.m[15] !== 1.0)
             if (this.m[0] !== 1.0 || this.m[5] !== 1.0 || this.m[10] !== 1.0 || this.m[15] !== 1.0)
                 return false;
                 return false;
-            if (this.m[1] !== 0.0 || this.m[2] !== 0.0 || this.m[3] !== 0.0 ||
-                this.m[4] !== 0.0 || this.m[6] !== 0.0 || this.m[7] !== 0.0 ||
-                this.m[8] !== 0.0 || this.m[9] !== 0.0 || this.m[11] !== 0.0 ||
-                this.m[12] !== 0.0 || this.m[13] !== 0.0 || this.m[14] !== 0.0)
+            if (this.m[1] !== 0.0 || this.m[2] !== 0.0 || this.m[3] !== 0.0 || this.m[4] !== 0.0 || this.m[6] !== 0.0 || this.m[7] !== 0.0 || this.m[8] !== 0.0 || this.m[9] !== 0.0 || this.m[11] !== 0.0 || this.m[12] !== 0.0 || this.m[13] !== 0.0 || this.m[14] !== 0.0)
                 return false;
                 return false;
             return true;
             return true;
         };
         };
@@ -1430,9 +1433,7 @@ var BABYLON;
             var temp4 = (this.m[8] * this.m[15]) - (this.m[11] * this.m[12]);
             var temp4 = (this.m[8] * this.m[15]) - (this.m[11] * this.m[12]);
             var temp5 = (this.m[8] * this.m[14]) - (this.m[10] * this.m[12]);
             var temp5 = (this.m[8] * this.m[14]) - (this.m[10] * this.m[12]);
             var temp6 = (this.m[8] * this.m[13]) - (this.m[9] * this.m[12]);
             var temp6 = (this.m[8] * this.m[13]) - (this.m[9] * this.m[12]);
-            return ((((this.m[0] * (((this.m[5] * temp1) - (this.m[6] * temp2)) + (this.m[7] * temp3))) - (this.m[1] * (((this.m[4] * temp1) -
-                (this.m[6] * temp4)) + (this.m[7] * temp5)))) + (this.m[2] * (((this.m[4] * temp2) - (this.m[5] * temp4)) + (this.m[7] * temp6)))) -
-                (this.m[3] * (((this.m[4] * temp3) - (this.m[5] * temp5)) + (this.m[6] * temp6))));
+            return ((((this.m[0] * (((this.m[5] * temp1) - (this.m[6] * temp2)) + (this.m[7] * temp3))) - (this.m[1] * (((this.m[4] * temp1) - (this.m[6] * temp4)) + (this.m[7] * temp5)))) + (this.m[2] * (((this.m[4] * temp2) - (this.m[5] * temp4)) + (this.m[7] * temp6)))) - (this.m[3] * (((this.m[4] * temp3) - (this.m[5] * temp5)) + (this.m[6] * temp6))));
         };
         };
         // Methods
         // Methods
         Matrix.prototype.toArray = function () {
         Matrix.prototype.toArray = function () {
@@ -1706,11 +1707,7 @@ var BABYLON;
             SIMD.float32x4.store(result, offset + 12, SIMD.float32x4.add(SIMD.float32x4.mul(SIMD.float32x4.swizzle(tm3, 0, 0, 0, 0), om0), SIMD.float32x4.add(SIMD.float32x4.mul(SIMD.float32x4.swizzle(tm3, 1, 1, 1, 1), om1), SIMD.float32x4.add(SIMD.float32x4.mul(SIMD.float32x4.swizzle(tm3, 2, 2, 2, 2), om2), SIMD.float32x4.mul(SIMD.float32x4.swizzle(tm3, 3, 3, 3, 3), om3)))));
             SIMD.float32x4.store(result, offset + 12, SIMD.float32x4.add(SIMD.float32x4.mul(SIMD.float32x4.swizzle(tm3, 0, 0, 0, 0), om0), SIMD.float32x4.add(SIMD.float32x4.mul(SIMD.float32x4.swizzle(tm3, 1, 1, 1, 1), om1), SIMD.float32x4.add(SIMD.float32x4.mul(SIMD.float32x4.swizzle(tm3, 2, 2, 2, 2), om2), SIMD.float32x4.mul(SIMD.float32x4.swizzle(tm3, 3, 3, 3, 3), om3)))));
         };
         };
         Matrix.prototype.equals = function (value) {
         Matrix.prototype.equals = function (value) {
-            return value &&
-                (this.m[0] === value.m[0] && this.m[1] === value.m[1] && this.m[2] === value.m[2] && this.m[3] === value.m[3] &&
-                    this.m[4] === value.m[4] && this.m[5] === value.m[5] && this.m[6] === value.m[6] && this.m[7] === value.m[7] &&
-                    this.m[8] === value.m[8] && this.m[9] === value.m[9] && this.m[10] === value.m[10] && this.m[11] === value.m[11] &&
-                    this.m[12] === value.m[12] && this.m[13] === value.m[13] && this.m[14] === value.m[14] && this.m[15] === value.m[15]);
+            return value && (this.m[0] === value.m[0] && this.m[1] === value.m[1] && this.m[2] === value.m[2] && this.m[3] === value.m[3] && this.m[4] === value.m[4] && this.m[5] === value.m[5] && this.m[6] === value.m[6] && this.m[7] === value.m[7] && this.m[8] === value.m[8] && this.m[9] === value.m[9] && this.m[10] === value.m[10] && this.m[11] === value.m[11] && this.m[12] === value.m[12] && this.m[13] === value.m[13] && this.m[14] === value.m[14] && this.m[15] === value.m[15]);
         };
         };
         Matrix.prototype.clone = function () {
         Matrix.prototype.clone = function () {
             return Matrix.FromValues(this.m[0], this.m[1], this.m[2], this.m[3], this.m[4], this.m[5], this.m[6], this.m[7], this.m[8], this.m[9], this.m[10], this.m[11], this.m[12], this.m[13], this.m[14], this.m[15]);
             return Matrix.FromValues(this.m[0], this.m[1], this.m[2], this.m[3], this.m[4], this.m[5], this.m[6], this.m[7], this.m[8], this.m[9], this.m[10], this.m[11], this.m[12], this.m[13], this.m[14], this.m[15]);
@@ -2508,9 +2505,7 @@ var BABYLON;
                 refinedT = Math.min(1, Math.max(0, refinedT));
                 refinedT = Math.min(1, Math.max(0, refinedT));
             }
             }
             // Resolve cubic bezier for the given x
             // Resolve cubic bezier for the given x
-            return 3 * Math.pow(1 - refinedT, 2) * refinedT * y1 +
-                3 * (1 - refinedT) * Math.pow(refinedT, 2) * y2 +
-                Math.pow(refinedT, 3);
+            return 3 * Math.pow(1 - refinedT, 2) * refinedT * y1 + 3 * (1 - refinedT) * Math.pow(refinedT, 2) * y2 + Math.pow(refinedT, 3);
         };
         };
         return BezierCurve;
         return BezierCurve;
     })();
     })();
@@ -2567,8 +2562,8 @@ var BABYLON;
                 a3 -= 360.0;
                 a3 -= 360.0;
             if (a3 - a2 < -180.0)
             if (a3 - a2 < -180.0)
                 a3 += 360.0;
                 a3 += 360.0;
-            this.orientation = (a2 - a1) < 0 ? Orientation.CW : Orientation.CCW;
-            this.angle = Angle.FromDegrees(this.orientation === Orientation.CW ? a1 - a3 : a3 - a1);
+            this.orientation = (a2 - a1) < 0 ? 0 /* CW */ : 1 /* CCW */;
+            this.angle = Angle.FromDegrees(this.orientation === 0 /* CW */ ? a1 - a3 : a3 - a1);
         }
         }
         return Arc2;
         return Arc2;
     })();
     })();
@@ -2659,7 +2654,7 @@ var BABYLON;
             var endPoint = new Vector2(endX, endY);
             var endPoint = new Vector2(endX, endY);
             var arc = new Arc2(startPoint, midPoint, endPoint);
             var arc = new Arc2(startPoint, midPoint, endPoint);
             var increment = arc.angle.radians() / numberOfSegments;
             var increment = arc.angle.radians() / numberOfSegments;
-            if (arc.orientation === Orientation.CW)
+            if (arc.orientation === 0 /* CW */)
                 increment *= -1;
                 increment *= -1;
             var currentAngle = arc.startAngle.radians() + increment;
             var currentAngle = arc.startAngle.radians() + increment;
             for (var i = 0; i < numberOfSegments; i++) {
             for (var i = 0; i < numberOfSegments; i++) {
@@ -2976,7 +2971,9 @@ var BABYLON;
             Vector3.TransformCoordinatesToRef = Vector3.TransformCoordinatesToRefSIMD;
             Vector3.TransformCoordinatesToRef = Vector3.TransformCoordinatesToRefSIMD;
             Vector3.TransformCoordinatesFromFloatsToRef = Vector3.TransformCoordinatesFromFloatsToRefSIMD;
             Vector3.TransformCoordinatesFromFloatsToRef = Vector3.TransformCoordinatesFromFloatsToRefSIMD;
             Object.defineProperty(BABYLON.Vector3.prototype, "x", {
             Object.defineProperty(BABYLON.Vector3.prototype, "x", {
-                get: function () { return this._data[0]; },
+                get: function () {
+                    return this._data[0];
+                },
                 set: function (value) {
                 set: function (value) {
                     if (!this._data) {
                     if (!this._data) {
                         this._data = new Float32Array(3);
                         this._data = new Float32Array(3);
@@ -2985,13 +2982,17 @@ var BABYLON;
                 }
                 }
             });
             });
             Object.defineProperty(BABYLON.Vector3.prototype, "y", {
             Object.defineProperty(BABYLON.Vector3.prototype, "y", {
-                get: function () { return this._data[1]; },
+                get: function () {
+                    return this._data[1];
+                },
                 set: function (value) {
                 set: function (value) {
                     this._data[1] = value;
                     this._data[1] = value;
                 }
                 }
             });
             });
             Object.defineProperty(BABYLON.Vector3.prototype, "z", {
             Object.defineProperty(BABYLON.Vector3.prototype, "z", {
-                get: function () { return this._data[2]; },
+                get: function () {
+                    return this._data[2];
+                },
                 set: function (value) {
                 set: function (value) {
                     this._data[2] = value;
                     this._data[2] = value;
                 }
                 }

+ 5 - 4
Babylon/Math/babylon.math.ts

@@ -1481,10 +1481,11 @@
         }
         }
 
 
         public multiplyToRef(q1: Quaternion, result: Quaternion): Quaternion {
         public multiplyToRef(q1: Quaternion, result: Quaternion): Quaternion {
-            result.x = this.x * q1.w + this.y * q1.z - this.z * q1.y + this.w * q1.x;
-            result.y = -this.x * q1.z + this.y * q1.w + this.z * q1.x + this.w * q1.y;
-            result.z = this.x * q1.y - this.y * q1.x + this.z * q1.w + this.w * q1.z;
-            result.w = -this.x * q1.x - this.y * q1.y - this.z * q1.z + this.w * q1.w;
+            var x = this.x * q1.w + this.y * q1.z - this.z * q1.y + this.w * q1.x;
+            var y = -this.x * q1.z + this.y * q1.w + this.z * q1.x + this.w * q1.y;
+            var z = this.x * q1.y - this.y * q1.x + this.z * q1.w + this.w * q1.z;
+            var w = -this.x * q1.x - this.y * q1.y - this.z * q1.z + this.w * q1.w;
+            result.copyFromFloats(x, y, z, w);
 
 
             return this;
             return this;
         }
         }

+ 2 - 5
Babylon/Mesh/babylon.abstractMesh.js

@@ -207,7 +207,7 @@ var BABYLON;
                 this.rotationQuaternion = BABYLON.Quaternion.RotationYawPitchRoll(this.rotation.y, this.rotation.x, this.rotation.z);
                 this.rotationQuaternion = BABYLON.Quaternion.RotationYawPitchRoll(this.rotation.y, this.rotation.x, this.rotation.z);
                 this.rotation = BABYLON.Vector3.Zero();
                 this.rotation = BABYLON.Vector3.Zero();
             }
             }
-            if (!space || space === BABYLON.Space.LOCAL) {
+            if (!space || space === 0 /* LOCAL */) {
                 var rotationQuaternion = BABYLON.Quaternion.RotationAxis(axis, amount);
                 var rotationQuaternion = BABYLON.Quaternion.RotationAxis(axis, amount);
                 this.rotationQuaternion = this.rotationQuaternion.multiply(rotationQuaternion);
                 this.rotationQuaternion = this.rotationQuaternion.multiply(rotationQuaternion);
             }
             }
@@ -223,7 +223,7 @@ var BABYLON;
         };
         };
         AbstractMesh.prototype.translate = function (axis, distance, space) {
         AbstractMesh.prototype.translate = function (axis, distance, space) {
             var displacementVector = axis.scale(distance);
             var displacementVector = axis.scale(distance);
-            if (!space || space === BABYLON.Space.LOCAL) {
+            if (!space || space === 0 /* LOCAL */) {
                 var tempV3 = this.getPositionExpressedInLocalSpace().add(displacementVector);
                 var tempV3 = this.getPositionExpressedInLocalSpace().add(displacementVector);
                 this.setPositionWithLocalVector(tempV3);
                 this.setPositionWithLocalVector(tempV3);
             }
             }
@@ -452,7 +452,6 @@ var BABYLON;
             this._updateBoundingInfo();
             this._updateBoundingInfo();
             // Absolute position
             // Absolute position
             this._absolutePosition.copyFromFloats(this._worldMatrix.m[12], this._worldMatrix.m[13], this._worldMatrix.m[14]);
             this._absolutePosition.copyFromFloats(this._worldMatrix.m[12], this._worldMatrix.m[13], this._worldMatrix.m[14]);
-            // Callbacks
             for (var callbackIndex = 0; callbackIndex < this._onAfterWorldMatrixUpdate.length; callbackIndex++) {
             for (var callbackIndex = 0; callbackIndex < this._onAfterWorldMatrixUpdate.length; callbackIndex++) {
                 this._onAfterWorldMatrixUpdate[callbackIndex](this);
                 this._onAfterWorldMatrixUpdate[callbackIndex](this);
             }
             }
@@ -771,7 +770,6 @@ var BABYLON;
             if (this.getPhysicsImpostor() !== BABYLON.PhysicsEngine.NoImpostor) {
             if (this.getPhysicsImpostor() !== BABYLON.PhysicsEngine.NoImpostor) {
                 this.setPhysicsState(BABYLON.PhysicsEngine.NoImpostor);
                 this.setPhysicsState(BABYLON.PhysicsEngine.NoImpostor);
             }
             }
-            // Intersections in progress
             for (index = 0; index < this._intersectionsInProgress.length; index++) {
             for (index = 0; index < this._intersectionsInProgress.length; index++) {
                 var other = this._intersectionsInProgress[index];
                 var other = this._intersectionsInProgress[index];
                 var pos = other._intersectionsInProgress.indexOf(this);
                 var pos = other._intersectionsInProgress.indexOf(this);
@@ -783,7 +781,6 @@ var BABYLON;
             // Remove from scene
             // Remove from scene
             this.getScene().removeMesh(this);
             this.getScene().removeMesh(this);
             if (!doNotRecurse) {
             if (!doNotRecurse) {
-                // Particles
                 for (index = 0; index < this.getScene().particleSystems.length; index++) {
                 for (index = 0; index < this.getScene().particleSystems.length; index++) {
                     if (this.getScene().particleSystems[index].emitter === this) {
                     if (this.getScene().particleSystems[index].emitter === this) {
                         this.getScene().particleSystems[index].dispose();
                         this.getScene().particleSystems[index].dispose();

+ 7 - 9
Babylon/Mesh/babylon.csg.js

@@ -76,7 +76,6 @@ var BABYLON;
                 polygonType |= type;
                 polygonType |= type;
                 types.push(type);
                 types.push(type);
             }
             }
-            // Put the polygon in the correct list, splitting it when necessary.
             switch (polygonType) {
             switch (polygonType) {
                 case COPLANAR:
                 case COPLANAR:
                     (BABYLON.Vector3.Dot(this.normal, polygon.plane.normal) > 0 ? coplanarFront : coplanarBack).push(polygon);
                     (BABYLON.Vector3.Dot(this.normal, polygon.plane.normal) > 0 ? coplanarFront : coplanarBack).push(polygon);
@@ -140,7 +139,9 @@ var BABYLON;
             return new Polygon(vertices, this.shared);
             return new Polygon(vertices, this.shared);
         };
         };
         Polygon.prototype.flip = function () {
         Polygon.prototype.flip = function () {
-            this.vertices.reverse().map(function (v) { v.flip(); });
+            this.vertices.reverse().map(function (v) {
+                v.flip();
+            });
             this.plane.flip();
             this.plane.flip();
         };
         };
         return Polygon;
         return Polygon;
@@ -394,7 +395,9 @@ var BABYLON;
             return csg;
             return csg;
         };
         };
         CSG.prototype.inverseInPlace = function () {
         CSG.prototype.inverseInPlace = function () {
-            this.polygons.map(function (p) { p.flip(); });
+            this.polygons.map(function (p) {
+                p.flip();
+            });
         };
         };
         // This is used to keep meshes transformations so they can be restored
         // This is used to keep meshes transformations so they can be restored
         // when we build back a Babylon Mesh
         // when we build back a Babylon Mesh
@@ -450,12 +453,7 @@ var BABYLON;
                         var localNormal = BABYLON.Vector3.TransformNormal(normal, matrix);
                         var localNormal = BABYLON.Vector3.TransformNormal(normal, matrix);
                         vertex_idx = vertice_dict[localVertex.x + ',' + localVertex.y + ',' + localVertex.z];
                         vertex_idx = vertice_dict[localVertex.x + ',' + localVertex.y + ',' + localVertex.z];
                         // Check if 2 points can be merged
                         // Check if 2 points can be merged
-                        if (!(typeof vertex_idx !== 'undefined' &&
-                            normals[vertex_idx * 3] === localNormal.x &&
-                            normals[vertex_idx * 3 + 1] === localNormal.y &&
-                            normals[vertex_idx * 3 + 2] === localNormal.z &&
-                            uvs[vertex_idx * 2] === uv.x &&
-                            uvs[vertex_idx * 2 + 1] === uv.y)) {
+                        if (!(typeof vertex_idx !== 'undefined' && normals[vertex_idx * 3] === localNormal.x && normals[vertex_idx * 3 + 1] === localNormal.y && normals[vertex_idx * 3 + 2] === localNormal.z && uvs[vertex_idx * 2] === uv.x && uvs[vertex_idx * 2 + 1] === uv.y)) {
                             vertices.push(localVertex.x, localVertex.y, localVertex.z);
                             vertices.push(localVertex.x, localVertex.y, localVertex.z);
                             uvs.push(uv.x, uv.y);
                             uvs.push(uv.x, uv.y);
                             normals.push(normal.x, normal.y, normal.z);
                             normals.push(normal.x, normal.y, normal.z);

+ 2 - 2
Babylon/Mesh/babylon.geometry.js

@@ -248,7 +248,6 @@ var BABYLON;
         };
         };
         Geometry.prototype._applyToMesh = function (mesh) {
         Geometry.prototype._applyToMesh = function (mesh) {
             var numOfMeshes = this._meshes.length;
             var numOfMeshes = this._meshes.length;
-            // vertexBuffers
             for (var kind in this._vertexBuffers) {
             for (var kind in this._vertexBuffers) {
                 if (numOfMeshes === 1) {
                 if (numOfMeshes === 1) {
                     this._vertexBuffers[kind].create();
                     this._vertexBuffers[kind].create();
@@ -302,7 +301,8 @@ var BABYLON;
                 if (onLoaded) {
                 if (onLoaded) {
                     onLoaded();
                     onLoaded();
                 }
                 }
-            }, function () { }, scene.database);
+            }, function () {
+            }, scene.database);
         };
         };
         Geometry.prototype.isDisposed = function () {
         Geometry.prototype.isDisposed = function () {
             return this._isDisposed;
             return this._isDisposed;

+ 0 - 1
Babylon/Mesh/babylon.instancedMesh.js

@@ -129,7 +129,6 @@ var BABYLON;
                 result.parent = newParent;
                 result.parent = newParent;
             }
             }
             if (!doNotCloneChildren) {
             if (!doNotCloneChildren) {
-                // Children
                 for (var index = 0; index < this.getScene().meshes.length; index++) {
                 for (var index = 0; index < this.getScene().meshes.length; index++) {
                     var mesh = this.getScene().meshes[index];
                     var mesh = this.getScene().meshes[index];
                     if (mesh.parent === this) {
                     if (mesh.parent === this) {

+ 14 - 17
Babylon/Mesh/babylon.mesh.js

@@ -52,7 +52,6 @@ var BABYLON;
                 // Material
                 // Material
                 this.material = source.material;
                 this.material = source.material;
                 if (!doNotCloneChildren) {
                 if (!doNotCloneChildren) {
-                    // Children
                     for (var index = 0; index < scene.meshes.length; index++) {
                     for (var index = 0; index < scene.meshes.length; index++) {
                         var mesh = scene.meshes[index];
                         var mesh = scene.meshes[index];
                         if (mesh.parent === source) {
                         if (mesh.parent === source) {
@@ -61,7 +60,6 @@ var BABYLON;
                         }
                         }
                     }
                     }
                 }
                 }
-                // Particles
                 for (index = 0; index < scene.particleSystems.length; index++) {
                 for (index = 0; index < scene.particleSystems.length; index++) {
                     var system = scene.particleSystems[index];
                     var system = scene.particleSystems[index];
                     if (system.emitter === source) {
                     if (system.emitter === source) {
@@ -371,7 +369,6 @@ var BABYLON;
             var totalIndices = this.getTotalIndices();
             var totalIndices = this.getTotalIndices();
             var subdivisionSize = (totalIndices / count) | 0;
             var subdivisionSize = (totalIndices / count) | 0;
             var offset = 0;
             var offset = 0;
-            // Ensure that subdivisionSize is a multiple of 3
             while (subdivisionSize % 3 !== 0) {
             while (subdivisionSize % 3 !== 0) {
                 subdivisionSize++;
                 subdivisionSize++;
             }
             }
@@ -484,7 +481,6 @@ var BABYLON;
                 return;
                 return;
             }
             }
             var engine = this.getScene().getEngine();
             var engine = this.getScene().getEngine();
-            // Draw order
             switch (fillMode) {
             switch (fillMode) {
                 case BABYLON.Material.PointFillMode:
                 case BABYLON.Material.PointFillMode:
                     engine.drawPointClouds(subMesh.verticesStart, subMesh.verticesCount, instancesCount);
                     engine.drawPointClouds(subMesh.verticesStart, subMesh.verticesCount, instancesCount);
@@ -721,7 +717,8 @@ var BABYLON;
                     }
                     }
                     _this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_LOADED;
                     _this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_LOADED;
                     scene._removePendingData(_this);
                     scene._removePendingData(_this);
-                }, function () { }, scene.database, getBinaryData);
+                }, function () {
+                }, scene.database, getBinaryData);
             }
             }
         };
         };
         Mesh.prototype.isInFrustum = function (frustumPlanes) {
         Mesh.prototype.isInFrustum = function (frustumPlanes) {
@@ -843,12 +840,11 @@ var BABYLON;
                     onSuccess(_this);
                     onSuccess(_this);
                 }
                 }
             };
             };
-            BABYLON.Tools.LoadImage(url, onload, function () { }, scene.database);
+            BABYLON.Tools.LoadImage(url, onload, function () {
+            }, scene.database);
         };
         };
         Mesh.prototype.applyDisplacementMapFromBuffer = function (buffer, heightMapWidth, heightMapHeight, minHeight, maxHeight) {
         Mesh.prototype.applyDisplacementMapFromBuffer = function (buffer, heightMapWidth, heightMapHeight, minHeight, maxHeight) {
-            if (!this.isVerticesDataPresent(BABYLON.VertexBuffer.PositionKind)
-                || !this.isVerticesDataPresent(BABYLON.VertexBuffer.NormalKind)
-                || !this.isVerticesDataPresent(BABYLON.VertexBuffer.UVKind)) {
+            if (!this.isVerticesDataPresent(BABYLON.VertexBuffer.PositionKind) || !this.isVerticesDataPresent(BABYLON.VertexBuffer.NormalKind) || !this.isVerticesDataPresent(BABYLON.VertexBuffer.UVKind)) {
                 BABYLON.Tools.Warn("Cannot call applyDisplacementMap: Given mesh is not complete. Position, Normal or UV are missing");
                 BABYLON.Tools.Warn("Cannot call applyDisplacementMap: Given mesh is not complete. Position, Normal or UV are missing");
                 return;
                 return;
             }
             }
@@ -904,7 +900,6 @@ var BABYLON;
             var previousSubmeshes = this.subMeshes.slice(0);
             var previousSubmeshes = this.subMeshes.slice(0);
             var indices = this.getIndices();
             var indices = this.getIndices();
             var totalIndices = this.getTotalIndices();
             var totalIndices = this.getTotalIndices();
-            // Generating unique vertices per face
             for (var index = 0; index < totalIndices; index++) {
             for (var index = 0; index < totalIndices; index++) {
                 var vertexIndex = indices[index];
                 var vertexIndex = indices[index];
                 for (kindIndex = 0; kindIndex < kinds.length; kindIndex++) {
                 for (kindIndex = 0; kindIndex < kinds.length; kindIndex++) {
@@ -928,7 +923,6 @@ var BABYLON;
                 var p1p2 = p1.subtract(p2);
                 var p1p2 = p1.subtract(p2);
                 var p3p2 = p3.subtract(p2);
                 var p3p2 = p3.subtract(p2);
                 var normal = BABYLON.Vector3.Normalize(BABYLON.Vector3.Cross(p1p2, p3p2));
                 var normal = BABYLON.Vector3.Normalize(BABYLON.Vector3.Cross(p1p2, p3p2));
-                // Store same normals for every vertex
                 for (var localIndex = 0; localIndex < 3; localIndex++) {
                 for (var localIndex = 0; localIndex < 3; localIndex++) {
                     normals.push(normal.x);
                     normals.push(normal.x);
                     normals.push(normal.y);
                     normals.push(normal.y);
@@ -937,7 +931,6 @@ var BABYLON;
             }
             }
             this.setIndices(indices);
             this.setIndices(indices);
             this.setVerticesData(BABYLON.VertexBuffer.NormalKind, normals, updatableNormals);
             this.setVerticesData(BABYLON.VertexBuffer.NormalKind, normals, updatableNormals);
-            // Updating vertex buffers
             for (kindIndex = 0; kindIndex < kinds.length; kindIndex++) {
             for (kindIndex = 0; kindIndex < kinds.length; kindIndex++) {
                 kind = kinds[kindIndex];
                 kind = kinds[kindIndex];
                 this.setVerticesData(kind, newdata[kind], vbs[kind].isUpdatable());
                 this.setVerticesData(kind, newdata[kind], vbs[kind].isUpdatable());
@@ -970,7 +963,7 @@ var BABYLON;
          */
          */
         Mesh.prototype.simplify = function (settings, parallelProcessing, simplificationType, successCallback) {
         Mesh.prototype.simplify = function (settings, parallelProcessing, simplificationType, successCallback) {
             if (parallelProcessing === void 0) { parallelProcessing = true; }
             if (parallelProcessing === void 0) { parallelProcessing = true; }
-            if (simplificationType === void 0) { simplificationType = BABYLON.SimplificationType.QUADRATIC; }
+            if (simplificationType === void 0) { simplificationType = 0 /* QUADRATIC */; }
             this.getScene().simplificationQueue.addTask({
             this.getScene().simplificationQueue.addTask({
                 settings: settings,
                 settings: settings,
                 parallelProcessing: parallelProcessing,
                 parallelProcessing: parallelProcessing,
@@ -1213,8 +1206,12 @@ var BABYLON;
                 var binormals = path3D.getBinormals();
                 var binormals = path3D.getBinormals();
                 var distances = path3D.getDistances();
                 var distances = path3D.getDistances();
                 var angle = 0;
                 var angle = 0;
-                var returnScale = function (i, distance) { return scale; };
-                var returnRotation = function (i, distance) { return rotation; };
+                var returnScale = function (i, distance) {
+                    return scale;
+                };
+                var returnRotation = function (i, distance) {
+                    return rotation;
+                };
                 var rotate = custom ? rotateFunction : returnRotation;
                 var rotate = custom ? rotateFunction : returnRotation;
                 var scl = custom ? scaleFunction : returnScale;
                 var scl = custom ? scaleFunction : returnScale;
                 var index = 0;
                 var index = 0;
@@ -1328,7 +1325,8 @@ var BABYLON;
                     onReady(ground);
                     onReady(ground);
                 }
                 }
             };
             };
-            BABYLON.Tools.LoadImage(url, onload, function () { }, scene.database);
+            BABYLON.Tools.LoadImage(url, onload, function () {
+            }, scene.database);
             return ground;
             return ground;
         };
         };
         Mesh.CreateTube = function (name, path, radius, tessellation, radiusFunction, cap, scene, updatable, sideOrientation, tubeInstance) {
         Mesh.CreateTube = function (name, path, radius, tessellation, radiusFunction, cap, scene, updatable, sideOrientation, tubeInstance) {
@@ -1607,7 +1605,6 @@ var BABYLON;
             if (disposeSource === void 0) { disposeSource = true; }
             if (disposeSource === void 0) { disposeSource = true; }
             if (!allow32BitsIndices) {
             if (!allow32BitsIndices) {
                 var totalVertices = 0;
                 var totalVertices = 0;
-                // Counting vertices
                 for (var index = 0; index < meshes.length; index++) {
                 for (var index = 0; index < meshes.length; index++) {
                     if (meshes[index]) {
                     if (meshes[index]) {
                         totalVertices += meshes[index].getTotalVertices();
                         totalVertices += meshes[index].getTotalVertices();

+ 0 - 15
Babylon/Mesh/babylon.mesh.vertexData.js

@@ -275,7 +275,6 @@ var BABYLON;
                 }
                 }
                 idc += l;
                 idc += l;
             }
             }
-            // vertical distances (v)
             for (i = 0; i < minlg; i++) {
             for (i = 0; i < minlg; i++) {
                 vTotalDistance[i] = 0;
                 vTotalDistance[i] = 0;
                 vs[i] = [0];
                 vs[i] = [0];
@@ -377,7 +376,6 @@ var BABYLON;
             var normals = [];
             var normals = [];
             var uvs = [];
             var uvs = [];
             size = size || 1;
             size = size || 1;
-            // Create each face in turn.
             for (var index = 0; index < normalsSource.length; index++) {
             for (var index = 0; index < normalsSource.length; index++) {
                 var normal = normalsSource[index];
                 var normal = normalsSource[index];
                 // Get two vectors perpendicular to the face normal and to each other.
                 // Get two vectors perpendicular to the face normal and to each other.
@@ -501,7 +499,6 @@ var BABYLON;
                     offset.scaleInPlace(-1);
                     offset.scaleInPlace(-1);
                     textureScale.x = -textureScale.x;
                     textureScale.x = -textureScale.x;
                 }
                 }
-                // Positions, normals & uvs
                 for (var i = 0; i < tessellation; i++) {
                 for (var i = 0; i < tessellation; i++) {
                     var circleVector = getCircleVector(i);
                     var circleVector = getCircleVector(i);
                     var position = circleVector.scale(radius).add(offset);
                     var position = circleVector.scale(radius).add(offset);
@@ -509,7 +506,6 @@ var BABYLON;
                     positions.push(position.x, position.y, position.z);
                     positions.push(position.x, position.y, position.z);
                     uvs.push(textureCoordinate.x, textureCoordinate.y);
                     uvs.push(textureCoordinate.x, textureCoordinate.y);
                 }
                 }
-                // Indices
                 for (i = 0; i < tessellation - 2; i++) {
                 for (i = 0; i < tessellation - 2; i++) {
                     if (!isTop) {
                     if (!isTop) {
                         indices.push(vbase);
                         indices.push(vbase);
@@ -526,7 +522,6 @@ var BABYLON;
             var base = new BABYLON.Vector3(0, -1, 0).scale(height / 2);
             var base = new BABYLON.Vector3(0, -1, 0).scale(height / 2);
             var offset = new BABYLON.Vector3(0, 1, 0).scale(height / subdivisions);
             var offset = new BABYLON.Vector3(0, 1, 0).scale(height / subdivisions);
             var stride = tessellation + 1;
             var stride = tessellation + 1;
-            // Positions, normals & uvs
             for (var i = 0; i <= tessellation; i++) {
             for (var i = 0; i <= tessellation; i++) {
                 var circleVector = getCircleVector(i);
                 var circleVector = getCircleVector(i);
                 var textureCoordinate = new BABYLON.Vector2(i / tessellation, 0);
                 var textureCoordinate = new BABYLON.Vector2(i / tessellation, 0);
@@ -543,7 +538,6 @@ var BABYLON;
                 }
                 }
             }
             }
             subdivisions += 1;
             subdivisions += 1;
-            // Indices
             for (s = 0; s < subdivisions - 1; s++) {
             for (s = 0; s < subdivisions - 1; s++) {
                 for (i = 0; i <= tessellation; i++) {
                 for (i = 0; i <= tessellation; i++) {
                     indices.push(i * subdivisions + s);
                     indices.push(i * subdivisions + s);
@@ -777,7 +771,6 @@ var BABYLON;
             var normals = [];
             var normals = [];
             var uvs = [];
             var uvs = [];
             var row, col;
             var row, col;
-            // Vertices
             for (row = 0; row <= subdivisions; row++) {
             for (row = 0; row <= subdivisions; row++) {
                 for (col = 0; col <= subdivisions; col++) {
                 for (col = 0; col <= subdivisions; col++) {
                     var position = new BABYLON.Vector3((col * width) / subdivisions - (width / 2.0), 0, ((subdivisions - row) * height) / subdivisions - (height / 2.0));
                     var position = new BABYLON.Vector3((col * width) / subdivisions - (width / 2.0), 0, ((subdivisions - row) * height) / subdivisions - (height / 2.0));
@@ -796,7 +789,6 @@ var BABYLON;
                     uvs.push(col / subdivisions, 1.0 - row / subdivisions);
                     uvs.push(col / subdivisions, 1.0 - row / subdivisions);
                 }
                 }
             }
             }
-            // Indices
             for (row = 0; row < subdivisions; row++) {
             for (row = 0; row < subdivisions; row++) {
                 for (col = 0; col < subdivisions; col++) {
                 for (col = 0; col < subdivisions; col++) {
                     indices.push(col + 1 + (row + 1) * (subdivisions + 1));
                     indices.push(col + 1 + (row + 1) * (subdivisions + 1));
@@ -914,7 +906,6 @@ var BABYLON;
                 var tz = radius * Math.sin(quOverP) * 0.5;
                 var tz = radius * Math.sin(quOverP) * 0.5;
                 return new BABYLON.Vector3(tx, ty, tz);
                 return new BABYLON.Vector3(tx, ty, tz);
             };
             };
-            // Vertices
             for (var i = 0; i <= radialSegments; i++) {
             for (var i = 0; i <= radialSegments; i++) {
                 var modI = i % radialSegments;
                 var modI = i % radialSegments;
                 var u = modI / radialSegments * 2 * p * Math.PI;
                 var u = modI / radialSegments * 2 * p * Math.PI;
@@ -1027,7 +1018,6 @@ var BABYLON;
                 normals[i3 * 3 + 1] = vertexNormali3.y;
                 normals[i3 * 3 + 1] = vertexNormali3.y;
                 normals[i3 * 3 + 2] = vertexNormali3.z;
                 normals[i3 * 3 + 2] = vertexNormali3.z;
             }
             }
-            // last normalization
             for (index = 0; index < normals.length / 3; index++) {
             for (index = 0; index < normals.length / 3; index++) {
                 BABYLON.Vector3.FromFloatsToRef(normals[index * 3], normals[index * 3 + 1], normals[index * 3 + 2], vertexNormali1);
                 BABYLON.Vector3.FromFloatsToRef(normals[index * 3], normals[index * 3 + 1], normals[index * 3 + 2], vertexNormali1);
                 vertexNormali1.normalize();
                 vertexNormali1.normalize();
@@ -1044,17 +1034,14 @@ var BABYLON;
             sideOrientation = sideOrientation || BABYLON.Mesh.DEFAULTSIDE;
             sideOrientation = sideOrientation || BABYLON.Mesh.DEFAULTSIDE;
             switch (sideOrientation) {
             switch (sideOrientation) {
                 case BABYLON.Mesh.FRONTSIDE:
                 case BABYLON.Mesh.FRONTSIDE:
-                    // nothing changed
                     break;
                     break;
                 case BABYLON.Mesh.BACKSIDE:
                 case BABYLON.Mesh.BACKSIDE:
                     var tmp;
                     var tmp;
-                    // indices
                     for (i = 0; i < li; i += 3) {
                     for (i = 0; i < li; i += 3) {
                         tmp = indices[i];
                         tmp = indices[i];
                         indices[i] = indices[i + 2];
                         indices[i] = indices[i + 2];
                         indices[i + 2] = tmp;
                         indices[i + 2] = tmp;
                     }
                     }
-                    // normals
                     for (n = 0; n < ln; n++) {
                     for (n = 0; n < ln; n++) {
                         normals[n] = -normals[n];
                         normals[n] = -normals[n];
                     }
                     }
@@ -1066,13 +1053,11 @@ var BABYLON;
                     for (var p = 0; p < lp; p++) {
                     for (var p = 0; p < lp; p++) {
                         positions[lp + p] = positions[p];
                         positions[lp + p] = positions[p];
                     }
                     }
-                    // indices
                     for (i = 0; i < li; i += 3) {
                     for (i = 0; i < li; i += 3) {
                         indices[i + li] = indices[i + 2] + l;
                         indices[i + li] = indices[i + 2] + l;
                         indices[i + 1 + li] = indices[i + 1] + l;
                         indices[i + 1 + li] = indices[i + 1] + l;
                         indices[i + 2 + li] = indices[i] + l;
                         indices[i + 2 + li] = indices[i] + l;
                     }
                     }
-                    // normals
                     for (n = 0; n < ln; n++) {
                     for (n = 0; n < ln; n++) {
                         normals[ln + n] = -normals[n];
                         normals[ln + n] = -normals[n];
                     }
                     }

+ 7 - 8
Babylon/Mesh/babylon.meshSimplification.js

@@ -71,7 +71,7 @@ var BABYLON;
         };
         };
         SimplificationQueue.prototype.getSimplifier = function (task) {
         SimplificationQueue.prototype.getSimplifier = function (task) {
             switch (task.simplificationType) {
             switch (task.simplificationType) {
-                case SimplificationType.QUADRATIC:
+                case 0 /* QUADRATIC */:
                 default:
                 default:
                     return new QuadraticErrorSimplification(task.mesh);
                     return new QuadraticErrorSimplification(task.mesh);
             }
             }
@@ -128,9 +128,7 @@ var BABYLON;
             }
             }
         }
         }
         QuadraticMatrix.prototype.det = function (a11, a12, a13, a21, a22, a23, a31, a32, a33) {
         QuadraticMatrix.prototype.det = function (a11, a12, a13, a21, a22, a23, a31, a32, a33) {
-            var det = this.data[a11] * this.data[a22] * this.data[a33] + this.data[a13] * this.data[a21] * this.data[a32] +
-                this.data[a12] * this.data[a23] * this.data[a31] - this.data[a13] * this.data[a22] * this.data[a31] -
-                this.data[a11] * this.data[a23] * this.data[a32] - this.data[a12] * this.data[a21] * this.data[a33];
+            var det = this.data[a11] * this.data[a22] * this.data[a33] + this.data[a13] * this.data[a21] * this.data[a32] + this.data[a12] * this.data[a23] * this.data[a31] - this.data[a13] * this.data[a22] * this.data[a31] - this.data[a11] * this.data[a23] * this.data[a32] - this.data[a12] * this.data[a21] * this.data[a33];
             return det;
             return det;
         };
         };
         QuadraticMatrix.prototype.addInPlace = function (matrix) {
         QuadraticMatrix.prototype.addInPlace = function (matrix) {
@@ -295,7 +293,9 @@ var BABYLON;
                             }
                             }
                         }
                         }
                     };
                     };
-                    BABYLON.AsyncLoop.SyncAsyncForLoop(_this.triangles.length, _this.syncIterations, trianglesIterator, callback, function () { return (triangleCount - deletedTriangles <= targetCount); });
+                    BABYLON.AsyncLoop.SyncAsyncForLoop(_this.triangles.length, _this.syncIterations, trianglesIterator, callback, function () {
+                        return (triangleCount - deletedTriangles <= targetCount);
+                    });
                 }, 0);
                 }, 0);
             };
             };
             BABYLON.AsyncLoop.Run(this.decimationIterations, function (loop) {
             BABYLON.AsyncLoop.Run(this.decimationIterations, function (loop) {
@@ -485,7 +485,7 @@ var BABYLON;
                 var s = this.references[vertex1.triangleStart + i].vertexId;
                 var s = this.references[vertex1.triangleStart + i].vertexId;
                 var v1 = t.vertices[(s + 1) % 3];
                 var v1 = t.vertices[(s + 1) % 3];
                 var v2 = t.vertices[(s + 2) % 3];
                 var v2 = t.vertices[(s + 2) % 3];
-                if ((v1 === vertex2 || v2 === vertex2) /* && !this.isTriangleOnBoundingBox(t)*/) {
+                if ((v1 === vertex2 || v2 === vertex2)) {
                     deletedArray[i] = true;
                     deletedArray[i] = true;
                     delTr.push(t);
                     delTr.push(t);
                     continue;
                     continue;
@@ -610,8 +610,7 @@ var BABYLON;
             var x = point.x;
             var x = point.x;
             var y = point.y;
             var y = point.y;
             var z = point.z;
             var z = point.z;
-            return q.data[0] * x * x + 2 * q.data[1] * x * y + 2 * q.data[2] * x * z + 2 * q.data[3] * x + q.data[4] * y * y
-                + 2 * q.data[5] * y * z + 2 * q.data[6] * y + q.data[7] * z * z + 2 * q.data[8] * z + q.data[9];
+            return q.data[0] * x * x + 2 * q.data[1] * x * y + 2 * q.data[2] * x * z + 2 * q.data[3] * x + q.data[4] * y * y + 2 * q.data[5] * y * z + 2 * q.data[6] * y + q.data[7] * z * z + 2 * q.data[8] * z + q.data[9];
         };
         };
         QuadraticErrorSimplification.prototype.calculateError = function (vertex1, vertex2, pointResult, normalResult, uvResult, colorResult) {
         QuadraticErrorSimplification.prototype.calculateError = function (vertex1, vertex2, pointResult, normalResult, uvResult, colorResult) {
             var q = vertex1.q.add(vertex2.q);
             var q = vertex1.q.add(vertex2.q);

+ 0 - 1
Babylon/Mesh/babylon.subMesh.js

@@ -87,7 +87,6 @@ var BABYLON;
         };
         };
         SubMesh.prototype.intersects = function (ray, positions, indices, fastCheck) {
         SubMesh.prototype.intersects = function (ray, positions, indices, fastCheck) {
             var intersectInfo = null;
             var intersectInfo = null;
-            // Triangles test
             for (var index = this.indexStart; index < this.indexStart + this.indexCount; index += 3) {
             for (var index = this.indexStart; index < this.indexStart + this.indexCount; index += 3) {
                 var p0 = positions[indices[index]];
                 var p0 = positions[indices[index]];
                 var p1 = positions[indices[index + 1]];
                 var p1 = positions[indices[index + 1]];

+ 0 - 1
Babylon/Mesh/babylon.vertexBuffer.js

@@ -18,7 +18,6 @@ var BABYLON;
                 this._strideSize = stride;
                 this._strideSize = stride;
                 return;
                 return;
             }
             }
-            // Deduce stride from kind
             switch (kind) {
             switch (kind) {
                 case VertexBuffer.PositionKind:
                 case VertexBuffer.PositionKind:
                     this._strideSize = 3;
                     this._strideSize = 3;

+ 0 - 2
Babylon/Physics/Plugins/babylon.cannonJSPlugin.js

@@ -110,13 +110,11 @@ var BABYLON;
         CannonJSPlugin.prototype._createConvexPolyhedron = function (rawVerts, rawFaces, mesh, options) {
         CannonJSPlugin.prototype._createConvexPolyhedron = function (rawVerts, rawFaces, mesh, options) {
             var verts = [], faces = [];
             var verts = [], faces = [];
             mesh.computeWorldMatrix(true);
             mesh.computeWorldMatrix(true);
-            // Get vertices
             for (var i = 0; i < rawVerts.length; i += 3) {
             for (var i = 0; i < rawVerts.length; i += 3) {
                 var transformed = BABYLON.Vector3.Zero();
                 var transformed = BABYLON.Vector3.Zero();
                 BABYLON.Vector3.TransformNormalFromFloatsToRef(rawVerts[i], rawVerts[i + 1], rawVerts[i + 2], mesh.getWorldMatrix(), transformed);
                 BABYLON.Vector3.TransformNormalFromFloatsToRef(rawVerts[i], rawVerts[i + 1], rawVerts[i + 2], mesh.getWorldMatrix(), transformed);
                 verts.push(new CANNON.Vec3(transformed.x, transformed.z, transformed.y));
                 verts.push(new CANNON.Vec3(transformed.x, transformed.z, transformed.y));
             }
             }
-            // Get faces
             for (var j = 0; j < rawFaces.length; j += 3) {
             for (var j = 0; j < rawFaces.length; j += 3) {
                 faces.push([rawFaces[j], rawFaces[j + 2], rawFaces[j + 1]]);
                 faces.push([rawFaces[j], rawFaces[j + 2], rawFaces[j + 1]]);
             }
             }

+ 0 - 2
Babylon/Physics/Plugins/babylon.oimoJSPlugin.js

@@ -63,7 +63,6 @@ var BABYLON;
                 initialRotation.toRotationMatrix(m);
                 initialRotation.toRotationMatrix(m);
                 deltaPosition = BABYLON.Vector3.TransformCoordinates(deltaPosition, m);
                 deltaPosition = BABYLON.Vector3.TransformCoordinates(deltaPosition, m);
             }
             }
-            // register mesh
             switch (impostor) {
             switch (impostor) {
                 case BABYLON.PhysicsEngine.SphereImpostor:
                 case BABYLON.PhysicsEngine.SphereImpostor:
                     var radiusX = bbox.maximumWorld.x - bbox.minimumWorld.x;
                     var radiusX = bbox.maximumWorld.x - bbox.minimumWorld.x;
@@ -81,7 +80,6 @@ var BABYLON;
                     });
                     });
                     break;
                     break;
                 case BABYLON.PhysicsEngine.PlaneImpostor:
                 case BABYLON.PhysicsEngine.PlaneImpostor:
-                //Oimo "fakes" a cylinder as a box, so why don't we!
                 case BABYLON.PhysicsEngine.CylinderImpostor:
                 case BABYLON.PhysicsEngine.CylinderImpostor:
                 case BABYLON.PhysicsEngine.BoxImpostor:
                 case BABYLON.PhysicsEngine.BoxImpostor:
                     var min = bbox.minimumWorld;
                     var min = bbox.minimumWorld;

+ 6 - 2
Babylon/PostProcess/RenderPipeline/babylon.postProcessRenderPipeline.js

@@ -74,7 +74,9 @@ var BABYLON;
             for (var i = 0; i < _cam.length; i++) {
             for (var i = 0; i < _cam.length; i++) {
                 var camera = _cam[i];
                 var camera = _cam[i];
                 var cameraName = camera.name;
                 var cameraName = camera.name;
-                this._renderEffectsForIsolatedPass[cameraName] = this._renderEffectsForIsolatedPass[cameraName] || new BABYLON.PostProcessRenderEffect(this._engine, PostProcessRenderPipeline.PASS_EFFECT_NAME, function () { return new BABYLON.DisplayPassPostProcess(PostProcessRenderPipeline.PASS_EFFECT_NAME, 1.0, null, null, _this._engine, true); });
+                this._renderEffectsForIsolatedPass[cameraName] = this._renderEffectsForIsolatedPass[cameraName] || new BABYLON.PostProcessRenderEffect(this._engine, PostProcessRenderPipeline.PASS_EFFECT_NAME, function () {
+                    return new BABYLON.DisplayPassPostProcess(PostProcessRenderPipeline.PASS_EFFECT_NAME, 1.0, null, null, _this._engine, true);
+                });
                 this._renderEffectsForIsolatedPass[cameraName].emptyPasses();
                 this._renderEffectsForIsolatedPass[cameraName].emptyPasses();
                 this._renderEffectsForIsolatedPass[cameraName].addPass(pass);
                 this._renderEffectsForIsolatedPass[cameraName].addPass(pass);
                 this._renderEffectsForIsolatedPass[cameraName]._attachCameras(camera);
                 this._renderEffectsForIsolatedPass[cameraName]._attachCameras(camera);
@@ -86,7 +88,9 @@ var BABYLON;
             for (var i = 0; i < _cam.length; i++) {
             for (var i = 0; i < _cam.length; i++) {
                 var camera = _cam[i];
                 var camera = _cam[i];
                 var cameraName = camera.name;
                 var cameraName = camera.name;
-                this._renderEffectsForIsolatedPass[cameraName] = this._renderEffectsForIsolatedPass[cameraName] || new BABYLON.PostProcessRenderEffect(this._engine, PostProcessRenderPipeline.PASS_EFFECT_NAME, function () { return new BABYLON.DisplayPassPostProcess(PostProcessRenderPipeline.PASS_EFFECT_NAME, 1.0, null, null, _this._engine, true); });
+                this._renderEffectsForIsolatedPass[cameraName] = this._renderEffectsForIsolatedPass[cameraName] || new BABYLON.PostProcessRenderEffect(this._engine, PostProcessRenderPipeline.PASS_EFFECT_NAME, function () {
+                    return new BABYLON.DisplayPassPostProcess(PostProcessRenderPipeline.PASS_EFFECT_NAME, 1.0, null, null, _this._engine, true);
+                });
                 this._renderEffectsForIsolatedPass[cameraName]._disable(camera);
                 this._renderEffectsForIsolatedPass[cameraName]._disable(camera);
             }
             }
             for (var renderEffectName in this._renderEffects) {
             for (var renderEffectName in this._renderEffects) {

+ 66 - 20
Babylon/PostProcess/babylon.lensRenderingPipeline.js

@@ -87,9 +87,15 @@ var BABYLON;
             this._createHighlightsPostProcess(ratio);
             this._createHighlightsPostProcess(ratio);
             this._createDepthOfFieldPostProcess(ratio);
             this._createDepthOfFieldPostProcess(ratio);
             // Set up pipeline
             // Set up pipeline
-            this.addEffect(new BABYLON.PostProcessRenderEffect(scene.getEngine(), this.LensChromaticAberrationEffect, function () { return _this._chromaticAberrationPostProcess; }, true));
-            this.addEffect(new BABYLON.PostProcessRenderEffect(scene.getEngine(), this.HighlightsEnhancingEffect, function () { return _this._highlightsPostProcess; }, true));
-            this.addEffect(new BABYLON.PostProcessRenderEffect(scene.getEngine(), this.LensDepthOfFieldEffect, function () { return _this._depthOfFieldPostProcess; }, true));
+            this.addEffect(new BABYLON.PostProcessRenderEffect(scene.getEngine(), this.LensChromaticAberrationEffect, function () {
+                return _this._chromaticAberrationPostProcess;
+            }, true));
+            this.addEffect(new BABYLON.PostProcessRenderEffect(scene.getEngine(), this.HighlightsEnhancingEffect, function () {
+                return _this._highlightsPostProcess;
+            }, true));
+            this.addEffect(new BABYLON.PostProcessRenderEffect(scene.getEngine(), this.LensDepthOfFieldEffect, function () {
+                return _this._depthOfFieldPostProcess;
+            }, true));
             if (this._highlightsGain == -1) {
             if (this._highlightsGain == -1) {
                 this._disableEffect(this.HighlightsEnhancingEffect, null);
                 this._disableEffect(this.HighlightsEnhancingEffect, null);
             }
             }
@@ -100,21 +106,51 @@ var BABYLON;
             }
             }
         }
         }
         // public methods (self explanatory)
         // public methods (self explanatory)
-        LensRenderingPipeline.prototype.setEdgeBlur = function (amount) { this._edgeBlur = amount; };
-        LensRenderingPipeline.prototype.disableEdgeBlur = function () { this._edgeBlur = 0; };
-        LensRenderingPipeline.prototype.setGrainAmount = function (amount) { this._grainAmount = amount; };
-        LensRenderingPipeline.prototype.disableGrain = function () { this._grainAmount = 0; };
-        LensRenderingPipeline.prototype.setChromaticAberration = function (amount) { this._chromaticAberration = amount; };
-        LensRenderingPipeline.prototype.disableChromaticAberration = function () { this._chromaticAberration = 0; };
-        LensRenderingPipeline.prototype.setEdgeDistortion = function (amount) { this._distortion = amount; };
-        LensRenderingPipeline.prototype.disableEdgeDistortion = function () { this._distortion = 0; };
-        LensRenderingPipeline.prototype.setFocusDepth = function (amount) { this._dofDepth = amount; };
-        LensRenderingPipeline.prototype.disableDepthOfField = function () { this._dofDepth = -1; };
-        LensRenderingPipeline.prototype.setAperture = function (amount) { this._dofAperture = amount; };
-        LensRenderingPipeline.prototype.enablePentagonBokeh = function () { this._dofPentagon = true; };
-        LensRenderingPipeline.prototype.disablePentagonBokeh = function () { this._dofPentagon = false; };
-        LensRenderingPipeline.prototype.enableNoiseBlur = function () { this._blurNoise = true; };
-        LensRenderingPipeline.prototype.disableNoiseBlur = function () { this._blurNoise = false; };
+        LensRenderingPipeline.prototype.setEdgeBlur = function (amount) {
+            this._edgeBlur = amount;
+        };
+        LensRenderingPipeline.prototype.disableEdgeBlur = function () {
+            this._edgeBlur = 0;
+        };
+        LensRenderingPipeline.prototype.setGrainAmount = function (amount) {
+            this._grainAmount = amount;
+        };
+        LensRenderingPipeline.prototype.disableGrain = function () {
+            this._grainAmount = 0;
+        };
+        LensRenderingPipeline.prototype.setChromaticAberration = function (amount) {
+            this._chromaticAberration = amount;
+        };
+        LensRenderingPipeline.prototype.disableChromaticAberration = function () {
+            this._chromaticAberration = 0;
+        };
+        LensRenderingPipeline.prototype.setEdgeDistortion = function (amount) {
+            this._distortion = amount;
+        };
+        LensRenderingPipeline.prototype.disableEdgeDistortion = function () {
+            this._distortion = 0;
+        };
+        LensRenderingPipeline.prototype.setFocusDepth = function (amount) {
+            this._dofDepth = amount;
+        };
+        LensRenderingPipeline.prototype.disableDepthOfField = function () {
+            this._dofDepth = -1;
+        };
+        LensRenderingPipeline.prototype.setAperture = function (amount) {
+            this._dofAperture = amount;
+        };
+        LensRenderingPipeline.prototype.enablePentagonBokeh = function () {
+            this._dofPentagon = true;
+        };
+        LensRenderingPipeline.prototype.disablePentagonBokeh = function () {
+            this._dofPentagon = false;
+        };
+        LensRenderingPipeline.prototype.enableNoiseBlur = function () {
+            this._blurNoise = true;
+        };
+        LensRenderingPipeline.prototype.disableNoiseBlur = function () {
+            this._blurNoise = false;
+        };
         LensRenderingPipeline.prototype.setHighlightsGain = function (amount) {
         LensRenderingPipeline.prototype.setHighlightsGain = function (amount) {
             this._highlightsGain = amount;
             this._highlightsGain = amount;
         };
         };
@@ -167,8 +203,18 @@ var BABYLON;
         LensRenderingPipeline.prototype._createDepthOfFieldPostProcess = function (ratio) {
         LensRenderingPipeline.prototype._createDepthOfFieldPostProcess = function (ratio) {
             var _this = this;
             var _this = this;
             this._depthOfFieldPostProcess = new BABYLON.PostProcess("LensDepthOfField", "depthOfField", [
             this._depthOfFieldPostProcess = new BABYLON.PostProcess("LensDepthOfField", "depthOfField", [
-                "focus_depth", "aperture", "pentagon", "maxZ", "edge_blur", "chromatic_aberration",
-                "distortion", "blur_noise", "grain_amount", "screen_width", "screen_height", "highlights"
+                "focus_depth",
+                "aperture",
+                "pentagon",
+                "maxZ",
+                "edge_blur",
+                "chromatic_aberration",
+                "distortion",
+                "blur_noise",
+                "grain_amount",
+                "screen_width",
+                "screen_height",
+                "highlights"
             ], ["depthSampler", "grainSampler", "highlightsSampler"], ratio, null, BABYLON.Texture.TRILINEAR_SAMPLINGMODE, this._scene.getEngine(), false);
             ], ["depthSampler", "grainSampler", "highlightsSampler"], ratio, null, BABYLON.Texture.TRILINEAR_SAMPLINGMODE, this._scene.getEngine(), false);
             this._depthOfFieldPostProcess.onApply = function (effect) {
             this._depthOfFieldPostProcess.onApply = function (effect) {
                 effect.setBool('blur_noise', _this._blurNoise);
                 effect.setBool('blur_noise', _this._blurNoise);

+ 63 - 21
Babylon/PostProcess/babylon.ssaoRenderingPipeline.js

@@ -81,11 +81,21 @@ var BABYLON;
             this._blurVPostProcess = new BABYLON.BlurPostProcess("SSAOBlurV", new BABYLON.Vector2(0.0, 2.0), 2.0, ssaoRatio, null, BABYLON.Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false);
             this._blurVPostProcess = new BABYLON.BlurPostProcess("SSAOBlurV", new BABYLON.Vector2(0.0, 2.0), 2.0, ssaoRatio, null, BABYLON.Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false);
             this._createSSAOCombinePostProcess(combineRatio);
             this._createSSAOCombinePostProcess(combineRatio);
             // Set up pipeline
             // Set up pipeline
-            this.addEffect(new BABYLON.PostProcessRenderEffect(scene.getEngine(), this.SSAOOriginalSceneColorEffect, function () { return _this._originalColorPostProcess; }, true));
-            this.addEffect(new BABYLON.PostProcessRenderEffect(scene.getEngine(), this.SSAORenderEffect, function () { return _this._ssaoPostProcess; }, true));
-            this.addEffect(new BABYLON.PostProcessRenderEffect(scene.getEngine(), this.SSAOBlurHRenderEffect, function () { return _this._blurHPostProcess; }, true));
-            this.addEffect(new BABYLON.PostProcessRenderEffect(scene.getEngine(), this.SSAOBlurVRenderEffect, function () { return _this._blurVPostProcess; }, true));
-            this.addEffect(new BABYLON.PostProcessRenderEffect(scene.getEngine(), this.SSAOCombineRenderEffect, function () { return _this._ssaoCombinePostProcess; }, true));
+            this.addEffect(new BABYLON.PostProcessRenderEffect(scene.getEngine(), this.SSAOOriginalSceneColorEffect, function () {
+                return _this._originalColorPostProcess;
+            }, true));
+            this.addEffect(new BABYLON.PostProcessRenderEffect(scene.getEngine(), this.SSAORenderEffect, function () {
+                return _this._ssaoPostProcess;
+            }, true));
+            this.addEffect(new BABYLON.PostProcessRenderEffect(scene.getEngine(), this.SSAOBlurHRenderEffect, function () {
+                return _this._blurHPostProcess;
+            }, true));
+            this.addEffect(new BABYLON.PostProcessRenderEffect(scene.getEngine(), this.SSAOBlurVRenderEffect, function () {
+                return _this._blurVPostProcess;
+            }, true));
+            this.addEffect(new BABYLON.PostProcessRenderEffect(scene.getEngine(), this.SSAOCombineRenderEffect, function () {
+                return _this._ssaoCombinePostProcess;
+            }, true));
             // Finish
             // Finish
             scene.postProcessRenderPipelineManager.addPipeline(this);
             scene.postProcessRenderPipelineManager.addPipeline(this);
             if (cameras)
             if (cameras)
@@ -125,22 +135,54 @@ var BABYLON;
         SSAORenderingPipeline.prototype._createSSAOPostProcess = function (ratio) {
         SSAORenderingPipeline.prototype._createSSAOPostProcess = function (ratio) {
             var _this = this;
             var _this = this;
             var sampleSphere = [
             var sampleSphere = [
-                0.5381, 0.1856, -0.4319,
-                0.1379, 0.2486, 0.4430,
-                0.3371, 0.5679, -0.0057,
-                -0.6999, -0.0451, -0.0019,
-                0.0689, -0.1598, -0.8547,
-                0.0560, 0.0069, -0.1843,
-                -0.0146, 0.1402, 0.0762,
-                0.0100, -0.1924, -0.0344,
-                -0.3577, -0.5301, -0.4358,
-                -0.3169, 0.1063, 0.0158,
-                0.0103, -0.5869, 0.0046,
-                -0.0897, -0.4940, 0.3287,
-                0.7119, -0.0154, -0.0918,
-                -0.0533, 0.0596, -0.5411,
-                0.0352, -0.0631, 0.5460,
-                -0.4776, 0.2847, -0.0271
+                0.5381,
+                0.1856,
+                -0.4319,
+                0.1379,
+                0.2486,
+                0.4430,
+                0.3371,
+                0.5679,
+                -0.0057,
+                -0.6999,
+                -0.0451,
+                -0.0019,
+                0.0689,
+                -0.1598,
+                -0.8547,
+                0.0560,
+                0.0069,
+                -0.1843,
+                -0.0146,
+                0.1402,
+                0.0762,
+                0.0100,
+                -0.1924,
+                -0.0344,
+                -0.3577,
+                -0.5301,
+                -0.4358,
+                -0.3169,
+                0.1063,
+                0.0158,
+                0.0103,
+                -0.5869,
+                0.0046,
+                -0.0897,
+                -0.4940,
+                0.3287,
+                0.7119,
+                -0.0154,
+                -0.0918,
+                -0.0533,
+                0.0596,
+                -0.5411,
+                0.0352,
+                -0.0631,
+                0.5460,
+                -0.4776,
+                0.2847,
+                -0.0271
             ];
             ];
             var samplesFactor = 1.0 / 16.0;
             var samplesFactor = 1.0 / 16.0;
             this._ssaoPostProcess = new BABYLON.PostProcess("ssao", "ssao", ["sampleSphere", "samplesFactor", "randTextureTiles", "totalStrength", "radius", "area", "fallOff"], ["randomSampler"], ratio, null, BABYLON.Texture.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false);
             this._ssaoPostProcess = new BABYLON.PostProcess("ssao", "ssao", ["sampleSphere", "samplesFactor", "randTextureTiles", "totalStrength", "radius", "area", "fallOff"], ["randomSampler"], ratio, null, BABYLON.Texture.BILINEAR_SAMPLINGMODE, this._scene.getEngine(), false);

+ 0 - 1
Babylon/PostProcess/babylon.volumetricLightScatteringPostProcess.js

@@ -226,7 +226,6 @@ var BABYLON;
                 }
                 }
                 engine.setAlphaTesting(false);
                 engine.setAlphaTesting(false);
                 if (transparentSubMeshes.length) {
                 if (transparentSubMeshes.length) {
-                    // Sort sub meshes
                     for (index = 0; index < transparentSubMeshes.length; index++) {
                     for (index = 0; index < transparentSubMeshes.length; index++) {
                         var submesh = transparentSubMeshes.data[index];
                         var submesh = transparentSubMeshes.data[index];
                         submesh._alphaIndex = submesh.getMesh().alphaIndex;
                         submesh._alphaIndex = submesh.getMesh().alphaIndex;

+ 1 - 3
Babylon/Rendering/babylon.boundingBoxRenderer.js

@@ -41,9 +41,7 @@ var BABYLON;
                 var max = boundingBox.maximum;
                 var max = boundingBox.maximum;
                 var diff = max.subtract(min);
                 var diff = max.subtract(min);
                 var median = min.add(diff.scale(0.5));
                 var median = min.add(diff.scale(0.5));
-                var worldMatrix = BABYLON.Matrix.Scaling(diff.x, diff.y, diff.z)
-                    .multiply(BABYLON.Matrix.Translation(median.x, median.y, median.z))
-                    .multiply(boundingBox.getWorldMatrix());
+                var worldMatrix = BABYLON.Matrix.Scaling(diff.x, diff.y, diff.z).multiply(BABYLON.Matrix.Translation(median.x, median.y, median.z)).multiply(boundingBox.getWorldMatrix());
                 // VBOs
                 // VBOs
                 engine.bindBuffers(this._vb.getBuffer(), this._ib, [3], 3 * 4, this._colorShader.getEffect());
                 engine.bindBuffers(this._vb.getBuffer(), this._ib, [3], 3 * 4, this._colorShader.getEffect());
                 if (this.showBackLines) {
                 if (this.showBackLines) {

+ 3 - 1
Babylon/Rendering/babylon.outlineRenderer.js

@@ -30,7 +30,9 @@ var BABYLON;
                 this._effect.setTexture("diffuseSampler", alphaTexture);
                 this._effect.setTexture("diffuseSampler", alphaTexture);
                 this._effect.setMatrix("diffuseMatrix", alphaTexture.getTextureMatrix());
                 this._effect.setMatrix("diffuseMatrix", alphaTexture.getTextureMatrix());
             }
             }
-            mesh._processRendering(subMesh, this._effect, BABYLON.Material.TriangleFillMode, batch, hardwareInstancedRendering, function (isInstance, world) { _this._effect.setMatrix("world", world); });
+            mesh._processRendering(subMesh, this._effect, BABYLON.Material.TriangleFillMode, batch, hardwareInstancedRendering, function (isInstance, world) {
+                _this._effect.setMatrix("world", world);
+            });
         };
         };
         OutlineRenderer.prototype.isReady = function (subMesh, useInstances) {
         OutlineRenderer.prototype.isReady = function (subMesh, useInstances) {
             var defines = [];
             var defines = [];

+ 0 - 1
Babylon/Rendering/babylon.renderingGroup.js

@@ -33,7 +33,6 @@ var BABYLON;
             engine.setAlphaTesting(false);
             engine.setAlphaTesting(false);
             // Transparent
             // Transparent
             if (this._transparentSubMeshes.length) {
             if (this._transparentSubMeshes.length) {
-                // Sorting
                 for (subIndex = 0; subIndex < this._transparentSubMeshes.length; subIndex++) {
                 for (subIndex = 0; subIndex < this._transparentSubMeshes.length; subIndex++) {
                     submesh = this._transparentSubMeshes.data[subIndex];
                     submesh = this._transparentSubMeshes.data[subIndex];
                     submesh._alphaIndex = submesh.getMesh().alphaIndex;
                     submesh._alphaIndex = submesh.getMesh().alphaIndex;

+ 6 - 4
Babylon/Tools/babylon.database.js

@@ -179,7 +179,6 @@ var BABYLON;
                         try {
                         try {
                             blobTextureURL = URL.createObjectURL(blob, { oneTimeOnly: true });
                             blobTextureURL = URL.createObjectURL(blob, { oneTimeOnly: true });
                         }
                         }
-                        // Chrome is raising a type error if we're setting the oneTimeOnly parameter
                         catch (ex) {
                         catch (ex) {
                             blobTextureURL = URL.createObjectURL(blob);
                             blobTextureURL = URL.createObjectURL(blob);
                         }
                         }
@@ -203,7 +202,8 @@ var BABYLON;
                                         this.hasReachedQuota = true;
                                         this.hasReachedQuota = true;
                                     }
                                     }
                                 }
                                 }
-                                catch (ex) { }
+                                catch (ex) {
+                                }
                                 generateBlobUrl();
                                 generateBlobUrl();
                             };
                             };
                             transaction.oncomplete = function (event) {
                             transaction.oncomplete = function (event) {
@@ -311,7 +311,8 @@ var BABYLON;
                                 _this.hasReachedQuota = true;
                                 _this.hasReachedQuota = true;
                             }
                             }
                         }
                         }
-                        catch (ex) { }
+                        catch (ex) {
+                        }
                         callback(-1);
                         callback(-1);
                     };
                     };
                     transaction.oncomplete = function (event) {
                     transaction.oncomplete = function (event) {
@@ -425,7 +426,8 @@ var BABYLON;
                                         this.hasReachedQuota = true;
                                         this.hasReachedQuota = true;
                                     }
                                     }
                                 }
                                 }
-                                catch (ex) { }
+                                catch (ex) {
+                                }
                                 callback(fileData);
                                 callback(fileData);
                             };
                             };
                             transaction.oncomplete = function (event) {
                             transaction.oncomplete = function (event) {

+ 13 - 7
Babylon/Tools/babylon.filesInput.js

@@ -17,9 +17,15 @@ var BABYLON;
             var _this = this;
             var _this = this;
             if (p_elementToMonitor) {
             if (p_elementToMonitor) {
                 this._elementToMonitor = p_elementToMonitor;
                 this._elementToMonitor = p_elementToMonitor;
-                this._elementToMonitor.addEventListener("dragenter", function (e) { _this.drag(e); }, false);
-                this._elementToMonitor.addEventListener("dragover", function (e) { _this.drag(e); }, false);
-                this._elementToMonitor.addEventListener("drop", function (e) { _this.drop(e); }, false);
+                this._elementToMonitor.addEventListener("dragenter", function (e) {
+                    _this.drag(e);
+                }, false);
+                this._elementToMonitor.addEventListener("dragover", function (e) {
+                    _this.drag(e);
+                }, false);
+                this._elementToMonitor.addEventListener("drop", function (e) {
+                    _this.drop(e);
+                }, false);
             }
             }
         };
         };
         FilesInput.prototype.renderFunction = function () {
         FilesInput.prototype.renderFunction = function () {
@@ -76,9 +82,7 @@ var BABYLON;
                             FilesInput.FilesToLoad[this._filesToLoad[i].name] = this._filesToLoad[i];
                             FilesInput.FilesToLoad[this._filesToLoad[i].name] = this._filesToLoad[i];
                             break;
                             break;
                         default:
                         default:
-                            if (this._filesToLoad[i].name.indexOf(".babylon") !== -1 && this._filesToLoad[i].name.indexOf(".manifest") === -1
-                                && this._filesToLoad[i].name.indexOf(".incremental") === -1 && this._filesToLoad[i].name.indexOf(".babylonmeshdata") === -1
-                                && this._filesToLoad[i].name.indexOf(".babylongeometrydata") === -1) {
+                            if (this._filesToLoad[i].name.indexOf(".babylon") !== -1 && this._filesToLoad[i].name.indexOf(".manifest") === -1 && this._filesToLoad[i].name.indexOf(".incremental") === -1 && this._filesToLoad[i].name.indexOf(".babylonmeshdata") === -1 && this._filesToLoad[i].name.indexOf(".babylongeometrydata") === -1) {
                                 this._sceneFileToLoad = this._filesToLoad[i];
                                 this._sceneFileToLoad = this._filesToLoad[i];
                             }
                             }
                             break;
                             break;
@@ -108,7 +112,9 @@ var BABYLON;
                         if (that._sceneLoadedCallback) {
                         if (that._sceneLoadedCallback) {
                             that._sceneLoadedCallback(_this._sceneFileToLoad, that._currentScene);
                             that._sceneLoadedCallback(_this._sceneFileToLoad, that._currentScene);
                         }
                         }
-                        that._engine.runRenderLoop(function () { that.renderFunction(); });
+                        that._engine.runRenderLoop(function () {
+                            that.renderFunction();
+                        });
                     });
                     });
                 }, function (progress) {
                 }, function (progress) {
                     if (_this._progressCallback) {
                     if (_this._progressCallback) {

File diff suppressed because it is too large
+ 24 - 20
Babylon/Tools/babylon.gamepads.js


+ 0 - 1
Babylon/Tools/babylon.sceneOptimizer.js

@@ -158,7 +158,6 @@ var BABYLON;
                         continue;
                         continue;
                     }
                     }
                     currentPool.push(current);
                     currentPool.push(current);
-                    // Find compatible meshes
                     for (var subIndex = index + 1; subIndex < globalLength; subIndex++) {
                     for (var subIndex = index + 1; subIndex < globalLength; subIndex++) {
                         var otherMesh = globalPool[subIndex];
                         var otherMesh = globalPool[subIndex];
                         if (!_this._canBeMerged(otherMesh)) {
                         if (!_this._canBeMerged(otherMesh)) {

+ 0 - 1
Babylon/Tools/babylon.smartCollection.js

@@ -29,7 +29,6 @@ var BABYLON;
         SmartCollection.prototype.removeItemOfIndex = function (index) {
         SmartCollection.prototype.removeItemOfIndex = function (index) {
             if (index < this.count && index > -1) {
             if (index < this.count && index > -1) {
                 delete this.items[this._keys[index]];
                 delete this.items[this._keys[index]];
-                //here, shifting by hand is better optimised than .splice
                 while (index < this.count) {
                 while (index < this.count) {
                     this._keys[index] = this._keys[index + 1];
                     this._keys[index] = this._keys[index + 1];
                     index++;
                     index++;

+ 1 - 4
Babylon/Tools/babylon.tools.dds.js

@@ -11,10 +11,7 @@ var BABYLON;
         var DDSCAPS2_CUBEMAP = 0x200, DDSCAPS2_CUBEMAP_POSITIVEX = 0x400, DDSCAPS2_CUBEMAP_NEGATIVEX = 0x800, DDSCAPS2_CUBEMAP_POSITIVEY = 0x1000, DDSCAPS2_CUBEMAP_NEGATIVEY = 0x2000, DDSCAPS2_CUBEMAP_POSITIVEZ = 0x4000, DDSCAPS2_CUBEMAP_NEGATIVEZ = 0x8000, DDSCAPS2_VOLUME = 0x200000;
         var DDSCAPS2_CUBEMAP = 0x200, DDSCAPS2_CUBEMAP_POSITIVEX = 0x400, DDSCAPS2_CUBEMAP_NEGATIVEX = 0x800, DDSCAPS2_CUBEMAP_POSITIVEY = 0x1000, DDSCAPS2_CUBEMAP_NEGATIVEY = 0x2000, DDSCAPS2_CUBEMAP_POSITIVEZ = 0x4000, DDSCAPS2_CUBEMAP_NEGATIVEZ = 0x8000, DDSCAPS2_VOLUME = 0x200000;
         var DDPF_ALPHAPIXELS = 0x1, DDPF_ALPHA = 0x2, DDPF_FOURCC = 0x4, DDPF_RGB = 0x40, DDPF_YUV = 0x200, DDPF_LUMINANCE = 0x20000;
         var DDPF_ALPHAPIXELS = 0x1, DDPF_ALPHA = 0x2, DDPF_FOURCC = 0x4, DDPF_RGB = 0x40, DDPF_YUV = 0x200, DDPF_LUMINANCE = 0x20000;
         function FourCCToInt32(value) {
         function FourCCToInt32(value) {
-            return value.charCodeAt(0) +
-                (value.charCodeAt(1) << 8) +
-                (value.charCodeAt(2) << 16) +
-                (value.charCodeAt(3) << 24);
+            return value.charCodeAt(0) + (value.charCodeAt(1) << 8) + (value.charCodeAt(2) << 16) + (value.charCodeAt(3) << 24);
         }
         }
         function Int32ToFourCC(value) {
         function Int32ToFourCC(value) {
             return String.fromCharCode(value & 0xff, (value >> 8) & 0xff, (value >> 16) & 0xff, (value >> 24) & 0xff);
             return String.fromCharCode(value & 0xff, (value >> 8) & 0xff, (value >> 16) & 0xff, (value >> 24) & 0xff);

+ 0 - 3
Babylon/Tools/babylon.tools.js

@@ -34,7 +34,6 @@ var BABYLON;
             } while (count < value);
             } while (count < value);
             return count === value;
             return count === value;
         };
         };
-        ;
         Tools.GetExponantOfTwo = function (value, max) {
         Tools.GetExponantOfTwo = function (value, max) {
             var count = 1;
             var count = 1;
             do {
             do {
@@ -44,7 +43,6 @@ var BABYLON;
                 count = max;
                 count = max;
             return count;
             return count;
         };
         };
-        ;
         Tools.GetFilename = function (path) {
         Tools.GetFilename = function (path) {
             var index = path.lastIndexOf("/");
             var index = path.lastIndexOf("/");
             if (index < 0)
             if (index < 0)
@@ -385,7 +383,6 @@ var BABYLON;
             var halfHeight = height / 2;
             var halfHeight = height / 2;
             //Reading datas from WebGL
             //Reading datas from WebGL
             var data = engine.readPixels(0, 0, width, height);
             var data = engine.readPixels(0, 0, width, height);
-            //To flip image on Y axis.
             for (var i = 0; i < halfHeight; i++) {
             for (var i = 0; i < halfHeight; i++) {
                 for (var j = 0; j < numberOfChannelsByLine; j++) {
                 for (var j = 0; j < numberOfChannelsByLine; j++) {
                     var currentCell = j + i * numberOfChannelsByLine;
                     var currentCell = j + i * numberOfChannelsByLine;

+ 0 - 3
Babylon/Tools/babylon.tools.tga.js

@@ -50,7 +50,6 @@ var BABYLON;
                 var use_pal = false;
                 var use_pal = false;
                 var use_rgb = false;
                 var use_rgb = false;
                 var use_grey = false;
                 var use_grey = false;
-                // Get some informations.
                 switch (header.image_type) {
                 switch (header.image_type) {
                     case TGATools._TYPE_RLE_INDEXED:
                     case TGATools._TYPE_RLE_INDEXED:
                         use_rle = true;
                         use_rle = true;
@@ -88,11 +87,9 @@ var BABYLON;
                         count = (c & 0x7f) + 1;
                         count = (c & 0x7f) + 1;
                         // RLE pixels
                         // RLE pixels
                         if (c & 0x80) {
                         if (c & 0x80) {
-                            // Bind pixel tmp array
                             for (i = 0; i < pixel_size; ++i) {
                             for (i = 0; i < pixel_size; ++i) {
                                 pixels[i] = data[offset++];
                                 pixels[i] = data[offset++];
                             }
                             }
-                            // Copy pixel array
                             for (i = 0; i < count; ++i) {
                             for (i = 0; i < count; ++i) {
                                 pixel_data.set(pixels, localOffset + i * pixel_size);
                                 pixel_data.set(pixels, localOffset + i * pixel_size);
                             }
                             }

+ 2 - 2
Babylon/Tools/babylon.tools.ts

@@ -46,7 +46,7 @@
             } while (count < value);
             } while (count < value);
 
 
             return count === value;
             return count === value;
-        };
+        }
 
 
         public static GetExponantOfTwo(value: number, max: number): number {
         public static GetExponantOfTwo(value: number, max: number): number {
             var count = 1;
             var count = 1;
@@ -59,7 +59,7 @@
                 count = max;
                 count = max;
 
 
             return count;
             return count;
-        };
+        }
 
 
         public static GetFilename(path: string): string {
         public static GetFilename(path: string): string {
             var index = path.lastIndexOf("/");
             var index = path.lastIndexOf("/");

+ 22 - 18
Babylon/Tools/babylon.virtualJoystick.js

@@ -22,8 +22,8 @@ var BABYLON;
             VirtualJoystick._globalJoystickIndex++;
             VirtualJoystick._globalJoystickIndex++;
             // By default left & right arrow keys are moving the X
             // By default left & right arrow keys are moving the X
             // and up & down keys are moving the Y
             // and up & down keys are moving the Y
-            this._axisTargetedByLeftAndRight = JoystickAxis.X;
-            this._axisTargetedByUpAndDown = JoystickAxis.Y;
+            this._axisTargetedByLeftAndRight = 0 /* X */;
+            this._axisTargetedByUpAndDown = 1 /* Y */;
             this.reverseLeftRight = false;
             this.reverseLeftRight = false;
             this.reverseUpDown = false;
             this.reverseUpDown = false;
             // collections of pointers
             // collections of pointers
@@ -88,7 +88,9 @@ var BABYLON;
             VirtualJoystick.vjCanvas.addEventListener("contextmenu", function (evt) {
             VirtualJoystick.vjCanvas.addEventListener("contextmenu", function (evt) {
                 evt.preventDefault(); // Disables system menu
                 evt.preventDefault(); // Disables system menu
             }, false);
             }, false);
-            requestAnimationFrame(function () { _this._drawVirtualJoystick(); });
+            requestAnimationFrame(function () {
+                _this._drawVirtualJoystick();
+            });
         }
         }
         VirtualJoystick.prototype.setJoystickSensibility = function (newJoystickSensibility) {
         VirtualJoystick.prototype.setJoystickSensibility = function (newJoystickSensibility) {
             this._joystickSensibility = newJoystickSensibility;
             this._joystickSensibility = newJoystickSensibility;
@@ -132,26 +134,26 @@ var BABYLON;
                 var directionLeftRight = this.reverseLeftRight ? -1 : 1;
                 var directionLeftRight = this.reverseLeftRight ? -1 : 1;
                 var deltaJoystickX = directionLeftRight * this._deltaJoystickVector.x / this._inversedSensibility;
                 var deltaJoystickX = directionLeftRight * this._deltaJoystickVector.x / this._inversedSensibility;
                 switch (this._axisTargetedByLeftAndRight) {
                 switch (this._axisTargetedByLeftAndRight) {
-                    case JoystickAxis.X:
+                    case 0 /* X */:
                         this.deltaPosition.x = Math.min(1, Math.max(-1, deltaJoystickX));
                         this.deltaPosition.x = Math.min(1, Math.max(-1, deltaJoystickX));
                         break;
                         break;
-                    case JoystickAxis.Y:
+                    case 1 /* Y */:
                         this.deltaPosition.y = Math.min(1, Math.max(-1, deltaJoystickX));
                         this.deltaPosition.y = Math.min(1, Math.max(-1, deltaJoystickX));
                         break;
                         break;
-                    case JoystickAxis.Z:
+                    case 2 /* Z */:
                         this.deltaPosition.z = Math.min(1, Math.max(-1, deltaJoystickX));
                         this.deltaPosition.z = Math.min(1, Math.max(-1, deltaJoystickX));
                         break;
                         break;
                 }
                 }
                 var directionUpDown = this.reverseUpDown ? 1 : -1;
                 var directionUpDown = this.reverseUpDown ? 1 : -1;
                 var deltaJoystickY = directionUpDown * this._deltaJoystickVector.y / this._inversedSensibility;
                 var deltaJoystickY = directionUpDown * this._deltaJoystickVector.y / this._inversedSensibility;
                 switch (this._axisTargetedByUpAndDown) {
                 switch (this._axisTargetedByUpAndDown) {
-                    case JoystickAxis.X:
+                    case 0 /* X */:
                         this.deltaPosition.x = Math.min(1, Math.max(-1, deltaJoystickY));
                         this.deltaPosition.x = Math.min(1, Math.max(-1, deltaJoystickY));
                         break;
                         break;
-                    case JoystickAxis.Y:
+                    case 1 /* Y */:
                         this.deltaPosition.y = Math.min(1, Math.max(-1, deltaJoystickY));
                         this.deltaPosition.y = Math.min(1, Math.max(-1, deltaJoystickY));
                         break;
                         break;
-                    case JoystickAxis.Z:
+                    case 2 /* Z */:
                         this.deltaPosition.z = Math.min(1, Math.max(-1, deltaJoystickY));
                         this.deltaPosition.z = Math.min(1, Math.max(-1, deltaJoystickY));
                         break;
                         break;
                 }
                 }
@@ -186,26 +188,26 @@ var BABYLON;
         // Define which axis you'd like to control for left & right 
         // Define which axis you'd like to control for left & right 
         VirtualJoystick.prototype.setAxisForLeftRight = function (axis) {
         VirtualJoystick.prototype.setAxisForLeftRight = function (axis) {
             switch (axis) {
             switch (axis) {
-                case JoystickAxis.X:
-                case JoystickAxis.Y:
-                case JoystickAxis.Z:
+                case 0 /* X */:
+                case 1 /* Y */:
+                case 2 /* Z */:
                     this._axisTargetedByLeftAndRight = axis;
                     this._axisTargetedByLeftAndRight = axis;
                     break;
                     break;
                 default:
                 default:
-                    this._axisTargetedByLeftAndRight = JoystickAxis.X;
+                    this._axisTargetedByLeftAndRight = 0 /* X */;
                     break;
                     break;
             }
             }
         };
         };
         // Define which axis you'd like to control for up & down 
         // Define which axis you'd like to control for up & down 
         VirtualJoystick.prototype.setAxisForUpDown = function (axis) {
         VirtualJoystick.prototype.setAxisForUpDown = function (axis) {
             switch (axis) {
             switch (axis) {
-                case JoystickAxis.X:
-                case JoystickAxis.Y:
-                case JoystickAxis.Z:
+                case 0 /* X */:
+                case 1 /* Y */:
+                case 2 /* Z */:
                     this._axisTargetedByUpAndDown = axis;
                     this._axisTargetedByUpAndDown = axis;
                     break;
                     break;
                 default:
                 default:
-                    this._axisTargetedByUpAndDown = JoystickAxis.Y;
+                    this._axisTargetedByUpAndDown = 1 /* Y */;
                     break;
                     break;
             }
             }
         };
         };
@@ -250,7 +252,9 @@ var BABYLON;
                     ;
                     ;
                 });
                 });
             }
             }
-            requestAnimationFrame(function () { _this._drawVirtualJoystick(); });
+            requestAnimationFrame(function () {
+                _this._drawVirtualJoystick();
+            });
         };
         };
         VirtualJoystick.prototype.releaseCanvas = function () {
         VirtualJoystick.prototype.releaseCanvas = function () {
             if (VirtualJoystick.vjCanvas) {
             if (VirtualJoystick.vjCanvas) {

+ 9 - 19
Babylon/babylon.engine.js

@@ -197,10 +197,7 @@ var BABYLON;
             configurable: true
             configurable: true
         });
         });
         _AlphaState.prototype.setAlphaBlendFunctionParameters = function (value0, value1, value2, value3) {
         _AlphaState.prototype.setAlphaBlendFunctionParameters = function (value0, value1, value2, value3) {
-            if (this._blendFunctionParameters[0] === value0 &&
-                this._blendFunctionParameters[1] === value1 &&
-                this._blendFunctionParameters[2] === value2 &&
-                this._blendFunctionParameters[3] === value3) {
+            if (this._blendFunctionParameters[0] === value0 && this._blendFunctionParameters[1] === value1 && this._blendFunctionParameters[2] === value2 && this._blendFunctionParameters[3] === value3) {
                 return;
                 return;
             }
             }
             this._blendFunctionParameters[0] = value0;
             this._blendFunctionParameters[0] = value0;
@@ -383,7 +380,6 @@ var BABYLON;
             this._canvasClientRect = this._renderingCanvas.getBoundingClientRect();
             this._canvasClientRect = this._renderingCanvas.getBoundingClientRect();
             options = options || {};
             options = options || {};
             options.antialias = antialias;
             options.antialias = antialias;
-            // GL
             try {
             try {
                 this._gl = canvas.getContext("webgl", options) || canvas.getContext("experimental-webgl", options);
                 this._gl = canvas.getContext("webgl", options) || canvas.getContext("experimental-webgl", options);
             }
             }
@@ -456,10 +452,7 @@ var BABYLON;
                 }
                 }
                 // Pointer lock
                 // Pointer lock
                 if (_this.isFullscreen && _this._pointerLockRequested) {
                 if (_this.isFullscreen && _this._pointerLockRequested) {
-                    canvas.requestPointerLock = canvas.requestPointerLock ||
-                        canvas.msRequestPointerLock ||
-                        canvas.mozRequestPointerLock ||
-                        canvas.webkitRequestPointerLock;
+                    canvas.requestPointerLock = canvas.requestPointerLock || canvas.msRequestPointerLock || canvas.mozRequestPointerLock || canvas.webkitRequestPointerLock;
                     if (canvas.requestPointerLock) {
                     if (canvas.requestPointerLock) {
                         canvas.requestPointerLock();
                         canvas.requestPointerLock();
                     }
                     }
@@ -471,10 +464,7 @@ var BABYLON;
             document.addEventListener("msfullscreenchange", this._onFullscreenChange, false);
             document.addEventListener("msfullscreenchange", this._onFullscreenChange, false);
             // Pointer lock
             // Pointer lock
             this._onPointerLockChange = function () {
             this._onPointerLockChange = function () {
-                _this.isPointerLock = (document.mozPointerLockElement === canvas ||
-                    document.webkitPointerLockElement === canvas ||
-                    document.msPointerLockElement === canvas ||
-                    document.pointerLockElement === canvas);
+                _this.isPointerLock = (document.mozPointerLockElement === canvas || document.webkitPointerLockElement === canvas || document.msPointerLockElement === canvas || document.pointerLockElement === canvas);
             };
             };
             document.addEventListener("pointerlockchange", this._onPointerLockChange, false);
             document.addEventListener("pointerlockchange", this._onPointerLockChange, false);
             document.addEventListener("mspointerlockchange", this._onPointerLockChange, false);
             document.addEventListener("mspointerlockchange", this._onPointerLockChange, false);
@@ -1572,8 +1562,12 @@ var BABYLON;
                     _this._workingCanvas.width = width;
                     _this._workingCanvas.width = width;
                     _this._workingCanvas.height = height;
                     _this._workingCanvas.height = height;
                     var faces = [
                     var faces = [
-                        gl.TEXTURE_CUBE_MAP_POSITIVE_X, gl.TEXTURE_CUBE_MAP_POSITIVE_Y, gl.TEXTURE_CUBE_MAP_POSITIVE_Z,
-                        gl.TEXTURE_CUBE_MAP_NEGATIVE_X, gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, gl.TEXTURE_CUBE_MAP_NEGATIVE_Z
+                        gl.TEXTURE_CUBE_MAP_POSITIVE_X,
+                        gl.TEXTURE_CUBE_MAP_POSITIVE_Y,
+                        gl.TEXTURE_CUBE_MAP_POSITIVE_Z,
+                        gl.TEXTURE_CUBE_MAP_NEGATIVE_X,
+                        gl.TEXTURE_CUBE_MAP_NEGATIVE_Y,
+                        gl.TEXTURE_CUBE_MAP_NEGATIVE_Z
                     ];
                     ];
                     gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture);
                     gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture);
                     gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, 0);
                     gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, 0);
@@ -1606,7 +1600,6 @@ var BABYLON;
                 gl.deleteRenderbuffer(texture._depthBuffer);
                 gl.deleteRenderbuffer(texture._depthBuffer);
             }
             }
             gl.deleteTexture(texture);
             gl.deleteTexture(texture);
-            // Unbind channels
             for (var channel = 0; channel < this._caps.maxTexturesImageUnits; channel++) {
             for (var channel = 0; channel < this._caps.maxTexturesImageUnits; channel++) {
                 this._gl.activeTexture(this._gl["TEXTURE" + channel]);
                 this._gl.activeTexture(this._gl["TEXTURE" + channel]);
                 this._gl.bindTexture(this._gl.TEXTURE_2D, null);
                 this._gl.bindTexture(this._gl.TEXTURE_2D, null);
@@ -1729,17 +1722,14 @@ var BABYLON;
         Engine.prototype.dispose = function () {
         Engine.prototype.dispose = function () {
             this.hideLoadingUI();
             this.hideLoadingUI();
             this.stopRenderLoop();
             this.stopRenderLoop();
-            // Release scenes
             while (this.scenes.length) {
             while (this.scenes.length) {
                 this.scenes[0].dispose();
                 this.scenes[0].dispose();
             }
             }
             // Release audio engine
             // Release audio engine
             Engine.audioEngine.dispose();
             Engine.audioEngine.dispose();
-            // Release effects
             for (var name in this._compiledEffects) {
             for (var name in this._compiledEffects) {
                 this._gl.deleteProgram(this._compiledEffects[name]._program);
                 this._gl.deleteProgram(this._compiledEffects[name]._program);
             }
             }
-            // Unbind
             for (var i in this._vertexAttribArrays) {
             for (var i in this._vertexAttribArrays) {
                 if (i > this._gl.VERTEX_ATTRIB_ARRAY_ENABLED || !this._vertexAttribArrays[i]) {
                 if (i > this._gl.VERTEX_ATTRIB_ARRAY_ENABLED || !this._vertexAttribArrays[i]) {
                     continue;
                     continue;

+ 5 - 0
Babylon/babylon.mixins.ts

@@ -102,4 +102,9 @@ interface Navigator {
     getVRDevices: () => any;
     getVRDevices: () => any;
     mozGetVRDevices: (any) => any;
     mozGetVRDevices: (any) => any;
     isCocoonJS: boolean;
     isCocoonJS: boolean;
+}
+
+interface Screen {
+    orientation: string;
+    mozOrientation: string;
 }
 }

+ 3 - 12
Babylon/babylon.scene.js

@@ -1075,7 +1075,6 @@ var BABYLON;
             this._evaluateActiveMeshes();
             this._evaluateActiveMeshes();
             this._evaluateActiveMeshesDuration += BABYLON.Tools.Now - beforeEvaluateActiveMeshesDate;
             this._evaluateActiveMeshesDuration += BABYLON.Tools.Now - beforeEvaluateActiveMeshesDate;
             BABYLON.Tools.EndPerformanceCounter("Active meshes evaluation");
             BABYLON.Tools.EndPerformanceCounter("Active meshes evaluation");
-            // Skeletons
             for (var skeletonIndex = 0; skeletonIndex < this._activeSkeletons.length; skeletonIndex++) {
             for (var skeletonIndex = 0; skeletonIndex < this._activeSkeletons.length; skeletonIndex++) {
                 var skeleton = this._activeSkeletons.data[skeletonIndex];
                 var skeleton = this._activeSkeletons.data[skeletonIndex];
                 skeleton.prepare();
                 skeleton.prepare();
@@ -1157,7 +1156,6 @@ var BABYLON;
                 this._renderForCamera(camera);
                 this._renderForCamera(camera);
                 return;
                 return;
             }
             }
-            // Sub-cameras
             for (var index = 0; index < camera.subCameras.length; index++) {
             for (var index = 0; index < camera.subCameras.length; index++) {
                 this._renderForCamera(camera.subCameras[index]);
                 this._renderForCamera(camera.subCameras[index]);
             }
             }
@@ -1322,7 +1320,6 @@ var BABYLON;
             for (callbackIndex = 0; callbackIndex < this._onAfterRenderCallbacks.length; callbackIndex++) {
             for (callbackIndex = 0; callbackIndex < this._onAfterRenderCallbacks.length; callbackIndex++) {
                 this._onAfterRenderCallbacks[callbackIndex]();
                 this._onAfterRenderCallbacks[callbackIndex]();
             }
             }
-            // Cleaning
             for (var index = 0; index < this._toBeDisposed.length; index++) {
             for (var index = 0; index < this._toBeDisposed.length; index++) {
                 this._toBeDisposed.data[index].dispose();
                 this._toBeDisposed.data[index].dispose();
                 this._toBeDisposed[index] = null;
                 this._toBeDisposed[index] = null;
@@ -1476,35 +1473,27 @@ var BABYLON;
             for (index = 0; index < this.cameras.length; index++) {
             for (index = 0; index < this.cameras.length; index++) {
                 this.cameras[index].detachControl(canvas);
                 this.cameras[index].detachControl(canvas);
             }
             }
-            // Release lights
             while (this.lights.length) {
             while (this.lights.length) {
                 this.lights[0].dispose();
                 this.lights[0].dispose();
             }
             }
-            // Release meshes
             while (this.meshes.length) {
             while (this.meshes.length) {
                 this.meshes[0].dispose(true);
                 this.meshes[0].dispose(true);
             }
             }
-            // Release cameras
             while (this.cameras.length) {
             while (this.cameras.length) {
                 this.cameras[0].dispose();
                 this.cameras[0].dispose();
             }
             }
-            // Release materials
             while (this.materials.length) {
             while (this.materials.length) {
                 this.materials[0].dispose();
                 this.materials[0].dispose();
             }
             }
-            // Release particles
             while (this.particleSystems.length) {
             while (this.particleSystems.length) {
                 this.particleSystems[0].dispose();
                 this.particleSystems[0].dispose();
             }
             }
-            // Release sprites
             while (this.spriteManagers.length) {
             while (this.spriteManagers.length) {
                 this.spriteManagers[0].dispose();
                 this.spriteManagers[0].dispose();
             }
             }
-            // Release layers
             while (this.layers.length) {
             while (this.layers.length) {
                 this.layers[0].dispose();
                 this.layers[0].dispose();
             }
             }
-            // Release textures
             while (this.textures.length) {
             while (this.textures.length) {
                 this.textures[0].dispose();
                 this.textures[0].dispose();
             }
             }
@@ -1713,7 +1702,9 @@ var BABYLON;
                 return list;
                 return list;
             }
             }
             var listByTags = [];
             var listByTags = [];
-            forEach = forEach || (function (item) { return; });
+            forEach = forEach || (function (item) {
+                return;
+            });
             for (var i in list) {
             for (var i in list) {
                 var item = list[i];
                 var item = list[i];
                 if (BABYLON.Tags.MatchesQuery(item, tagsQuery)) {
                 if (BABYLON.Tags.MatchesQuery(item, tagsQuery)) {

File diff suppressed because it is too large
+ 464 - 481
babylon.2.1-beta.debug.js


File diff suppressed because it is too large
+ 23 - 20
babylon.2.1-beta.js


File diff suppressed because it is too large
+ 21 - 18
babylon.2.1-beta.noworker.js