فهرست منبع

Merge pull request #556 from RaananW/babylon-cleanup

Babylon references cleanup
David Catuhe 10 سال پیش
والد
کامیت
f2923d8711
46فایلهای تغییر یافته به همراه290 افزوده شده و 290 حذف شده
  1. 1 1
      Babylon/Actions/babylon.directActions.ts
  2. 1 1
      Babylon/Audio/babylon.analyser.ts
  3. 1 1
      Babylon/Audio/babylon.sound.ts
  4. 6 6
      Babylon/Audio/babylon.soundtrack.ts
  5. 1 1
      Babylon/Cameras/VR/babylon.vrDeviceOrientationCamera.ts
  6. 2 2
      Babylon/Cameras/babylon.arcRotateCamera.ts
  7. 3 3
      Babylon/Cameras/babylon.deviceOrientationCamera.ts
  8. 10 10
      Babylon/Cameras/babylon.freeCamera.ts
  9. 7 7
      Babylon/Cameras/babylon.gamepadCamera.ts
  10. 9 9
      Babylon/Cameras/babylon.targetCamera.ts
  11. 5 5
      Babylon/Cameras/babylon.touchCamera.ts
  12. 10 10
      Babylon/Cameras/babylon.virtualJoysticksCamera.ts
  13. 38 38
      Babylon/Collisions/babylon.collider.ts
  14. 10 10
      Babylon/Collisions/babylon.collisionCoordinator.ts
  15. 17 17
      Babylon/Collisions/babylon.collisionWorker.ts
  16. 3 3
      Babylon/Culling/Octrees/babylon.octree.ts
  17. 2 2
      Babylon/Culling/Octrees/babylon.octreeBlock.ts
  18. 13 13
      Babylon/Culling/babylon.boundingInfo.ts
  19. 6 6
      Babylon/Culling/babylon.boundingSphere.ts
  20. 4 4
      Babylon/Layer/babylon.layer.ts
  21. 2 2
      Babylon/LensFlare/babylon.lensFlare.ts
  22. 6 6
      Babylon/LensFlare/babylon.lensFlareSystem.ts
  23. 4 4
      Babylon/Lights/babylon.hemisphericLight.ts
  24. 1 1
      Babylon/Lights/babylon.light.ts
  25. 5 5
      Babylon/Materials/Textures/babylon.mirrorTexture.ts
  26. 4 4
      Babylon/Materials/Textures/babylon.videoTexture.ts
  27. 1 1
      Babylon/Materials/babylon.shaderMaterial.ts
  28. 14 14
      Babylon/Math/babylon.math.ts
  29. 21 21
      Babylon/Mesh/babylon.csg.ts
  30. 2 2
      Babylon/Mesh/babylon.groundMesh.ts
  31. 1 1
      Babylon/Mesh/babylon.linesMesh.ts
  32. 15 15
      Babylon/Mesh/babylon.mesh.ts
  33. 18 18
      Babylon/Mesh/babylon.mesh.vertexData.ts
  34. 1 1
      Babylon/Mesh/babylon.subMesh.ts
  35. 10 10
      Babylon/Physics/Plugins/babylon.cannonJSPlugin.ts
  36. 12 12
      Babylon/Physics/Plugins/babylon.oimoJSPlugin.ts
  37. 1 1
      Babylon/PostProcess/babylon.blurPostProcess.ts
  38. 1 1
      Babylon/PostProcess/babylon.refractionPostProcess.ts
  39. 4 4
      Babylon/PostProcess/babylon.vrDistortionCorrectionPostProcess.ts
  40. 5 5
      Babylon/Rendering/babylon.renderingGroup.ts
  41. 2 2
      Babylon/Sprites/babylon.sprite.ts
  42. 2 2
      Babylon/Tools/babylon.assetsManager.ts
  43. 2 2
      Babylon/Tools/babylon.database.ts
  44. 2 2
      Babylon/Tools/babylon.gamepads.ts
  45. 1 1
      Babylon/Tools/babylon.tags.ts
  46. 4 4
      Babylon/Tools/babylon.virtualJoystick.ts

+ 1 - 1
Babylon/Actions/babylon.directActions.ts

@@ -166,7 +166,7 @@
             var invertParentWorldMatrix = this._parent.getWorldMatrix().clone();
             invertParentWorldMatrix.invert();
 
-            this._target.position = BABYLON.Vector3.TransformCoordinates(this._target.position, invertParentWorldMatrix);
+            this._target.position = Vector3.TransformCoordinates(this._target.position, invertParentWorldMatrix);
 
             this._target.parent = this._parent;
         }

+ 1 - 1
Babylon/Audio/babylon.analyser.ts

@@ -16,7 +16,7 @@ module BABYLON {
         private _registerFunc;
         private _audioEngine: AudioEngine;
 
-        constructor(scene: BABYLON.Scene) {
+        constructor(scene: Scene) {
             this._scene = scene;
             this._audioEngine = Engine.audioEngine;
             if (this._audioEngine.canUseWebAudio) {

+ 1 - 1
Babylon/Audio/babylon.sound.ts

@@ -105,7 +105,7 @@
                 // Adding an empty sound to avoid breaking audio calls for non Web Audio browsers
                 this._scene.mainSoundTrack.AddSound(this);
                 if (!Engine.audioEngine.WarnedWebAudioUnsupported) {
-                    BABYLON.Tools.Error("Web Audio is not supported by your browser.");
+                    Tools.Error("Web Audio is not supported by your browser.");
                     Engine.audioEngine.WarnedWebAudioUnsupported = true;
                 }
                 // Simulating a ready to play event to avoid breaking code for non web audio browsers

+ 6 - 6
Babylon/Audio/babylon.soundtrack.ts

@@ -1,16 +1,16 @@
 module BABYLON {
     export class SoundTrack {
-        private _audioEngine: BABYLON.AudioEngine;
+        private _audioEngine: AudioEngine;
         private _outputAudioNode: GainNode;
         private _inputAudioNode: AudioNode;
         private _trackConvolver: ConvolverNode;
-        private _scene: BABYLON.Scene;
+        private _scene: Scene;
         public id: number = -1;
-        public soundCollection: Array<BABYLON.Sound>;
+        public soundCollection: Array<Sound>;
         private _isMainTrack: boolean = false;
         private _connectedAnalyser: Analyser;
 
-        constructor(scene: BABYLON.Scene, options?: any) {
+        constructor(scene: Scene, options?: any) {
             this._scene = scene;
             this._audioEngine = Engine.audioEngine;
             this.soundCollection = new Array();
@@ -42,7 +42,7 @@
             }
         }
 
-        public AddSound(sound: BABYLON.Sound) {
+        public AddSound(sound: Sound) {
             if (Engine.audioEngine.canUseWebAudio) {
                 sound.connectToSoundTrackAudioNode(this._outputAudioNode);
             }
@@ -59,7 +59,7 @@
             sound.soundTrackId = this.id;
         }
 
-        public RemoveSound(sound: BABYLON.Sound) {
+        public RemoveSound(sound: Sound) {
             var index = this.soundCollection.indexOf(sound);
             if (index !== -1) {
                 this.soundCollection.splice(index, 1);

+ 1 - 1
Babylon/Cameras/VR/babylon.vrDeviceOrientationCamera.ts

@@ -1,5 +1,5 @@
 module BABYLON {
-    export class VRDeviceOrientationFreeCamera extends BABYLON.FreeCamera {
+    export class VRDeviceOrientationFreeCamera extends FreeCamera {
 		public _alpha = 0;
 		public _beta = 0;
 		public _gamma = 0;

+ 2 - 2
Babylon/Cameras/babylon.arcRotateCamera.ts

@@ -456,7 +456,7 @@
                     up = up.negate();
                 }
 
-                BABYLON.Matrix.LookAtLHToRef(this.position, target, up, this._viewMatrix);
+                Matrix.LookAtLHToRef(this.position, target, up, this._viewMatrix);
                 this._viewMatrix.m[12] += this.targetScreenOffset.x;
                 this._viewMatrix.m[13] += this.targetScreenOffset.y;
             }
@@ -537,7 +537,7 @@
          */
         public getSubCamera(name: string, isA: boolean): Camera {
             var alphaSpace = this._subCamHalfSpace * (isA ? -1 : 1);
-            return new BABYLON.ArcRotateCamera(name, this.alpha + alphaSpace, this.beta, this.radius, this.target, this.getScene());
+            return new ArcRotateCamera(name, this.alpha + alphaSpace, this.beta, this.radius, this.target, this.getScene());
         }
         
         /**

+ 3 - 3
Babylon/Cameras/babylon.deviceOrientationCamera.ts

@@ -67,10 +67,10 @@ module BABYLON {
             this.cameraRotation.y -= this._offsetX / this.angularSensibility;
 
             var speed = this._computeLocalCameraSpeed();
-            var direction = new BABYLON.Vector3(0, 0, speed * this._offsetY / this.moveSensibility);
+            var direction = new Vector3(0, 0, speed * this._offsetY / this.moveSensibility);
 
-            BABYLON.Matrix.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, 0, this._cameraRotationMatrix);
-            this.cameraDirection.addInPlace(BABYLON.Vector3.TransformCoordinates(direction, this._cameraRotationMatrix));
+            Matrix.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, 0, this._cameraRotationMatrix);
+            this.cameraDirection.addInPlace(Vector3.TransformCoordinates(direction, this._cameraRotationMatrix));
 
             super._checkInputs();
         }

+ 10 - 10
Babylon/Cameras/babylon.freeCamera.ts

@@ -1,6 +1,6 @@
 module BABYLON {
     export class FreeCamera extends TargetCamera {
-        public ellipsoid = new BABYLON.Vector3(0.5, 1, 0.5);
+        public ellipsoid = new Vector3(0.5, 1, 0.5);
         public keysUp = [38];
         public keysDown = [40];
         public keysLeft = [37];
@@ -13,9 +13,9 @@
         private _keys = [];
         private _collider = new Collider();
         private _needMoveForGravity = false;
-        private _oldPosition = BABYLON.Vector3.Zero();
-        private _diffPosition = BABYLON.Vector3.Zero();
-        private _newPosition = BABYLON.Vector3.Zero();
+        private _oldPosition = Vector3.Zero();
+        private _diffPosition = Vector3.Zero();
+        private _newPosition = Vector3.Zero();
         private _attachedElement: HTMLElement;
         private _localDirection: Vector3;
         private _transformedDirection: Vector3;
@@ -138,8 +138,8 @@
                 this._reset = () => {
                     this._keys = [];
                     previousPosition = null;
-                    this.cameraDirection = new BABYLON.Vector3(0, 0, 0);
-                    this.cameraRotation = new BABYLON.Vector2(0, 0);
+                    this.cameraDirection = new Vector3(0, 0, 0);
+                    this.cameraRotation = new Vector2(0, 0);
                 };
             }
 
@@ -181,7 +181,7 @@
             var globalPosition: Vector3;
 
             if (this.parent) {
-                globalPosition = BABYLON.Vector3.TransformCoordinates(this.position, this.parent.getWorldMatrix());
+                globalPosition = Vector3.TransformCoordinates(this.position, this.parent.getWorldMatrix());
             } else {
                 globalPosition = this.position;
             }
@@ -222,8 +222,8 @@
 
         public _checkInputs(): void {
             if (!this._localDirection) {
-                this._localDirection = BABYLON.Vector3.Zero();
-                this._transformedDirection = BABYLON.Vector3.Zero();
+                this._localDirection = Vector3.Zero();
+                this._transformedDirection = Vector3.Zero();
             }
 
             // Keyboard
@@ -242,7 +242,7 @@
                 }
 
                 this.getViewMatrix().invertToRef(this._cameraTransformMatrix);
-                BABYLON.Vector3.TransformNormalToRef(this._localDirection, this._cameraTransformMatrix, this._transformedDirection);
+                Vector3.TransformNormalToRef(this._localDirection, this._cameraTransformMatrix, this._transformedDirection);
                 this.cameraDirection.addInPlace(this._transformedDirection);
             }
 

+ 7 - 7
Babylon/Cameras/babylon.gamepadCamera.ts

@@ -1,17 +1,17 @@
 module BABYLON {
     // We're mainly based on the logic defined into the FreeCamera code
     export class GamepadCamera extends FreeCamera {
-        private _gamepad: BABYLON.Gamepad;
-        private _gamepads: BABYLON.Gamepads;
+        private _gamepad: Gamepad;
+        private _gamepads: Gamepads;
         public angularSensibility = 200;
         public moveSensibility = 75;
 
         constructor(name: string, position: Vector3, scene: Scene) {
             super(name, position, scene);
-            this._gamepads = new BABYLON.Gamepads((gamepad: BABYLON.Gamepad) => { this._onNewGameConnected(gamepad); });
+            this._gamepads = new Gamepads((gamepad: Gamepad) => { this._onNewGameConnected(gamepad); });
         }
 
-        private _onNewGameConnected(gamepad: BABYLON.Gamepad) {
+        private _onNewGameConnected(gamepad: Gamepad) {
             // Only the first gamepad can control the camera
             if (gamepad.index === 0) {
                 this._gamepad = gamepad;
@@ -32,12 +32,12 @@ module BABYLON {
                 RSValues.x = Math.abs(normalizedRX) > 0.001 ? 0 + normalizedRX : 0;
                 RSValues.y = Math.abs(normalizedRY) > 0.001 ? 0 + normalizedRY : 0;
 
-                var cameraTransform = BABYLON.Matrix.RotationYawPitchRoll(this.rotation.y, this.rotation.x, 0);
+                var cameraTransform = Matrix.RotationYawPitchRoll(this.rotation.y, this.rotation.x, 0);
 
                 var speed = this._computeLocalCameraSpeed() * 50.0;
-                var deltaTransform = BABYLON.Vector3.TransformCoordinates(new BABYLON.Vector3(LSValues.x * speed, 0, -LSValues.y * speed), cameraTransform);
+                var deltaTransform = Vector3.TransformCoordinates(new Vector3(LSValues.x * speed, 0, -LSValues.y * speed), cameraTransform);
                 this.cameraDirection = this.cameraDirection.add(deltaTransform);
-                this.cameraRotation = this.cameraRotation.add(new BABYLON.Vector2(RSValues.y, RSValues.x));
+                this.cameraRotation = this.cameraRotation.add(new Vector2(RSValues.y, RSValues.x));
             }
 
             super._checkInputs();

+ 9 - 9
Babylon/Cameras/babylon.targetCamera.ts

@@ -212,15 +212,15 @@
         }
         
         public _getVRViewMatrix(): Matrix {
-            BABYLON.Matrix.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this._cameraRotationMatrix);
+            Matrix.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, this.rotation.z, this._cameraRotationMatrix);
 
-            BABYLON.Vector3.TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint);
-            BABYLON.Vector3.TransformNormalToRef(this.upVector, this._cameraRotationMatrix, this._vrActualUp);
+            Vector3.TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint);
+            Vector3.TransformNormalToRef(this.upVector, this._cameraRotationMatrix, this._vrActualUp);
 
             // Computing target and final matrix
             this.position.addToRef(this._transformedReferencePoint, this._currentTarget);
 
-            BABYLON.Matrix.LookAtLHToRef(this.position, this._currentTarget, this._vrActualUp, this._vrWorkMatrix);
+            Matrix.LookAtLHToRef(this.position, this._currentTarget, this._vrActualUp, this._vrWorkMatrix);
 
             this._vrWorkMatrix.multiplyToRef(this._vrPreViewMatrix, this._viewMatrix);
             return this._viewMatrix;
@@ -231,7 +231,7 @@
          * needs to be overridden, so sub has required properties to be copied
          */
         public getSubCamera(name : string, isA : boolean) : Camera{
-            var subCamera = new BABYLON.TargetCamera(name, this.position.clone(), this.getScene());
+            var subCamera = new TargetCamera(name, this.position.clone(), this.getScene());
             if (this._subCameraMode === Camera.SUB_CAMERA_MODE_VR){
                 subCamera._vrActualUp = new Vector3(0, 0, 0);
                 subCamera._getViewMatrix = subCamera._getVRViewMatrix;
@@ -267,14 +267,14 @@
         
         private _getSubCamPosition(halfSpace: number, result: Vector3) {
             if (!this._subCamTransformMatrix){
-                this._subCamTransformMatrix = new BABYLON.Matrix();
+                this._subCamTransformMatrix = new Matrix();
             }
             var target = this.getTarget();
-            BABYLON.Matrix.Translation(-target.x, -target.y, -target.z).multiplyToRef(BABYLON.Matrix.RotationY(halfSpace), this._subCamTransformMatrix);
+            Matrix.Translation(-target.x, -target.y, -target.z).multiplyToRef(Matrix.RotationY(halfSpace), this._subCamTransformMatrix);
 
-            this._subCamTransformMatrix = this._subCamTransformMatrix.multiply(BABYLON.Matrix.Translation(target.x, target.y, target.z));
+            this._subCamTransformMatrix = this._subCamTransformMatrix.multiply(Matrix.Translation(target.x, target.y, target.z));
 
-            BABYLON.Vector3.TransformCoordinatesToRef(this.position, this._subCamTransformMatrix, result);
+            Vector3.TransformCoordinatesToRef(this.position, this._subCamTransformMatrix, result);
         }
     }
 } 

+ 5 - 5
Babylon/Cameras/babylon.touchCamera.ts

@@ -95,7 +95,7 @@ module BABYLON {
             canvas.addEventListener("pointerout", this._onPointerUp);
             canvas.addEventListener("pointermove", this._onPointerMove);
 
-            BABYLON.Tools.RegisterTopRootEvents([
+            Tools.RegisterTopRootEvents([
                 { name: "blur", handler: this._onLostFocus }
             ]);
         }
@@ -110,7 +110,7 @@ module BABYLON {
             canvas.removeEventListener("pointerout", this._onPointerUp);
             canvas.removeEventListener("pointermove", this._onPointerMove);
 
-            BABYLON.Tools.UnregisterTopRootEvents([
+            Tools.UnregisterTopRootEvents([
                 { name: "blur", handler: this._onLostFocus }
             ]);
 
@@ -127,10 +127,10 @@ module BABYLON {
                 this.cameraRotation.x += -this._offsetY / this.angularSensibility;
             } else {
                 var speed = this._computeLocalCameraSpeed();
-                var direction = new BABYLON.Vector3(0, 0, speed * this._offsetY / this.moveSensibility);
+                var direction = new Vector3(0, 0, speed * this._offsetY / this.moveSensibility);
 
-                BABYLON.Matrix.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, 0, this._cameraRotationMatrix);
-                this.cameraDirection.addInPlace(BABYLON.Vector3.TransformCoordinates(direction, this._cameraRotationMatrix));
+                Matrix.RotationYawPitchRollToRef(this.rotation.y, this.rotation.x, 0, this._cameraRotationMatrix);
+                this.cameraDirection.addInPlace(Vector3.TransformCoordinates(direction, this._cameraRotationMatrix));
             }
 
             super._checkInputs();

+ 10 - 10
Babylon/Cameras/babylon.virtualJoysticksCamera.ts

@@ -1,26 +1,26 @@
 module BABYLON {
     // We're mainly based on the logic defined into the FreeCamera code
     export class VirtualJoysticksCamera extends FreeCamera {
-        private _leftjoystick: BABYLON.VirtualJoystick;
-        private _rightjoystick: BABYLON.VirtualJoystick;
+        private _leftjoystick: VirtualJoystick;
+        private _rightjoystick: VirtualJoystick;
 
         constructor(name: string, position: Vector3, scene: Scene) {
             super(name, position, scene);
-            this._leftjoystick = new BABYLON.VirtualJoystick(true);
-            this._leftjoystick.setAxisForUpDown(BABYLON.JoystickAxis.Z);
-            this._leftjoystick.setAxisForLeftRight(BABYLON.JoystickAxis.X);
+            this._leftjoystick = new VirtualJoystick(true);
+            this._leftjoystick.setAxisForUpDown(JoystickAxis.Z);
+            this._leftjoystick.setAxisForLeftRight(JoystickAxis.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 = new VirtualJoystick(false);
+            this._rightjoystick.setAxisForUpDown(JoystickAxis.X);
+            this._rightjoystick.setAxisForLeftRight(JoystickAxis.Y);
             this._rightjoystick.reverseUpDown = true;
             this._rightjoystick.setJoystickSensibility(0.05);
             this._rightjoystick.setJoystickColor("yellow");
         }
 
         public _checkInputs(): void {
-            var cameraTransform = BABYLON.Matrix.RotationYawPitchRoll(this.rotation.y, this.rotation.x, 0);
-            var deltaTransform = BABYLON.Vector3.TransformCoordinates(this._leftjoystick.deltaPosition, cameraTransform);
+            var cameraTransform = Matrix.RotationYawPitchRoll(this.rotation.y, this.rotation.x, 0);
+            var deltaTransform = Vector3.TransformCoordinates(this._leftjoystick.deltaPosition, cameraTransform);
             this.cameraDirection = this.cameraDirection.add(deltaTransform);
             this.cameraRotation = this.cameraRotation.addVector3(this._rightjoystick.deltaPosition);
             if (!this._leftjoystick.pressed) {

+ 38 - 38
Babylon/Collisions/babylon.collider.ts

@@ -54,38 +54,38 @@
     };
 
     export class Collider {
-        public radius = new BABYLON.Vector3(1, 1, 1);
+        public radius = new Vector3(1, 1, 1);
         public retry = 0;
         public velocity: Vector3;
         public basePoint: Vector3;
         public epsilon: number;
         public collisionFound: boolean;
         public velocityWorldLength: number;
-        public basePointWorld = BABYLON.Vector3.Zero();
-        public velocityWorld = BABYLON.Vector3.Zero();
-        public normalizedVelocity = BABYLON.Vector3.Zero();
+        public basePointWorld = Vector3.Zero();
+        public velocityWorld = Vector3.Zero();
+        public normalizedVelocity = Vector3.Zero();
         public initialVelocity: Vector3;
         public initialPosition: Vector3;
         public nearestDistance: number;
         public intersectionPoint: Vector3;
         public collidedMesh: AbstractMesh;
 
-        private _collisionPoint = BABYLON.Vector3.Zero();
-        private _planeIntersectionPoint = BABYLON.Vector3.Zero();
-        private _tempVector = BABYLON.Vector3.Zero();
-        private _tempVector2 = BABYLON.Vector3.Zero();
-        private _tempVector3 = BABYLON.Vector3.Zero();
-        private _tempVector4 = BABYLON.Vector3.Zero();
-        private _edge = BABYLON.Vector3.Zero();
-        private _baseToVertex = BABYLON.Vector3.Zero();
-        private _destinationPoint = BABYLON.Vector3.Zero();
-        private _slidePlaneNormal = BABYLON.Vector3.Zero();
-        private _displacementVector = BABYLON.Vector3.Zero();
+        private _collisionPoint = Vector3.Zero();
+        private _planeIntersectionPoint = Vector3.Zero();
+        private _tempVector = Vector3.Zero();
+        private _tempVector2 = Vector3.Zero();
+        private _tempVector3 = Vector3.Zero();
+        private _tempVector4 = Vector3.Zero();
+        private _edge = Vector3.Zero();
+        private _baseToVertex = Vector3.Zero();
+        private _destinationPoint = Vector3.Zero();
+        private _slidePlaneNormal = Vector3.Zero();
+        private _displacementVector = Vector3.Zero();
 
         // Methods
         public _initialize(source: Vector3, dir: Vector3, e: number): void {
             this.velocity = dir;
-            BABYLON.Vector3.NormalizeToRef(dir, this.normalizedVelocity);
+            Vector3.NormalizeToRef(dir, this.normalizedVelocity);
             this.basePoint = source;
 
             source.multiplyToRef(this.radius, this.basePointWorld);
@@ -101,24 +101,24 @@
             pa.subtractToRef(point, this._tempVector);
             pb.subtractToRef(point, this._tempVector2);
 
-            BABYLON.Vector3.CrossToRef(this._tempVector, this._tempVector2, this._tempVector4);
-            var d = BABYLON.Vector3.Dot(this._tempVector4, n);
+            Vector3.CrossToRef(this._tempVector, this._tempVector2, this._tempVector4);
+            var d = Vector3.Dot(this._tempVector4, n);
             if (d < 0)
                 return false;
 
             pc.subtractToRef(point, this._tempVector3);
-            BABYLON.Vector3.CrossToRef(this._tempVector2, this._tempVector3, this._tempVector4);
-            d = BABYLON.Vector3.Dot(this._tempVector4, n);
+            Vector3.CrossToRef(this._tempVector2, this._tempVector3, this._tempVector4);
+            d = Vector3.Dot(this._tempVector4, n);
             if (d < 0)
                 return false;
 
-            BABYLON.Vector3.CrossToRef(this._tempVector3, this._tempVector, this._tempVector4);
-            d = BABYLON.Vector3.Dot(this._tempVector4, n);
+            Vector3.CrossToRef(this._tempVector3, this._tempVector, this._tempVector4);
+            d = Vector3.Dot(this._tempVector4, n);
             return d >= 0;
         }
 
         public _canDoCollision(sphereCenter: Vector3, sphereRadius: number, vecMin: Vector3, vecMax: Vector3): boolean {
-            var distance = BABYLON.Vector3.Distance(this.basePointWorld, sphereCenter);
+            var distance = Vector3.Distance(this.basePointWorld, sphereCenter);
 
             var max = Math.max(this.radius.x, this.radius.y, this.radius.z);
 
@@ -142,7 +142,7 @@
             }
 
             if (!trianglePlaneArray[faceIndex]) {
-                trianglePlaneArray[faceIndex] = new BABYLON.Plane(0, 0, 0, 0);
+                trianglePlaneArray[faceIndex] = new Plane(0, 0, 0, 0);
                 trianglePlaneArray[faceIndex].copyFromPoints(p1, p2, p3);
             }
 
@@ -152,7 +152,7 @@
                 return;
 
             var signedDistToTrianglePlane = trianglePlane.signedDistanceTo(this.basePoint);
-            var normalDotVelocity = BABYLON.Vector3.Dot(trianglePlane.normal, this.velocity);
+            var normalDotVelocity = Vector3.Dot(trianglePlane.normal, this.velocity);
 
             if (normalDotVelocity == 0) {
                 if (Math.abs(signedDistToTrianglePlane) >= 1.0)
@@ -202,7 +202,7 @@
                 var a = velocitySquaredLength;
 
                 this.basePoint.subtractToRef(p1, this._tempVector);
-                var b = 2.0 * (BABYLON.Vector3.Dot(this.velocity, this._tempVector));
+                var b = 2.0 * (Vector3.Dot(this.velocity, this._tempVector));
                 var c = this._tempVector.lengthSquared() - 1.0;
 
                 var lowestRoot = getLowestRoot(a, b, c, t);
@@ -213,7 +213,7 @@
                 }
 
                 this.basePoint.subtractToRef(p2, this._tempVector);
-                b = 2.0 * (BABYLON.Vector3.Dot(this.velocity, this._tempVector));
+                b = 2.0 * (Vector3.Dot(this.velocity, this._tempVector));
                 c = this._tempVector.lengthSquared() - 1.0;
 
                 lowestRoot = getLowestRoot(a, b, c, t);
@@ -224,7 +224,7 @@
                 }
 
                 this.basePoint.subtractToRef(p3, this._tempVector);
-                b = 2.0 * (BABYLON.Vector3.Dot(this.velocity, this._tempVector));
+                b = 2.0 * (Vector3.Dot(this.velocity, this._tempVector));
                 c = this._tempVector.lengthSquared() - 1.0;
 
                 lowestRoot = getLowestRoot(a, b, c, t);
@@ -237,11 +237,11 @@
                 p2.subtractToRef(p1, this._edge);
                 p1.subtractToRef(this.basePoint, this._baseToVertex);
                 var edgeSquaredLength = this._edge.lengthSquared();
-                var edgeDotVelocity = BABYLON.Vector3.Dot(this._edge, this.velocity);
-                var edgeDotBaseToVertex = BABYLON.Vector3.Dot(this._edge, this._baseToVertex);
+                var edgeDotVelocity = Vector3.Dot(this._edge, this.velocity);
+                var edgeDotBaseToVertex = Vector3.Dot(this._edge, this._baseToVertex);
 
                 a = edgeSquaredLength * (-velocitySquaredLength) + edgeDotVelocity * edgeDotVelocity;
-                b = edgeSquaredLength * (2.0 * BABYLON.Vector3.Dot(this.velocity, this._baseToVertex)) - 2.0 * edgeDotVelocity * edgeDotBaseToVertex;
+                b = edgeSquaredLength * (2.0 * Vector3.Dot(this.velocity, this._baseToVertex)) - 2.0 * edgeDotVelocity * edgeDotBaseToVertex;
                 c = edgeSquaredLength * (1.0 - this._baseToVertex.lengthSquared()) + edgeDotBaseToVertex * edgeDotBaseToVertex;
 
                 lowestRoot = getLowestRoot(a, b, c, t);
@@ -259,11 +259,11 @@
                 p3.subtractToRef(p2, this._edge);
                 p2.subtractToRef(this.basePoint, this._baseToVertex);
                 edgeSquaredLength = this._edge.lengthSquared();
-                edgeDotVelocity = BABYLON.Vector3.Dot(this._edge, this.velocity);
-                edgeDotBaseToVertex = BABYLON.Vector3.Dot(this._edge, this._baseToVertex);
+                edgeDotVelocity = Vector3.Dot(this._edge, this.velocity);
+                edgeDotBaseToVertex = Vector3.Dot(this._edge, this._baseToVertex);
 
                 a = edgeSquaredLength * (-velocitySquaredLength) + edgeDotVelocity * edgeDotVelocity;
-                b = edgeSquaredLength * (2.0 * BABYLON.Vector3.Dot(this.velocity, this._baseToVertex)) - 2.0 * edgeDotVelocity * edgeDotBaseToVertex;
+                b = edgeSquaredLength * (2.0 * Vector3.Dot(this.velocity, this._baseToVertex)) - 2.0 * edgeDotVelocity * edgeDotBaseToVertex;
                 c = edgeSquaredLength * (1.0 - this._baseToVertex.lengthSquared()) + edgeDotBaseToVertex * edgeDotBaseToVertex;
                 lowestRoot = getLowestRoot(a, b, c, t);
                 if (lowestRoot.found) {
@@ -280,11 +280,11 @@
                 p1.subtractToRef(p3, this._edge);
                 p3.subtractToRef(this.basePoint, this._baseToVertex);
                 edgeSquaredLength = this._edge.lengthSquared();
-                edgeDotVelocity = BABYLON.Vector3.Dot(this._edge, this.velocity);
-                edgeDotBaseToVertex = BABYLON.Vector3.Dot(this._edge, this._baseToVertex);
+                edgeDotVelocity = Vector3.Dot(this._edge, this.velocity);
+                edgeDotBaseToVertex = Vector3.Dot(this._edge, this._baseToVertex);
 
                 a = edgeSquaredLength * (-velocitySquaredLength) + edgeDotVelocity * edgeDotVelocity;
-                b = edgeSquaredLength * (2.0 * BABYLON.Vector3.Dot(this.velocity, this._baseToVertex)) - 2.0 * edgeDotVelocity * edgeDotBaseToVertex;
+                b = edgeSquaredLength * (2.0 * Vector3.Dot(this.velocity, this._baseToVertex)) - 2.0 * edgeDotVelocity * edgeDotBaseToVertex;
                 c = edgeSquaredLength * (1.0 - this._baseToVertex.lengthSquared()) + edgeDotBaseToVertex * edgeDotBaseToVertex;
 
                 lowestRoot = getLowestRoot(a, b, c, t);
@@ -337,7 +337,7 @@
             pos.addInPlace(this._displacementVector);
             this.intersectionPoint.addInPlace(this._displacementVector);
 
-            this._slidePlaneNormal.scaleInPlace(BABYLON.Plane.SignedDistanceToPlaneFromPositionAndNormal(this.intersectionPoint, this._slidePlaneNormal, this._destinationPoint));
+            this._slidePlaneNormal.scaleInPlace(Plane.SignedDistanceToPlaneFromPositionAndNormal(this.intersectionPoint, this._slidePlaneNormal, this._destinationPoint));
             this._destinationPoint.subtractInPlace(this._slidePlaneNormal);
 
             this._destinationPoint.subtractToRef(this.intersectionPoint, vel);

+ 10 - 10
Babylon/Collisions/babylon.collisionCoordinator.ts

@@ -4,7 +4,7 @@ module BABYLON {
     export var CollisionWorker = "";
 
     export interface ICollisionCoordinator {
-        getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: BABYLON.Vector3, collidedMesh?: BABYLON.AbstractMesh) => void, collisionIndex: number): void;
+        getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void;
         init(scene: Scene): void;
         destroy(): void;
 
@@ -111,7 +111,7 @@ module BABYLON {
         private _scaledPosition = Vector3.Zero();
         private _scaledVelocity = Vector3.Zero();
 
-        private _collisionsCallbackArray: Array<(collisionIndex: number, newPosition: BABYLON.Vector3, collidedMesh?: BABYLON.AbstractMesh) => void>;
+        private _collisionsCallbackArray: Array<(collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void>;
 
         private _init: boolean;
         private _runningUpdated: number;
@@ -135,7 +135,7 @@ module BABYLON {
             this._toRemoveMeshesArray = [];
         }
 
-        public static SerializeMesh = function (mesh: BABYLON.AbstractMesh): SerializedMesh {
+        public static SerializeMesh = function (mesh: AbstractMesh): SerializedMesh {
             var submeshes: Array<SerializedSubMesh> = [];
             if (mesh.subMeshes) {
                 submeshes = mesh.subMeshes.map(function (sm, idx) {
@@ -154,7 +154,7 @@ module BABYLON {
                 });
             }
 
-            var geometryId = (<BABYLON.Mesh>mesh).geometry ? (<BABYLON.Mesh>mesh).geometry.id : null;
+            var geometryId = (<Mesh>mesh).geometry ? (<Mesh>mesh).geometry.id : null;
 
             return {
                 uniqueId: mesh.uniqueId,
@@ -171,17 +171,17 @@ module BABYLON {
             }
         }
 
-        public static SerializeGeometry = function (geometry: BABYLON.Geometry): SerializedGeometry {
+        public static SerializeGeometry = function (geometry: Geometry): SerializedGeometry {
             return {
                 id: geometry.id,
-                positions: new Float32Array(geometry.getVerticesData(BABYLON.VertexBuffer.PositionKind) || []),
-                normals: new Float32Array(geometry.getVerticesData(BABYLON.VertexBuffer.NormalKind) || []),
+                positions: new Float32Array(geometry.getVerticesData(VertexBuffer.PositionKind) || []),
+                normals: new Float32Array(geometry.getVerticesData(VertexBuffer.NormalKind) || []),
                 indices: new Int32Array(geometry.getIndices() || []),
-                //uvs: new Float32Array(geometry.getVerticesData(BABYLON.VertexBuffer.UVKind) || [])
+                //uvs: new Float32Array(geometry.getVerticesData(VertexBuffer.UVKind) || [])
             }
         }
 
-        public getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: BABYLON.Vector3, collidedMesh?: BABYLON.AbstractMesh) => void, collisionIndex: number): void {
+        public getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void {
             if (!this._init) return;
             if (this._collisionsCallbackArray[collisionIndex] || this._collisionsCallbackArray[collisionIndex + 100000]) return;
 
@@ -342,7 +342,7 @@ module BABYLON {
 
         private _finalPosition = Vector3.Zero();
 
-        public getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: BABYLON.Vector3, collidedMesh?: BABYLON.AbstractMesh) => void, collisionIndex: number): void {
+        public getNewPosition(position: Vector3, velocity: Vector3, collider: Collider, maximumRetry: number, excludedMesh: AbstractMesh, onNewPosition: (collisionIndex: number, newPosition: Vector3, collidedMesh?: AbstractMesh) => void, collisionIndex: number): void {
             position.divideToRef(collider.radius, this._scaledPosition);
             velocity.divideToRef(collider.radius, this._scaledVelocity);
 			collider.collidedMesh = null;

+ 17 - 17
Babylon/Collisions/babylon.collisionWorker.ts

@@ -34,17 +34,17 @@ module BABYLON {
 
     export class CollideWorker {
 
-        private collisionsScalingMatrix = BABYLON.Matrix.Zero();
-        private collisionTranformationMatrix = BABYLON.Matrix.Zero();
+        private collisionsScalingMatrix = Matrix.Zero();
+        private collisionTranformationMatrix = Matrix.Zero();
 
-        constructor(public collider: BABYLON.Collider, private _collisionCache: CollisionCache, private finalPosition: BABYLON.Vector3) {
+        constructor(public collider: Collider, private _collisionCache: CollisionCache, private finalPosition: Vector3) {
 
         }
 
-        public collideWithWorld(position: BABYLON.Vector3, velocity: BABYLON.Vector3, maximumRetry: number, excludedMeshUniqueId?: number) {
+        public collideWithWorld(position: Vector3, velocity: Vector3, maximumRetry: number, excludedMeshUniqueId?: number) {
 
             //TODO CollisionsEpsilon should be defined here and not in the engine.
-            var closeDistance = /*BABYLON.Engine.CollisionsEpsilon * 10.0*/ 0.01;
+            var closeDistance = /*Engine.CollisionsEpsilon * 10.0*/ 0.01;
 
             //is initializing here correct? A quick look - looks like it is fine.
             if (this.collider.retry >= maximumRetry) {
@@ -89,20 +89,20 @@ module BABYLON {
 
         private checkCollision(mesh: SerializedMesh) {
 
-            if (!this.collider._canDoCollision(BABYLON.Vector3.FromArray(mesh.sphereCenter), mesh.sphereRadius, BABYLON.Vector3.FromArray(mesh.boxMinimum), BABYLON.Vector3.FromArray(mesh.boxMaximum))) {
+            if (!this.collider._canDoCollision(Vector3.FromArray(mesh.sphereCenter), mesh.sphereRadius, Vector3.FromArray(mesh.boxMinimum), Vector3.FromArray(mesh.boxMaximum))) {
                 return;
             };
 
             // Transformation matrix
-            BABYLON.Matrix.ScalingToRef(1.0 / this.collider.radius.x, 1.0 / this.collider.radius.y, 1.0 / this.collider.radius.z, this.collisionsScalingMatrix);
-            var worldFromCache = BABYLON.Matrix.FromArray(mesh.worldMatrixFromCache);
+            Matrix.ScalingToRef(1.0 / this.collider.radius.x, 1.0 / this.collider.radius.y, 1.0 / this.collider.radius.z, this.collisionsScalingMatrix);
+            var worldFromCache = Matrix.FromArray(mesh.worldMatrixFromCache);
             worldFromCache.multiplyToRef(this.collisionsScalingMatrix, this.collisionTranformationMatrix);
 
             this.processCollisionsForSubMeshes(this.collisionTranformationMatrix, mesh);
             //return colTransMat;
         }
 
-        private processCollisionsForSubMeshes(transformMatrix: BABYLON.Matrix, mesh: SerializedMesh): void {
+        private processCollisionsForSubMeshes(transformMatrix: Matrix, mesh: SerializedMesh): void {
             var len: number;
             var subMeshes;
 
@@ -143,11 +143,11 @@ module BABYLON {
             }
         }
 
-        private collideForSubMesh(subMesh: SerializedSubMesh, transformMatrix: BABYLON.Matrix, meshGeometry: SerializedGeometry): void {
+        private collideForSubMesh(subMesh: SerializedSubMesh, transformMatrix: Matrix, meshGeometry: SerializedGeometry): void {
             if (!meshGeometry['positionsArray']) {
                 meshGeometry['positionsArray'] = [];
                 for (var i = 0, len = meshGeometry.positions.length; i < len; i = i + 3) {
-                    var p = BABYLON.Vector3.FromArray([meshGeometry.positions[i], meshGeometry.positions[i + 1], meshGeometry.positions[i + 2]]);
+                    var p = Vector3.FromArray([meshGeometry.positions[i], meshGeometry.positions[i + 1], meshGeometry.positions[i + 2]]);
                     meshGeometry['positionsArray'].push(p);
                 }
             }
@@ -159,7 +159,7 @@ module BABYLON {
                 var start = subMesh.verticesStart;
                 var end = (subMesh.verticesStart + subMesh.verticesCount);
                 for (var i = start; i < end; i++) {
-                    subMesh['_lastColliderWorldVertices'].push(BABYLON.Vector3.TransformCoordinates(meshGeometry['positionsArray'][i], transformMatrix));
+                    subMesh['_lastColliderWorldVertices'].push(Vector3.TransformCoordinates(meshGeometry['positionsArray'][i], transformMatrix));
                 }
             }        
 
@@ -169,7 +169,7 @@ module BABYLON {
         }
 
         private checkSubmeshCollision(subMesh: SerializedSubMesh) : boolean {
-            return this.collider._canDoCollision(BABYLON.Vector3.FromArray(subMesh.sphereCenter), subMesh.sphereRadius, BABYLON.Vector3.FromArray(subMesh.boxMinimum), BABYLON.Vector3.FromArray(subMesh.boxMaximum));
+            return this.collider._canDoCollision(Vector3.FromArray(subMesh.sphereCenter), subMesh.sphereRadius, Vector3.FromArray(subMesh.boxMinimum), Vector3.FromArray(subMesh.boxMaximum));
         }
     }
 
@@ -211,13 +211,13 @@ module BABYLON {
         }
 
         public onCollision(payload: CollidePayload) {
-            var finalPosition = BABYLON.Vector3.Zero();
+            var finalPosition = Vector3.Zero();
             //create a new collider
-            var collider = new BABYLON.Collider();
-            collider.radius = BABYLON.Vector3.FromArray(payload.collider.radius);
+            var collider = new Collider();
+            collider.radius = Vector3.FromArray(payload.collider.radius);
 
             var colliderWorker = new CollideWorker(collider, this._collisionCache, finalPosition);
-            colliderWorker.collideWithWorld(BABYLON.Vector3.FromArray(payload.collider.position), BABYLON.Vector3.FromArray(payload.collider.velocity), payload.maximumRetry, payload.excludedMeshUniqueId);
+            colliderWorker.collideWithWorld(Vector3.FromArray(payload.collider.position), Vector3.FromArray(payload.collider.velocity), payload.maximumRetry, payload.excludedMeshUniqueId);
             var replyPayload: CollisionReplyPayload = {
                 collidedMeshUniqueId: <any> collider.collidedMesh,
                 collisionId: payload.collisionId,

+ 3 - 3
Babylon/Culling/Octrees/babylon.octree.ts

@@ -13,7 +13,7 @@
 
         constructor(creationFunc: (entry: T, block: OctreeBlock<T>) => void, maxBlockCapacity?: number, public maxDepth = 2) {
             this._maxBlockCapacity = maxBlockCapacity || 64;
-            this._selectionContent = new BABYLON.SmartArray<T>(1024);
+            this._selectionContent = new SmartArray<T>(1024);
             this._creationFunc = creationFunc;
         }
 
@@ -78,7 +78,7 @@
 
         public static _CreateBlocks<T>(worldMin: Vector3, worldMax: Vector3, entries: T[], maxBlockCapacity: number, currentDepth: number, maxDepth: number, target: IOctreeContainer<T>, creationFunc: (entry: T, block: OctreeBlock<T>) => void): void {
             target.blocks = new Array<OctreeBlock<T>>();
-            var blockSize = new BABYLON.Vector3((worldMax.x - worldMin.x) / 2, (worldMax.y - worldMin.y) / 2, (worldMax.z - worldMin.z) / 2);
+            var blockSize = new 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++) {
@@ -87,7 +87,7 @@
                         var localMin = worldMin.add(blockSize.multiplyByFloats(x, y, z));
                         var localMax = worldMin.add(blockSize.multiplyByFloats(x + 1, y + 1, z + 1));
 
-                        var block = new BABYLON.OctreeBlock<T>(localMin, localMax, maxBlockCapacity, currentDepth + 1, maxDepth, creationFunc);
+                        var block = new OctreeBlock<T>(localMin, localMax, maxBlockCapacity, currentDepth + 1, maxDepth, creationFunc);
                         block.addEntries(entries);
                         target.blocks.push(block);
                     }

+ 2 - 2
Babylon/Culling/Octrees/babylon.octreeBlock.ts

@@ -80,7 +80,7 @@
         }
 
         public select(frustumPlanes: Plane[], selection: SmartArray<T>, allowDuplicate?: boolean): void {
-            if (BABYLON.BoundingBox.IsInFrustum(this._boundingVectors, frustumPlanes)) {
+            if (BoundingBox.IsInFrustum(this._boundingVectors, frustumPlanes)) {
                 if (this.blocks) {
                     for (var index = 0; index < this.blocks.length; index++) {
                         var block = this.blocks[index];
@@ -98,7 +98,7 @@
         }
 
         public intersects(sphereCenter: Vector3, sphereRadius: number, selection: SmartArray<T>, allowDuplicate?: boolean): void {
-            if (BABYLON.BoundingBox.IntersectsSphere(this._minPoint, this._maxPoint, sphereCenter, sphereRadius)) {
+            if (BoundingBox.IntersectsSphere(this._minPoint, this._maxPoint, sphereCenter, sphereRadius)) {
                 if (this.blocks) {
                     for (var index = 0; index < this.blocks.length; index++) {
                         var block = this.blocks[index];

+ 13 - 13
Babylon/Culling/babylon.boundingInfo.ts

@@ -27,8 +27,8 @@
         public boundingSphere: BoundingSphere;
 
         constructor(public minimum: Vector3, public maximum: Vector3) {
-            this.boundingBox = new BABYLON.BoundingBox(minimum, maximum);
-            this.boundingSphere = new BABYLON.BoundingSphere(minimum, maximum);
+            this.boundingBox = new BoundingBox(minimum, maximum);
+            this.boundingSphere = new BoundingSphere(minimum, maximum);
         }
 
         // Methods
@@ -73,11 +73,11 @@
                 return false;
             }
 
-            if (!BABYLON.BoundingSphere.Intersects(this.boundingSphere, boundingInfo.boundingSphere)) {
+            if (!BoundingSphere.Intersects(this.boundingSphere, boundingInfo.boundingSphere)) {
                 return false;
             }
 
-            if (!BABYLON.BoundingBox.Intersects(this.boundingBox, boundingInfo.boundingBox)) {
+            if (!BoundingBox.Intersects(this.boundingBox, boundingInfo.boundingBox)) {
                 return false;
             }
 
@@ -94,15 +94,15 @@
             if (!axisOverlap(box1.directions[0], box0, box1)) return false;
             if (!axisOverlap(box1.directions[1], box0, box1)) return false;
             if (!axisOverlap(box1.directions[2], box0, box1)) return false;
-            if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[0], box1.directions[0]), box0, box1)) return false;
-            if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[0], box1.directions[1]), box0, box1)) return false;
-            if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[0], box1.directions[2]), box0, box1)) return false;
-            if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[1], box1.directions[0]), box0, box1)) return false;
-            if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[1], box1.directions[1]), box0, box1)) return false;
-            if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[1], box1.directions[2]), box0, box1)) return false;
-            if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[2], box1.directions[0]), box0, box1)) return false;
-            if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[2], box1.directions[1]), box0, box1)) return false;
-            if (!axisOverlap(BABYLON.Vector3.Cross(box0.directions[2], box1.directions[2]), box0, box1)) return false;
+            if (!axisOverlap(Vector3.Cross(box0.directions[0], box1.directions[0]), box0, box1)) return false;
+            if (!axisOverlap(Vector3.Cross(box0.directions[0], box1.directions[1]), box0, box1)) return false;
+            if (!axisOverlap(Vector3.Cross(box0.directions[0], box1.directions[2]), box0, box1)) return false;
+            if (!axisOverlap(Vector3.Cross(box0.directions[1], box1.directions[0]), box0, box1)) return false;
+            if (!axisOverlap(Vector3.Cross(box0.directions[1], box1.directions[1]), box0, box1)) return false;
+            if (!axisOverlap(Vector3.Cross(box0.directions[1], box1.directions[2]), box0, box1)) return false;
+            if (!axisOverlap(Vector3.Cross(box0.directions[2], box1.directions[0]), box0, box1)) return false;
+            if (!axisOverlap(Vector3.Cross(box0.directions[2], box1.directions[1]), box0, box1)) return false;
+            if (!axisOverlap(Vector3.Cross(box0.directions[2], box1.directions[2]), box0, box1)) return false;
 
             return true;
         }

+ 6 - 6
Babylon/Culling/babylon.boundingSphere.ts

@@ -8,19 +8,19 @@
         private _tempRadiusVector = Vector3.Zero();
 
         constructor(public minimum: Vector3, public maximum: Vector3) {
-            var distance = BABYLON.Vector3.Distance(minimum, maximum);
+            var distance = Vector3.Distance(minimum, maximum);
 
-            this.center = BABYLON.Vector3.Lerp(minimum, maximum, 0.5);
+            this.center = Vector3.Lerp(minimum, maximum, 0.5);
             this.radius = distance * 0.5;
 
-            this.centerWorld = BABYLON.Vector3.Zero();
-            this._update(BABYLON.Matrix.Identity());
+            this.centerWorld = Vector3.Zero();
+            this._update(Matrix.Identity());
         }
 
         // Methods
         public _update(world: Matrix): void {
-            BABYLON.Vector3.TransformCoordinatesToRef(this.center, world, this.centerWorld);
-            BABYLON.Vector3.TransformNormalFromFloatsToRef(1.0, 1.0, 1.0, world, this._tempRadiusVector);
+            Vector3.TransformCoordinatesToRef(this.center, world, this.centerWorld);
+            Vector3.TransformNormalFromFloatsToRef(1.0, 1.0, 1.0, world, this._tempRadiusVector);
             this.radiusWorld = Math.max(Math.abs(this._tempRadiusVector.x), Math.abs(this._tempRadiusVector.y), Math.abs(this._tempRadiusVector.z)) * this.radius;
         }
 

+ 4 - 4
Babylon/Layer/babylon.layer.ts

@@ -13,9 +13,9 @@
         private _effect: Effect;
 
         constructor(public name: string, imgUrl: string, scene: Scene, isBackground?: boolean, color?: Color4) {
-            this.texture = imgUrl ? new BABYLON.Texture(imgUrl, scene, true) : null;
+            this.texture = imgUrl ? new Texture(imgUrl, scene, true) : null;
             this.isBackground = isBackground === undefined ? true : isBackground;
-            this.color = color === undefined ? new BABYLON.Color4(1, 1, 1, 1) : color;
+            this.color = color === undefined ? new Color4(1, 1, 1, 1) : color;
 
             this._scene = scene;
             this._scene.layers.push(this);
@@ -70,9 +70,9 @@
             engine.bindBuffers(this._vertexBuffer, this._indexBuffer, this._vertexDeclaration, this._vertexStrideSize, this._effect);
 
             // Draw order
-            engine.setAlphaMode(BABYLON.Engine.ALPHA_COMBINE);
+            engine.setAlphaMode(Engine.ALPHA_COMBINE);
             engine.draw(true, 0, 6);
-            engine.setAlphaMode(BABYLON.Engine.ALPHA_DISABLE);
+            engine.setAlphaMode(Engine.ALPHA_DISABLE);
         }
 
         public dispose(): void {

+ 2 - 2
Babylon/LensFlare/babylon.lensFlare.ts

@@ -6,8 +6,8 @@
         private _system: LensFlareSystem;
 
         constructor(public size: number, public position: number, color, imgUrl: string, system: LensFlareSystem) {
-            this.color = color || new BABYLON.Color3(1, 1, 1);
-            this.texture = imgUrl ? new BABYLON.Texture(imgUrl, system.getScene(), true) : null;
+            this.color = color || new Color3(1, 1, 1);
+            this.texture = imgUrl ? new Texture(imgUrl, system.getScene(), true) : null;
             this._system = system;
 
             system.lensFlares.push(this);

+ 6 - 6
Babylon/LensFlare/babylon.lensFlareSystem.ts

@@ -74,12 +74,12 @@
         public computeEffectivePosition(globalViewport: Viewport): boolean {
             var position = this.getEmitterPosition();
 
-            position = BABYLON.Vector3.Project(position, BABYLON.Matrix.Identity(), this._scene.getTransformMatrix(), globalViewport);
+            position = Vector3.Project(position, Matrix.Identity(), this._scene.getTransformMatrix(), globalViewport);
 
             this._positionX = position.x;
             this._positionY = position.y;
 
-            position = BABYLON.Vector3.TransformCoordinates(this.getEmitterPosition(), this._scene.getViewMatrix());
+            position = Vector3.TransformCoordinates(this.getEmitterPosition(), this._scene.getViewMatrix());
 
             if (position.z > 0) {
                 if ((this._positionX > globalViewport.x) && (this._positionX < globalViewport.x + globalViewport.width)) {
@@ -101,7 +101,7 @@
             var distance = direction.length();
             direction.normalize();
 
-            var ray = new BABYLON.Ray(this._scene.activeCamera.position, direction);
+            var ray = new Ray(this._scene.activeCamera.position, direction);
             var pickInfo = this._scene.pickWithRay(ray, this.meshesSelectionPredicate, true);
 
             return !pickInfo.hit || pickInfo.distance > distance;
@@ -169,7 +169,7 @@
             engine.enableEffect(this._effect);
             engine.setState(false);
             engine.setDepthBuffer(false);
-            engine.setAlphaMode(BABYLON.Engine.ALPHA_ADD);
+            engine.setAlphaMode(Engine.ALPHA_ADD);
 
             // VBOs
             engine.bindBuffers(this._vertexBuffer, this._indexBuffer, this._vertexDeclaration, this._vertexStrideSize, this._effect);
@@ -186,7 +186,7 @@
                 var cx = 2 * (x / globalViewport.width) - 1.0;
                 var cy = 1.0 - 2 * (y / globalViewport.height);
 
-                var viewportMatrix = BABYLON.Matrix.FromValues(
+                var viewportMatrix = Matrix.FromValues(
                     cw / 2, 0, 0, 0,
                     0, ch / 2, 0, 0,
                     0, 0, 1, 0,
@@ -205,7 +205,7 @@
             }
 
             engine.setDepthBuffer(true);
-            engine.setAlphaMode(BABYLON.Engine.ALPHA_DISABLE);
+            engine.setAlphaMode(Engine.ALPHA_DISABLE);
             return true;
         }
 

+ 4 - 4
Babylon/Lights/babylon.hemisphericLight.ts

@@ -1,6 +1,6 @@
 module BABYLON {
     export class HemisphericLight extends Light {
-        public groundColor = new BABYLON.Color3(0.0, 0.0, 0.0);
+        public groundColor = new Color3(0.0, 0.0, 0.0);
 
         private _worldMatrix: Matrix;
 
@@ -9,7 +9,7 @@
         }
 
         public setDirectionToTarget(target: Vector3): Vector3 {
-            this.direction = BABYLON.Vector3.Normalize(target.subtract(Vector3.Zero()));
+            this.direction = Vector3.Normalize(target.subtract(Vector3.Zero()));
             return this.direction;
         }
 
@@ -18,14 +18,14 @@
         }
 
         public transferToEffect(effect: Effect, directionUniformName: string, groundColorUniformName: string): void {
-            var normalizeDirection = BABYLON.Vector3.Normalize(this.direction);
+            var normalizeDirection = Vector3.Normalize(this.direction);
             effect.setFloat4(directionUniformName, normalizeDirection.x, normalizeDirection.y, normalizeDirection.z, 0);
             effect.setColor3(groundColorUniformName, this.groundColor.scale(this.intensity));
         }
 
         public _getWorldMatrix(): Matrix {
             if (!this._worldMatrix) {
-                this._worldMatrix = BABYLON.Matrix.Identity();
+                this._worldMatrix = Matrix.Identity();
             }
 
             return this._worldMatrix;

+ 1 - 1
Babylon/Lights/babylon.light.ts

@@ -85,7 +85,7 @@
 
             if (this.parent && this.parent.getWorldMatrix) {
                 if (!this._parentedWorldMatrix) {
-                    this._parentedWorldMatrix = BABYLON.Matrix.Identity();
+                    this._parentedWorldMatrix = Matrix.Identity();
                 }
 
                 worldMatrix.multiplyToRef(this.parent.getWorldMatrix(), this._parentedWorldMatrix);

+ 5 - 5
Babylon/Materials/Textures/babylon.mirrorTexture.ts

@@ -1,16 +1,16 @@
 module BABYLON {
     export class MirrorTexture extends RenderTargetTexture {
-        public mirrorPlane = new BABYLON.Plane(0, 1, 0, 1);
+        public mirrorPlane = new Plane(0, 1, 0, 1);
 
-        private _transformMatrix = BABYLON.Matrix.Zero();
-        private _mirrorMatrix = BABYLON.Matrix.Zero();
+        private _transformMatrix = Matrix.Zero();
+        private _mirrorMatrix = Matrix.Zero();
         private _savedViewMatrix: Matrix;
 
         constructor(name: string, size: number, scene: Scene, generateMipMaps?: boolean) {
             super(name, size, scene, generateMipMaps, true);
 
             this.onBeforeRender = () => {
-                BABYLON.Matrix.ReflectionToRef(this.mirrorPlane, this._mirrorMatrix);
+                Matrix.ReflectionToRef(this.mirrorPlane, this._mirrorMatrix);
                 this._savedViewMatrix = scene.getViewMatrix();
 
                 this._mirrorMatrix.multiplyToRef(this._savedViewMatrix, this._transformMatrix);
@@ -32,7 +32,7 @@
 
         public clone(): MirrorTexture {
             var textureSize = this.getSize();
-            var newTexture = new BABYLON.MirrorTexture(this.name, textureSize.width, this.getScene(), this._generateMipMaps);
+            var newTexture = new MirrorTexture(this.name, textureSize.width, this.getScene(), this._generateMipMaps);
 
             // Base texture
             newTexture.hasAlpha = this.hasAlpha;

+ 4 - 4
Babylon/Materials/Textures/babylon.videoTexture.ts

@@ -16,11 +16,11 @@
 
             this.video.addEventListener("canplaythrough", () => {
                 if (Tools.IsExponantOfTwo(this.video.videoWidth) && Tools.IsExponantOfTwo(this.video.videoHeight)) {
-                    this.wrapU = BABYLON.Texture.WRAP_ADDRESSMODE;
-                    this.wrapV = BABYLON.Texture.WRAP_ADDRESSMODE;
+                    this.wrapU = Texture.WRAP_ADDRESSMODE;
+                    this.wrapV = Texture.WRAP_ADDRESSMODE;
                 } else {
-                    this.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
-                    this.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
+                    this.wrapU = Texture.CLAMP_ADDRESSMODE;
+                    this.wrapV = Texture.CLAMP_ADDRESSMODE;
                     generateMipMaps = false;
                 }
 

+ 1 - 1
Babylon/Materials/babylon.shaderMaterial.ts

@@ -10,7 +10,7 @@
         private _vectors2 = new Array<Vector2>();
         private _vectors3 = new Array<Vector3>();
         private _matrices = new Array<Matrix>();
-        private _cachedWorldViewMatrix = new BABYLON.Matrix();
+        private _cachedWorldViewMatrix = new Matrix();
         private _renderId: number;
 
         constructor(name: string, scene: Scene, shaderPath: any, options: any) {

+ 14 - 14
Babylon/Math/babylon.math.ts

@@ -1080,16 +1080,16 @@
                 z = Math.sqrt(1 / (1 + t * t));
             }
 
-            w2 = new BABYLON.Vector3(x, y, z);
-            v2 = BABYLON.Vector3.Cross(w2, u1);   // v2 image of v1 through rotation around u1
-            cross = BABYLON.Vector3.Cross(w, w2); // returns same direction as u1 (=local x) if positive angle : cross(source, image)
-            if (BABYLON.Vector3.Dot(u1, cross) < 0) {
+            w2 = new Vector3(x, y, z);
+            v2 = Vector3.Cross(w2, u1);   // v2 image of v1 through rotation around u1
+            cross = Vector3.Cross(w, w2); // returns same direction as u1 (=local x) if positive angle : cross(source, image)
+            if (Vector3.Dot(u1, cross) < 0) {
                 sign = 1;
             }
 
-            dot = BABYLON.Vector3.Dot(w, w2);
+            dot = Vector3.Dot(w, w2);
             pitch = Math.acos(dot) * sign;      
-            if (BABYLON.Vector3.Dot(v2, Y) < 0) { // checks for Y orientation
+            if (Vector3.Dot(v2, Y) < 0) { // checks for Y orientation
                 pitch = Math.PI + pitch;
                 v2 = v2.scaleInPlace(-1);
                 w2 = w2.scaleInPlace(-1);
@@ -1099,17 +1099,17 @@
             // step 3 : rotate around v2
             // Rv2(u1) = X, same as Rv2(w2) = Z, with X=(1,0,0) and Z=(0,0,1)
             sign = -1;
-            cross = BABYLON.Vector3.Cross(X, u1); // returns same direction as Y if positive angle : cross(source, image)
-            if (BABYLON.Vector3.Dot(cross, Y) < 0) {
+            cross = Vector3.Cross(X, u1); // returns same direction as Y if positive angle : cross(source, image)
+            if (Vector3.Dot(cross, Y) < 0) {
                 sign = 1;
             }
-            dot = BABYLON.Vector3.Dot(u1, X);
+            dot = Vector3.Dot(u1, X);
             yaw = - Math.acos(dot) * sign;         // negative : plane zOx oriented clockwise
             if (dot < 0 && nbRevert < 2) {
                 yaw = Math.PI + yaw;
             }
 
-            return new BABYLON.Vector3(pitch, yaw, roll);
+            return new Vector3(pitch, yaw, roll);
         }
     }
 
@@ -3571,7 +3571,7 @@
             var hermite = new Array<Vector3>();
             var step = 1 / nbPoints;
             for(var i = 0; i <= nbPoints; i++) {
-                hermite.push(BABYLON.Vector3.Hermite(p1, t1, p2, t2, i * step));
+                hermite.push(Vector3.Hermite(p1, t1, p2, t2, i * step));
             }
             return new Curve3(hermite);
         }
@@ -3667,7 +3667,7 @@
             Vector3.TransformCoordinatesToRef = <any>Vector3.TransformCoordinatesToRefSIMD;
             Vector3.TransformCoordinatesFromFloatsToRef = <any>Vector3.TransformCoordinatesFromFloatsToRefSIMD;
 
-            Object.defineProperty(BABYLON.Vector3.prototype, "x", {
+            Object.defineProperty(Vector3.prototype, "x", {
                 get: function () { return this._data[0]; },
                 set: function (value: number) {
                     if (!this._data) {
@@ -3677,14 +3677,14 @@
                 }
             });
 
-            Object.defineProperty(BABYLON.Vector3.prototype, "y", {
+            Object.defineProperty(Vector3.prototype, "y", {
                 get: function () { return this._data[1]; },
                 set: function (value: number) {
                     this._data[1] = value;
                 }
             });
 
-            Object.defineProperty(BABYLON.Vector3.prototype, "z", {
+            Object.defineProperty(Vector3.prototype, "z", {
                 get: function () { return this._data[2]; },
                 set: function (value: number) {
                     this._data[2] = value;

+ 21 - 21
Babylon/Mesh/babylon.csg.ts

@@ -291,7 +291,7 @@
 				meshRotationQuaternion: Quaternion,
 				meshScaling: Vector3;
 				
-            if (mesh instanceof BABYLON.Mesh) {
+            if (mesh instanceof Mesh) {
                 mesh.computeWorldMatrix(true);
                 matrix = mesh.getWorldMatrix();
                 meshPosition = mesh.position.clone();
@@ -305,9 +305,9 @@
             }
 
             var indices = mesh.getIndices(),
-                positions = mesh.getVerticesData(BABYLON.VertexBuffer.PositionKind),
-                normals = mesh.getVerticesData(BABYLON.VertexBuffer.NormalKind),
-                uvs = mesh.getVerticesData(BABYLON.VertexBuffer.UVKind);
+                positions = mesh.getVerticesData(VertexBuffer.PositionKind),
+                normals = mesh.getVerticesData(VertexBuffer.NormalKind),
+                uvs = mesh.getVerticesData(VertexBuffer.UVKind);
 
             var subMeshes = mesh.subMeshes;
 
@@ -315,11 +315,11 @@
                 for (var i = subMeshes[sm].indexStart, il = subMeshes[sm].indexCount + subMeshes[sm].indexStart; i < il; i += 3) {
                     vertices = [];
                     for (var j = 0; j < 3; j++) {
-                        var sourceNormal = new BABYLON.Vector3(normals[indices[i + j] * 3], normals[indices[i + j] * 3 + 1], normals[indices[i + j] * 3 + 2]);
-                        uv = new BABYLON.Vector2(uvs[indices[i + j] * 2], uvs[indices[i + j] * 2 + 1]);
-                        var sourcePosition = new BABYLON.Vector3(positions[indices[i + j] * 3], positions[indices[i + j] * 3 + 1], positions[indices[i + j] * 3 + 2]);
-                        position = BABYLON.Vector3.TransformCoordinates(sourcePosition, matrix);
-                        normal = BABYLON.Vector3.TransformNormal(sourceNormal, matrix);
+                        var sourceNormal = new Vector3(normals[indices[i + j] * 3], normals[indices[i + j] * 3 + 1], normals[indices[i + j] * 3 + 2]);
+                        uv = new Vector2(uvs[indices[i + j] * 2], uvs[indices[i + j] * 2 + 1]);
+                        var sourcePosition = new Vector3(positions[indices[i + j] * 3], positions[indices[i + j] * 3 + 1], positions[indices[i + j] * 3 + 2]);
+                        position = Vector3.TransformCoordinates(sourcePosition, matrix);
+                        normal = Vector3.TransformNormal(sourceNormal, matrix);
 
                         vertex = new Vertex(position, normal, uv);
                         vertices.push(vertex);
@@ -348,13 +348,13 @@
 
         // Construct a BABYLON.CSG solid from a list of `BABYLON.CSG.Polygon` instances.
         private static FromPolygons(polygons: Polygon[]): CSG {
-            var csg = new BABYLON.CSG();
+            var csg = new CSG();
             csg.polygons = polygons;
             return csg;
         }
 
         public clone(): CSG {
-            var csg = new BABYLON.CSG();
+            var csg = new CSG();
             csg.polygons = this.polygons.map(p => p.clone());
             csg.copyTransformAttributes(this);
             return csg;
@@ -479,14 +479,14 @@
             var matrix = this.matrix.clone();
             matrix.invert();
 
-            var mesh = new BABYLON.Mesh(name, scene),
+            var mesh = new Mesh(name, scene),
                 vertices = [],
                 indices = [],
                 normals = [],
                 uvs = [],
-                vertex = BABYLON.Vector3.Zero(),
-                normal = BABYLON.Vector3.Zero(),
-                uv = BABYLON.Vector2.Zero(),
+                vertex = Vector3.Zero(),
+                normal = Vector3.Zero(),
+                uv = Vector2.Zero(),
                 polygons = this.polygons,
                 polygonIndices = [0, 0, 0], polygon,
                 vertice_dict = {},
@@ -533,8 +533,8 @@
                         vertex.copyFrom(polygon.vertices[polygonIndices[k]].pos);
                         normal.copyFrom(polygon.vertices[polygonIndices[k]].normal);
                         uv.copyFrom(polygon.vertices[polygonIndices[k]].uv);
-                        var localVertex = BABYLON.Vector3.TransformCoordinates(vertex, matrix);
-                        var localNormal = BABYLON.Vector3.TransformNormal(normal, matrix);
+                        var localVertex = Vector3.TransformCoordinates(vertex, matrix);
+                        var localNormal = Vector3.TransformNormal(normal, matrix);
 
                         vertex_idx = vertice_dict[localVertex.x + ',' + localVertex.y + ',' + localVertex.z];
 
@@ -562,9 +562,9 @@
 
             }
 
-            mesh.setVerticesData(BABYLON.VertexBuffer.PositionKind, vertices);
-            mesh.setVerticesData(BABYLON.VertexBuffer.NormalKind, normals);
-            mesh.setVerticesData(BABYLON.VertexBuffer.UVKind, uvs);
+            mesh.setVerticesData(VertexBuffer.PositionKind, vertices);
+            mesh.setVerticesData(VertexBuffer.NormalKind, normals);
+            mesh.setVerticesData(VertexBuffer.UVKind, uvs);
             mesh.setIndices(indices);
 
             if (keepSubMeshes) {
@@ -578,7 +578,7 @@
                     materialMaxIndex = -1;
                     for (var sm in subMesh_dict[m]) {
                         subMesh_obj = subMesh_dict[m][sm];
-                        BABYLON.SubMesh.CreateFromIndices(subMesh_obj.materialIndex + materialIndexOffset, subMesh_obj.indexStart, subMesh_obj.indexEnd - subMesh_obj.indexStart + 1, mesh);
+                        SubMesh.CreateFromIndices(subMesh_obj.materialIndex + materialIndexOffset, subMesh_obj.indexStart, subMesh_obj.indexEnd - subMesh_obj.indexStart + 1, mesh);
                         materialMaxIndex = Math.max(subMesh_obj.materialIndex, materialMaxIndex);
                     }
                     materialIndexOffset += ++materialMaxIndex;

+ 2 - 2
Babylon/Mesh/babylon.groundMesh.ts

@@ -2,7 +2,7 @@
     export class GroundMesh extends Mesh {
         public generateOctree = false;
 
-        private _worldInverse = new BABYLON.Matrix();
+        private _worldInverse = new Matrix();
         public _subdivisions: number;
 
         constructor(name: string, scene: Scene) {
@@ -19,7 +19,7 @@
         }
 
         public getHeightAtCoordinates(x: number, z: number): number {
-            var ray = new Ray(new Vector3(x, this.getBoundingInfo().boundingBox.maximumWorld.y + 1, z), new BABYLON.Vector3(0, -1, 0));
+            var ray = new Ray(new Vector3(x, this.getBoundingInfo().boundingBox.maximumWorld.y + 1, z), new Vector3(0, -1, 0));
 
             this.getWorldMatrix().invertToRef(this._worldInverse);
 

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

@@ -1,6 +1,6 @@
 module BABYLON {
     export class LinesMesh extends Mesh {
-        public color = new BABYLON.Color3(1, 1, 1);
+        public color = new Color3(1, 1, 1);
         public alpha = 1;
 
         private _colorShader: ShaderMaterial;

+ 15 - 15
Babylon/Mesh/babylon.mesh.ts

@@ -466,14 +466,14 @@
         // The positionFunction argument must be a javascript function accepting the mesh "positions" array as parameter.
         // This dedicated positionFunction computes new mesh positions according to the given mesh type.
         public updateMeshPositions(positionFunction, computeNormals: boolean = true): void {
-            var positions = this.getVerticesData(BABYLON.VertexBuffer.PositionKind);
+            var positions = this.getVerticesData(VertexBuffer.PositionKind);
             positionFunction(positions);
-            this.updateVerticesData(BABYLON.VertexBuffer.PositionKind, positions, false, false);
+            this.updateVerticesData(VertexBuffer.PositionKind, positions, false, false);
             if (computeNormals) {
                 var indices = this.getIndices();
-                var normals = this.getVerticesData(BABYLON.VertexBuffer.NormalKind);
-                BABYLON.VertexData.ComputeNormals(positions, indices, normals);
-                this.updateVerticesData(BABYLON.VertexBuffer.NormalKind, normals, false, false);
+                var normals = this.getVerticesData(VertexBuffer.NormalKind);
+                VertexData.ComputeNormals(positions, indices, normals);
+                this.updateVerticesData(VertexBuffer.NormalKind, normals, false, false);
             }
         }
 
@@ -1205,7 +1205,7 @@
                 var positionFunction = function (positions) {
                     var minlg = pathArray[0].length;
                     var i = 0;
-                    var ns = (ribbonInstance.sideOrientation === BABYLON.Mesh.DOUBLESIDE) ? 2 : 1;
+                    var ns = (ribbonInstance.sideOrientation === Mesh.DOUBLESIDE) ? 2 : 1;
                     for (var si = 1; si <= ns; si++) {
                         for (var p = 0; p < pathArray.length; p++) {
                             var path = pathArray[p];
@@ -1443,15 +1443,15 @@
                     return pointCap;
                 };
                 switch (cap) {
-                    case BABYLON.Mesh.NO_CAP:
+                    case Mesh.NO_CAP:
                         break;
-                    case BABYLON.Mesh.CAP_START:
+                    case Mesh.CAP_START:
                         shapePaths.unshift(capPath(shapePaths[0]));
                         break;
-                    case BABYLON.Mesh.CAP_END:
+                    case Mesh.CAP_END:
                         shapePaths.push(capPath(shapePaths[shapePaths.length - 1]));
                         break;
-                    case BABYLON.Mesh.CAP_ALL:
+                    case Mesh.CAP_ALL:
                         shapePaths.unshift(capPath(shapePaths[0]));
                         shapePaths.push(capPath(shapePaths[shapePaths.length - 1]));
                         break;
@@ -1489,7 +1489,7 @@
             radius = radius || 1;
             tessellation = tessellation || radius * 60;
             var pi2 = Math.PI * 2;
-            var Y = BABYLON.Axis.Y;
+            var Y = Axis.Y;
             var shapeLathe = new Array<Vector3>();
 
             // first rotatable point
@@ -1630,15 +1630,15 @@
                     return pointCap;
                 };
                 switch (cap) {
-                    case BABYLON.Mesh.NO_CAP:
+                    case Mesh.NO_CAP:
                         break;
-                    case BABYLON.Mesh.CAP_START:
+                    case Mesh.CAP_START:
                         circlePaths.unshift(capPath(tessellation + 1, 0));
                         break;
-                    case BABYLON.Mesh.CAP_END:
+                    case Mesh.CAP_END:
                         circlePaths.push(capPath(tessellation + 1, path.length - 1));
                         break;
-                    case BABYLON.Mesh.CAP_ALL:
+                    case Mesh.CAP_ALL:
                         circlePaths.unshift(capPath(tessellation + 1, 0));
                         circlePaths.push(capPath(tessellation + 1, path.length - 1));
                         break;

+ 18 - 18
Babylon/Mesh/babylon.mesh.vertexData.ts

@@ -1207,16 +1207,16 @@
             var index = 0;
             
             // temp Vector3
-            var p1 = BABYLON.Vector3.Zero();
-            var p2 = BABYLON.Vector3.Zero();
-            var p3 = BABYLON.Vector3.Zero();
-            var p1p2 = BABYLON.Vector3.Zero();
-            var p3p2 = BABYLON.Vector3.Zero();
-            var faceNormal = BABYLON.Vector3.Zero();
-
-            var vertexNormali1 = BABYLON.Vector3.Zero();
-            var vertexNormali2 = BABYLON.Vector3.Zero();
-            var vertexNormali3 = BABYLON.Vector3.Zero();
+            var p1 = Vector3.Zero();
+            var p2 = Vector3.Zero();
+            var p3 = Vector3.Zero();
+            var p1p2 = Vector3.Zero();
+            var p3p2 = Vector3.Zero();
+            var faceNormal = Vector3.Zero();
+
+            var vertexNormali1 = Vector3.Zero();
+            var vertexNormali2 = Vector3.Zero();
+            var vertexNormali3 = Vector3.Zero();
             
             // indice triplet = 1 face
             var nbFaces = indices.length / 3;
@@ -1226,14 +1226,14 @@
                 var i3 = indices[index * 3 + 2];
                 
                 // setting the temp V3
-                BABYLON.Vector3.FromFloatsToRef(positions[i1 * 3], positions[i1 * 3 + 1], positions[i1 * 3 + 2], p1);
-                BABYLON.Vector3.FromFloatsToRef(positions[i2 * 3], positions[i2 * 3 + 1], positions[i2 * 3 + 2], p2);
-                BABYLON.Vector3.FromFloatsToRef(positions[i3 * 3], positions[i3 * 3 + 1], positions[i3 * 3 + 2], p3);
+                Vector3.FromFloatsToRef(positions[i1 * 3], positions[i1 * 3 + 1], positions[i1 * 3 + 2], p1);
+                Vector3.FromFloatsToRef(positions[i2 * 3], positions[i2 * 3 + 1], positions[i2 * 3 + 2], p2);
+                Vector3.FromFloatsToRef(positions[i3 * 3], positions[i3 * 3 + 1], positions[i3 * 3 + 2], p3);
 
                 p1.subtractToRef(p2, p1p2);
                 p3.subtractToRef(p2, p3p2);
 
-                BABYLON.Vector3.CrossToRef(p1p2, p3p2, faceNormal);
+                Vector3.CrossToRef(p1p2, p3p2, faceNormal);
                 faceNormal.normalize();
     
                 // All intermediate results are stored in the normals array :
@@ -1248,9 +1248,9 @@
                 normals[i3 * 3 + 1] = normals[i3 * 3 + 1] || 0.0;
                 normals[i3 * 3 + 2] = normals[i3 * 3 + 2] || 0.0;
                 // make intermediate vectors3 from normals values
-                BABYLON.Vector3.FromFloatsToRef(normals[i1 * 3], normals[i1 * 3 + 1], normals[i1 * 3 + 2], vertexNormali1);
-                BABYLON.Vector3.FromFloatsToRef(normals[i2 * 3], normals[i2 * 3 + 1], normals[i2 * 3 + 2], vertexNormali2);
-                BABYLON.Vector3.FromFloatsToRef(normals[i3 * 3], normals[i3 * 3 + 1], normals[i3 * 3 + 2], vertexNormali3);
+                Vector3.FromFloatsToRef(normals[i1 * 3], normals[i1 * 3 + 1], normals[i1 * 3 + 2], vertexNormali1);
+                Vector3.FromFloatsToRef(normals[i2 * 3], normals[i2 * 3 + 1], normals[i2 * 3 + 2], vertexNormali2);
+                Vector3.FromFloatsToRef(normals[i3 * 3], normals[i3 * 3 + 1], normals[i3 * 3 + 2], vertexNormali3);
                 // add the current face normals to these intermediate vectors3
                 vertexNormali1 = vertexNormali1.addInPlace(faceNormal);
                 vertexNormali2 = vertexNormali2.addInPlace(faceNormal);
@@ -1269,7 +1269,7 @@
             
             // 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);
+                Vector3.FromFloatsToRef(normals[index * 3], normals[index * 3 + 1], normals[index * 3 + 2], vertexNormali1);
                 vertexNormali1.normalize();
                 normals[index * 3] = vertexNormali1.x;
                 normals[index * 3 + 1] = vertexNormali1.y;

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

@@ -184,7 +184,7 @@
                     maxVertexIndex = vertexIndex;
             }
 
-            return new BABYLON.SubMesh(materialIndex, minVertexIndex, maxVertexIndex - minVertexIndex + 1, startIndex, indexCount, mesh, renderingMesh);
+            return new SubMesh(materialIndex, minVertexIndex, maxVertexIndex - minVertexIndex + 1, startIndex, indexCount, mesh, renderingMesh);
         }
     }
 }

+ 10 - 10
Babylon/Physics/Plugins/babylon.cannonJSPlugin.ts

@@ -15,7 +15,7 @@
         }
 
         private _checkWithEpsilon(value: number): number {
-            return value < BABYLON.PhysicsEngine.Epsilon ? BABYLON.PhysicsEngine.Epsilon : value;
+            return value < PhysicsEngine.Epsilon ? PhysicsEngine.Epsilon : value;
         }
 
         public runOneStep(delta: number): void {
@@ -46,7 +46,7 @@
 
 
                 if (!registeredMesh.mesh.rotationQuaternion) {
-                    registeredMesh.mesh.rotationQuaternion = new BABYLON.Quaternion(0, 0, 0, 1);
+                    registeredMesh.mesh.rotationQuaternion = new Quaternion(0, 0, 0, 1);
                 }
 
                 registeredMesh.mesh.rotationQuaternion.x = registeredMesh.body.quaternion.x;
@@ -66,23 +66,23 @@
             mesh.computeWorldMatrix(true);
 
             switch (impostor) {
-                case BABYLON.PhysicsEngine.SphereImpostor:
+                case PhysicsEngine.SphereImpostor:
                     var bbox = mesh.getBoundingInfo().boundingBox;
                     var radiusX = bbox.maximumWorld.x - bbox.minimumWorld.x;
                     var radiusY = bbox.maximumWorld.y - bbox.minimumWorld.y;
                     var radiusZ = bbox.maximumWorld.z - bbox.minimumWorld.z;
 
                     return this._createSphere(Math.max(this._checkWithEpsilon(radiusX), this._checkWithEpsilon(radiusY), this._checkWithEpsilon(radiusZ)) / 2, mesh, options);
-                case BABYLON.PhysicsEngine.BoxImpostor:
+                case PhysicsEngine.BoxImpostor:
                     bbox = mesh.getBoundingInfo().boundingBox;
                     var min = bbox.minimumWorld;
                     var max = bbox.maximumWorld;
                     var box = max.subtract(min).scale(0.5);
                     return this._createBox(this._checkWithEpsilon(box.x), this._checkWithEpsilon(box.y), this._checkWithEpsilon(box.z), mesh, options);
-                case BABYLON.PhysicsEngine.PlaneImpostor:
+                case PhysicsEngine.PlaneImpostor:
                     return this._createPlane(mesh, options);
-                case BABYLON.PhysicsEngine.MeshImpostor:
-                    var rawVerts = mesh.getVerticesData(BABYLON.VertexBuffer.PositionKind);
+                case PhysicsEngine.MeshImpostor:
+                    var rawVerts = mesh.getVerticesData(VertexBuffer.PositionKind);
                     var rawFaces = mesh.getIndices();
 
                     return this._createConvexPolyhedron(rawVerts, rawFaces, mesh, options);
@@ -128,9 +128,9 @@
 
             // Get vertices
             for (var i = 0; i < rawVerts.length; i += 3) {
-                var transformed = BABYLON.Vector3.Zero();
+                var transformed = Vector3.Zero();
 
-                BABYLON.Vector3.TransformNormalFromFloatsToRef(rawVerts[i], rawVerts[i + 1], rawVerts[i + 2], mesh.getWorldMatrix(), transformed);
+                Vector3.TransformNormalFromFloatsToRef(rawVerts[i], rawVerts[i + 1], rawVerts[i + 2], mesh.getWorldMatrix(), transformed);
                 verts.push(new CANNON.Vec3(transformed.x, transformed.z, transformed.y));
             }
 
@@ -183,7 +183,7 @@
 
             if (mesh.rotationQuaternion) {
                 initialRotation = mesh.rotationQuaternion.clone();
-                mesh.rotationQuaternion = new BABYLON.Quaternion(0, 0, 0, 1);
+                mesh.rotationQuaternion = new Quaternion(0, 0, 0, 1);
             }
 
             // The delta between the mesh position and the mesh bounding box center

+ 12 - 12
Babylon/Physics/Plugins/babylon.oimoJSPlugin.ts

@@ -6,7 +6,7 @@ module BABYLON {
         private _registeredMeshes = [];
 
         private _checkWithEpsilon(value: number): number {
-            return value < BABYLON.PhysicsEngine.Epsilon ? BABYLON.PhysicsEngine.Epsilon : value;
+            return value < PhysicsEngine.Epsilon ? PhysicsEngine.Epsilon : value;
         }
 
         public initialize(iterations?: number): void {
@@ -27,7 +27,7 @@ module BABYLON {
             var initialRotation = null;
             if (mesh.rotationQuaternion) {
                 initialRotation = mesh.rotationQuaternion.clone();
-                mesh.rotationQuaternion = new BABYLON.Quaternion(0, 0, 0, 1);
+                mesh.rotationQuaternion = new Quaternion(0, 0, 0, 1);
                 mesh.computeWorldMatrix(true);
             }
 
@@ -38,14 +38,14 @@ module BABYLON {
 
             // Transform delta position with the rotation
             if (initialRotation) {
-                var m = new BABYLON.Matrix();
+                var m = new Matrix();
                 initialRotation.toRotationMatrix(m);
-                deltaPosition = BABYLON.Vector3.TransformCoordinates(deltaPosition, m);
+                deltaPosition = Vector3.TransformCoordinates(deltaPosition, m);
             }
 
             // register mesh
             switch (impostor) {
-                case BABYLON.PhysicsEngine.SphereImpostor:
+                case PhysicsEngine.SphereImpostor:
 
 
                     var radiusX = bbox.maximumWorld.x - bbox.minimumWorld.x;
@@ -154,7 +154,7 @@ module BABYLON {
             mesh.computeWorldMatrix();
 
             switch (part.impostor) {
-                case BABYLON.PhysicsEngine.SphereImpostor:
+                case PhysicsEngine.SphereImpostor:
                     var bbox = mesh.getBoundingInfo().boundingBox;
                     var radiusX = bbox.maximumWorld.x - bbox.minimumWorld.x;
                     var radiusY = bbox.maximumWorld.y - bbox.minimumWorld.y;
@@ -173,8 +173,8 @@ module BABYLON {
                     };
                     break;
 
-                case BABYLON.PhysicsEngine.PlaneImpostor:
-                case BABYLON.PhysicsEngine.BoxImpostor:
+                case PhysicsEngine.PlaneImpostor:
+                case PhysicsEngine.BoxImpostor:
                     bbox = mesh.getBoundingInfo().boundingBox;
                     var min = bbox.minimumWorld;
                     var max = bbox.maximumWorld;
@@ -341,17 +341,17 @@ module BABYLON {
                         mesh.position.x = parentShape.position.x * OIMO.WORLD_SCALE;
                         mesh.position.y = parentShape.position.y * OIMO.WORLD_SCALE;
                         mesh.position.z = parentShape.position.z * OIMO.WORLD_SCALE;
-                        var mtx = BABYLON.Matrix.FromArray(body.getMatrix());
+                        var mtx = Matrix.FromArray(body.getMatrix());
 
                         if (!mesh.rotationQuaternion) {
-                            mesh.rotationQuaternion = new BABYLON.Quaternion(0, 0, 0, 1);
+                            mesh.rotationQuaternion = new Quaternion(0, 0, 0, 1);
                         }
                         mesh.rotationQuaternion.fromRotationMatrix(mtx);
                         mesh.computeWorldMatrix();
 
                     } else {
                         m = body.getMatrix();
-                        mtx = BABYLON.Matrix.FromArray(m);
+                        mtx = Matrix.FromArray(m);
 
                         // Body position
                         var bodyX = mtx.m[12],
@@ -369,7 +369,7 @@ module BABYLON {
                         }
 
                         if (!mesh.rotationQuaternion) {
-                            mesh.rotationQuaternion = new BABYLON.Quaternion(0, 0, 0, 1);
+                            mesh.rotationQuaternion = new Quaternion(0, 0, 0, 1);
                         }
                         Quaternion.FromRotationMatrixToRef(mtx, mesh.rotationQuaternion);
                         mesh.computeWorldMatrix();

+ 1 - 1
Babylon/PostProcess/babylon.blurPostProcess.ts

@@ -1,6 +1,6 @@
 module BABYLON {
     export class BlurPostProcess extends PostProcess {
-        constructor(name: string, public direction: Vector2, public blurWidth: number, ratio: number, camera: Camera, samplingMode: number = BABYLON.Texture.BILINEAR_SAMPLINGMODE, engine?: Engine, reusable?: boolean) {
+        constructor(name: string, public direction: Vector2, public blurWidth: number, ratio: number, camera: Camera, samplingMode: number = Texture.BILINEAR_SAMPLINGMODE, engine?: Engine, reusable?: boolean) {
             super(name, "blur", ["screenSize", "direction", "blurWidth"], null, ratio, camera, samplingMode, engine, reusable);
             this.onApply = (effect: Effect) => {
                 effect.setFloat2("screenSize", this.width, this.height);

+ 1 - 1
Babylon/PostProcess/babylon.refractionPostProcess.ts

@@ -5,7 +5,7 @@
             super(name, "refraction", ["baseColor", "depth", "colorLevel"], ["refractionSampler"], ratio, camera, samplingMode, engine, reusable);
 
             this.onActivate = (cam: Camera) => {
-                this._refRexture = this._refRexture || new BABYLON.Texture(refractionTextureUrl, cam.getScene());
+                this._refRexture = this._refRexture || new Texture(refractionTextureUrl, cam.getScene());
             };
 
             this.onApply = (effect: Effect) => {

+ 4 - 4
Babylon/PostProcess/babylon.vrDistortionCorrectionPostProcess.ts

@@ -17,7 +17,7 @@
                 'Scale',
                 'ScaleIn',
                 'HmdWarpParam'
-            ], null, vrMetrics.postProcessScaleFactor, camera, BABYLON.Texture.BILINEAR_SAMPLINGMODE, null, null);
+            ], null, vrMetrics.postProcessScaleFactor, camera, Texture.BILINEAR_SAMPLINGMODE, null, null);
 
             this._isRightEye = isRightEye;
             this._distortionFactors = vrMetrics.distortionK;
@@ -26,9 +26,9 @@
 
             this.onSizeChanged = () => {
                 this.aspectRatio = this.width * .5 / this.height;
-                this._scaleIn = new BABYLON.Vector2(2, 2 / this.aspectRatio);
-                this._scaleFactor = new BABYLON.Vector2(.5 * (1 / this._postProcessScaleFactor), .5 * (1 / this._postProcessScaleFactor) * this.aspectRatio);
-                this._lensCenter = new BABYLON.Vector2(this._isRightEye ? 0.5 - this._lensCenterOffset * 0.5 : 0.5 + this._lensCenterOffset * 0.5, 0.5);
+                this._scaleIn = new Vector2(2, 2 / this.aspectRatio);
+                this._scaleFactor = new Vector2(.5 * (1 / this._postProcessScaleFactor), .5 * (1 / this._postProcessScaleFactor) * this.aspectRatio);
+                this._lensCenter = new Vector2(this._isRightEye ? 0.5 - this._lensCenterOffset * 0.5 : 0.5 + this._lensCenterOffset * 0.5, 0.5);
             };
             this.onApply = (effect: Effect) => {
                 effect.setFloat2("LensCenter", this._lensCenter.x, this._lensCenter.y);

+ 5 - 5
Babylon/Rendering/babylon.renderingGroup.ts

@@ -1,9 +1,9 @@
 module BABYLON {
     export class RenderingGroup {
         private _scene: Scene
-        private _opaqueSubMeshes = new BABYLON.SmartArray<SubMesh>(256);
-        private _transparentSubMeshes = new BABYLON.SmartArray<SubMesh>(256);
-        private _alphaTestSubMeshes = new BABYLON.SmartArray<SubMesh>(256);
+        private _opaqueSubMeshes = new SmartArray<SubMesh>(256);
+        private _transparentSubMeshes = new SmartArray<SubMesh>(256);
+        private _alphaTestSubMeshes = new SmartArray<SubMesh>(256);
         private _activeVertices: number;
 
         constructor(public index: number, scene: Scene) {
@@ -71,13 +71,13 @@
                 });
 
                 // Rendering
-                engine.setAlphaMode(BABYLON.Engine.ALPHA_COMBINE);
+                engine.setAlphaMode(Engine.ALPHA_COMBINE);
                 for (subIndex = 0; subIndex < sortedArray.length; subIndex++) {
                     submesh = sortedArray[subIndex];
 
                     submesh.render();
                 }
-                engine.setAlphaMode(BABYLON.Engine.ALPHA_DISABLE);
+                engine.setAlphaMode(Engine.ALPHA_DISABLE);
             }
             return true;
         }

+ 2 - 2
Babylon/Sprites/babylon.sprite.ts

@@ -1,7 +1,7 @@
 module BABYLON {
     export class Sprite {
         public position: Vector3;
-        public color = new BABYLON.Color4(1.0, 1.0, 1.0, 1.0);
+        public color = new Color4(1.0, 1.0, 1.0, 1.0);
         public width = 1.0;
         public height = 1.0;
         public angle = 0;
@@ -35,7 +35,7 @@
 
             this._manager.sprites.push(this);
 
-            this.position = BABYLON.Vector3.Zero();
+            this.position = Vector3.Zero();
         }
 
         public playAnimation(from: number, to: number, loop: boolean, delay: number): void {

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

@@ -21,7 +21,7 @@
         }
 
         public run(scene: Scene, onSuccess: () => void, onError: () => void) {
-            BABYLON.SceneLoader.ImportMesh(this.meshesNames, this.rootUrl, this.sceneFilename, scene,
+            SceneLoader.ImportMesh(this.meshesNames, this.rootUrl, this.sceneFilename, scene,
                 (meshes: AbstractMesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => {
                     this.loadedMeshes = meshes;
                     this.loadedParticleSystems = particleSystems;
@@ -173,7 +173,7 @@
                 onError();
             };
 
-            this.texture = new BABYLON.Texture(this.url, scene, this.noMipmap, this.invertY, this.samplingMode, onload, onError);
+            this.texture = new Texture(this.url, scene, this.noMipmap, this.invertY, this.samplingMode, onload, onError);
         }
     }
 

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

@@ -17,7 +17,7 @@ module BABYLON {
 
         constructor(urlToScene: string, callbackManifestChecked: (boolean) => any) {
             this.callbackManifestChecked = callbackManifestChecked;
-            this.currentSceneUrl = BABYLON.Database.ReturnFullUrlLocation(urlToScene);
+            this.currentSceneUrl = Database.ReturnFullUrlLocation(urlToScene);
             this.db = null;
             this.enableSceneOffline = false;
             this.enableTexturesOffline = false;
@@ -38,7 +38,7 @@ module BABYLON {
 
         static ReturnFullUrlLocation = (url: string): string => {
             if (url.indexOf("http:/") === -1) {
-                return (BABYLON.Database.parseURL(window.location.href) + url);
+                return (Database.parseURL(window.location.href) + url);
             }
             else {
                 return url;

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

@@ -114,10 +114,10 @@
             var newGamepad;
 
             if ((<string>gamepad.id).search("Xbox 360") !== -1 || (<string>gamepad.id).search("xinput") !== -1) {
-                newGamepad = new BABYLON.Xbox360Pad(gamepad.id, gamepad.index, gamepad);
+                newGamepad = new Xbox360Pad(gamepad.id, gamepad.index, gamepad);
             }
             else {
-                newGamepad = new BABYLON.GenericPad(gamepad.id, gamepad.index, gamepad);
+                newGamepad = new GenericPad(gamepad.id, gamepad.index, gamepad);
             }
             this.babylonGamepads.push(newGamepad);
             return newGamepad;

+ 1 - 1
Babylon/Tools/babylon.tags.ts

@@ -32,7 +32,7 @@
             if (!obj._tags) {
                 return false;
             }
-            return !BABYLON.Tools.IsEmpty(obj._tags);
+            return !Tools.IsEmpty(obj._tags);
         }
 
         public static GetTags(obj: any): any {

+ 4 - 4
Babylon/Tools/babylon.virtualJoystick.ts

@@ -62,7 +62,7 @@ module BABYLON {
 
             // collections of pointers
             this._touches = new SmartCollection();
-            this.deltaPosition = BABYLON.Vector3.Zero();
+            this.deltaPosition = Vector3.Zero();
 
             this._joystickSensibility = 25;
             this._inversedSensibility = 1 / (this._joystickSensibility / 1000);
@@ -106,10 +106,10 @@ module BABYLON {
 
             this._joystickPointerID = -1;
             // current joystick position
-            this._joystickPointerPos = new BABYLON.Vector2(0, 0);
+            this._joystickPointerPos = new Vector2(0, 0);
             // origin joystick position
-            this._joystickPointerStartPos = new BABYLON.Vector2(0, 0);
-            this._deltaJoystickVector = new BABYLON.Vector2(0, 0);
+            this._joystickPointerStartPos = new Vector2(0, 0);
+            this._deltaJoystickVector = new Vector2(0, 0);
 
             VirtualJoystick.vjCanvas.addEventListener('pointerdown',(evt) => {
                 this._onPointerDown(evt);