Trevor Baron 6 years ago
parent
commit
1433d06976

+ 1 - 1
src/Animations/animation.ts

@@ -1,5 +1,5 @@
 import { Path2, Vector3, Quaternion, Vector2, Color3, Size, Scalar, Matrix } from "Math";
-import { IEasingFunction, RuntimeAnimation, EasingFunction } from "Animations";
+import { IEasingFunction, RuntimeAnimation, EasingFunction, Animatable } from "Animations";
 import { Nullable } from "types";
 import { Scene } from "Debug/debugLayer";
 import { IAnimatable } from "Tools";

+ 1 - 1
src/Animations/animationGroup.ts

@@ -400,7 +400,7 @@ import { Engine } from "Engine";
          * @returns a new AnimationGroup
          */
         public static Parse(parsedAnimationGroup: any, scene: Scene): AnimationGroup {
-            var animationGroup = new BABYLON.AnimationGroup(parsedAnimationGroup.name, scene);
+            var animationGroup = new AnimationGroup(parsedAnimationGroup.name, scene);
             for (var i = 0; i < parsedAnimationGroup.targetedAnimations.length; i++) {
                 var targetedAnimation = parsedAnimationGroup.targetedAnimations[i];
                 var animation = Animation.Parse(targetedAnimation.animation);

+ 1 - 1
src/Behaviors/Cameras/autoRotationBehavior.ts

@@ -5,7 +5,7 @@ import { Observer, Tools } from "Tools";
 import { PointerInfoPre, PointerEventTypes } from "Events";
 
     /**
-     * The autoRotation behavior (BABYLON.AutoRotationBehavior) is designed to create a smooth rotation of an ArcRotateCamera when there is no user interaction.
+     * The autoRotation behavior (AutoRotationBehavior) is designed to create a smooth rotation of an ArcRotateCamera when there is no user interaction.
      * @see http://doc.babylonjs.com/how_to/camera_behaviors#autorotation-behavior
      */
     export class AutoRotationBehavior implements Behavior<ArcRotateCamera> {

+ 3 - 3
src/Behaviors/Cameras/framingBehavior.ts

@@ -1,15 +1,15 @@
 import { Behavior } from "Behaviors";
 import { ArcRotateCamera, Camera } from "Cameras";
-import { ExponentialEase } from "Animations";
+import { ExponentialEase, EasingFunction } from "Animations";
 import { Nullable } from "types";
 import { PointerInfoPre, PointerEventTypes } from "Events";
 import { Observer, Tools } from "Tools";
 import { AbstractMesh } from "Mesh";
 import { Vector3, Vector2 } from "Math";
-import {Animation} from "Animations";
+import { Animation, Animatable } from "Animations";
 
     /**
-     * The framing behavior (BABYLON.FramingBehavior) is designed to automatically position an ArcRotateCamera when its target is set to a mesh. It is also useful if you want to prevent the camera to go under a virtual horizontal plane.
+     * The framing behavior (FramingBehavior) is designed to automatically position an ArcRotateCamera when its target is set to a mesh. It is also useful if you want to prevent the camera to go under a virtual horizontal plane.
      * @see http://doc.babylonjs.com/how_to/camera_behaviors#framing-behavior
      */
     export class FramingBehavior implements Behavior<ArcRotateCamera> {

+ 6 - 5
src/Behaviors/Mesh/attachToBoxBehavior.ts

@@ -1,9 +1,10 @@
 import { Vector3, Matrix, Quaternion } from "Math";
-import { Mesh } from "Mesh";
+import { Mesh, TransformNode } from "Mesh";
 import { Scene } from "scene";
 import { Nullable } from "types";
 import { Observer } from "Tools";
 import { WebVRFreeCamera } from "Cameras";
+import { Behavior } from "Behaviors";
 
     /**
      * @hidden
@@ -15,7 +16,7 @@ import { WebVRFreeCamera } from "Cameras";
     /**
      * A behavior that when attached to a mesh will will place a specified node on the meshes face pointing towards the camera
      */
-    export class AttachToBoxBehavior implements BABYLON.Behavior<Mesh> {
+    export class AttachToBoxBehavior implements Behavior<Mesh> {
         /**
          *  The name of the behavior
          */
@@ -39,7 +40,7 @@ import { WebVRFreeCamera } from "Cameras";
          * Creates the AttachToBoxBehavior, used to attach UI to the closest face of the box to a camera
          * @param ui The transform node that should be attched to the mesh
          */
-        constructor(private ui: BABYLON.TransformNode) {
+        constructor(private ui: TransformNode) {
             /* Does nothing */
         }
 
@@ -75,9 +76,9 @@ import { WebVRFreeCamera } from "Cameras";
         private _zeroVector = Vector3.Zero();
         private _lookAtTmpMatrix = new Matrix();
         private _lookAtToRef(pos: Vector3, up = new Vector3(0, 1, 0), ref: Quaternion) {
-            BABYLON.Matrix.LookAtLHToRef(this._zeroVector, pos, up, this._lookAtTmpMatrix);
+            Matrix.LookAtLHToRef(this._zeroVector, pos, up, this._lookAtTmpMatrix);
             this._lookAtTmpMatrix.invert();
-            BABYLON.Quaternion.FromRotationMatrixToRef(this._lookAtTmpMatrix, ref);
+            Quaternion.FromRotationMatrixToRef(this._lookAtTmpMatrix, ref);
         }
 
         /**

+ 2 - 2
src/Behaviors/Mesh/multiPointerScaleBehavior.ts

@@ -21,9 +21,9 @@ import { Scene } from "scene";
          * Instantiate a new behavior that when attached to a mesh will allow the mesh to be scaled
          */
         constructor() {
-            this._dragBehaviorA = new BABYLON.PointerDragBehavior({});
+            this._dragBehaviorA = new PointerDragBehavior({});
             this._dragBehaviorA.moveAttached = false;
-            this._dragBehaviorB = new BABYLON.PointerDragBehavior({});
+            this._dragBehaviorB = new PointerDragBehavior({});
             this._dragBehaviorB.moveAttached = false;
         }
 

+ 14 - 14
src/Behaviors/Mesh/pointerDragBehavior.ts

@@ -9,7 +9,7 @@ import { Nullable } from "types";
 import { Observer, Observable } from "Tools";
 
 import { Vector3 } from "Math";
-import { PointerInfo } from "Events";
+import { PointerInfo, PointerEventTypes } from "Events";
 import { BoundingBoxGizmo } from "Gizmos";
 import { Ray } from "Culling/ray";
 
@@ -125,7 +125,7 @@ import { Ray } from "Culling/ray";
         private _tmpVector = new Vector3(0, 0, 0);
         private _alternatePickedPoint = new Vector3(0, 0, 0);
         private _worldDragAxis = new Vector3(0, 0, 0);
-        private _targetPosition = new BABYLON.Vector3(0, 0, 0);
+        private _targetPosition = new Vector3(0, 0, 0);
         private _attachedElement: Nullable<HTMLElement> = null;
         /**
          * Attaches the drag behavior the passed in mesh
@@ -140,7 +140,7 @@ import { Ray } from "Culling/ray";
                 if (this._debugMode) {
                     PointerDragBehavior._planeScene = this._scene;
                 }else {
-                    PointerDragBehavior._planeScene = new BABYLON.Scene(this._scene.getEngine());
+                    PointerDragBehavior._planeScene = new Scene(this._scene.getEngine());
                     PointerDragBehavior._planeScene.detachControl();
                     this._scene.getEngine().scenes.pop();
                     this._scene.onDisposeObservable.addOnce(() => {
@@ -149,10 +149,10 @@ import { Ray } from "Culling/ray";
                     });
                 }
             }
-            this._dragPlane = BABYLON.Mesh.CreatePlane("pointerDragPlane", this._debugMode ? 1 : 10000, PointerDragBehavior._planeScene, false, BABYLON.Mesh.DOUBLESIDE);
+            this._dragPlane = Mesh.CreatePlane("pointerDragPlane", this._debugMode ? 1 : 10000, PointerDragBehavior._planeScene, false, Mesh.DOUBLESIDE);
 
             // State of the drag
-            this.lastDragPosition = new BABYLON.Vector3(0, 0, 0);
+            this.lastDragPosition = new Vector3(0, 0, 0);
 
             var pickPredicate = (m: AbstractMesh) => {
                 return this._attachedNode == m || m.isDescendantOf(this._attachedNode);
@@ -163,16 +163,16 @@ import { Ray } from "Culling/ray";
                     return;
                 }
 
-                if (pointerInfo.type == BABYLON.PointerEventTypes.POINTERDOWN) {
+                if (pointerInfo.type == PointerEventTypes.POINTERDOWN) {
 
                     if (!this.dragging && pointerInfo.pickInfo && pointerInfo.pickInfo.hit && pointerInfo.pickInfo.pickedMesh && pointerInfo.pickInfo.pickedPoint && pointerInfo.pickInfo.ray && pickPredicate(pointerInfo.pickInfo.pickedMesh)) {
                         this._startDrag((<PointerEvent>pointerInfo.event).pointerId, pointerInfo.pickInfo.ray, pointerInfo.pickInfo.pickedPoint);
                     }
-                }else if (pointerInfo.type == BABYLON.PointerEventTypes.POINTERUP) {
+                }else if (pointerInfo.type == PointerEventTypes.POINTERUP) {
                     if (this.currentDraggingPointerID == (<PointerEvent>pointerInfo.event).pointerId) {
                         this.releaseDrag();
                     }
-                }else if (pointerInfo.type == BABYLON.PointerEventTypes.POINTERMOVE) {
+                }else if (pointerInfo.type == PointerEventTypes.POINTERMOVE) {
                     var pointerId = (<PointerEvent>pointerInfo.event).pointerId;
 
                     // If drag was started with anyMouseID specified, set pointerID to the next mouse that moved
@@ -186,7 +186,7 @@ import { Ray } from "Culling/ray";
 
                     // Keep track of last pointer ray, this is used simulating the start of a drag in startDrag()
                     if (!this._lastPointerRay[pointerId]) {
-                        this._lastPointerRay[pointerId] = new BABYLON.Ray(new BABYLON.Vector3(), new BABYLON.Vector3());
+                        this._lastPointerRay[pointerId] = new Ray(new Vector3(), new Vector3());
                     }
                     if (pointerInfo.pickInfo && pointerInfo.pickInfo.ray) {
                         this._lastPointerRay[pointerId].origin.copyFrom(pointerInfo.pickInfo.ray.origin);
@@ -227,7 +227,7 @@ import { Ray } from "Culling/ray";
             }
         }
 
-        private _startDragRay = new BABYLON.Ray(new BABYLON.Vector3(), new BABYLON.Vector3());
+        private _startDragRay = new Ray(new Vector3(), new Vector3());
         private _lastPointerRay: {[key: number]: Ray} = {};
         /**
          * Simulates the start of a pointer drag event on the behavior
@@ -288,7 +288,7 @@ import { Ray } from "Culling/ray";
             BoundingBoxGizmo._RestorePivotPoint(this._attachedNode);
         }
 
-        private _dragDelta = new BABYLON.Vector3();
+        private _dragDelta = new Vector3();
         private _moveDrag(ray: Ray) {
             this._moving = true;
             var pickedPoint = this._pickWithRayOnDragPlane(ray);
@@ -306,7 +306,7 @@ import { Ray } from "Culling/ray";
 
                     // Project delta drag from the drag plane onto the drag axis
                     pickedPoint.subtractToRef(this.lastDragPosition, this._tmpVector);
-                    dragLength = BABYLON.Vector3.Dot(this._tmpVector, this._worldDragAxis);
+                    dragLength = Vector3.Dot(this._tmpVector, this._worldDragAxis);
                     this._worldDragAxis.scaleToRef(dragLength, this._dragDelta);
                 }else {
                     dragLength = this._dragDelta.length();
@@ -380,9 +380,9 @@ import { Ray } from "Culling/ray";
                 // Get perpendicular line from direction to camera and drag axis
                 this._pointB.subtractToRef(this._pointA, this._lineA);
                 this._pointC.subtractToRef(this._pointA, this._lineB);
-                BABYLON.Vector3.CrossToRef(this._lineA, this._lineB, this._lookAt);
+                Vector3.CrossToRef(this._lineA, this._lineB, this._lookAt);
                 // Get perpendicular line from previous result and drag axis to adjust lineB to be perpendiculat to camera
-                BABYLON.Vector3.CrossToRef(this._lineA, this._lookAt, this._lookAt);
+                Vector3.CrossToRef(this._lineA, this._lookAt, this._lookAt);
                 this._lookAt.normalize();
 
                 this._dragPlane.position.copyFrom(this._pointA);

+ 13 - 12
src/Behaviors/Mesh/sixDofDragBehavior.ts

@@ -1,12 +1,13 @@
 import { Behavior } from "Behaviors";
 import { Mesh, AbstractMesh } from "Mesh";
-import {Scene} from "scene";
-import { Nullable } from "index";
+import { Scene } from "scene";
+import { Nullable, PointerEventTypes } from "index";
 import { Vector3, Quaternion } from "Math";
-import {PointerInfo} from "Events";
+import { PointerInfo } from "Events";
 import { Observer, Observable } from "Tools";
-import {BoundingBoxGizmo} from "Gizmos";
-import {Camera} from "Cameras";
+import { BoundingBoxGizmo } from "Gizmos";
+import { Camera } from "Cameras";
+import { Matrix } from "Math";
     /**
      * A behavior that when attached to a mesh will allow the mesh to be dragged around based on directions and origin of the pointer's ray
      */
@@ -76,18 +77,18 @@ import {Camera} from "Cameras";
             this._ownerNode = ownerNode;
             this._scene = this._ownerNode.getScene();
             if (!SixDofDragBehavior._virtualScene) {
-                SixDofDragBehavior._virtualScene = new BABYLON.Scene(this._scene.getEngine());
+                SixDofDragBehavior._virtualScene = new Scene(this._scene.getEngine());
                 SixDofDragBehavior._virtualScene.detachControl();
                 this._scene.getEngine().scenes.pop();
             }
 
             var pickedMesh: Nullable<AbstractMesh> = null;
-            var lastSixDofOriginPosition = new BABYLON.Vector3(0, 0, 0);
+            var lastSixDofOriginPosition = new Vector3(0, 0, 0);
 
             // Setup virtual meshes to be used for dragging without dirtying the existing scene
-            this._virtualOriginMesh = new BABYLON.AbstractMesh("", SixDofDragBehavior._virtualScene);
+            this._virtualOriginMesh = new AbstractMesh("", SixDofDragBehavior._virtualScene);
             this._virtualOriginMesh.rotationQuaternion = new Quaternion();
-            this._virtualDragMesh = new BABYLON.AbstractMesh("", SixDofDragBehavior._virtualScene);
+            this._virtualDragMesh = new AbstractMesh("", SixDofDragBehavior._virtualScene);
             this._virtualDragMesh.rotationQuaternion = new Quaternion();
 
             var pickPredicate = (m: AbstractMesh) => {
@@ -95,7 +96,7 @@ import {Camera} from "Cameras";
             };
             var attachedElement: Nullable<HTMLElement> = null;
             this._pointerObserver = this._scene.onPointerObservable.add((pointerInfo, eventState) => {
-                if (pointerInfo.type == BABYLON.PointerEventTypes.POINTERDOWN) {
+                if (pointerInfo.type == PointerEventTypes.POINTERDOWN) {
                     if (!this.dragging && pointerInfo.pickInfo && pointerInfo.pickInfo.hit && pointerInfo.pickInfo.pickedMesh && pointerInfo.pickInfo.ray && pickPredicate(pointerInfo.pickInfo.pickedMesh)) {
                         if (this._scene.activeCamera && this._scene.activeCamera.cameraRigMode == Camera.RIG_MODE_NONE) {
                             pointerInfo.pickInfo.ray.origin.copyFrom(this._scene.activeCamera!.position);
@@ -139,7 +140,7 @@ import {Camera} from "Cameras";
                         BoundingBoxGizmo._RestorePivotPoint(pickedMesh);
                         this.onDragStartObservable.notifyObservers({});
                     }
-                }else if (pointerInfo.type == BABYLON.PointerEventTypes.POINTERUP) {
+                }else if (pointerInfo.type == PointerEventTypes.POINTERUP) {
                     if (this.currentDraggingPointerID == (<PointerEvent>pointerInfo.event).pointerId) {
                         this.dragging = false;
                         this._moving = false;
@@ -153,7 +154,7 @@ import {Camera} from "Cameras";
                         }
                         this.onDragEndObservable.notifyObservers({});
                     }
-                }else if (pointerInfo.type == BABYLON.PointerEventTypes.POINTERMOVE) {
+                }else if (pointerInfo.type == PointerEventTypes.POINTERMOVE) {
                     if (this.currentDraggingPointerID == (<PointerEvent>pointerInfo.event).pointerId && this.dragging && pointerInfo.pickInfo && pointerInfo.pickInfo.ray && pickedMesh) {
                         var zDragFactor = this.zDragFactor;
                         if (this._scene.activeCamera && this._scene.activeCamera.cameraRigMode == Camera.RIG_MODE_NONE) {

+ 2 - 2
src/Bones/boneLookController.ts

@@ -35,7 +35,7 @@ import { Nullable } from "types";
         public upAxis: Vector3 = Vector3.Up();
 
         /**
-         * The space that the up axis is in - BABYLON.Space.BONE, BABYLON.Space.LOCAL (default), or BABYLON.Space.WORLD
+         * The space that the up axis is in - Space.BONE, Space.LOCAL (default), or Space.WORLD
          */
         public upAxisSpace: Space = Space.LOCAL;
 
@@ -149,7 +149,7 @@ import { Nullable } from "types";
          * * minPitch: the minimum angle the bone will yaw to
          * * slerpAmount: set the between 0 and 1 to make the bone slerp to the target.
          * * upAxis: the up axis of the coordinate system
-         * * upAxisSpace: the space that the up axis is in - BABYLON.Space.BONE, BABYLON.Space.LOCAL (default), or BABYLON.Space.WORLD.
+         * * upAxisSpace: the space that the up axis is in - Space.BONE, Space.LOCAL (default), or Space.WORLD.
          * * yawAxis: set yawAxis if the bone does not yaw on the y axis
          * * pitchAxis: set pitchAxis if the bone does not pitch on the x axis
          * * adjustYaw: used to make an adjustment to the yaw of the bone

+ 7 - 6
src/Cameras/Inputs/flyCameraMouseInput.ts

@@ -3,6 +3,7 @@ import { Nullable } from "types";
 import { ICameraInput, CameraInputTypes, FlyCamera } from "Cameras";
 import { PointerInfo, PointerEventTypes } from "Events";
 import { Scene } from "scene";
+import { Quaternion, Axis } from "Math";
     /**
      * Listen to mouse events to control the camera.
      * @see http://doc.babylonjs.com/how_to/customizing_camera_inputs
@@ -258,17 +259,17 @@ import { Scene } from "scene";
             var y = offsetY / this.angularSensibility;
 
             // Initialize to current rotation.
-            var currentRotation = BABYLON.Quaternion.RotationYawPitchRoll(
+            var currentRotation = Quaternion.RotationYawPitchRoll(
                 camera.rotation.y,
                 camera.rotation.x,
                 camera.rotation.z
             );
-            var rotationChange: BABYLON.Quaternion;
+            var rotationChange: Quaternion;
 
             // Pitch.
             if (this.buttonsPitch.some((v) => { return v === this.activeButton; })) {
                 // Apply change in Radians to vector Angle.
-                rotationChange = BABYLON.Quaternion.RotationAxis(BABYLON.Axis.X, y);
+                rotationChange = Quaternion.RotationAxis(Axis.X, y);
                 // Apply Pitch to quaternion.
                 currentRotation.multiplyInPlace(rotationChange);
             }
@@ -276,7 +277,7 @@ import { Scene } from "scene";
             // Yaw.
             if (this.buttonsYaw.some((v) => { return v === this.activeButton; })) {
                 // Apply change in Radians to vector Angle.
-                rotationChange = BABYLON.Quaternion.RotationAxis(BABYLON.Axis.Y, x);
+                rotationChange = Quaternion.RotationAxis(Axis.Y, x);
                 // Apply Yaw to quaternion.
                 currentRotation.multiplyInPlace(rotationChange);
 
@@ -285,7 +286,7 @@ import { Scene } from "scene";
                 if (camera.bankedTurn && -limit < camera.rotation.z && camera.rotation.z < limit) {
                     let bankingDelta = camera.bankedTurnMultiplier * -x;
                     // Apply change in Radians to vector Angle.
-                    rotationChange = BABYLON.Quaternion.RotationAxis(BABYLON.Axis.Z, bankingDelta);
+                    rotationChange = Quaternion.RotationAxis(Axis.Z, bankingDelta);
                     // Apply Yaw to quaternion.
                     currentRotation.multiplyInPlace(rotationChange);
                 }
@@ -294,7 +295,7 @@ import { Scene } from "scene";
             // Roll.
             if (this.buttonsRoll.some((v) => { return v === this.activeButton; })) {
                 // Apply change in Radians to vector Angle.
-                rotationChange = BABYLON.Quaternion.RotationAxis(BABYLON.Axis.Z, -x);
+                rotationChange = Quaternion.RotationAxis(Axis.Z, -x);
                 // Track Rolling.
                 camera._trackRoll -= x;
                 // Apply Pitch to quaternion.

+ 4 - 4
src/Cameras/VR/vrExperienceHelper.ts

@@ -3,15 +3,15 @@ import { Nullable } from "types";
 import { FreeCamera, DeviceOrientationCamera, Camera, VRDeviceOrientationFreeCamera, WebVROptions, WebVRFreeCamera, TargetCamera } from "Cameras";
 import { PointerEventTypes } from "Events";
 import { Scene, IDisposable } from "scene";
-import { Quaternion, Matrix, Vector3, Color3, Color4 } from "Math";
-import {Gamepad, WebVRController, PoseEnabledController, Xbox360Pad, Xbox360Button, StickValues, PoseEnabledControllerType} from "Gamepad"
+import { Quaternion, Matrix, Vector3, Color3, Color4, Axis } from "Math";
+import { Gamepad, WebVRController, PoseEnabledController, Xbox360Pad, Xbox360Button, StickValues, PoseEnabledControllerType } from "Gamepad";
 import { IDisplayChangedEventArgs } from "Engine";
 import { Mesh, AbstractMesh } from "Mesh";
 import { PickingInfo } from "Collisions";
 import { Ray } from "Culling";
 import { StandardMaterial, ImageProcessingConfiguration, DynamicTexture } from "Materials";
 import { ImageProcessingPostProcess } from "PostProcess";
-import { SineEase, EasingFunction, Animation } from "Animations";
+import { SineEase, EasingFunction, Animation, CircleEase } from "Animations";
     /**
      * Options to modify the vr teleportation behavior.
      */
@@ -1671,7 +1671,7 @@ import { SineEase, EasingFunction, Animation } from "Animations";
 
         private _convertNormalToDirectionOfRay(normal: Nullable<Vector3>, ray: Ray) {
             if (normal) {
-                var angle = Math.acos(BABYLON.Vector3.Dot(normal, ray.direction));
+                var angle = Math.acos(Vector3.Dot(normal, ray.direction));
                 if (angle < Math.PI / 2) {
                     normal.scaleInPlace(-1);
                 }

+ 4 - 4
src/Cameras/VR/webVRCamera.ts

@@ -1,11 +1,11 @@
 import { Observer, Observable } from "Tools";
 import { Nullable } from "types";
-import { FreeCamera, Camera, WebVROptions, WebVRFreeCamera, TargetCamera } from "Cameras";
+import { FreeCamera, Camera, WebVROptions, TargetCamera } from "Cameras";
 import { Scene } from "scene";
 import { Quaternion, Matrix, Vector3 } from "Math";
-import {Gamepad, WebVRController, PoseEnabledControllerType} from "Gamepad"
+import { Gamepad, WebVRController, PoseEnabledControllerType } from "Gamepad";
 import { IDisplayChangedEventArgs } from "Engine";
-import {Node} from "Node";
+import { Node } from "Node";
 import { AbstractMesh } from "Mesh";
 import { Ray } from "Culling";
 import { HemisphericLight } from "Lights";
@@ -626,7 +626,7 @@ import { HemisphericLight } from "Lights";
             return Matrix.Identity();
         }
 
-        private _tmpMatrix = new BABYLON.Matrix();
+        private _tmpMatrix = new Matrix();
         /**
          * This function is called by the two RIG cameras.
          * 'this' is the left or right camera (and NOT (!!!) the WebVRFreeCamera instance)

+ 16 - 14
src/Cameras/XR/webXRCamera.ts

@@ -1,33 +1,35 @@
-import { FreeCamera, WebXRSessionManager } from "Cameras";
+import { FreeCamera, WebXRSessionManager, Camera, TargetCamera } from "Cameras";
+import { Vector3, Matrix, Quaternion, Viewport } from "Math";
+import { Scene } from "scene";
 
     /**
      * WebXR Camera which holds the views for the xrSession
      * @see https://doc.babylonjs.com/how_to/webxr
      */
     export class WebXRCamera extends FreeCamera {
-        private static _TmpMatrix = new BABYLON.Matrix();
+        private static _TmpMatrix = new Matrix();
 
         /**
          * Creates a new webXRCamera, this should only be set at the camera after it has been updated by the xrSessionManager
          * @param name the name of the camera
          * @param scene the scene to add the camera to
          */
-        constructor(name: string, scene: BABYLON.Scene) {
-            super(name, BABYLON.Vector3.Zero(), scene);
+        constructor(name: string, scene: Scene) {
+            super(name, Vector3.Zero(), scene);
 
             // Initial camera configuration
             this.minZ = 0;
-            this.rotationQuaternion = new BABYLON.Quaternion();
-            this.cameraRigMode = BABYLON.Camera.RIG_MODE_CUSTOM;
+            this.rotationQuaternion = new Quaternion();
+            this.cameraRigMode = Camera.RIG_MODE_CUSTOM;
             this._updateNumberOfRigCameras(1);
         }
 
         private _updateNumberOfRigCameras(viewCount = 1) {
             while (this.rigCameras.length < viewCount) {
-                var newCamera = new BABYLON.TargetCamera("view: " + this.rigCameras.length, BABYLON.Vector3.Zero(), this.getScene());
+                var newCamera = new TargetCamera("view: " + this.rigCameras.length, Vector3.Zero(), this.getScene());
                 newCamera.minZ = 0;
                 newCamera.parent = this;
-                newCamera.rotationQuaternion = new BABYLON.Quaternion();
+                newCamera.rotationQuaternion = new Quaternion();
                 this.rigCameras.push(newCamera);
             }
             while (this.rigCameras.length > viewCount) {
@@ -42,10 +44,10 @@ import { FreeCamera, WebXRSessionManager } from "Cameras";
         public _updateForDualEyeDebugging(pupilDistance = 0.01) {
             // Create initial camera rigs
             this._updateNumberOfRigCameras(2);
-            this.rigCameras[0].viewport = new BABYLON.Viewport(0, 0, 0.5, 1.0);
+            this.rigCameras[0].viewport = new Viewport(0, 0, 0.5, 1.0);
             this.rigCameras[0].position.x = -pupilDistance / 2;
             this.rigCameras[0].outputRenderTarget = null;
-            this.rigCameras[1].viewport = new BABYLON.Viewport(0.5, 0, 0.5, 1.0);
+            this.rigCameras[1].viewport = new Viewport(0.5, 0, 0.5, 1.0);
             this.rigCameras[1].position.x = pupilDistance / 2;
             this.rigCameras[1].outputRenderTarget = null;
         }
@@ -66,21 +68,21 @@ import { FreeCamera, WebXRSessionManager } from "Cameras";
             }
 
             // Update the parent cameras matrix
-            BABYLON.Matrix.FromFloat32ArrayToRefScaled(pose.poseModelMatrix, 0, 1, WebXRCamera._TmpMatrix);
+            Matrix.FromFloat32ArrayToRefScaled(pose.poseModelMatrix, 0, 1, WebXRCamera._TmpMatrix);
             if (!this._scene.useRightHandedSystem) {
                 WebXRCamera._TmpMatrix.toggleModelMatrixHandInPlace();
             }
             WebXRCamera._TmpMatrix.getTranslationToRef(this.position);
             WebXRCamera._TmpMatrix.getRotationMatrixToRef(WebXRCamera._TmpMatrix);
-            BABYLON.Quaternion.FromRotationMatrixToRef(WebXRCamera._TmpMatrix, this.rotationQuaternion);
+            Quaternion.FromRotationMatrixToRef(WebXRCamera._TmpMatrix, this.rotationQuaternion);
             this.computeWorldMatrix();
 
             // Update camera rigs
             this._updateNumberOfRigCameras(xrSessionManager._currentXRFrame.views.length);
             xrSessionManager._currentXRFrame.views.forEach((view, i) => {
                 // Update view/projection matrix
-                BABYLON.Matrix.FromFloat32ArrayToRefScaled(pose.getViewMatrix(view), 0, 1, this.rigCameras[i]._computedViewMatrix);
-                BABYLON.Matrix.FromFloat32ArrayToRefScaled(view.projectionMatrix, 0, 1, this.rigCameras[i]._projectionMatrix);
+                Matrix.FromFloat32ArrayToRefScaled(pose.getViewMatrix(view), 0, 1, this.rigCameras[i]._computedViewMatrix);
+                Matrix.FromFloat32ArrayToRefScaled(view.projectionMatrix, 0, 1, this.rigCameras[i]._projectionMatrix);
                 if (!this._scene.useRightHandedSystem) {
                     this.rigCameras[i]._computedViewMatrix.toggleModelMatrixHandInPlace();
                     this.rigCameras[i]._projectionMatrix.toggleProjectionMatrixHandInPlace();

+ 7 - 6
src/Cameras/XR/webXREnterExitUI.ts

@@ -1,6 +1,7 @@
 import { Nullable } from "types";
 import { WebXRExperienceHelper, WebXRState } from "Cameras";
-import { IDisposable } from "scene";
+import { IDisposable, Scene } from "scene";
+import { Observable } from "Tools";
     /**
      * Button which can be used to enter a different mode of XR
      */
@@ -52,7 +53,7 @@ import { IDisposable } from "scene";
          *
          * When exiting xr the callback parameter will be null)
          */
-        public activeButtonChangedObservable = new BABYLON.Observable<Nullable<WebXREnterExitUIButton>>();
+        public activeButtonChangedObservable = new Observable<Nullable<WebXREnterExitUIButton>>();
         /**
          * Creates UI to allow the user to enter/exit XR mode
          * @param scene the scene to add the ui to
@@ -60,7 +61,7 @@ import { IDisposable } from "scene";
          * @param options options to configure the UI
          * @returns the created ui
          */
-        public static CreateAsync(scene: BABYLON.Scene, helper: WebXRExperienceHelper, options: WebXREnterExitUIOptions): Promise<WebXREnterExitUI> {
+        public static CreateAsync(scene: Scene, helper: WebXRExperienceHelper, options: WebXREnterExitUIOptions): Promise<WebXREnterExitUI> {
             var ui = new WebXREnterExitUI(scene, options);
             var supportedPromises = ui._buttons.map((btn) => {
                 return helper.supportsSessionAsync(btn.initializationOptions);
@@ -75,11 +76,11 @@ import { IDisposable } from "scene";
                     if (supported) {
                         ui._overlay.appendChild(ui._buttons[i].element);
                         ui._buttons[i].element.onclick = async() => {
-                            if (helper.state == BABYLON.WebXRState.IN_XR) {
+                            if (helper.state == WebXRState.IN_XR) {
                                 ui._updateButtons(null);
                                 await helper.exitXRAsync();
                                 return;
-                            } else if (helper.state == BABYLON.WebXRState.NOT_IN_XR) {
+                            } else if (helper.state == WebXRState.NOT_IN_XR) {
                                 ui._updateButtons(ui._buttons[i]);
                                 await helper.enterXRAsync(ui._buttons[i].initializationOptions, "eye-level");
                             }
@@ -90,7 +91,7 @@ import { IDisposable } from "scene";
             });
         }
 
-        private constructor(private scene: BABYLON.Scene, options: WebXREnterExitUIOptions) {
+        private constructor(private scene: Scene, options: WebXREnterExitUIOptions) {
             this._overlay = document.createElement("div");
             this._overlay.style.cssText = "z-index:11;position: absolute; right: 20px;bottom: 50px;";
 

+ 8 - 7
src/Cameras/XR/webXRExperienceHelper.ts

@@ -1,9 +1,10 @@
 import { Observable } from "Tools";
 import { Nullable } from "types";
 import { Camera, WebXRSessionManager, WebXRCamera } from "Cameras";
-import { IDisposable } from "scene";
+import { IDisposable, Scene } from "scene";
 import { Quaternion, Vector3 } from "Math";
 import { AbstractMesh } from "Mesh";
+import { Ray } from "Culling";
     /**
      * States of the webXR experience
      */
@@ -49,7 +50,7 @@ import { AbstractMesh } from "Mesh";
             this.onStateChangedObservable.notifyObservers(this.state);
         }
 
-        private static _TmpVector = new BABYLON.Vector3();
+        private static _TmpVector = new Vector3();
 
         /**
          * Fires when the state of the experience helper has changed
@@ -69,7 +70,7 @@ import { AbstractMesh } from "Mesh";
          * @param scene the scene to attach the experience helper to
          * @returns a promise for the experience helper
          */
-        public static CreateAsync(scene: BABYLON.Scene): Promise<WebXRExperienceHelper> {
+        public static CreateAsync(scene: Scene): Promise<WebXRExperienceHelper> {
             var helper = new WebXRExperienceHelper(scene);
             return helper._sessionManager.initializeAsync().then(() => {
                 helper._supported = true;
@@ -83,9 +84,9 @@ import { AbstractMesh } from "Mesh";
          * Creates a WebXRExperienceHelper
          * @param scene The scene the helper should be created in
          */
-        private constructor(private scene: BABYLON.Scene) {
-            this.camera = new BABYLON.WebXRCamera("", scene);
-            this._sessionManager = new BABYLON.WebXRSessionManager(scene);
+        private constructor(private scene: Scene) {
+            this.camera = new WebXRCamera("", scene);
+            this._sessionManager = new WebXRSessionManager(scene);
             this.container = new AbstractMesh("", scene);
             this.camera.parent = this.container;
         }
@@ -143,7 +144,7 @@ import { AbstractMesh } from "Mesh";
          * @param ray ray to cast into the environment
          * @returns Promise which resolves with a collision point in the environment if it exists
          */
-        public environmentPointHitTestAsync(ray: BABYLON.Ray): Promise<Nullable<Vector3>> {
+        public environmentPointHitTestAsync(ray: Ray): Promise<Nullable<Vector3>> {
             return this._sessionManager.environmentPointHitTestAsync(ray);
         }
 

+ 1 - 1
src/Cameras/camera.ts

@@ -3,7 +3,7 @@ import { Nullable } from "types";
 import { FreeCamera, UniversalCamera, VRCameraMetrics, TargetCamera, CameraInputsManager } from "Cameras";
 import { Scene } from "scene";
 import { Matrix, Vector3, Viewport, Plane, Frustum } from "Math";
-import {Node} from "Node";
+import { Node } from "Node";
 import { Mesh, AbstractMesh } from "Mesh";
 import { Ray, ICullable } from "Culling";
 import { RenderTargetTexture } from "Materials";

+ 2 - 2
src/Cameras/flyCamera.ts

@@ -42,13 +42,13 @@ import { Collider } from "Collisions";
         /**
          * Define the current direction the camera is moving to.
          */
-        public cameraDirection = BABYLON.Vector3.Zero();
+        public cameraDirection = Vector3.Zero();
 
         /**
          * Define the current local rotation of the camera as a quaternion to prevent Gimbal lock.
          * This overrides and empties cameraRotation.
          */
-        public rotationQuaternion: BABYLON.Quaternion;
+        public rotationQuaternion: Quaternion;
 
         /**
          * Track Roll to maintain the wanted Rolling when looking around.

+ 20 - 11
src/Cameras/freeCamera.ts

@@ -1,3 +1,12 @@
+import { TargetCamera, UniversalCamera, FreeCameraInputsManager, FreeCameraMouseInput, FreeCameraKeyboardMoveInput } from "Cameras";
+import { Vector3, Vector2 } from "Math";
+import { Node } from "Node";
+import { AbstractMesh } from "Mesh";
+import { Collider } from "Collisions";
+import { Scene } from "scene";
+import { Nullable } from "types";
+import { Engine } from "Engine";
+
     Node.AddNodeConstructor("FreeCamera", (name, scene) => {
         // Forcing to use the Universal camera
         return () => new UniversalCamera(name, Vector3.Zero(), scene);
@@ -49,7 +58,7 @@
         public get angularSensibility(): number {
             var mouse = <FreeCameraMouseInput>this.inputs.attached["mouse"];
             if (mouse) {
-                return mouse.angularSensibility;
+                return mouse.angularSensibility;
             }
 
             return 0;
@@ -62,7 +71,7 @@
         public set angularSensibility(value: number) {
             var mouse = <FreeCameraMouseInput>this.inputs.attached["mouse"];
             if (mouse) {
-                mouse.angularSensibility = value;
+                mouse.angularSensibility = value;
             }
         }
 
@@ -72,7 +81,7 @@
         public get keysUp(): number[] {
             var keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached["keyboard"];
             if (keyboard) {
-                return keyboard.keysUp;
+                return keyboard.keysUp;
             }
 
             return [];
@@ -81,7 +90,7 @@
         public set keysUp(value: number[]) {
             var keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached["keyboard"];
             if (keyboard) {
-                keyboard.keysUp = value;
+                keyboard.keysUp = value;
             }
         }
 
@@ -91,7 +100,7 @@
         public get keysDown(): number[] {
             var keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached["keyboard"];
             if (keyboard) {
-                return keyboard.keysDown;
+                return keyboard.keysDown;
             }
 
             return [];
@@ -100,7 +109,7 @@
         public set keysDown(value: number[]) {
             var keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached["keyboard"];
             if (keyboard) {
-                keyboard.keysDown = value;
+                keyboard.keysDown = value;
             }
         }
 
@@ -110,7 +119,7 @@
         public get keysLeft(): number[] {
             var keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached["keyboard"];
             if (keyboard) {
-                return keyboard.keysLeft;
+                return keyboard.keysLeft;
             }
 
             return [];
@@ -119,7 +128,7 @@
         public set keysLeft(value: number[]) {
             var keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached["keyboard"];
             if (keyboard) {
-                keyboard.keysLeft = value;
+                keyboard.keysLeft = value;
             }
         }
 
@@ -129,7 +138,7 @@
         public get keysRight(): number[] {
             var keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached["keyboard"];
             if (keyboard) {
-                return keyboard.keysRight;
+                return keyboard.keysRight;
             }
 
             return [];
@@ -138,7 +147,7 @@
         public set keysRight(value: number[]) {
             var keyboard = <FreeCameraKeyboardMoveInput>this.inputs.attached["keyboard"];
             if (keyboard) {
-                keyboard.keysRight = value;
+                keyboard.keysRight = value;
             }
         }
 
@@ -245,7 +254,7 @@
         private _onCollisionPositionChange = (collisionId: number, newPosition: Vector3, collidedMesh: Nullable<AbstractMesh> = null) => {
             //TODO move this to the collision coordinator!
             if (this.getScene().workerCollisions) {
-                newPosition.multiplyInPlace(this._collider._radius);
+                newPosition.multiplyInPlace(this._collider._radius);
             }
 
             var updatePosition = (newPos: Vector3) => {

+ 1 - 1
src/Cameras/targetCamera.ts

@@ -71,7 +71,7 @@ import { Quaternion, Matrix, Vector3, Vector2, Epsilon, Tmp } from "Math";
         /** @hidden */
         public _reset: () => void;
 
-        private _defaultUp = BABYLON.Vector3.Up();
+        private _defaultUp = Vector3.Up();
 
         /**
          * Instantiates a target camera that takes a meshor position as a target and continues to look at it while it moves.

+ 3 - 3
src/Tools/assetsManager.ts

@@ -479,7 +479,7 @@ import { BaseTexture, Texture, CubeTexture, HDRCubeTexture } from "Materials";
          * @param url defines the location of the file to load
          * @param noMipmap defines if mipmap should not be generated (default is false)
          * @param invertY defines if texture must be inverted on Y axis (default is false)
-         * @param samplingMode defines the sampling mode to use (default is BABYLON.Texture.TRILINEAR_SAMPLINGMODE)
+         * @param samplingMode defines the sampling mode to use (default is Texture.TRILINEAR_SAMPLINGMODE)
          */
         constructor(
             /**
@@ -499,7 +499,7 @@ import { BaseTexture, Texture, CubeTexture, HDRCubeTexture } from "Materials";
              */
             public invertY?: boolean,
             /**
-             * Defines the sampling mode to use (default is BABYLON.Texture.TRILINEAR_SAMPLINGMODE)
+             * Defines the sampling mode to use (default is Texture.TRILINEAR_SAMPLINGMODE)
              */
             public samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE) {
             super(name);
@@ -801,7 +801,7 @@ import { BaseTexture, Texture, CubeTexture, HDRCubeTexture } from "Materials";
          * @param url defines the url of the file to load
          * @param noMipmap defines if the texture must not receive mipmaps (false by default)
          * @param invertY defines if you want to invert Y axis of the loaded texture (false by default)
-         * @param samplingMode defines the sampling mode to use (BABYLON.Texture.TRILINEAR_SAMPLINGMODE by default)
+         * @param samplingMode defines the sampling mode to use (Texture.TRILINEAR_SAMPLINGMODE by default)
          * @returns a new TextureAssetTask object
          */
         public addTextureTask(taskName: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE): TextureAssetTask {

+ 1 - 0
src/abstractScene.ts

@@ -10,6 +10,7 @@ import { MultiMaterial, Material, BaseTexture } from "Materials";
 import { ActionManager } from "Actions";
 import { Camera } from "Cameras";
 import { Light } from "Lights";
+import { Node } from "Node";
 
     /**
      * Defines how the parser contract is defined.

+ 5 - 1
src/assetContainer.ts

@@ -1,3 +1,7 @@
+import { AbstractScene } from "abstractScene";
+import { Scene } from "scene";
+import { Mesh } from "Mesh";
+
     /**
      * Set of assets to keep when moving a scene into an asset container.
      */
@@ -171,7 +175,7 @@
          * @returns the root mesh
          */
         public createRootMesh() {
-            var rootMesh = new BABYLON.Mesh("assetContainerRootMesh", this.scene);
+            var rootMesh = new Mesh("assetContainerRootMesh", this.scene);
             this.meshes.forEach((m) => {
                 if (!m.parent) {
                     rootMesh.addChild(m);

+ 9 - 1
src/node.ts

@@ -1,3 +1,11 @@
+import { Animation, Animatable, AnimationRange, AnimationPropertiesOverride } from "Animations";
+import { Scene } from "scene";
+import { Nullable } from "types";
+import { Matrix } from "Math";
+import { Engine } from "Engine";
+import { AbstractMesh, TransformNode } from "Mesh";
+import { IBehaviorAware, Behavior } from "Behaviors";
+import { Observable, Observer } from "Tools";
     /**
      * Defines how a node can be built from a string name.
      */
@@ -362,7 +370,7 @@
         /** @hidden */
         public updateCache(force?: boolean): void {
             if (!force && this.isSynchronized()) {
-                return;
+                return;
             }
 
             this._cache.parent = this.parent;

+ 2 - 2
src/scene.ts

@@ -1264,7 +1264,7 @@ import { Ray } from "Culling";
             }
 
             //collision coordinator initialization. For now legacy per default.
-            this.workerCollisions = false; //(!!Worker && (!!BABYLON.CollisionWorker || BABYLON.WorkerIncluded));
+            this.workerCollisions = false; //(!!Worker && (!!CollisionWorker || WorkerIncluded));
 
             // Uniform Buffer
             this._createUbo();
@@ -5314,7 +5314,7 @@ import { Ray } from "Culling";
         // Tags
         private _getByTags(list: any[], tagsQuery: string, forEach?: (item: any) => void): any[] {
             if (tagsQuery === undefined) {
-                // returns the complete list (could be done with BABYLON.Tags.MatchesQuery but no need to have a for-loop here)
+                // returns the complete list (could be done with Tags.MatchesQuery but no need to have a for-loop here)
                 return list;
             }