Browse Source

Improving CSG with rotationQuaternion support
Cleaning extrusion for polygonMesh

David Catuhe 10 năm trước cách đây
mục cha
commit
86610396a3
65 tập tin đã thay đổi với 1235 bổ sung980 xóa
  1. 1 2
      Babylon/Actions/babylon.actionManager.js
  2. 2 1
      Babylon/Actions/babylon.interpolateValueAction.js
  3. 0 17
      Babylon/Animations/babylon.animation.js
  4. 0 1
      Babylon/Audio/babylon.analyser.js
  5. 9 3
      Babylon/Audio/babylon.sound.js
  6. 0 1
      Babylon/Cameras/VR/babylon.webVRCamera.js
  7. 3 14
      Babylon/Cameras/babylon.arcRotateCamera.js
  8. 4 15
      Babylon/Cameras/babylon.camera.js
  9. 2 9
      Babylon/Cameras/babylon.freeCamera.js
  10. 3 1
      Babylon/Cameras/babylon.gamepadCamera.js
  11. 1 2
      Babylon/Cameras/babylon.targetCamera.js
  12. 4 4
      Babylon/Cameras/babylon.virtualJoysticksCamera.js
  13. 19 14
      Babylon/Collisions/babylon.collisionCoordinator.js
  14. 9 10
      Babylon/Collisions/babylon.collisionWorker.js
  15. 0 1
      Babylon/Culling/Octrees/babylon.octree.js
  16. 0 1
      Babylon/Culling/babylon.boundingBox.js
  17. 88 69
      Babylon/Debug/babylon.debugLayer.js
  18. 1 1
      Babylon/Debug/babylon.debugLayer.js.map
  19. 0 1
      Babylon/LensFlare/babylon.lensFlareSystem.js
  20. 1 3
      Babylon/Lights/Shadows/babylon.shadowGenerator.js
  21. 0 1
      Babylon/Lights/babylon.directionalLight.js
  22. 8 11
      Babylon/Loading/Plugins/babylon.babylonFileLoader.js
  23. 0 8
      Babylon/Materials/Textures/Procedurals/babylon.proceduralTexture.js
  24. 2 12
      Babylon/Materials/Textures/babylon.texture.js
  25. 0 8
      Babylon/Materials/babylon.shaderMaterial.js
  26. 2 18
      Babylon/Materials/babylon.standardMaterial.js
  27. 5 1
      Babylon/Math/babylon.math.js
  28. 5 3
      Babylon/Math/babylon.math.ts
  29. 3 6
      Babylon/Mesh/babylon.abstractMesh.js
  30. 1 1
      Babylon/Mesh/babylon.abstractMesh.ts
  31. 11 9
      Babylon/Mesh/babylon.csg.js
  32. 5 0
      Babylon/Mesh/babylon.csg.ts
  33. 2 2
      Babylon/Mesh/babylon.geometry.js
  34. 0 1
      Babylon/Mesh/babylon.instancedMesh.js
  35. 15 17
      Babylon/Mesh/babylon.mesh.js
  36. 1 0
      Babylon/Mesh/babylon.mesh.ts
  37. 0 15
      Babylon/Mesh/babylon.mesh.vertexData.js
  38. 7 8
      Babylon/Mesh/babylon.meshSimplification.js
  39. 104 6
      Babylon/Mesh/babylon.polygonmesh.js
  40. 3 10
      Babylon/Mesh/babylon.polygonmesh.ts
  41. 0 1
      Babylon/Mesh/babylon.subMesh.js
  42. 0 1
      Babylon/Mesh/babylon.vertexBuffer.js
  43. 0 2
      Babylon/Physics/Plugins/babylon.cannonJSPlugin.js
  44. 0 2
      Babylon/Physics/Plugins/babylon.oimoJSPlugin.js
  45. 6 2
      Babylon/PostProcess/RenderPipeline/babylon.postProcessRenderPipeline.js
  46. 66 20
      Babylon/PostProcess/babylon.lensRenderingPipeline.js
  47. 63 21
      Babylon/PostProcess/babylon.ssaoRenderingPipeline.js
  48. 0 1
      Babylon/PostProcess/babylon.volumetricLightScatteringPostProcess.js
  49. 1 3
      Babylon/Rendering/babylon.boundingBoxRenderer.js
  50. 3 1
      Babylon/Rendering/babylon.outlineRenderer.js
  51. 0 1
      Babylon/Rendering/babylon.renderingGroup.js
  52. 6 4
      Babylon/Tools/babylon.database.js
  53. 13 7
      Babylon/Tools/babylon.filesInput.js
  54. 24 20
      Babylon/Tools/babylon.gamepads.js
  55. 0 1
      Babylon/Tools/babylon.sceneOptimizer.js
  56. 0 1
      Babylon/Tools/babylon.smartCollection.js
  57. 1 4
      Babylon/Tools/babylon.tools.dds.js
  58. 0 1
      Babylon/Tools/babylon.tools.js
  59. 0 3
      Babylon/Tools/babylon.tools.tga.js
  60. 22 18
      Babylon/Tools/babylon.virtualJoystick.js
  61. 9 19
      Babylon/babylon.engine.js
  62. 3 12
      Babylon/babylon.scene.js
  63. 657 478
      babylon.2.1-beta.debug.js
  64. 21 26
      babylon.2.1-beta.js
  65. 19 24
      babylon.2.1-beta.noworker.js

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

@@ -242,8 +242,7 @@ var BABYLON;
             for (var index = 0; index < this.actions.length; index++) {
                 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;

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

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

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

@@ -124,7 +124,6 @@ var BABYLON;
                         gradient = this._easingFunction.ease(gradient);
                     }
                     switch (this.dataType) {
-                        // Float
                         case Animation.ANIMATIONTYPE_FLOAT:
                             switch (loopMode) {
                                 case Animation.ANIMATIONLOOPMODE_CYCLE:
@@ -134,7 +133,6 @@ var BABYLON;
                                     return offsetValue * repeatCount + this.floatInterpolateFunction(startValue, endValue, gradient);
                             }
                             break;
-                        // Quaternion
                         case Animation.ANIMATIONTYPE_QUATERNION:
                             var quaternion = null;
                             switch (loopMode) {
@@ -147,7 +145,6 @@ var BABYLON;
                                     break;
                             }
                             return quaternion;
-                        // Vector3
                         case Animation.ANIMATIONTYPE_VECTOR3:
                             switch (loopMode) {
                                 case Animation.ANIMATIONLOOPMODE_CYCLE:
@@ -156,7 +153,6 @@ 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:
@@ -165,7 +161,6 @@ 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:
@@ -174,12 +169,10 @@ 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;
                             }
@@ -227,21 +220,16 @@ 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:
@@ -255,23 +243,18 @@ 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();
                 }

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

@@ -71,7 +71,6 @@ 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;

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

@@ -75,7 +75,9 @@ 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) {
@@ -145,7 +147,9 @@ 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) {
@@ -286,7 +290,9 @@ 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;

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

@@ -24,7 +24,6 @@ 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];

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

@@ -89,11 +89,7 @@ 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) {
@@ -192,10 +188,7 @@ 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);
@@ -208,10 +201,7 @@ 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);
@@ -302,7 +292,6 @@ 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) {

+ 4 - 15
Babylon/Cameras/babylon.camera.js

@@ -126,29 +126,19 @@ 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;
         };
@@ -285,7 +275,6 @@ var BABYLON;
         Camera.prototype.dispose = function () {
             // Remove from scene
             this.getScene().removeCamera(this);
-            // Postprocesses
             for (var i = 0; i < this._postProcessesTakenIndices.length; ++i) {
                 this._postProcesses[this._postProcessesTakenIndices[i]].dispose(this);
             }

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

@@ -101,10 +101,7 @@ 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);
@@ -115,10 +112,7 @@ 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);
@@ -187,7 +181,6 @@ 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();

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

@@ -14,7 +14,9 @@ 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

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

@@ -62,8 +62,7 @@ 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(BABYLON.JoystickAxis.Z);
-            this._leftjoystick.setAxisForLeftRight(BABYLON.JoystickAxis.X);
+            this._leftjoystick.setAxisForUpDown(2 /* Z */);
+            this._leftjoystick.setAxisForLeftRight(0 /* X */);
             this._leftjoystick.setJoystickSensibility(0.15);
             this._rightjoystick = new BABYLON.VirtualJoystick(false);
-            this._rightjoystick.setAxisForUpDown(BABYLON.JoystickAxis.X);
-            this._rightjoystick.setAxisForLeftRight(BABYLON.JoystickAxis.Y);
+            this._rightjoystick.setAxisForUpDown(0 /* X */);
+            this._rightjoystick.setAxisForLeftRight(1 /* Y */);
             this._rightjoystick.reverseUpDown = true;
             this._rightjoystick.setJoystickSensibility(0.05);
             this._rightjoystick.setJoystickColor("yellow");

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

@@ -44,7 +44,7 @@ var BABYLON;
                 };
                 var message = {
                     payload: payload,
-                    taskType: WorkerTaskType.UPDATE
+                    taskType: 1 /* 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 != WorkerReplyType.SUCCESS) {
+                if (returnData.error != 0 /* SUCCESS */) {
                     //TODO what errors can be returned from the worker?
                     BABYLON.Tools.Warn("error returned from worker!");
                     return;
                 }
                 switch (returnData.taskType) {
-                    case WorkerTaskType.INIT:
+                    case 0 /* 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 WorkerTaskType.UPDATE:
+                    case 1 /* UPDATE */:
                         _this._runningUpdated--;
                         break;
-                    case WorkerTaskType.COLLIDE:
+                    case 2 /* COLLIDE */:
                         _this._runningCollisionTask = false;
                         var returnPayload = returnData.payload;
                         if (!_this._collisionsCallbackArray[returnPayload.collisionId])
@@ -122,7 +122,7 @@ var BABYLON;
             };
             var message = {
                 payload: payload,
-                taskType: WorkerTaskType.COLLIDE
+                taskType: 2 /* COLLIDE */
             };
             this._worker.postMessage(message);
         };
@@ -134,7 +134,7 @@ var BABYLON;
             this._worker.onmessage = this._onMessageFromWorker;
             var message = {
                 payload: {},
-                taskType: WorkerTaskType.INIT
+                taskType: 0 /* INIT */
             };
             this._worker.postMessage(message);
         };
@@ -225,12 +225,18 @@ 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;
@@ -239,7 +245,6 @@ 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) {

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

@@ -147,8 +147,8 @@ var BABYLON;
         CollisionDetectorTransferable.prototype.onInit = function (payload) {
             this._collisionCache = new CollisionCache();
             var reply = {
-                error: BABYLON.WorkerReplyType.SUCCESS,
-                taskType: BABYLON.WorkerTaskType.INIT
+                error: 0 /* SUCCESS */,
+                taskType: 0 /* INIT */
             };
             postMessage(reply, undefined);
         };
@@ -164,8 +164,8 @@ var BABYLON;
                 }
             }
             var replay = {
-                error: BABYLON.WorkerReplyType.SUCCESS,
-                taskType: BABYLON.WorkerTaskType.UPDATE
+                error: 0 /* SUCCESS */,
+                taskType: 1 /* UPDATE */
             };
             postMessage(replay, undefined);
         };
@@ -182,8 +182,8 @@ var BABYLON;
                 newPosition: finalPosition.asArray()
             };
             var reply = {
-                error: BABYLON.WorkerReplyType.SUCCESS,
-                taskType: BABYLON.WorkerTaskType.COLLIDE,
+                error: 0 /* SUCCESS */,
+                taskType: 2 /* COLLIDE */,
                 payload: replyPayload
             };
             postMessage(reply, undefined);
@@ -191,7 +191,6 @@ 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.
@@ -206,13 +205,13 @@ var BABYLON;
             var onNewMessage = function (event) {
                 var message = event.data;
                 switch (message.taskType) {
-                    case BABYLON.WorkerTaskType.INIT:
+                    case 0 /* INIT */:
                         collisionDetector.onInit(message.payload);
                         break;
-                    case BABYLON.WorkerTaskType.COLLIDE:
+                    case 2 /* COLLIDE */:
                         collisionDetector.onCollision(message.payload);
                         break;
-                    case BABYLON.WorkerTaskType.UPDATE:
+                    case 1 /* UPDATE */:
                         collisionDetector.onUpdate(message.payload);
                         break;
                 }

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

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

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

@@ -25,7 +25,6 @@ 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();
             }

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 88 - 69
Babylon/Debug/babylon.debugLayer.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
Babylon/Debug/babylon.debugLayer.js.map


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

@@ -134,7 +134,6 @@ var BABYLON;
             engine.setAlphaMode(BABYLON.Engine.ALPHA_ADD);
             // 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);

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

@@ -194,9 +194,7 @@ 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);

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

@@ -28,7 +28,6 @@ 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) {

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

@@ -677,7 +677,6 @@ 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]];
                 }
@@ -780,7 +779,6 @@ 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];
@@ -801,14 +799,19 @@ 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);
@@ -1052,7 +1055,6 @@ var BABYLON;
                         meshes.push(mesh);
                     }
                 }
-                // Connecting parents
                 for (index = 0; index < scene.meshes.length; index++) {
                     var currentMesh = scene.meshes[index];
                     if (currentMesh._waitingParentId) {
@@ -1087,7 +1089,6 @@ 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);
@@ -1180,12 +1181,10 @@ 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);
@@ -1193,7 +1192,6 @@ 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) {
@@ -1220,7 +1218,6 @@ var BABYLON;
                         }
                     }
                 }
-                // Connect parents & children and parse actions
                 for (index = 0; index < scene.meshes.length; index++) {
                     var mesh = scene.meshes[index];
                     if (mesh._waitingParentId) {

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

@@ -186,36 +186,28 @@ 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]);
             }

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

@@ -83,13 +83,7 @@ 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;
@@ -125,11 +119,7 @@ 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) {

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

@@ -147,36 +147,28 @@ 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]);
                 }

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 2 - 18
Babylon/Materials/babylon.standardMaterial.js


+ 5 - 1
Babylon/Math/babylon.math.js

@@ -302,6 +302,9 @@ var BABYLON;
         Vector2.prototype.equals = function (otherVector) {
             return otherVector && this.x === otherVector.x && this.y === otherVector.y;
         };
+        Vector2.prototype.equalsWithEpsilon = function (otherVector) {
+            return otherVector && BABYLON.Tools.WithinEpsilon(this.x, otherVector.x) && BABYLON.Tools.WithinEpsilon(this.y, otherVector.y);
+        };
         // Properties
         Vector2.prototype.length = function () {
             return Math.sqrt(this.x * this.x + this.y * this.y);
@@ -496,7 +499,7 @@ var BABYLON;
             return otherVector && this.x === otherVector.x && this.y === otherVector.y && this.z === otherVector.z;
         };
         Vector3.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;
+            return otherVector && BABYLON.Tools.WithinEpsilon(this.x, otherVector.x) && BABYLON.Tools.WithinEpsilon(this.y, otherVector.y) && BABYLON.Tools.WithinEpsilon(this.z, otherVector.z);
         };
         Vector3.prototype.equalsToFloats = function (x, y, z) {
             return this.x === x && this.y === y && this.z === z;
@@ -3003,3 +3006,4 @@ var BABYLON;
         SIMDHelper.EnableSIMD();
     }
 })(BABYLON || (BABYLON = {}));
+//# sourceMappingURL=babylon.math.js.map

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

@@ -353,6 +353,10 @@
             return otherVector && this.x === otherVector.x && this.y === otherVector.y;
         }
 
+        public equalsWithEpsilon(otherVector: Vector2): boolean {
+            return otherVector && Tools.WithinEpsilon(this.x, otherVector.x) && Tools.WithinEpsilon(this.y, otherVector.y);
+        }
+
         // Properties
         public length(): number {
             return Math.sqrt(this.x * this.x + this.y * this.y);
@@ -609,9 +613,7 @@
         }
 
         public equalsWithEpsilon(otherVector: Vector3): boolean {
-            return Math.abs(this.x - otherVector.x) < Engine.Epsilon &&
-                Math.abs(this.y - otherVector.y) < Engine.Epsilon &&
-                Math.abs(this.z - otherVector.z) < Engine.Epsilon;
+            return otherVector && Tools.WithinEpsilon(this.x, otherVector.x) && Tools.WithinEpsilon(this.y, otherVector.y) && Tools.WithinEpsilon(this.z, otherVector.z);
         }
 
         public equalsToFloats(x: number, y: number, z: number): boolean {

+ 3 - 6
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 === BABYLON.Space.LOCAL) {
+            if (!space || space === 0 /* 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 === BABYLON.Space.LOCAL) {
+            if (!space || space === 0 /* LOCAL */) {
                 var tempV3 = this.getPositionExpressedInLocalSpace().add(displacementVector);
                 this.setPositionWithLocalVector(tempV3);
             }
@@ -452,7 +452,6 @@ 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);
             }
@@ -482,7 +481,7 @@ var BABYLON;
             return BABYLON.Vector3.TransformNormal(this.position, invLocalWorldMatrix);
         };
         AbstractMesh.prototype.locallyTranslate = function (vector3) {
-            this.computeWorldMatrix();
+            this.computeWorldMatrix(true);
             this.position = BABYLON.Vector3.TransformCoordinates(vector3, this._localWorld);
         };
         AbstractMesh.prototype.lookAt = function (targetPoint, yawCor, pitchCor, rollCor) {
@@ -771,7 +770,6 @@ 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);
@@ -783,7 +781,6 @@ 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();

+ 1 - 1
Babylon/Mesh/babylon.abstractMesh.ts

@@ -539,7 +539,7 @@
         }
 
         public locallyTranslate(vector3: Vector3): void {
-            this.computeWorldMatrix();
+            this.computeWorldMatrix(true);
 
             this.position = Vector3.TransformCoordinates(vector3, this._localWorld);
         }

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

@@ -76,7 +76,6 @@ 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);
@@ -140,7 +139,9 @@ 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;
@@ -263,6 +264,7 @@ var BABYLON;
                 var matrix = mesh.getWorldMatrix();
                 var meshPosition = mesh.position.clone();
                 var meshRotation = mesh.rotation.clone();
+                var meshRotationQuaternion = mesh.rotationQuaternion.clone();
                 var meshScaling = mesh.scaling.clone();
             }
             else {
@@ -294,6 +296,7 @@ var BABYLON;
             csg.position = meshPosition;
             csg.rotation = meshRotation;
             csg.scaling = meshScaling;
+            csg.rotationQuaternion = meshRotationQuaternion;
             currentCSGMeshId++;
             return csg;
         };
@@ -392,7 +395,9 @@ 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
@@ -402,6 +407,7 @@ var BABYLON;
             this.position = csg.position;
             this.rotation = csg.rotation;
             this.scaling = csg.scaling;
+            this.rotationQuaternion = csg.rotationQuaternion;
             return this;
         };
         // Build Raw mesh from CSG
@@ -447,12 +453,7 @@ 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);
@@ -491,6 +492,7 @@ var BABYLON;
             mesh.material = material;
             mesh.position.copyFrom(this.position);
             mesh.rotation.copyFrom(this.rotation);
+            mesh.rotationQuaternion.copyFrom(this.rotationQuaternion);
             mesh.scaling.copyFrom(this.scaling);
             mesh.computeWorldMatrix(true);
             return mesh;

+ 5 - 0
Babylon/Mesh/babylon.csg.ts

@@ -276,6 +276,7 @@
         public matrix: Matrix;
         public position: Vector3;
         public rotation: Vector3;
+        public rotationQuaternion: Quaternion;
         public scaling: Vector3;
 
         // Convert BABYLON.Mesh to BABYLON.CSG
@@ -290,6 +291,7 @@
                 var matrix = mesh.getWorldMatrix();
                 var meshPosition = mesh.position.clone();
                 var meshRotation = mesh.rotation.clone();
+                var meshRotationQuaternion = mesh.rotationQuaternion.clone();
                 var meshScaling = mesh.scaling.clone();
             } else {
                 throw 'BABYLON.CSG: Wrong Mesh type, must be BABYLON.Mesh';
@@ -330,6 +332,7 @@
             csg.position = meshPosition;
             csg.rotation = meshRotation;
             csg.scaling = meshScaling;
+            csg.rotationQuaternion = meshRotationQuaternion;
             currentCSGMeshId++;
 
             return csg;
@@ -458,6 +461,7 @@
             this.position = csg.position;
             this.rotation = csg.rotation;
             this.scaling = csg.scaling;
+            this.rotationQuaternion = csg.rotationQuaternion;
 
             return this;
         }
@@ -585,6 +589,7 @@
 
             mesh.position.copyFrom(this.position);
             mesh.rotation.copyFrom(this.rotation);
+            mesh.rotationQuaternion.copyFrom(this.rotationQuaternion);
             mesh.scaling.copyFrom(this.scaling);
             mesh.computeWorldMatrix(true);
 

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

@@ -248,7 +248,6 @@ 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();
@@ -302,7 +301,8 @@ var BABYLON;
                 if (onLoaded) {
                     onLoaded();
                 }
-            }, function () { }, scene.database);
+            }, function () {
+            }, scene.database);
         };
         Geometry.prototype.isDisposed = function () {
             return this._isDisposed;

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

@@ -129,7 +129,6 @@ 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) {

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

@@ -52,7 +52,6 @@ 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) {
@@ -61,7 +60,6 @@ var BABYLON;
                         }
                     }
                 }
-                // Particles
                 for (index = 0; index < scene.particleSystems.length; index++) {
                     var system = scene.particleSystems[index];
                     if (system.emitter === source) {
@@ -371,7 +369,6 @@ 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++;
             }
@@ -484,7 +481,6 @@ var BABYLON;
                 return;
             }
             var engine = this.getScene().getEngine();
-            // Draw order
             switch (fillMode) {
                 case BABYLON.Material.PointFillMode:
                     engine.drawPointClouds(subMesh.verticesStart, subMesh.verticesCount, instancesCount);
@@ -721,7 +717,8 @@ var BABYLON;
                     }
                     _this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_LOADED;
                     scene._removePendingData(_this);
-                }, function () { }, scene.database, getBinaryData);
+                }, function () {
+                }, scene.database, getBinaryData);
             }
         };
         Mesh.prototype.isInFrustum = function (frustumPlanes) {
@@ -843,12 +840,11 @@ 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;
             }
@@ -904,7 +900,6 @@ 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++) {
@@ -928,7 +923,6 @@ 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);
@@ -937,7 +931,6 @@ 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());
@@ -970,7 +963,7 @@ var BABYLON;
          */
         Mesh.prototype.simplify = function (settings, parallelProcessing, simplificationType, successCallback) {
             if (parallelProcessing === void 0) { parallelProcessing = true; }
-            if (simplificationType === void 0) { simplificationType = BABYLON.SimplificationType.QUADRATIC; }
+            if (simplificationType === void 0) { simplificationType = 0 /* QUADRATIC */; }
             this.getScene().simplificationQueue.addTask({
                 settings: settings,
                 parallelProcessing: parallelProcessing,
@@ -1162,8 +1155,12 @@ 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;
@@ -1277,7 +1274,8 @@ 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) {
@@ -1556,7 +1554,6 @@ 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();
@@ -1573,6 +1570,7 @@ var BABYLON;
             var source;
             for (index = 0; index < meshes.length; index++) {
                 if (meshes[index]) {
+                    meshes[index].computeWorldMatrix(true);
                     otherVertexData = BABYLON.VertexData.ExtractFromMesh(meshes[index], true);
                     otherVertexData.transform(meshes[index].getWorldMatrix());
                     if (vertexData) {

+ 1 - 0
Babylon/Mesh/babylon.mesh.ts

@@ -1861,6 +1861,7 @@
             var source: Mesh;
             for (index = 0; index < meshes.length; index++) {
                 if (meshes[index]) {
+                    meshes[index].computeWorldMatrix(true);
                     otherVertexData = VertexData.ExtractFromMesh(meshes[index], true);
                     otherVertexData.transform(meshes[index].getWorldMatrix());
 

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

@@ -275,7 +275,6 @@ var BABYLON;
                 }
                 idc += l;
             }
-            // vertical distances (v)
             for (i = 0; i < minlg; i++) {
                 vTotalDistance[i] = 0;
                 vs[i] = [0];
@@ -377,7 +376,6 @@ 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.
@@ -501,7 +499,6 @@ 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);
@@ -509,7 +506,6 @@ 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);
@@ -526,7 +522,6 @@ 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);
@@ -543,7 +538,6 @@ var BABYLON;
                 }
             }
             subdivisions += 1;
-            // Indices
             for (s = 0; s < subdivisions - 1; s++) {
                 for (i = 0; i <= tessellation; i++) {
                     indices.push(i * subdivisions + s);
@@ -739,7 +733,6 @@ 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));
@@ -758,7 +751,6 @@ 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));
@@ -876,7 +868,6 @@ 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;
@@ -989,7 +980,6 @@ 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();
@@ -1006,17 +996,14 @@ 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];
                     }
@@ -1028,13 +1015,11 @@ 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];
                     }

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

@@ -71,7 +71,7 @@ var BABYLON;
         };
         SimplificationQueue.prototype.getSimplifier = function (task) {
             switch (task.simplificationType) {
-                case SimplificationType.QUADRATIC:
+                case 0 /* QUADRATIC */:
                 default:
                     return new QuadraticErrorSimplification(task.mesh);
             }
@@ -128,9 +128,7 @@ 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) {
@@ -295,7 +293,9 @@ var BABYLON;
                             }
                         }
                     };
-                    BABYLON.AsyncLoop.SyncAsyncForLoop(_this.triangles.length, _this.syncIterations, trianglesIterator, callback, function () { return (triangleCount - deletedTriangles <= targetCount); });
+                    BABYLON.AsyncLoop.SyncAsyncForLoop(_this.triangles.length, _this.syncIterations, trianglesIterator, callback, function () {
+                        return (triangleCount - deletedTriangles <= targetCount);
+                    });
                 }, 0);
             };
             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) /* && !this.isTriangleOnBoundingBox(t)*/) {
+                if ((v1 === vertex2 || v2 === vertex2)) {
                     deletedArray[i] = true;
                     delTr.push(t);
                     continue;
@@ -610,8 +610,7 @@ 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);

+ 104 - 6
Babylon/Mesh/babylon.polygonmesh.js

@@ -22,7 +22,7 @@ var BABYLON;
             var _this = this;
             var result = new Array();
             originalPoints.forEach(function (point) {
-                if (result.length === 0 || !(BABYLON.Tools.WithinEpsilon(point.x, result[0].x, 0.00001) && BABYLON.Tools.WithinEpsilon(point.y, result[0].y, 0.00001))) {
+                if (result.length === 0 || !point.equalsWithEpsilon(result[0])) {
                     var newPoint = new IndexedVector2(point, _this.elements.length);
                     result.push(newPoint);
                     _this.elements.push(newPoint);
@@ -86,7 +86,7 @@ var BABYLON;
             var floats = input.split(/[^-+eE\.\d]+/).map(parseFloat).filter(function (val) { return (!isNaN(val)); });
             var i, result = [];
             for (i = 0; i < (floats.length & 0x7FFFFFFE); i += 2) {
-                result.push(new poly2tri.Point(floats[i], floats[i + 1]));
+                result.push(new BABYLON.Vector2(floats[i], floats[i + 1]));
             }
             return result;
         };
@@ -99,6 +99,8 @@ var BABYLON;
     var PolygonMeshBuilder = (function () {
         function PolygonMeshBuilder(name, contours, scene) {
             this._points = new PolygonPoints();
+            this._outlinepoints = new PolygonPoints();
+            this._holes = [];
             if (!("poly2tri" in window)) {
                 throw "PolygonMeshBuilder cannot be used because poly2tri is not referenced";
             }
@@ -112,12 +114,17 @@ var BABYLON;
                 points = contours;
             }
             this._swctx = new poly2tri.SweepContext(this._points.add(points));
+            this._outlinepoints.add(points);
         }
         PolygonMeshBuilder.prototype.addHole = function (hole) {
             this._swctx.addHole(this._points.add(hole));
+            var holepoints = new PolygonPoints();
+            holepoints.add(hole);
+            this._holes.push(holepoints);
             return this;
         };
-        PolygonMeshBuilder.prototype.build = function (updatable) {
+        PolygonMeshBuilder.prototype.build = function (updatable, depth) {
+            var _this = this;
             if (updatable === void 0) { updatable = false; }
             var result = new BABYLON.Mesh(this._name, this._scene);
             var normals = [];
@@ -136,12 +143,103 @@ var BABYLON;
                     indices.push(point.index);
                 });
             });
-            result.setVerticesData(BABYLON.VertexBuffer.PositionKind, positions, updatable);
-            result.setVerticesData(BABYLON.VertexBuffer.NormalKind, normals, updatable);
-            result.setVerticesData(BABYLON.VertexBuffer.UVKind, uvs, updatable);
+            if (depth > 0) {
+                var positionscount = (positions.length / 3); //get the current pointcount
+                this._points.elements.forEach(function (p) {
+                    normals.push(0, -1.0, 0);
+                    positions.push(p.x, -depth, p.y);
+                    uvs.push(1 - (p.x - bounds.min.x) / bounds.width, 1 - (p.y - bounds.min.y) / bounds.height);
+                });
+                var p1; //we need to change order of point so the triangles are made in the rigth way.
+                var p2;
+                var poscounter = 0;
+                this._swctx.getTriangles().forEach(function (triangle) {
+                    triangle.getPoints().forEach(function (point) {
+                        switch (poscounter) {
+                            case 0:
+                                p1 = point;
+                                break;
+                            case 1:
+                                p2 = point;
+                                break;
+                            case 2:
+                                indices.push(point.index + positionscount);
+                                indices.push(p2.index + positionscount);
+                                indices.push(p1.index + positionscount);
+                                poscounter = -1;
+                                break;
+                        }
+                        poscounter++;
+                        //indices.push((<IndexedVector2>point).index + positionscount);
+                    });
+                });
+                //Add the sides
+                this.addSide(positions, normals, uvs, indices, bounds, this._outlinepoints, depth, false);
+                this._holes.forEach(function (hole) {
+                    _this.addSide(positions, normals, uvs, indices, bounds, hole, depth, true);
+                });
+            }
+            result.setVerticesData(positions, BABYLON.VertexBuffer.PositionKind, updatable);
+            result.setVerticesData(normals, BABYLON.VertexBuffer.NormalKind, updatable);
+            result.setVerticesData(uvs, BABYLON.VertexBuffer.UVKind, updatable);
             result.setIndices(indices);
             return result;
         };
+        PolygonMeshBuilder.prototype.addSide = function (positions, normals, uvs, indices, bounds, points, depth, flip) {
+            var StartIndex = positions.length / 3;
+            var ulength = 0;
+            for (var i = 0; i < points.elements.length; i++) {
+                var p = points.elements[i];
+                var p1;
+                if ((i + 1) > points.elements.length - 1) {
+                    p1 = points.elements[0];
+                }
+                else {
+                    p1 = points.elements[i + 1];
+                }
+                positions.push(p.x, 0, p.y);
+                positions.push(p.x, -depth, p.y);
+                positions.push(p1.x, 0, p1.y);
+                positions.push(p1.x, -depth, p1.y);
+                var v1 = new BABYLON.Vector3(p.x, 0, p.y);
+                var v2 = new BABYLON.Vector3(p1.x, 0, p1.y);
+                var v3 = v2.subtract(v1);
+                var v4 = new BABYLON.Vector3(0, 1, 0);
+                var vn = BABYLON.Vector3.Cross(v3, v4);
+                vn = vn.normalize();
+                uvs.push(ulength / bounds.width, 0);
+                uvs.push(ulength / bounds.width, 1);
+                ulength += v3.length();
+                uvs.push((ulength / bounds.width), 0);
+                uvs.push((ulength / bounds.width), 1);
+                if (!flip) {
+                    normals.push(-vn.x, -vn.y, -vn.z);
+                    normals.push(-vn.x, -vn.y, -vn.z);
+                    normals.push(-vn.x, -vn.y, -vn.z);
+                    normals.push(-vn.x, -vn.y, -vn.z);
+                    indices.push(StartIndex);
+                    indices.push(StartIndex + 1);
+                    indices.push(StartIndex + 2);
+                    indices.push(StartIndex + 1);
+                    indices.push(StartIndex + 3);
+                    indices.push(StartIndex + 2);
+                }
+                else {
+                    normals.push(vn.x, vn.y, vn.z);
+                    normals.push(vn.x, vn.y, vn.z);
+                    normals.push(vn.x, vn.y, vn.z);
+                    normals.push(vn.x, vn.y, vn.z);
+                    indices.push(StartIndex);
+                    indices.push(StartIndex + 2);
+                    indices.push(StartIndex + 1);
+                    indices.push(StartIndex + 1);
+                    indices.push(StartIndex + 2);
+                    indices.push(StartIndex + 3);
+                }
+                StartIndex += 4;
+            }
+            ;
+        };
         return PolygonMeshBuilder;
     })();
     BABYLON.PolygonMeshBuilder = PolygonMeshBuilder;

+ 3 - 10
Babylon/Mesh/babylon.polygonmesh.ts

@@ -5,13 +5,6 @@ module BABYLON {
         }
     }
 
-    function nearlyEqual(a: number, b: number, epsilon: number = 0.0001): boolean {
-        if (a === b) {
-            return true;
-        }
-        return Math.abs(a - b) < epsilon;
-    }
-
     class PolygonPoints {
         elements = new Array<IndexedVector2>();
 
@@ -19,7 +12,7 @@ module BABYLON {
 
             var result = new Array<IndexedVector2>();
             originalPoints.forEach(point => {
-                if (result.length === 0 || !(nearlyEqual(point.x, result[0].x) && nearlyEqual(point.y, result[0].y))) {
+                if (result.length === 0 || !point.equalsWithEpsilon(result[0])) {
                     var newPoint = new IndexedVector2(point, this.elements.length);
                     result.push(newPoint);
                     this.elements.push(newPoint);
@@ -199,10 +192,10 @@ module BABYLON {
                     });
                 });
                 //Add the sides
-                this.addside(positions, normals, uvs, indices, bounds, this._outlinepoints, depth, false)
+                this.addSide(positions, normals, uvs, indices, bounds, this._outlinepoints, depth, false)
 
                 this._holes.forEach((hole) => {
-                    this.addside(positions, normals, uvs, indices, bounds, hole, depth, true)
+                    this.addSide(positions, normals, uvs, indices, bounds, hole, depth, true)
                 });                               
             }
 

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

@@ -87,7 +87,6 @@ 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]];

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

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

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

@@ -110,13 +110,11 @@ var BABYLON;
         CannonJSPlugin.prototype._createConvexPolyhedron = function (rawVerts, rawFaces, mesh, options) {
             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]]);
             }

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

@@ -63,7 +63,6 @@ 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;
@@ -81,7 +80,6 @@ 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;

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

@@ -74,7 +74,9 @@ 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);
@@ -86,7 +88,9 @@ 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) {

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

@@ -87,9 +87,15 @@ 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);
             }
@@ -100,21 +106,51 @@ 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;
         };
@@ -167,8 +203,18 @@ 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);

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

@@ -81,11 +81,21 @@ var BABYLON;
             this._blurVPostProcess = new BABYLON.BlurPostProcess("SSAOBlurV", new BABYLON.Vector2(0.0, 2.0), 2.0, ssaoRatio, null, BABYLON.Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false);
             this._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)
@@ -125,22 +135,54 @@ 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);

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

@@ -226,7 +226,6 @@ 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;

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

@@ -41,9 +41,7 @@ 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) {

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

@@ -30,7 +30,9 @@ 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 = [];

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

@@ -33,7 +33,6 @@ 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;

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

@@ -179,7 +179,6 @@ 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);
                         }
@@ -203,7 +202,8 @@ var BABYLON;
                                         this.hasReachedQuota = true;
                                     }
                                 }
-                                catch (ex) { }
+                                catch (ex) {
+                                }
                                 generateBlobUrl();
                             };
                             transaction.oncomplete = function (event) {
@@ -311,7 +311,8 @@ var BABYLON;
                                 _this.hasReachedQuota = true;
                             }
                         }
-                        catch (ex) { }
+                        catch (ex) {
+                        }
                         callback(-1);
                     };
                     transaction.oncomplete = function (event) {
@@ -425,7 +426,8 @@ var BABYLON;
                                         this.hasReachedQuota = true;
                                     }
                                 }
-                                catch (ex) { }
+                                catch (ex) {
+                                }
                                 callback(fileData);
                             };
                             transaction.oncomplete = function (event) {

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

@@ -17,9 +17,15 @@ 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 () {
@@ -76,9 +82,7 @@ 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;
@@ -108,7 +112,9 @@ 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) {

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 24 - 20
Babylon/Tools/babylon.gamepads.js


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

@@ -158,7 +158,6 @@ 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)) {

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

@@ -29,7 +29,6 @@ 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++;

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

@@ -11,10 +11,7 @@ var BABYLON;
         var DDSCAPS2_CUBEMAP = 0x200, DDSCAPS2_CUBEMAP_POSITIVEX = 0x400, DDSCAPS2_CUBEMAP_NEGATIVEX = 0x800, DDSCAPS2_CUBEMAP_POSITIVEY = 0x1000, DDSCAPS2_CUBEMAP_NEGATIVEY = 0x2000, DDSCAPS2_CUBEMAP_POSITIVEZ = 0x4000, DDSCAPS2_CUBEMAP_NEGATIVEZ = 0x8000, DDSCAPS2_VOLUME = 0x200000;
         var 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);

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

@@ -367,7 +367,6 @@ 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;

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

@@ -50,7 +50,6 @@ 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;
@@ -88,11 +87,9 @@ 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);
                             }

+ 22 - 18
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 = JoystickAxis.X;
-            this._axisTargetedByUpAndDown = JoystickAxis.Y;
+            this._axisTargetedByLeftAndRight = 0 /* X */;
+            this._axisTargetedByUpAndDown = 1 /* Y */;
             this.reverseLeftRight = false;
             this.reverseUpDown = false;
             // collections of pointers
@@ -88,7 +88,9 @@ 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;
@@ -132,26 +134,26 @@ var BABYLON;
                 var directionLeftRight = this.reverseLeftRight ? -1 : 1;
                 var deltaJoystickX = directionLeftRight * this._deltaJoystickVector.x / this._inversedSensibility;
                 switch (this._axisTargetedByLeftAndRight) {
-                    case JoystickAxis.X:
+                    case 0 /* X */:
                         this.deltaPosition.x = Math.min(1, Math.max(-1, deltaJoystickX));
                         break;
-                    case JoystickAxis.Y:
+                    case 1 /* Y */:
                         this.deltaPosition.y = Math.min(1, Math.max(-1, deltaJoystickX));
                         break;
-                    case JoystickAxis.Z:
+                    case 2 /* 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 JoystickAxis.X:
+                    case 0 /* X */:
                         this.deltaPosition.x = Math.min(1, Math.max(-1, deltaJoystickY));
                         break;
-                    case JoystickAxis.Y:
+                    case 1 /* Y */:
                         this.deltaPosition.y = Math.min(1, Math.max(-1, deltaJoystickY));
                         break;
-                    case JoystickAxis.Z:
+                    case 2 /* Z */:
                         this.deltaPosition.z = Math.min(1, Math.max(-1, deltaJoystickY));
                         break;
                 }
@@ -186,26 +188,26 @@ var BABYLON;
         // Define which axis you'd like to control for left & right 
         VirtualJoystick.prototype.setAxisForLeftRight = function (axis) {
             switch (axis) {
-                case JoystickAxis.X:
-                case JoystickAxis.Y:
-                case JoystickAxis.Z:
+                case 0 /* X */:
+                case 1 /* Y */:
+                case 2 /* Z */:
                     this._axisTargetedByLeftAndRight = axis;
                     break;
                 default:
-                    this._axisTargetedByLeftAndRight = JoystickAxis.X;
+                    this._axisTargetedByLeftAndRight = 0 /* X */;
                     break;
             }
         };
         // Define which axis you'd like to control for up & down 
         VirtualJoystick.prototype.setAxisForUpDown = function (axis) {
             switch (axis) {
-                case JoystickAxis.X:
-                case JoystickAxis.Y:
-                case JoystickAxis.Z:
+                case 0 /* X */:
+                case 1 /* Y */:
+                case 2 /* Z */:
                     this._axisTargetedByUpAndDown = axis;
                     break;
                 default:
-                    this._axisTargetedByUpAndDown = JoystickAxis.Y;
+                    this._axisTargetedByUpAndDown = 1 /* Y */;
                     break;
             }
         };
@@ -250,7 +252,9 @@ var BABYLON;
                     ;
                 });
             }
-            requestAnimationFrame(function () { _this._drawVirtualJoystick(); });
+            requestAnimationFrame(function () {
+                _this._drawVirtualJoystick();
+            });
         };
         VirtualJoystick.prototype.releaseCanvas = function () {
             if (VirtualJoystick.vjCanvas) {

+ 9 - 19
Babylon/babylon.engine.js

@@ -197,10 +197,7 @@ 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;
@@ -383,7 +380,6 @@ 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);
             }
@@ -456,10 +452,7 @@ 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();
                     }
@@ -471,10 +464,7 @@ 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);
@@ -1559,8 +1549,12 @@ 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);
@@ -1593,7 +1587,6 @@ 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);
@@ -1716,17 +1709,14 @@ 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;

+ 3 - 12
Babylon/babylon.scene.js

@@ -1074,7 +1074,6 @@ 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();
@@ -1156,7 +1155,6 @@ var BABYLON;
                 this._renderForCamera(camera);
                 return;
             }
-            // Sub-cameras
             for (var index = 0; index < camera.subCameras.length; index++) {
                 this._renderForCamera(camera.subCameras[index]);
             }
@@ -1321,7 +1319,6 @@ 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;
@@ -1475,35 +1472,27 @@ 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();
             }
@@ -1712,7 +1701,9 @@ 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)) {

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 657 - 478
babylon.2.1-beta.debug.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 21 - 26
babylon.2.1-beta.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 19 - 24
babylon.2.1-beta.noworker.js