瀏覽代碼

Cleaning up BABYLON references

Part one
Raanan Weber 10 年之前
父節點
當前提交
ec94faf4f3

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

@@ -166,7 +166,7 @@
             var invertParentWorldMatrix = this._parent.getWorldMatrix().clone();
             var invertParentWorldMatrix = this._parent.getWorldMatrix().clone();
             invertParentWorldMatrix.invert();
             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;
             this._target.parent = this._parent;
         }
         }

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

@@ -16,7 +16,7 @@ module BABYLON {
         private _registerFunc;
         private _registerFunc;
         private _audioEngine: AudioEngine;
         private _audioEngine: AudioEngine;
 
 
-        constructor(scene: BABYLON.Scene) {
+        constructor(scene: Scene) {
             this._scene = scene;
             this._scene = scene;
             this._audioEngine = Engine.audioEngine;
             this._audioEngine = Engine.audioEngine;
             if (this._audioEngine.canUseWebAudio) {
             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
                 // Adding an empty sound to avoid breaking audio calls for non Web Audio browsers
                 this._scene.mainSoundTrack.AddSound(this);
                 this._scene.mainSoundTrack.AddSound(this);
                 if (!Engine.audioEngine.WarnedWebAudioUnsupported) {
                 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;
                     Engine.audioEngine.WarnedWebAudioUnsupported = true;
                 }
                 }
                 // Simulating a ready to play event to avoid breaking code for non web audio browsers
                 // 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 {
 module BABYLON {
     export class SoundTrack {
     export class SoundTrack {
-        private _audioEngine: BABYLON.AudioEngine;
+        private _audioEngine: AudioEngine;
         private _outputAudioNode: GainNode;
         private _outputAudioNode: GainNode;
         private _inputAudioNode: AudioNode;
         private _inputAudioNode: AudioNode;
         private _trackConvolver: ConvolverNode;
         private _trackConvolver: ConvolverNode;
-        private _scene: BABYLON.Scene;
+        private _scene: Scene;
         public id: number = -1;
         public id: number = -1;
-        public soundCollection: Array<BABYLON.Sound>;
+        public soundCollection: Array<Sound>;
         private _isMainTrack: boolean = false;
         private _isMainTrack: boolean = false;
         private _connectedAnalyser: Analyser;
         private _connectedAnalyser: Analyser;
 
 
-        constructor(scene: BABYLON.Scene, options?: any) {
+        constructor(scene: Scene, options?: any) {
             this._scene = scene;
             this._scene = scene;
             this._audioEngine = Engine.audioEngine;
             this._audioEngine = Engine.audioEngine;
             this.soundCollection = new Array();
             this.soundCollection = new Array();
@@ -42,7 +42,7 @@
             }
             }
         }
         }
 
 
-        public AddSound(sound: BABYLON.Sound) {
+        public AddSound(sound: Sound) {
             if (Engine.audioEngine.canUseWebAudio) {
             if (Engine.audioEngine.canUseWebAudio) {
                 sound.connectToSoundTrackAudioNode(this._outputAudioNode);
                 sound.connectToSoundTrackAudioNode(this._outputAudioNode);
             }
             }
@@ -59,7 +59,7 @@
             sound.soundTrackId = this.id;
             sound.soundTrackId = this.id;
         }
         }
 
 
-        public RemoveSound(sound: BABYLON.Sound) {
+        public RemoveSound(sound: Sound) {
             var index = this.soundCollection.indexOf(sound);
             var index = this.soundCollection.indexOf(sound);
             if (index !== -1) {
             if (index !== -1) {
                 this.soundCollection.splice(index, 1);
                 this.soundCollection.splice(index, 1);

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

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

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

@@ -456,7 +456,7 @@
                     up = up.negate();
                     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[12] += this.targetScreenOffset.x;
                 this._viewMatrix.m[13] += this.targetScreenOffset.y;
                 this._viewMatrix.m[13] += this.targetScreenOffset.y;
             }
             }
@@ -537,7 +537,7 @@
          */
          */
         public getSubCamera(name: string, isA: boolean): Camera {
         public getSubCamera(name: string, isA: boolean): Camera {
             var alphaSpace = this._subCamHalfSpace * (isA ? -1 : 1);
             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;
             this.cameraRotation.y -= this._offsetX / this.angularSensibility;
 
 
             var speed = this._computeLocalCameraSpeed();
             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();
             super._checkInputs();
         }
         }

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

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

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

@@ -1,17 +1,17 @@
 module BABYLON {
 module BABYLON {
     // We're mainly based on the logic defined into the FreeCamera code
     // We're mainly based on the logic defined into the FreeCamera code
     export class GamepadCamera extends FreeCamera {
     export class GamepadCamera extends FreeCamera {
-        private _gamepad: BABYLON.Gamepad;
-        private _gamepads: BABYLON.Gamepads;
+        private _gamepad: Gamepad;
+        private _gamepads: Gamepads;
         public angularSensibility = 200;
         public angularSensibility = 200;
         public moveSensibility = 75;
         public moveSensibility = 75;
 
 
         constructor(name: string, position: Vector3, scene: Scene) {
         constructor(name: string, position: Vector3, scene: Scene) {
             super(name, position, 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
             // Only the first gamepad can control the camera
             if (gamepad.index === 0) {
             if (gamepad.index === 0) {
                 this._gamepad = gamepad;
                 this._gamepad = gamepad;
@@ -32,12 +32,12 @@ module BABYLON {
                 RSValues.x = Math.abs(normalizedRX) > 0.001 ? 0 + normalizedRX : 0;
                 RSValues.x = Math.abs(normalizedRX) > 0.001 ? 0 + normalizedRX : 0;
                 RSValues.y = Math.abs(normalizedRY) > 0.001 ? 0 + normalizedRY : 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 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.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();
             super._checkInputs();

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

@@ -212,15 +212,15 @@
         }
         }
         
         
         public _getVRViewMatrix(): Matrix {
         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
             // Computing target and final matrix
             this.position.addToRef(this._transformedReferencePoint, this._currentTarget);
             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);
             this._vrWorkMatrix.multiplyToRef(this._vrPreViewMatrix, this._viewMatrix);
             return this._viewMatrix;
             return this._viewMatrix;
@@ -231,7 +231,7 @@
          * needs to be overridden, so sub has required properties to be copied
          * needs to be overridden, so sub has required properties to be copied
          */
          */
         public getSubCamera(name : string, isA : boolean) : Camera{
         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){
             if (this._subCameraMode === Camera.SUB_CAMERA_MODE_VR){
                 subCamera._vrActualUp = new Vector3(0, 0, 0);
                 subCamera._vrActualUp = new Vector3(0, 0, 0);
                 subCamera._getViewMatrix = subCamera._getVRViewMatrix;
                 subCamera._getViewMatrix = subCamera._getVRViewMatrix;
@@ -267,14 +267,14 @@
         
         
         private _getSubCamPosition(halfSpace: number, result: Vector3) {
         private _getSubCamPosition(halfSpace: number, result: Vector3) {
             if (!this._subCamTransformMatrix){
             if (!this._subCamTransformMatrix){
-                this._subCamTransformMatrix = new BABYLON.Matrix();
+                this._subCamTransformMatrix = new Matrix();
             }
             }
             var target = this.getTarget();
             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("pointerout", this._onPointerUp);
             canvas.addEventListener("pointermove", this._onPointerMove);
             canvas.addEventListener("pointermove", this._onPointerMove);
 
 
-            BABYLON.Tools.RegisterTopRootEvents([
+            Tools.RegisterTopRootEvents([
                 { name: "blur", handler: this._onLostFocus }
                 { name: "blur", handler: this._onLostFocus }
             ]);
             ]);
         }
         }
@@ -110,7 +110,7 @@ module BABYLON {
             canvas.removeEventListener("pointerout", this._onPointerUp);
             canvas.removeEventListener("pointerout", this._onPointerUp);
             canvas.removeEventListener("pointermove", this._onPointerMove);
             canvas.removeEventListener("pointermove", this._onPointerMove);
 
 
-            BABYLON.Tools.UnregisterTopRootEvents([
+            Tools.UnregisterTopRootEvents([
                 { name: "blur", handler: this._onLostFocus }
                 { name: "blur", handler: this._onLostFocus }
             ]);
             ]);
 
 
@@ -127,10 +127,10 @@ module BABYLON {
                 this.cameraRotation.x += -this._offsetY / this.angularSensibility;
                 this.cameraRotation.x += -this._offsetY / this.angularSensibility;
             } else {
             } else {
                 var speed = this._computeLocalCameraSpeed();
                 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();
             super._checkInputs();

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

@@ -1,26 +1,26 @@
 module BABYLON {
 module BABYLON {
     // We're mainly based on the logic defined into the FreeCamera code
     // We're mainly based on the logic defined into the FreeCamera code
     export class VirtualJoysticksCamera extends FreeCamera {
     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) {
         constructor(name: string, position: Vector3, scene: Scene) {
             super(name, position, 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._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.reverseUpDown = true;
             this._rightjoystick.setJoystickSensibility(0.05);
             this._rightjoystick.setJoystickSensibility(0.05);
             this._rightjoystick.setJoystickColor("yellow");
             this._rightjoystick.setJoystickColor("yellow");
         }
         }
 
 
         public _checkInputs(): void {
         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.cameraDirection = this.cameraDirection.add(deltaTransform);
             this.cameraRotation = this.cameraRotation.addVector3(this._rightjoystick.deltaPosition);
             this.cameraRotation = this.cameraRotation.addVector3(this._rightjoystick.deltaPosition);
             if (!this._leftjoystick.pressed) {
             if (!this._leftjoystick.pressed) {

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

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

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

@@ -4,7 +4,7 @@ module BABYLON {
     export var CollisionWorker = "";
     export var CollisionWorker = "";
 
 
     export interface ICollisionCoordinator {
     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;
         init(scene: Scene): void;
         destroy(): void;
         destroy(): void;
 
 
@@ -111,7 +111,7 @@ module BABYLON {
         private _scaledPosition = Vector3.Zero();
         private _scaledPosition = Vector3.Zero();
         private _scaledVelocity = 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 _init: boolean;
         private _runningUpdated: number;
         private _runningUpdated: number;
@@ -135,7 +135,7 @@ module BABYLON {
             this._toRemoveMeshesArray = [];
             this._toRemoveMeshesArray = [];
         }
         }
 
 
-        public static SerializeMesh = function (mesh: BABYLON.AbstractMesh): SerializedMesh {
+        public static SerializeMesh = function (mesh: AbstractMesh): SerializedMesh {
             var submeshes: Array<SerializedSubMesh> = [];
             var submeshes: Array<SerializedSubMesh> = [];
             if (mesh.subMeshes) {
             if (mesh.subMeshes) {
                 submeshes = mesh.subMeshes.map(function (sm, idx) {
                 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 {
             return {
                 uniqueId: mesh.uniqueId,
                 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 {
             return {
                 id: geometry.id,
                 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() || []),
                 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._init) return;
             if (this._collisionsCallbackArray[collisionIndex] || this._collisionsCallbackArray[collisionIndex + 100000]) return;
             if (this._collisionsCallbackArray[collisionIndex] || this._collisionsCallbackArray[collisionIndex + 100000]) return;
 
 
@@ -342,7 +342,7 @@ module BABYLON {
 
 
         private _finalPosition = Vector3.Zero();
         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);
             position.divideToRef(collider.radius, this._scaledPosition);
             velocity.divideToRef(collider.radius, this._scaledVelocity);
             velocity.divideToRef(collider.radius, this._scaledVelocity);
 			collider.collidedMesh = null;
 			collider.collidedMesh = null;

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

@@ -34,17 +34,17 @@ module BABYLON {
 
 
     export class CollideWorker {
     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.
             //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.
             //is initializing here correct? A quick look - looks like it is fine.
             if (this.collider.retry >= maximumRetry) {
             if (this.collider.retry >= maximumRetry) {
@@ -89,20 +89,20 @@ module BABYLON {
 
 
         private checkCollision(mesh: SerializedMesh) {
         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;
                 return;
             };
             };
 
 
             // Transformation matrix
             // 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);
             worldFromCache.multiplyToRef(this.collisionsScalingMatrix, this.collisionTranformationMatrix);
 
 
             this.processCollisionsForSubMeshes(this.collisionTranformationMatrix, mesh);
             this.processCollisionsForSubMeshes(this.collisionTranformationMatrix, mesh);
             //return colTransMat;
             //return colTransMat;
         }
         }
 
 
-        private processCollisionsForSubMeshes(transformMatrix: BABYLON.Matrix, mesh: SerializedMesh): void {
+        private processCollisionsForSubMeshes(transformMatrix: Matrix, mesh: SerializedMesh): void {
             var len: number;
             var len: number;
             var subMeshes;
             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']) {
             if (!meshGeometry['positionsArray']) {
                 meshGeometry['positionsArray'] = [];
                 meshGeometry['positionsArray'] = [];
                 for (var i = 0, len = meshGeometry.positions.length; i < len; i = i + 3) {
                 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);
                     meshGeometry['positionsArray'].push(p);
                 }
                 }
             }
             }
@@ -159,7 +159,7 @@ module BABYLON {
                 var start = subMesh.verticesStart;
                 var start = subMesh.verticesStart;
                 var end = (subMesh.verticesStart + subMesh.verticesCount);
                 var end = (subMesh.verticesStart + subMesh.verticesCount);
                 for (var i = start; i < end; i++) {
                 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 {
         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) {
         public onCollision(payload: CollidePayload) {
-            var finalPosition = BABYLON.Vector3.Zero();
+            var finalPosition = Vector3.Zero();
             //create a new collider
             //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);
             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 = {
             var replyPayload: CollisionReplyPayload = {
                 collidedMeshUniqueId: <any> collider.collidedMesh,
                 collidedMeshUniqueId: <any> collider.collidedMesh,
                 collisionId: payload.collisionId,
                 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) {
         constructor(creationFunc: (entry: T, block: OctreeBlock<T>) => void, maxBlockCapacity?: number, public maxDepth = 2) {
             this._maxBlockCapacity = maxBlockCapacity || 64;
             this._maxBlockCapacity = maxBlockCapacity || 64;
-            this._selectionContent = new BABYLON.SmartArray<T>(1024);
+            this._selectionContent = new SmartArray<T>(1024);
             this._creationFunc = creationFunc;
             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 {
         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>>();
             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
             // Segmenting space
             for (var x = 0; x < 2; x++) {
             for (var x = 0; x < 2; x++) {
@@ -87,7 +87,7 @@
                         var localMin = worldMin.add(blockSize.multiplyByFloats(x, y, z));
                         var localMin = worldMin.add(blockSize.multiplyByFloats(x, y, z));
                         var localMax = worldMin.add(blockSize.multiplyByFloats(x + 1, y + 1, z + 1));
                         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);
                         block.addEntries(entries);
                         target.blocks.push(block);
                         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 {
         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) {
                 if (this.blocks) {
                     for (var index = 0; index < this.blocks.length; index++) {
                     for (var index = 0; index < this.blocks.length; index++) {
                         var block = this.blocks[index];
                         var block = this.blocks[index];
@@ -98,7 +98,7 @@
         }
         }
 
 
         public intersects(sphereCenter: Vector3, sphereRadius: number, selection: SmartArray<T>, allowDuplicate?: boolean): void {
         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) {
                 if (this.blocks) {
                     for (var index = 0; index < this.blocks.length; index++) {
                     for (var index = 0; index < this.blocks.length; index++) {
                         var block = this.blocks[index];
                         var block = this.blocks[index];

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

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

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

@@ -8,19 +8,19 @@
         private _tempRadiusVector = Vector3.Zero();
         private _tempRadiusVector = Vector3.Zero();
 
 
         constructor(public minimum: Vector3, public maximum: Vector3) {
         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.radius = distance * 0.5;
 
 
-            this.centerWorld = BABYLON.Vector3.Zero();
-            this._update(BABYLON.Matrix.Identity());
+            this.centerWorld = Vector3.Zero();
+            this._update(Matrix.Identity());
         }
         }
 
 
         // Methods
         // Methods
         public _update(world: Matrix): void {
         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;
             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;
         private _effect: Effect;
 
 
         constructor(public name: string, imgUrl: string, scene: Scene, isBackground?: boolean, color?: Color4) {
         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.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 = scene;
             this._scene.layers.push(this);
             this._scene.layers.push(this);
@@ -70,9 +70,9 @@
             engine.bindBuffers(this._vertexBuffer, this._indexBuffer, this._vertexDeclaration, this._vertexStrideSize, this._effect);
             engine.bindBuffers(this._vertexBuffer, this._indexBuffer, this._vertexDeclaration, this._vertexStrideSize, this._effect);
 
 
             // Draw order
             // Draw order
-            engine.setAlphaMode(BABYLON.Engine.ALPHA_COMBINE);
+            engine.setAlphaMode(Engine.ALPHA_COMBINE);
             engine.draw(true, 0, 6);
             engine.draw(true, 0, 6);
-            engine.setAlphaMode(BABYLON.Engine.ALPHA_DISABLE);
+            engine.setAlphaMode(Engine.ALPHA_DISABLE);
         }
         }
 
 
         public dispose(): void {
         public dispose(): void {

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

@@ -6,8 +6,8 @@
         private _system: LensFlareSystem;
         private _system: LensFlareSystem;
 
 
         constructor(public size: number, public position: number, color, imgUrl: string, 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;
             this._system = system;
 
 
             system.lensFlares.push(this);
             system.lensFlares.push(this);