Procházet zdrojové kódy

Removing BABYLON references

part 2
Raanan Weber před 10 roky
rodič
revize
107a2a66ad

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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