瀏覽代碼

New cameras: AnaglyphGamepadCamera, StereogramFreeCamera, StereogramArcRotateCamera, StereogramGamepadCamera

David Catuhe 10 年之前
父節點
當前提交
7f94ce27d3
共有 69 個文件被更改,包括 1139 次插入975 次删除
  1. 2 1
      Babylon/Actions/babylon.actionManager.js
  2. 1 2
      Babylon/Actions/babylon.interpolateValueAction.js
  3. 17 0
      Babylon/Animations/babylon.animation.js
  4. 1 0
      Babylon/Audio/babylon.analyser.js
  5. 3 9
      Babylon/Audio/babylon.sound.js
  6. 1 0
      Babylon/Cameras/VR/babylon.webVRCamera.js
  7. 9 0
      Babylon/Cameras/babylon.anaglyphCamera.js
  8. 8 3
      Babylon/Cameras/babylon.anaglyphCamera.ts
  9. 14 3
      Babylon/Cameras/babylon.arcRotateCamera.js
  10. 17 5
      Babylon/Cameras/babylon.camera.js
  11. 9 2
      Babylon/Cameras/babylon.freeCamera.js
  12. 1 3
      Babylon/Cameras/babylon.gamepadCamera.js
  13. 37 0
      Babylon/Cameras/babylon.stereogramCamera.js
  14. 23 0
      Babylon/Cameras/babylon.stereogramCamera.ts
  15. 2 1
      Babylon/Cameras/babylon.targetCamera.js
  16. 4 4
      Babylon/Cameras/babylon.virtualJoysticksCamera.js
  17. 14 19
      Babylon/Collisions/babylon.collisionCoordinator.js
  18. 10 9
      Babylon/Collisions/babylon.collisionWorker.js
  19. 1 0
      Babylon/Culling/Octrees/babylon.octree.js
  20. 1 0
      Babylon/Culling/babylon.boundingBox.js
  21. 69 88
      Babylon/Debug/babylon.debugLayer.js
  22. 1 1
      Babylon/Debug/babylon.debugLayer.js.map
  23. 1 0
      Babylon/LensFlare/babylon.lensFlareSystem.js
  24. 3 1
      Babylon/Lights/Shadows/babylon.shadowGenerator.js
  25. 1 0
      Babylon/Lights/babylon.directionalLight.js
  26. 13 10
      Babylon/Loading/Plugins/babylon.babylonFileLoader.js
  27. 2 2
      Babylon/Loading/Plugins/babylon.babylonFileLoader.ts
  28. 8 0
      Babylon/Materials/Textures/Procedurals/babylon.proceduralTexture.js
  29. 12 2
      Babylon/Materials/Textures/babylon.texture.js
  30. 8 0
      Babylon/Materials/babylon.shaderMaterial.js
  31. 18 2
      Babylon/Materials/babylon.standardMaterial.js
  32. 49 49
      Babylon/Math/babylon.math.js
  33. 5 2
      Babylon/Mesh/babylon.abstractMesh.js
  34. 9 7
      Babylon/Mesh/babylon.csg.js
  35. 2 2
      Babylon/Mesh/babylon.geometry.js
  36. 1 0
      Babylon/Mesh/babylon.instancedMesh.js
  37. 17 14
      Babylon/Mesh/babylon.mesh.js
  38. 15 0
      Babylon/Mesh/babylon.mesh.vertexData.js
  39. 8 7
      Babylon/Mesh/babylon.meshSimplification.js
  40. 1 0
      Babylon/Mesh/babylon.subMesh.js
  41. 1 0
      Babylon/Mesh/babylon.vertexBuffer.js
  42. 2 0
      Babylon/Physics/Plugins/babylon.cannonJSPlugin.js
  43. 2 0
      Babylon/Physics/Plugins/babylon.oimoJSPlugin.js
  44. 2 6
      Babylon/PostProcess/RenderPipeline/babylon.postProcessRenderPipeline.js
  45. 20 66
      Babylon/PostProcess/babylon.lensRenderingPipeline.js
  46. 21 63
      Babylon/PostProcess/babylon.ssaoRenderingPipeline.js
  47. 1 0
      Babylon/PostProcess/babylon.volumetricLightScatteringPostProcess.js
  48. 3 1
      Babylon/Rendering/babylon.boundingBoxRenderer.js
  49. 1 3
      Babylon/Rendering/babylon.outlineRenderer.js
  50. 1 0
      Babylon/Rendering/babylon.renderingGroup.js
  51. 4 6
      Babylon/Tools/babylon.database.js
  52. 7 13
      Babylon/Tools/babylon.filesInput.js
  53. 20 24
      Babylon/Tools/babylon.gamepads.js
  54. 1 0
      Babylon/Tools/babylon.sceneOptimizer.js
  55. 2 2
      Babylon/Tools/babylon.sceneSerializer.js
  56. 2 2
      Babylon/Tools/babylon.sceneSerializer.ts
  57. 1 0
      Babylon/Tools/babylon.smartCollection.js
  58. 4 1
      Babylon/Tools/babylon.tools.dds.js
  59. 1 0
      Babylon/Tools/babylon.tools.js
  60. 3 0
      Babylon/Tools/babylon.tools.tga.js
  61. 18 22
      Babylon/Tools/babylon.virtualJoystick.js
  62. 19 9
      Babylon/babylon.engine.js
  63. 12 3
      Babylon/babylon.scene.js
  64. 2 2
      Exporters/3ds Max/Max2Babylon/Forms/CameraPropertiesForm.Designer.cs
  65. 14 14
      Exporters/Blender/io_export_babylon.py
  66. 521 453
      babylon.2.1-beta.debug.js
  67. 17 19
      babylon.2.1-beta.js
  68. 16 18
      babylon.2.1-beta.noworker.js
  69. 3 0
      what's new - 2.1 - proposal.md

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

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

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

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

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

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

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

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

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

@@ -75,9 +75,7 @@ var BABYLON;
                 if (urlOrArrayBuffer) {
                     // If it's an URL
                     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 {
                         if (urlOrArrayBuffer instanceof ArrayBuffer) {
@@ -147,9 +145,7 @@ var BABYLON;
                 if (_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) {
             if (BABYLON.Engine.audioEngine.canUseWebAudio) {
@@ -290,9 +286,7 @@ var BABYLON;
                     this._soundSource.loop = this.loop;
                     this._soundSource.playbackRate.value = this._playbackRate;
                     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.isPlaying = true;
                     this.isPaused = false;

+ 1 - 0
Babylon/Cameras/VR/babylon.webVRCamera.js

@@ -25,6 +25,7 @@ var BABYLON;
             // Reset devices.
             this._sensorDevice = null;
             this._hmdDevice = null;
+            // Search for a HmdDevice.
             while (i < size && this._hmdDevice === null) {
                 if (devices[i] instanceof HMDVRDevice) {
                     this._hmdDevice = devices[i];

+ 9 - 0
Babylon/Cameras/babylon.anaglyphCamera.js

@@ -24,5 +24,14 @@ var BABYLON;
         return AnaglyphArcRotateCamera;
     })(BABYLON.ArcRotateCamera);
     BABYLON.AnaglyphArcRotateCamera = AnaglyphArcRotateCamera;
+    var AnaglyphGamepadCamera = (function (_super) {
+        __extends(AnaglyphGamepadCamera, _super);
+        function AnaglyphGamepadCamera(name, position, eyeSpace, scene) {
+            _super.call(this, name, position, scene);
+            this.setSubCameraMode(BABYLON.Camera.SUB_CAMERA_MODE_ANAGLYPH, eyeSpace);
+        }
+        return AnaglyphGamepadCamera;
+    })(BABYLON.GamepadCamera);
+    BABYLON.AnaglyphGamepadCamera = AnaglyphGamepadCamera;
 })(BABYLON || (BABYLON = {}));
 //# sourceMappingURL=babylon.anaglyphCamera.js.map

+ 8 - 3
Babylon/Cameras/babylon.anaglyphCamera.ts

@@ -1,6 +1,5 @@
 module BABYLON {
     export class AnaglyphFreeCamera extends FreeCamera {
-
         constructor(name: string, position: Vector3, eyeSpace: number, scene: Scene) {
             super(name, position, scene);
             this.setSubCameraMode(Camera.SUB_CAMERA_MODE_ANAGLYPH, eyeSpace);
@@ -8,10 +7,16 @@
     }
 
     export class AnaglyphArcRotateCamera extends ArcRotateCamera {
-
-        constructor(name: string, alpha: number, beta: number, radius: number, target, eyeSpace: number, scene) {
+        constructor(name: string, alpha: number, beta: number, radius: number, target, eyeSpace: number, scene: Scene) {
             super(name, alpha, beta, radius, target, scene);
             this.setSubCameraMode(Camera.SUB_CAMERA_MODE_ANAGLYPH, eyeSpace);
         }
     }
+
+    export class AnaglyphGamepadCamera extends GamepadCamera {
+        constructor(name: string, position: Vector3, eyeSpace: number, scene: Scene) {
+            super(name, position, scene);
+            this.setSubCameraMode(Camera.SUB_CAMERA_MODE_ANAGLYPH, eyeSpace);
+        }
+    }
 } 

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

@@ -89,7 +89,11 @@ var BABYLON;
         ArcRotateCamera.prototype._isSynchronizedViewMatrix = function () {
             if (!_super.prototype._isSynchronizedViewMatrix.call(this))
                 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
         ArcRotateCamera.prototype.attachControl = function (element, noPreventDefault) {
@@ -188,7 +192,10 @@ var BABYLON;
                     }
                 };
                 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);
                         if (index === -1) {
                             _this._keys.push(evt.keyCode);
@@ -201,7 +208,10 @@ var BABYLON;
                     }
                 };
                 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);
                         if (index >= 0) {
                             _this._keys.splice(index, 1);
@@ -292,6 +302,7 @@ var BABYLON;
             if (this._collisionTriggered) {
                 return;
             }
+            // Keyboard
             for (var index = 0; index < this._keys.length; index++) {
                 var keyCode = this._keys[index];
                 if (this.keysLeft.indexOf(keyCode) !== -1) {

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

@@ -62,7 +62,8 @@ var BABYLON;
             result.vResolution = 800;
             result.hScreenSize = 0.149759993;
             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.interpupillaryDistance = 0.0640000030;
             result.distortionK = [1.0, 0.219999999, 0.239999995, 0.0];
@@ -246,19 +247,29 @@ var BABYLON;
         Camera.prototype._isSynchronizedViewMatrix = function () {
             if (!_super.prototype._isSynchronized.call(this))
                 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 () {
-            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) {
                 return false;
             }
             var engine = this.getEngine();
             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 {
-                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;
         };
@@ -404,6 +415,7 @@ var BABYLON;
             while (this.subCameras.length > 0) {
                 this.subCameras.pop().dispose();
             }
+            // Postprocesses
             for (var i = 0; i < this._postProcessesTakenIndices.length; ++i) {
                 this._postProcesses[this._postProcessesTakenIndices[i]].dispose(this);
             }

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

@@ -101,7 +101,10 @@ var BABYLON;
                     }
                 };
                 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);
                         if (index === -1) {
                             _this._keys.push(evt.keyCode);
@@ -112,7 +115,10 @@ var BABYLON;
                     }
                 };
                 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);
                         if (index >= 0) {
                             _this._keys.splice(index, 1);
@@ -181,6 +187,7 @@ var BABYLON;
                 this._localDirection = BABYLON.Vector3.Zero();
                 this._transformedDirection = BABYLON.Vector3.Zero();
             }
+            // Keyboard
             for (var index = 0; index < this._keys.length; index++) {
                 var keyCode = this._keys[index];
                 var speed = this._computeLocalCameraSpeed();

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

@@ -14,9 +14,7 @@ var BABYLON;
             _super.call(this, name, position, scene);
             this.angularSensibility = 200;
             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) {
             // Only the first gamepad can control the camera

+ 37 - 0
Babylon/Cameras/babylon.stereogramCamera.js

@@ -0,0 +1,37 @@
+var __extends = this.__extends || function (d, b) {
+    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
+    function __() { this.constructor = d; }
+    __.prototype = b.prototype;
+    d.prototype = new __();
+};
+var BABYLON;
+(function (BABYLON) {
+    var StereogramFreeCamera = (function (_super) {
+        __extends(StereogramFreeCamera, _super);
+        function StereogramFreeCamera(name, position, eyeSpace, isVertical, scene) {
+            _super.call(this, name, position, scene);
+            this.setSubCameraMode(isVertical ? BABYLON.Camera.SUB_CAMERA_MODE_VERTICAL_STEREOGRAM : BABYLON.Camera.SUB_CAMERA_MODE_HORIZONTAL_STEREOGRAM, eyeSpace);
+        }
+        return StereogramFreeCamera;
+    })(BABYLON.FreeCamera);
+    BABYLON.StereogramFreeCamera = StereogramFreeCamera;
+    var StereogramArcRotateCamera = (function (_super) {
+        __extends(StereogramArcRotateCamera, _super);
+        function StereogramArcRotateCamera(name, alpha, beta, radius, target, eyeSpace, isVertical, scene) {
+            _super.call(this, name, alpha, beta, radius, target, scene);
+            this.setSubCameraMode(isVertical ? BABYLON.Camera.SUB_CAMERA_MODE_VERTICAL_STEREOGRAM : BABYLON.Camera.SUB_CAMERA_MODE_HORIZONTAL_STEREOGRAM, eyeSpace);
+        }
+        return StereogramArcRotateCamera;
+    })(BABYLON.ArcRotateCamera);
+    BABYLON.StereogramArcRotateCamera = StereogramArcRotateCamera;
+    var StereogramGamepadCamera = (function (_super) {
+        __extends(StereogramGamepadCamera, _super);
+        function StereogramGamepadCamera(name, position, eyeSpace, isVertical, scene) {
+            _super.call(this, name, position, scene);
+            this.setSubCameraMode(isVertical ? BABYLON.Camera.SUB_CAMERA_MODE_VERTICAL_STEREOGRAM : BABYLON.Camera.SUB_CAMERA_MODE_HORIZONTAL_STEREOGRAM, eyeSpace);
+        }
+        return StereogramGamepadCamera;
+    })(BABYLON.GamepadCamera);
+    BABYLON.StereogramGamepadCamera = StereogramGamepadCamera;
+})(BABYLON || (BABYLON = {}));
+//# sourceMappingURL=babylon.stereogramCamera.js.map

+ 23 - 0
Babylon/Cameras/babylon.stereogramCamera.ts

@@ -0,0 +1,23 @@
+module BABYLON {
+    export class StereogramFreeCamera extends FreeCamera {
+        constructor(name: string, position: Vector3, eyeSpace: number, isVertical: boolean, scene: Scene) {
+            super(name, position, scene);
+
+            this.setSubCameraMode(isVertical ? Camera.SUB_CAMERA_MODE_VERTICAL_STEREOGRAM : Camera.SUB_CAMERA_MODE_HORIZONTAL_STEREOGRAM, eyeSpace);
+        }
+    }
+
+    export class StereogramArcRotateCamera extends ArcRotateCamera {
+        constructor(name: string, alpha: number, beta: number, radius: number, target, eyeSpace: number, isVertical: boolean, scene:Scene) {
+            super(name, alpha, beta, radius, target, scene);
+            this.setSubCameraMode(isVertical ? Camera.SUB_CAMERA_MODE_VERTICAL_STEREOGRAM : Camera.SUB_CAMERA_MODE_HORIZONTAL_STEREOGRAM, eyeSpace);
+        }
+    }
+
+    export class StereogramGamepadCamera extends GamepadCamera {
+        constructor(name: string, position: Vector3, eyeSpace: number, isVertical: boolean, scene: Scene) {
+            super(name, position, scene);
+            this.setSubCameraMode(isVertical ? Camera.SUB_CAMERA_MODE_VERTICAL_STEREOGRAM : Camera.SUB_CAMERA_MODE_HORIZONTAL_STEREOGRAM, eyeSpace);
+        }
+    }
+} 

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

@@ -62,7 +62,8 @@ var BABYLON;
                 return false;
             }
             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
         TargetCamera.prototype._computeLocalCameraSpeed = function () {

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

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

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

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

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

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

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

@@ -59,6 +59,7 @@ var BABYLON;
         Octree._CreateBlocks = function (worldMin, worldMax, entries, maxBlockCapacity, currentDepth, maxDepth, target, creationFunc) {
             target.blocks = new Array();
             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 y = 0; y < 2; y++) {
                     for (var z = 0; z < 2; z++) {

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

@@ -25,6 +25,7 @@ var BABYLON;
             this.center = this.maximum.add(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()];
+            // World
             for (var index = 0; index < this.vectors.length; index++) {
                 this.vectorsWorld[index] = BABYLON.Vector3.Zero();
             }

文件差異過大導致無法顯示
+ 69 - 88
Babylon/Debug/babylon.debugLayer.js


文件差異過大導致無法顯示
+ 1 - 1
Babylon/Debug/babylon.debugLayer.js.map


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

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

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

@@ -194,7 +194,9 @@ var BABYLON;
         });
         Object.defineProperty(ShadowGenerator.prototype, "usePoissonSampling", {
             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) {
                 this.filter = (value ? ShadowGenerator.FILTER_POISSONSAMPLING : ShadowGenerator.FILTER_NONE);

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

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

+ 13 - 10
Babylon/Loading/Plugins/babylon.babylonFileLoader.js

@@ -351,10 +351,10 @@ var BABYLON;
             else if (parsedCamera.type === "VirtualJoysticksCamera") {
                 camera = new BABYLON.VirtualJoysticksCamera(parsedCamera.name, position, scene);
             }
-            else if (parsedCamera.type === "WebVRCamera") {
+            else if (parsedCamera.type === "WebVRFreeCamera") {
                 camera = new BABYLON.WebVRFreeCamera(parsedCamera.name, position, scene);
             }
-            else if (parsedCamera.type === "VRDeviceOrientationCamera") {
+            else if (parsedCamera.type === "VRDeviceOrientationFreeCamera") {
                 camera = new BABYLON.VRDeviceOrientationFreeCamera(parsedCamera.name, position, scene);
             }
             else {
@@ -677,6 +677,7 @@ var BABYLON;
                 }
                 var effectiveTarget = propertyPath.split(".");
                 var values = value.split(",");
+                // Get effective Target
                 for (var i = 0; i < effectiveTarget.length; i++) {
                     target = target[effectiveTarget[i]];
                 }
@@ -779,6 +780,7 @@ var BABYLON;
                 for (var i = 0; i < parsedAction.children.length; i++)
                     traverse(parsedAction.children[i], trigger, condition, newAction, null);
             };
+            // triggers
             for (var i = 0; i < parsedActions.children.length; i++) {
                 var triggerParams;
                 var trigger = parsedActions.children[i];
@@ -799,19 +801,14 @@ var BABYLON;
             var soundName = parsedSound.name;
             var soundUrl = rootUrl + soundName;
             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,
                 refDistance: parsedSound.refDistance,
                 distanceModel: parsedSound.distanceModel,
                 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);
             if (parsedSound.position) {
                 var soundPosition = BABYLON.Vector3.FromArray(parsedSound.position);
@@ -1055,6 +1052,7 @@ var BABYLON;
                         meshes.push(mesh);
                     }
                 }
+                // Connecting parents
                 for (index = 0; index < scene.meshes.length; index++) {
                     var currentMesh = scene.meshes[index];
                     if (currentMesh._waitingParentId) {
@@ -1089,6 +1087,7 @@ var BABYLON;
                     scene.fogEnd = parsedData.fogEnd;
                     scene.fogDensity = parsedData.fogDensity;
                 }
+                // Lights
                 for (var index = 0; index < parsedData.lights.length; index++) {
                     var parsedLight = parsedData.lights[index];
                     parseLight(parsedLight, scene);
@@ -1181,10 +1180,12 @@ var BABYLON;
                         }
                     }
                 }
+                // Meshes
                 for (index = 0; index < parsedData.meshes.length; index++) {
                     var parsedMesh = parsedData.meshes[index];
                     parseMesh(parsedMesh, scene, rootUrl);
                 }
+                // Cameras
                 for (index = 0; index < parsedData.cameras.length; index++) {
                     var parsedCamera = parsedData.cameras[index];
                     parseCamera(parsedCamera, scene);
@@ -1192,6 +1193,7 @@ var BABYLON;
                 if (parsedData.activeCameraID) {
                     scene.setActiveCameraByID(parsedData.activeCameraID);
                 }
+                // Browsing all the graph to connect the dots
                 for (index = 0; index < scene.cameras.length; index++) {
                     var camera = scene.cameras[index];
                     if (camera._waitingParentId) {
@@ -1218,6 +1220,7 @@ var BABYLON;
                         }
                     }
                 }
+                // Connect parents & children and parse actions
                 for (index = 0; index < scene.meshes.length; index++) {
                     var mesh = scene.meshes[index];
                     if (mesh._waitingParentId) {

+ 2 - 2
Babylon/Loading/Plugins/babylon.babylonFileLoader.ts

@@ -429,10 +429,10 @@
         } else if (parsedCamera.type === "VirtualJoysticksCamera") {
             camera = new VirtualJoysticksCamera(parsedCamera.name, position, scene);
 
-        } else if (parsedCamera.type === "WebVRCamera") {
+        } else if (parsedCamera.type === "WebVRFreeCamera") {
             camera = new WebVRFreeCamera(parsedCamera.name, position, scene);
 
-        } else if (parsedCamera.type === "VRDeviceOrientationCamera") {
+        } else if (parsedCamera.type === "VRDeviceOrientationFreeCamera") {
             camera = new VRDeviceOrientationFreeCamera(parsedCamera.name, position, scene);
 
         } else {

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

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

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

@@ -83,7 +83,13 @@ var BABYLON;
             t.z += 0.5;
         };
         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;
             }
             this._cachedUOffset = this.uOffset;
@@ -119,7 +125,11 @@ var BABYLON;
             return this._cachedTextureMatrix;
         };
         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;
             }
             if (!this._cachedTextureMatrix) {

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

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

文件差異過大導致無法顯示
+ 18 - 2
Babylon/Materials/babylon.standardMaterial.js


+ 49 - 49
Babylon/Math/babylon.math.js

@@ -102,33 +102,15 @@ var BABYLON;
             var b = start.b + ((end.b - start.b) * amount);
             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;
     })();
     BABYLON.Color3 = Color3;
@@ -340,8 +322,12 @@ var BABYLON;
         Vector2.CatmullRom = function (value1, value2, value3, value4, amount) {
             var squared = amount * amount;
             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);
         };
         Vector2.Clamp = function (value, min, max) {
@@ -679,9 +665,15 @@ var BABYLON;
         Vector3.CatmullRom = function (value1, value2, value3, value4, amount) {
             var squared = amount * amount;
             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);
         };
         Vector3.Clamp = function (value, min, max) {
@@ -991,7 +983,10 @@ var BABYLON;
             return otherVector && this.x === otherVector.x && this.y === otherVector.y && this.z === otherVector.z && this.w === otherVector.w;
         };
         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) {
             return this.x === x && this.y === y && this.z === z && this.w === w;
@@ -1421,7 +1416,10 @@ var BABYLON;
         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)
                 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 true;
         };
@@ -1432,7 +1430,9 @@ var BABYLON;
             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 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
         Matrix.prototype.toArray = function () {
@@ -1706,7 +1706,11 @@ 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)))));
         };
         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 () {
             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]);
@@ -2504,7 +2508,9 @@ var BABYLON;
                 refinedT = Math.min(1, Math.max(0, refinedT));
             }
             // 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;
     })();
@@ -2561,8 +2567,8 @@ var BABYLON;
                 a3 -= 360.0;
             if (a3 - a2 < -180.0)
                 a3 += 360.0;
-            this.orientation = (a2 - a1) < 0 ? 0 /* CW */ : 1 /* CCW */;
-            this.angle = Angle.FromDegrees(this.orientation === 0 /* CW */ ? a1 - a3 : a3 - a1);
+            this.orientation = (a2 - a1) < 0 ? Orientation.CW : Orientation.CCW;
+            this.angle = Angle.FromDegrees(this.orientation === Orientation.CW ? a1 - a3 : a3 - a1);
         }
         return Arc2;
     })();
@@ -2653,7 +2659,7 @@ var BABYLON;
             var endPoint = new Vector2(endX, endY);
             var arc = new Arc2(startPoint, midPoint, endPoint);
             var increment = arc.angle.radians() / numberOfSegments;
-            if (arc.orientation === 0 /* CW */)
+            if (arc.orientation === Orientation.CW)
                 increment *= -1;
             var currentAngle = arc.startAngle.radians() + increment;
             for (var i = 0; i < numberOfSegments; i++) {
@@ -2970,9 +2976,7 @@ var BABYLON;
             Vector3.TransformCoordinatesToRef = Vector3.TransformCoordinatesToRefSIMD;
             Vector3.TransformCoordinatesFromFloatsToRef = Vector3.TransformCoordinatesFromFloatsToRefSIMD;
             Object.defineProperty(BABYLON.Vector3.prototype, "x", {
-                get: function () {
-                    return this._data[0];
-                },
+                get: function () { return this._data[0]; },
                 set: function (value) {
                     if (!this._data) {
                         this._data = new Float32Array(3);
@@ -2981,17 +2985,13 @@ var BABYLON;
                 }
             });
             Object.defineProperty(BABYLON.Vector3.prototype, "y", {
-                get: function () {
-                    return this._data[1];
-                },
+                get: function () { return this._data[1]; },
                 set: function (value) {
                     this._data[1] = value;
                 }
             });
             Object.defineProperty(BABYLON.Vector3.prototype, "z", {
-                get: function () {
-                    return this._data[2];
-                },
+                get: function () { return this._data[2]; },
                 set: function (value) {
                     this._data[2] = value;
                 }

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

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

@@ -76,6 +76,7 @@ var BABYLON;
                 polygonType |= type;
                 types.push(type);
             }
+            // Put the polygon in the correct list, splitting it when necessary.
             switch (polygonType) {
                 case COPLANAR:
                     (BABYLON.Vector3.Dot(this.normal, polygon.plane.normal) > 0 ? coplanarFront : coplanarBack).push(polygon);
@@ -139,9 +140,7 @@ var BABYLON;
             return new Polygon(vertices, this.shared);
         };
         Polygon.prototype.flip = function () {
-            this.vertices.reverse().map(function (v) {
-                v.flip();
-            });
+            this.vertices.reverse().map(function (v) { v.flip(); });
             this.plane.flip();
         };
         return Polygon;
@@ -395,9 +394,7 @@ var BABYLON;
             return csg;
         };
         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
         // when we build back a Babylon Mesh
@@ -453,7 +450,12 @@ var BABYLON;
                         var localNormal = BABYLON.Vector3.TransformNormal(normal, matrix);
                         vertex_idx = vertice_dict[localVertex.x + ',' + localVertex.y + ',' + localVertex.z];
                         // 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);
                             uvs.push(uv.x, uv.y);
                             normals.push(normal.x, normal.y, normal.z);

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

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

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

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

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

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

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

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

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

@@ -71,7 +71,7 @@ var BABYLON;
         };
         SimplificationQueue.prototype.getSimplifier = function (task) {
             switch (task.simplificationType) {
-                case 0 /* QUADRATIC */:
+                case SimplificationType.QUADRATIC:
                 default:
                     return new QuadraticErrorSimplification(task.mesh);
             }
@@ -128,7 +128,9 @@ var BABYLON;
             }
         }
         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;
         };
         QuadraticMatrix.prototype.addInPlace = function (matrix) {
@@ -293,9 +295,7 @@ 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);
             };
             BABYLON.AsyncLoop.Run(this.decimationIterations, function (loop) {
@@ -485,7 +485,7 @@ var BABYLON;
                 var s = this.references[vertex1.triangleStart + i].vertexId;
                 var v1 = t.vertices[(s + 1) % 3];
                 var v2 = t.vertices[(s + 2) % 3];
-                if ((v1 === vertex2 || v2 === vertex2)) {
+                if ((v1 === vertex2 || v2 === vertex2) /* && !this.isTriangleOnBoundingBox(t)*/) {
                     deletedArray[i] = true;
                     delTr.push(t);
                     continue;
@@ -610,7 +610,8 @@ var BABYLON;
             var x = point.x;
             var y = point.y;
             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) {
             var q = vertex1.q.add(vertex2.q);

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

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

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

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

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

@@ -110,11 +110,13 @@ var BABYLON;
         CannonJSPlugin.prototype._createConvexPolyhedron = function (rawVerts, rawFaces, mesh, options) {
             var verts = [], faces = [];
             mesh.computeWorldMatrix(true);
+            // Get vertices
             for (var i = 0; i < rawVerts.length; i += 3) {
                 var transformed = BABYLON.Vector3.Zero();
                 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));
             }
+            // Get faces
             for (var j = 0; j < rawFaces.length; j += 3) {
                 faces.push([rawFaces[j], rawFaces[j + 2], rawFaces[j + 1]]);
             }

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

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

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

@@ -74,9 +74,7 @@ var BABYLON;
             for (var i = 0; i < _cam.length; i++) {
                 var camera = _cam[i];
                 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].addPass(pass);
                 this._renderEffectsForIsolatedPass[cameraName]._attachCameras(camera);
@@ -88,9 +86,7 @@ var BABYLON;
             for (var i = 0; i < _cam.length; i++) {
                 var camera = _cam[i];
                 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);
             }
             for (var renderEffectName in this._renderEffects) {

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

@@ -87,15 +87,9 @@ var BABYLON;
             this._createHighlightsPostProcess(ratio);
             this._createDepthOfFieldPostProcess(ratio);
             // 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) {
                 this._disableEffect(this.HighlightsEnhancingEffect, null);
             }
@@ -106,51 +100,21 @@ var BABYLON;
             }
         }
         // 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) {
             this._highlightsGain = amount;
         };
@@ -203,18 +167,8 @@ var BABYLON;
         LensRenderingPipeline.prototype._createDepthOfFieldPostProcess = function (ratio) {
             var _this = this;
             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);
             this._depthOfFieldPostProcess.onApply = function (effect) {
                 effect.setBool('blur_noise', _this._blurNoise);

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

@@ -81,21 +81,11 @@ 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._createSSAOCombinePostProcess(combineRatio);
             // 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
             scene.postProcessRenderPipelineManager.addPipeline(this);
             if (cameras)
@@ -135,54 +125,22 @@ var BABYLON;
         SSAORenderingPipeline.prototype._createSSAOPostProcess = function (ratio) {
             var _this = this;
             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;
             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);

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

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

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

@@ -41,7 +41,9 @@ var BABYLON;
                 var max = boundingBox.maximum;
                 var diff = max.subtract(min);
                 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
                 engine.bindBuffers(this._vb.getBuffer(), this._ib, [3], 3 * 4, this._colorShader.getEffect());
                 if (this.showBackLines) {

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

@@ -30,9 +30,7 @@ var BABYLON;
                 this._effect.setTexture("diffuseSampler", alphaTexture);
                 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) {
             var defines = [];

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

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

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

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

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

@@ -17,15 +17,9 @@ var BABYLON;
             var _this = this;
             if (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 () {
@@ -82,7 +76,9 @@ var BABYLON;
                             FilesInput.FilesToLoad[this._filesToLoad[i].name] = this._filesToLoad[i];
                             break;
                         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];
                             }
                             break;
@@ -112,9 +108,7 @@ var BABYLON;
                         if (that._sceneLoadedCallback) {
                             that._sceneLoadedCallback(_this._sceneFileToLoad, that._currentScene);
                         }
-                        that._engine.runRenderLoop(function () {
-                            that.renderFunction();
-                        });
+                        that._engine.runRenderLoop(function () { that.renderFunction(); });
                     });
                 }, function (progress) {
                     if (_this._progressCallback) {

文件差異過大導致無法顯示
+ 20 - 24
Babylon/Tools/babylon.gamepads.js


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

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

+ 2 - 2
Babylon/Tools/babylon.sceneSerializer.js

@@ -98,10 +98,10 @@ var BABYLON;
             serializationObject.type = "VirtualJoysticksCamera";
         }
         else if (camera instanceof BABYLON.WebVRFreeCamera) {
-            serializationObject.type = "WebVRCamera";
+            serializationObject.type = "WebVRFreeCamera";
         }
         else if (camera instanceof BABYLON.VRDeviceOrientationFreeCamera) {
-            serializationObject.type = "VRDeviceOrientationCamera";
+            serializationObject.type = "VRDeviceOrientationFreeCamera";
         }
         //special properties of specific cameras
         if (camera instanceof BABYLON.ArcRotateCamera || camera instanceof BABYLON.AnaglyphArcRotateCamera) {

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

@@ -101,9 +101,9 @@
         } else if (camera instanceof VirtualJoysticksCamera) {
             serializationObject.type = "VirtualJoysticksCamera";
         } else if (camera instanceof WebVRFreeCamera) {
-            serializationObject.type = "WebVRCamera";
+            serializationObject.type = "WebVRFreeCamera";
         } else if (camera instanceof VRDeviceOrientationFreeCamera) {
-            serializationObject.type = "VRDeviceOrientationCamera";
+            serializationObject.type = "VRDeviceOrientationFreeCamera";
         } 
 
         //special properties of specific cameras

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

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

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

@@ -11,7 +11,10 @@ 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 DDPF_ALPHAPIXELS = 0x1, DDPF_ALPHA = 0x2, DDPF_FOURCC = 0x4, DDPF_RGB = 0x40, DDPF_YUV = 0x200, DDPF_LUMINANCE = 0x20000;
         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) {
             return String.fromCharCode(value & 0xff, (value >> 8) & 0xff, (value >> 16) & 0xff, (value >> 24) & 0xff);

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

@@ -367,6 +367,7 @@ var BABYLON;
             var halfHeight = height / 2;
             //Reading datas from WebGL
             var data = engine.readPixels(0, 0, width, height);
+            //To flip image on Y axis.
             for (var i = 0; i < halfHeight; i++) {
                 for (var j = 0; j < numberOfChannelsByLine; j++) {
                     var currentCell = j + i * numberOfChannelsByLine;

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

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

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

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

+ 19 - 9
Babylon/babylon.engine.js

@@ -197,7 +197,10 @@ var BABYLON;
             configurable: true
         });
         _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;
             }
             this._blendFunctionParameters[0] = value0;
@@ -380,6 +383,7 @@ var BABYLON;
             this._canvasClientRect = this._renderingCanvas.getBoundingClientRect();
             options = options || {};
             options.antialias = antialias;
+            // GL
             try {
                 this._gl = canvas.getContext("webgl", options) || canvas.getContext("experimental-webgl", options);
             }
@@ -452,7 +456,10 @@ var BABYLON;
                 }
                 // Pointer lock
                 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) {
                         canvas.requestPointerLock();
                     }
@@ -464,7 +471,10 @@ var BABYLON;
             document.addEventListener("msfullscreenchange", this._onFullscreenChange, false);
             // Pointer lock
             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("mspointerlockchange", this._onPointerLockChange, false);
@@ -1549,12 +1559,8 @@ var BABYLON;
                     _this._workingCanvas.width = width;
                     _this._workingCanvas.height = height;
                     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.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, 0);
@@ -1587,6 +1593,7 @@ var BABYLON;
                 gl.deleteRenderbuffer(texture._depthBuffer);
             }
             gl.deleteTexture(texture);
+            // Unbind channels
             for (var channel = 0; channel < this._caps.maxTexturesImageUnits; channel++) {
                 this._gl.activeTexture(this._gl["TEXTURE" + channel]);
                 this._gl.bindTexture(this._gl.TEXTURE_2D, null);
@@ -1709,14 +1716,17 @@ var BABYLON;
         Engine.prototype.dispose = function () {
             this.hideLoadingUI();
             this.stopRenderLoop();
+            // Release scenes
             while (this.scenes.length) {
                 this.scenes[0].dispose();
             }
             // Release audio engine
             Engine.audioEngine.dispose();
+            // Release effects
             for (var name in this._compiledEffects) {
                 this._gl.deleteProgram(this._compiledEffects[name]._program);
             }
+            // Unbind
             for (var i in this._vertexAttribArrays) {
                 if (i > this._gl.VERTEX_ATTRIB_ARRAY_ENABLED || !this._vertexAttribArrays[i]) {
                     continue;

+ 12 - 3
Babylon/babylon.scene.js

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

+ 2 - 2
Exporters/3ds Max/Max2Babylon/Forms/CameraPropertiesForm.Designer.cs

@@ -331,8 +331,8 @@
             "GamepadCamera",
             "TouchCamera",
             "VirtualJoysticksCamera",
-            "WebVRCamera",
-            "VRDeviceOrientationCamera"});
+            "WebVRFreeCamera",
+            "VRDeviceOrientationFreeCamera"});
             this.cbCameraType.Location = new System.Drawing.Point(23, 74);
             this.cbCameraType.Name = "cbCameraType";
             this.cbCameraType.Size = new System.Drawing.Size(290, 21);

+ 14 - 14
Exporters/Blender/io_export_babylon.py

@@ -1,7 +1,7 @@
 bl_info = {
     'name': 'Babylon.js',
     'author': 'David Catuhe, Jeff Palmer',
-    'version': (1, 8, 0),
+    'version': (1, 8, 1),
     'blender': (2, 72, 0),
     "location": "File > Export > Babylon.js (.babylon)",
     "description": "Export Babylon.js scenes (.babylon)",
@@ -87,8 +87,8 @@ FREE_CAM = 'FreeCamera'
 GAMEPAD_CAM = 'GamepadCamera'
 TOUCH_CAM = 'TouchCamera'
 V_JOYSTICKS_CAM = 'VirtualJoysticksCamera'
-VR_DEV_ORIENT_CAM ='VRDeviceOrientationCamera'
-WEB_VR_CAM = 'WebVRCamera'
+VR_DEV_ORIENT_FREE_CAM ='VRDeviceOrientationFreeCamera'
+WEB_VR_FREE_CAM = 'WebVRFreeCamera'
 
 # used in Light constructor, never formally defined in Babylon, but used in babylonFileLoader
 POINT_LIGHT = 0
@@ -1730,17 +1730,17 @@ bpy.types.Camera.CameraType = bpy.props.EnumProperty(
     description='',
     # ONLY Append, or existing .blends will have their camera changed
     items = ( 
-             (V_JOYSTICKS_CAM   , 'Virtual Joysticks'  , 'Use Virtual Joysticks Camera'),
-             (TOUCH_CAM         , 'Touch'              , 'Use Touch Camera'),
-             (GAMEPAD_CAM       , 'Gamepad'            , 'Use Gamepad Camera'),
-             (FREE_CAM          , 'Free'               , 'Use Free Camera'),
-             (FOLLOW_CAM        , 'Follow'             , 'Use Follow Camera'),
-             (DEV_ORIENT_CAM    , 'Device Orientation' , 'Use Device Orientation Camera'),
-             (ARC_ROTATE_CAM    , 'Arc Rotate'         , 'Use Arc Rotate Camera'),
-             (ANAGLYPH_FREE_CAM , 'Anaglyph Free'      , 'Use Anaglyph Free Camera'), 
-             (ANAGLYPH_ARC_CAM  , 'Anaglyph Arc Rotate', 'Use Anaglyph Arc Rotate Camera'),
-             (VR_DEV_ORIENT_CAM , 'VR Dev Orientation' , 'Use VR Dev Orientation Camera'),
-             (WEB_VR_CAM        , 'Web VR'             , 'Use Web VR Camera')
+             (V_JOYSTICKS_CAM        , 'Virtual Joysticks'       , 'Use Virtual Joysticks Camera'),
+             (TOUCH_CAM              , 'Touch'                   , 'Use Touch Camera'),
+             (GAMEPAD_CAM            , 'Gamepad'                 , 'Use Gamepad Camera'),
+             (FREE_CAM               , 'Free'                    , 'Use Free Camera'),
+             (FOLLOW_CAM             , 'Follow'                  , 'Use Follow Camera'),
+             (DEV_ORIENT_CAM         , 'Device Orientation'      , 'Use Device Orientation Camera'),
+             (ARC_ROTATE_CAM         , 'Arc Rotate'              , 'Use Arc Rotate Camera'),
+             (ANAGLYPH_FREE_CAM      , 'Anaglyph Free'           , 'Use Anaglyph Free Camera'), 
+             (ANAGLYPH_ARC_CAM       , 'Anaglyph Arc Rotate'     , 'Use Anaglyph Arc Rotate Camera'),
+             (VR_DEV_ORIENT_FREE_CAM , 'VR Dev Orientation Free' , 'Use VR Dev Orientation Free Camera'),
+             (WEB_VR_FREE_CAM        , 'Web VR Free'             , 'Use Web VR Free Camera')
             ),
     default = FREE_CAM
 )

文件差異過大導致無法顯示
+ 521 - 453
babylon.2.1-beta.debug.js


文件差異過大導致無法顯示
+ 17 - 19
babylon.2.1-beta.js


文件差異過大導致無法顯示
+ 16 - 18
babylon.2.1-beta.noworker.js


+ 3 - 0
what's new - 2.1 - proposal.md

@@ -13,7 +13,10 @@
  - New Loaders folder with a first additionnal plugin: [STL](http://doc.babylonjs.com/page.php?p=25109)  ([raananw](http://www.github.com/raananw), [deltakosh](http://www.github.com/deltakosh))
  - Gulp building process revamped, updated and simplified and now includes a config.json ([raananw](http://www.github.com/raananw)) 
  - **Updates**
+ - Cameras hierarchy rework ([deltakosh](http://www.github.com/deltakosh))
+ - New ```Camera.setSubCameraMode``` to control 3D rendering of any camera (Anaglyph, Stereo, VR) ([Palmer-JC](http://www.github.com/Palmer-JC))
  - VR cameras can disable distortion postprocess to get more performance ([deltakosh](http://www.github.com/deltakosh))
+ - New cameras: AnaglyphGamepadCamera, StereogramFreeCamera, StereogramArcRotateCamera, StereogramGamepadCamera ([deltakosh](http://www.github.com/deltakosh))
  - New ```MultiMaterial.clone()``` function ([deltakosh](http://www.github.com/deltakosh))
  - Faster ```mesh.computeNormals()``` function ([jbousquie](https://github.com/jbousquie))
  - Added the ability [to dynamically update or to morph](http://doc.babylonjs.com/page.php?p=25096) an mesh instance ([jbousquie](https://github.com/jbousquie))