瀏覽代碼

Merge pull request #3036 from RaananW/cleanup-references

Cleaning up reference tags
David Catuhe 7 年之前
父節點
當前提交
95b5f2853f

+ 97 - 99
src/Bones/babylon.bone.ts

@@ -1,6 +1,4 @@
-/// <reference path="..\babylon.node.ts" />
-
-module BABYLON {
+module BABYLON {
     export class Bone extends Node {
     export class Bone extends Node {
 
 
         private static _tmpVecs: Vector3[] = [Vector3.Zero(), Vector3.Zero()];
         private static _tmpVecs: Vector3[] = [Vector3.Zero(), Vector3.Zero()];
@@ -41,8 +39,8 @@ module BABYLON {
             }
             }
         }
         }
 
 
-        constructor(public name: string, skeleton: Skeleton, parentBone: Nullable<Bone> = null, localMatrix: Nullable<Matrix> = null, 
-                    restPose: Nullable<Matrix> = null, baseMatrix: Nullable<Matrix> = null, index: Nullable<number> = null) {
+        constructor(public name: string, skeleton: Skeleton, parentBone: Nullable<Bone> = null, localMatrix: Nullable<Matrix> = null,
+            restPose: Nullable<Matrix> = null, baseMatrix: Nullable<Matrix> = null, index: Nullable<number> = null) {
             super(name, skeleton.getScene());
             super(name, skeleton.getScene());
             this._skeleton = skeleton;
             this._skeleton = skeleton;
             this._localMatrix = localMatrix ? localMatrix : Matrix.Identity();
             this._localMatrix = localMatrix ? localMatrix : Matrix.Identity();
@@ -99,7 +97,7 @@ module BABYLON {
 
 
         public getRestPose(): Matrix {
         public getRestPose(): Matrix {
             return this._restPose;
             return this._restPose;
-        }      
+        }
 
 
         public returnToRest(): void {
         public returnToRest(): void {
             this.updateMatrix(this._restPose.clone());
             this.updateMatrix(this._restPose.clone());
@@ -202,21 +200,21 @@ module BABYLON {
             var from = sourceRange.from;
             var from = sourceRange.from;
             var to = sourceRange.to;
             var to = sourceRange.to;
             var sourceKeys = source.animations[0].getKeys();
             var sourceKeys = source.animations[0].getKeys();
-            
+
             // rescaling prep
             // rescaling prep
             var sourceBoneLength = source.length;
             var sourceBoneLength = source.length;
             var sourceParent = source.getParent();
             var sourceParent = source.getParent();
             var parent = this.getParent();
             var parent = this.getParent();
             var parentScalingReqd = rescaleAsRequired && sourceParent && sourceBoneLength && this.length && sourceBoneLength !== this.length;
             var parentScalingReqd = rescaleAsRequired && sourceParent && sourceBoneLength && this.length && sourceBoneLength !== this.length;
             var parentRatio = parentScalingReqd && parent && sourceParent ? parent.length / sourceParent.length : 1;
             var parentRatio = parentScalingReqd && parent && sourceParent ? parent.length / sourceParent.length : 1;
-            
-            var dimensionsScalingReqd = rescaleAsRequired && !parent && skelDimensionsRatio && (skelDimensionsRatio.x !== 1 || skelDimensionsRatio.y !== 1 || skelDimensionsRatio.z !== 1);           
-            
+
+            var dimensionsScalingReqd = rescaleAsRequired && !parent && skelDimensionsRatio && (skelDimensionsRatio.x !== 1 || skelDimensionsRatio.y !== 1 || skelDimensionsRatio.z !== 1);
+
             var destKeys = this.animations[0].getKeys();
             var destKeys = this.animations[0].getKeys();
-            
+
             // loop vars declaration
             // loop vars declaration
             var orig: { frame: number, value: Matrix };
             var orig: { frame: number, value: Matrix };
-            var origTranslation : Vector3;
+            var origTranslation: Vector3;
             var mat: Matrix;
             var mat: Matrix;
 
 
             for (var key = 0, nKeys = sourceKeys.length; key < nKeys; key++) {
             for (var key = 0, nKeys = sourceKeys.length; key < nKeys; key++) {
@@ -224,20 +222,20 @@ module BABYLON {
                 if (orig.frame >= from && orig.frame <= to) {
                 if (orig.frame >= from && orig.frame <= to) {
                     if (rescaleAsRequired) {
                     if (rescaleAsRequired) {
                         mat = orig.value.clone();
                         mat = orig.value.clone();
-                        
+
                         // scale based on parent ratio, when bone has parent
                         // scale based on parent ratio, when bone has parent
                         if (parentScalingReqd) {
                         if (parentScalingReqd) {
                             origTranslation = mat.getTranslation();
                             origTranslation = mat.getTranslation();
                             mat.setTranslation(origTranslation.scaleInPlace(parentRatio));
                             mat.setTranslation(origTranslation.scaleInPlace(parentRatio));
-                            
-                        // scale based on skeleton dimension ratio when root bone, and value is passed
+
+                            // scale based on skeleton dimension ratio when root bone, and value is passed
                         } else if (dimensionsScalingReqd && skelDimensionsRatio) {
                         } else if (dimensionsScalingReqd && skelDimensionsRatio) {
                             origTranslation = mat.getTranslation();
                             origTranslation = mat.getTranslation();
-                            mat.setTranslation(origTranslation.multiplyInPlace(skelDimensionsRatio));                            
+                            mat.setTranslation(origTranslation.multiplyInPlace(skelDimensionsRatio));
 
 
-                        // use original when root bone, and no data for skelDimensionsRatio
+                            // use original when root bone, and no data for skelDimensionsRatio
                         } else {
                         } else {
-                            mat = orig.value;                            
+                            mat = orig.value;
                         }
                         }
                     } else {
                     } else {
                         mat = orig.value;
                         mat = orig.value;
@@ -258,7 +256,7 @@ module BABYLON {
         public translate(vec: Vector3, space = Space.LOCAL, mesh?: AbstractMesh): void {
         public translate(vec: Vector3, space = Space.LOCAL, mesh?: AbstractMesh): void {
             var lm = this.getLocalMatrix();
             var lm = this.getLocalMatrix();
 
 
-            if(space == Space.LOCAL){
+            if (space == Space.LOCAL) {
                 lm.m[12] += vec.x;
                 lm.m[12] += vec.x;
                 lm.m[13] += vec.y;
                 lm.m[13] += vec.y;
                 lm.m[14] += vec.z;
                 lm.m[14] += vec.z;
@@ -266,7 +264,7 @@ module BABYLON {
                 var wm: Nullable<Matrix> = null;
                 var wm: Nullable<Matrix> = null;
 
 
                 //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()
                 //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()
-                if (mesh){
+                if (mesh) {
                     wm = mesh.getWorldMatrix();
                     wm = mesh.getWorldMatrix();
                 }
                 }
 
 
@@ -297,7 +295,7 @@ module BABYLON {
             }
             }
 
 
             this.markAsDirty();
             this.markAsDirty();
-	        
+
         }
         }
 
 
         /**
         /**
@@ -318,7 +316,7 @@ module BABYLON {
                 var wm: Nullable<Matrix> = null;
                 var wm: Nullable<Matrix> = null;
 
 
                 //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()
                 //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()
-                if(mesh){
+                if (mesh) {
                     wm = mesh.getWorldMatrix();
                     wm = mesh.getWorldMatrix();
                 }
                 }
 
 
@@ -346,7 +344,7 @@ module BABYLON {
             }
             }
 
 
             this.markAsDirty();
             this.markAsDirty();
-	        
+
         }
         }
 
 
         /**
         /**
@@ -354,7 +352,7 @@ module BABYLON {
          * @param position The position to set the bone.
          * @param position The position to set the bone.
          * @param mesh The mesh that this bone is attached to.
          * @param mesh The mesh that this bone is attached to.
          */
          */
-        public setAbsolutePosition(position:Vector3, mesh?: AbstractMesh){
+        public setAbsolutePosition(position: Vector3, mesh?: AbstractMesh) {
 
 
             this.setPosition(position, Space.WORLD, mesh);
             this.setPosition(position, Space.WORLD, mesh);
 
 
@@ -371,9 +369,9 @@ module BABYLON {
 
 
             if (this.animations[0] && !this.animations[0].hasRunningRuntimeAnimations) {
             if (this.animations[0] && !this.animations[0].hasRunningRuntimeAnimations) {
                 if (!scaleChildren) {
                 if (!scaleChildren) {
-                    this._negateScaleChildren.x = 1/x;
-                    this._negateScaleChildren.y = 1/y;
-                    this._negateScaleChildren.z = 1/z;
+                    this._negateScaleChildren.x = 1 / x;
+                    this._negateScaleChildren.y = 1 / y;
+                    this._negateScaleChildren.z = 1 / z;
                 }
                 }
                 this._syncScaleVector();
                 this._syncScaleVector();
             }
             }
@@ -390,7 +388,7 @@ module BABYLON {
          * @param scaleChildren Set this to true if children of the bone should be scaled.
          * @param scaleChildren Set this to true if children of the bone should be scaled.
          */
          */
         public scale(x: number, y: number, z: number, scaleChildren = false): void {
         public scale(x: number, y: number, z: number, scaleChildren = false): void {
-	
+
             var locMat = this.getLocalMatrix();
             var locMat = this.getLocalMatrix();
             var origLocMat = Bone._tmpMats[0];
             var origLocMat = Bone._tmpMats[0];
             origLocMat.copyFrom(locMat);
             origLocMat.copyFrom(locMat);
@@ -414,14 +412,14 @@ module BABYLON {
 
 
             if (parent) {
             if (parent) {
                 locMat.multiplyToRef(parent.getAbsoluteTransform(), this.getAbsoluteTransform());
                 locMat.multiplyToRef(parent.getAbsoluteTransform(), this.getAbsoluteTransform());
-            }else {
+            } else {
                 this.getAbsoluteTransform().copyFrom(locMat);
                 this.getAbsoluteTransform().copyFrom(locMat);
             }
             }
 
 
             var len = this.children.length;
             var len = this.children.length;
 
 
             scaleMat.invert();
             scaleMat.invert();
-            
+
             for (var i = 0; i < len; i++) {
             for (var i = 0; i < len; i++) {
                 var child = this.children[i];
                 var child = this.children[i];
                 var cm = child.getLocalMatrix();
                 var cm = child.getLocalMatrix();
@@ -433,12 +431,12 @@ module BABYLON {
             }
             }
 
 
             this.computeAbsoluteTransforms();
             this.computeAbsoluteTransforms();
-            
+
             if (scaleChildren) {
             if (scaleChildren) {
                 for (var i = 0; i < len; i++) {
                 for (var i = 0; i < len; i++) {
                     this.children[i].scale(x, y, z, scaleChildren);
                     this.children[i].scale(x, y, z, scaleChildren);
                 }
                 }
-            }          
+            }
 
 
             this.markAsDirty();
             this.markAsDirty();
 
 
@@ -453,18 +451,18 @@ module BABYLON {
          * @param mesh The mesh that this bone is attached to.  This is only used in world space.
          * @param mesh The mesh that this bone is attached to.  This is only used in world space.
          */
          */
         public setYawPitchRoll(yaw: number, pitch: number, roll: number, space = Space.LOCAL, mesh?: AbstractMesh): void {
         public setYawPitchRoll(yaw: number, pitch: number, roll: number, space = Space.LOCAL, mesh?: AbstractMesh): void {
-	
+
             var rotMat = Bone._tmpMats[0];
             var rotMat = Bone._tmpMats[0];
             Matrix.RotationYawPitchRollToRef(yaw, pitch, roll, rotMat);
             Matrix.RotationYawPitchRollToRef(yaw, pitch, roll, rotMat);
-            
+
             var rotMatInv = Bone._tmpMats[1];
             var rotMatInv = Bone._tmpMats[1];
-            
+
             this._getNegativeRotationToRef(rotMatInv, space, mesh);
             this._getNegativeRotationToRef(rotMatInv, space, mesh);
-	
+
             rotMatInv.multiplyToRef(rotMat, rotMat);
             rotMatInv.multiplyToRef(rotMat, rotMat);
-            
+
             this._rotateWithMatrix(rotMat, space, mesh);
             this._rotateWithMatrix(rotMat, space, mesh);
-            
+
         }
         }
 
 
         /**
         /**
@@ -475,16 +473,16 @@ module BABYLON {
          * @param mesh The mesh that this bone is attached to.  This is only used in world space.
          * @param mesh The mesh that this bone is attached to.  This is only used in world space.
          */
          */
         public rotate(axis: Vector3, amount: number, space = Space.LOCAL, mesh?: AbstractMesh): void {
         public rotate(axis: Vector3, amount: number, space = Space.LOCAL, mesh?: AbstractMesh): void {
-            
+
             var rmat = Bone._tmpMats[0];
             var rmat = Bone._tmpMats[0];
             rmat.m[12] = 0;
             rmat.m[12] = 0;
             rmat.m[13] = 0;
             rmat.m[13] = 0;
             rmat.m[14] = 0;
             rmat.m[14] = 0;
-            
+
             Matrix.RotationAxisToRef(axis, amount, rmat);
             Matrix.RotationAxisToRef(axis, amount, rmat);
-            
+
             this._rotateWithMatrix(rmat, space, mesh);
             this._rotateWithMatrix(rmat, space, mesh);
-            
+
         }
         }
 
 
         /**
         /**
@@ -499,9 +497,9 @@ module BABYLON {
             var rotMat = Bone._tmpMats[0];
             var rotMat = Bone._tmpMats[0];
             Matrix.RotationAxisToRef(axis, angle, rotMat);
             Matrix.RotationAxisToRef(axis, angle, rotMat);
             var rotMatInv = Bone._tmpMats[1];
             var rotMatInv = Bone._tmpMats[1];
-            
+
             this._getNegativeRotationToRef(rotMatInv, space, mesh);
             this._getNegativeRotationToRef(rotMatInv, space, mesh);
-            
+
             rotMatInv.multiplyToRef(rotMat, rotMat);
             rotMatInv.multiplyToRef(rotMat, rotMat);
             this._rotateWithMatrix(rotMat, space, mesh);
             this._rotateWithMatrix(rotMat, space, mesh);
 
 
@@ -514,7 +512,7 @@ module BABYLON {
          * @param mesh The mesh that this bone is attached to.  This is only used in world space.
          * @param mesh The mesh that this bone is attached to.  This is only used in world space.
          */
          */
         public setRotation(rotation: Vector3, space = Space.LOCAL, mesh?: AbstractMesh): void {
         public setRotation(rotation: Vector3, space = Space.LOCAL, mesh?: AbstractMesh): void {
-            
+
             this.setYawPitchRoll(rotation.y, rotation.x, rotation.z, space, mesh);
             this.setYawPitchRoll(rotation.y, rotation.x, rotation.z, space, mesh);
 
 
         }
         }
@@ -549,14 +547,14 @@ module BABYLON {
         public setRotationMatrix(rotMat: Matrix, space = Space.LOCAL, mesh?: AbstractMesh): void {
         public setRotationMatrix(rotMat: Matrix, space = Space.LOCAL, mesh?: AbstractMesh): void {
 
 
             var rotMatInv = Bone._tmpMats[0];
             var rotMatInv = Bone._tmpMats[0];
-            
+
             this._getNegativeRotationToRef(rotMatInv, space, mesh);
             this._getNegativeRotationToRef(rotMatInv, space, mesh);
 
 
             var rotMat2 = Bone._tmpMats[1];
             var rotMat2 = Bone._tmpMats[1];
             rotMat2.copyFrom(rotMat);
             rotMat2.copyFrom(rotMat);
 
 
             rotMatInv.multiplyToRef(rotMat, rotMat2);
             rotMatInv.multiplyToRef(rotMat, rotMat2);
-            
+
             this._rotateWithMatrix(rotMat2, space, mesh);
             this._rotateWithMatrix(rotMat2, space, mesh);
 
 
         }
         }
@@ -576,10 +574,10 @@ module BABYLON {
                     if (mesh) {
                     if (mesh) {
                         parentScale.copyFrom(mesh.getWorldMatrix());
                         parentScale.copyFrom(mesh.getWorldMatrix());
                         parent.getAbsoluteTransform().multiplyToRef(parentScale, parentScale);
                         parent.getAbsoluteTransform().multiplyToRef(parentScale, parentScale);
-                    }else {
+                    } else {
                         parentScale.copyFrom(parent.getAbsoluteTransform());
                         parentScale.copyFrom(parent.getAbsoluteTransform());
                     }
                     }
-                }else {
+                } else {
                     parentScale = parent._scaleMatrix;
                     parentScale = parent._scaleMatrix;
                 }
                 }
                 parentScaleInv.copyFrom(parentScale);
                 parentScaleInv.copyFrom(parentScale);
@@ -587,7 +585,7 @@ module BABYLON {
                 lmat.multiplyToRef(parentScale, lmat);
                 lmat.multiplyToRef(parentScale, lmat);
                 lmat.multiplyToRef(rmat, lmat);
                 lmat.multiplyToRef(rmat, lmat);
                 lmat.multiplyToRef(parentScaleInv, lmat);
                 lmat.multiplyToRef(parentScaleInv, lmat);
-            }else {
+            } else {
                 if (space == Space.WORLD && mesh) {
                 if (space == Space.WORLD && mesh) {
                     parentScale.copyFrom(mesh.getWorldMatrix());
                     parentScale.copyFrom(mesh.getWorldMatrix());
                     parentScaleInv.copyFrom(parentScale);
                     parentScaleInv.copyFrom(parentScale);
@@ -595,7 +593,7 @@ module BABYLON {
                     lmat.multiplyToRef(parentScale, lmat);
                     lmat.multiplyToRef(parentScale, lmat);
                     lmat.multiplyToRef(rmat, lmat);
                     lmat.multiplyToRef(rmat, lmat);
                     lmat.multiplyToRef(parentScaleInv, lmat);
                     lmat.multiplyToRef(parentScaleInv, lmat);
-                }else {
+                } else {
                     lmat.multiplyToRef(rmat, lmat);
                     lmat.multiplyToRef(rmat, lmat);
                 }
                 }
             }
             }
@@ -616,7 +614,7 @@ module BABYLON {
                 var scaleMatrix = Bone._tmpMats[2];
                 var scaleMatrix = Bone._tmpMats[2];
                 scaleMatrix.copyFrom(this._scaleMatrix);
                 scaleMatrix.copyFrom(this._scaleMatrix);
                 rotMatInv.copyFrom(this.getAbsoluteTransform());
                 rotMatInv.copyFrom(this.getAbsoluteTransform());
-                
+
                 if (mesh) {
                 if (mesh) {
                     rotMatInv.multiplyToRef(mesh.getWorldMatrix(), rotMatInv);
                     rotMatInv.multiplyToRef(mesh.getWorldMatrix(), rotMatInv);
                     var meshScale = Bone._tmpMats[3];
                     var meshScale = Bone._tmpMats[3];
@@ -652,9 +650,9 @@ module BABYLON {
          * @returns the scale of the bone
          * @returns the scale of the bone
          */
          */
         public getScale(): Vector3 {
         public getScale(): Vector3 {
-            
+
             return this._scaleVector.clone();
             return this._scaleVector.clone();
-            
+
         }
         }
 
 
         /**
         /**
@@ -662,9 +660,9 @@ module BABYLON {
          * @param result The vector3 to copy the scale to
          * @param result The vector3 to copy the scale to
          */
          */
         public getScaleToRef(result: Vector3): void {
         public getScaleToRef(result: Vector3): void {
-	
+
             result.copyFrom(this._scaleVector);
             result.copyFrom(this._scaleVector);
-            
+
         }
         }
 
 
         /**
         /**
@@ -689,28 +687,28 @@ module BABYLON {
          */
          */
         public getPositionToRef(space = Space.LOCAL, mesh: Nullable<AbstractMesh>, result: Vector3): void {
         public getPositionToRef(space = Space.LOCAL, mesh: Nullable<AbstractMesh>, result: Vector3): void {
 
 
-            if (space == Space.LOCAL){
+            if (space == Space.LOCAL) {
                 var lm = this.getLocalMatrix();
                 var lm = this.getLocalMatrix();
 
 
                 result.x = lm.m[12];
                 result.x = lm.m[12];
                 result.y = lm.m[13];
                 result.y = lm.m[13];
                 result.z = lm.m[14];
                 result.z = lm.m[14];
-            } else {               
+            } else {
                 var wm: Nullable<Matrix> = null;
                 var wm: Nullable<Matrix> = null;
-                
+
                 //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()
                 //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()
-                if (mesh){
+                if (mesh) {
                     wm = mesh.getWorldMatrix();
                     wm = mesh.getWorldMatrix();
                 }
                 }
-                
+
                 this._skeleton.computeAbsoluteTransforms();
                 this._skeleton.computeAbsoluteTransforms();
-                
+
                 var tmat = Bone._tmpMats[0];
                 var tmat = Bone._tmpMats[0];
 
 
                 if (mesh && wm) {
                 if (mesh && wm) {
                     tmat.copyFrom(this.getAbsoluteTransform());
                     tmat.copyFrom(this.getAbsoluteTransform());
                     tmat.multiplyToRef(wm, tmat);
                     tmat.multiplyToRef(wm, tmat);
-                }else{
+                } else {
                     tmat = this.getAbsoluteTransform();
                     tmat = this.getAbsoluteTransform();
                 }
                 }
 
 
@@ -758,8 +756,8 @@ module BABYLON {
 
 
                 var poseMatrix = this._skeleton.getPoseMatrix();
                 var poseMatrix = this._skeleton.getPoseMatrix();
 
 
-                if(poseMatrix){
-                    this._absoluteTransform.multiplyToRef(poseMatrix, this._absoluteTransform);					
+                if (poseMatrix) {
+                    this._absoluteTransform.multiplyToRef(poseMatrix, this._absoluteTransform);
                 }
                 }
             }
             }
 
 
@@ -772,29 +770,29 @@ module BABYLON {
 
 
         }
         }
 
 
-        private _syncScaleVector(): void{
-            
+        private _syncScaleVector(): void {
+
             var lm = this.getLocalMatrix();
             var lm = this.getLocalMatrix();
-            
+
             var xsq = (lm.m[0] * lm.m[0] + lm.m[1] * lm.m[1] + lm.m[2] * lm.m[2]);
             var xsq = (lm.m[0] * lm.m[0] + lm.m[1] * lm.m[1] + lm.m[2] * lm.m[2]);
             var ysq = (lm.m[4] * lm.m[4] + lm.m[5] * lm.m[5] + lm.m[6] * lm.m[6]);
             var ysq = (lm.m[4] * lm.m[4] + lm.m[5] * lm.m[5] + lm.m[6] * lm.m[6]);
             var zsq = (lm.m[8] * lm.m[8] + lm.m[9] * lm.m[9] + lm.m[10] * lm.m[10]);
             var zsq = (lm.m[8] * lm.m[8] + lm.m[9] * lm.m[9] + lm.m[10] * lm.m[10]);
-            
+
             var xs = lm.m[0] * lm.m[1] * lm.m[2] * lm.m[3] < 0 ? -1 : 1;
             var xs = lm.m[0] * lm.m[1] * lm.m[2] * lm.m[3] < 0 ? -1 : 1;
             var ys = lm.m[4] * lm.m[5] * lm.m[6] * lm.m[7] < 0 ? -1 : 1;
             var ys = lm.m[4] * lm.m[5] * lm.m[6] * lm.m[7] < 0 ? -1 : 1;
             var zs = lm.m[8] * lm.m[9] * lm.m[10] * lm.m[11] < 0 ? -1 : 1;
             var zs = lm.m[8] * lm.m[9] * lm.m[10] * lm.m[11] < 0 ? -1 : 1;
-            
+
             this._scaleVector.x = xs * Math.sqrt(xsq);
             this._scaleVector.x = xs * Math.sqrt(xsq);
             this._scaleVector.y = ys * Math.sqrt(ysq);
             this._scaleVector.y = ys * Math.sqrt(ysq);
             this._scaleVector.z = zs * Math.sqrt(zsq);
             this._scaleVector.z = zs * Math.sqrt(zsq);
-            
+
             if (this._parent) {
             if (this._parent) {
                 this._scaleVector.x /= this._parent._negateScaleChildren.x;
                 this._scaleVector.x /= this._parent._negateScaleChildren.x;
                 this._scaleVector.y /= this._parent._negateScaleChildren.y;
                 this._scaleVector.y /= this._parent._negateScaleChildren.y;
                 this._scaleVector.z /= this._parent._negateScaleChildren.z;
                 this._scaleVector.z /= this._parent._negateScaleChildren.z;
             }
             }
-            
-            Matrix.FromValuesToRef(this._scaleVector.x, 0, 0, 0, 0,  this._scaleVector.y, 0, 0, 0, 0,  this._scaleVector.z, 0, 0, 0, 0, 1, this._scaleMatrix);
+
+            Matrix.FromValuesToRef(this._scaleVector.x, 0, 0, 0, 0, this._scaleVector.y, 0, 0, 0, 0, this._scaleVector.z, 0, 0, 0, 0, 1, this._scaleMatrix);
 
 
         }
         }
 
 
@@ -804,12 +802,12 @@ module BABYLON {
          * @param mesh The mesh that this bone is attached to.
          * @param mesh The mesh that this bone is attached to.
          * @returns The world direction
          * @returns The world direction
          */
          */
-        public getDirection(localAxis: Vector3, mesh: Nullable<AbstractMesh> = null): Vector3{
+        public getDirection(localAxis: Vector3, mesh: Nullable<AbstractMesh> = null): Vector3 {
 
 
             var result = Vector3.Zero();
             var result = Vector3.Zero();
 
 
             this.getDirectionToRef(localAxis, mesh, result);
             this.getDirectionToRef(localAxis, mesh, result);
-            
+
             return result;
             return result;
 
 
         }
         }
@@ -825,12 +823,12 @@ module BABYLON {
             var wm: Nullable<Matrix> = null;
             var wm: Nullable<Matrix> = null;
 
 
             //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()
             //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()
-            if(mesh){
+            if (mesh) {
                 wm = mesh.getWorldMatrix();
                 wm = mesh.getWorldMatrix();
             }
             }
 
 
             this._skeleton.computeAbsoluteTransforms();
             this._skeleton.computeAbsoluteTransforms();
-            
+
             var mat = Bone._tmpMats[0];
             var mat = Bone._tmpMats[0];
 
 
             mat.copyFrom(this.getAbsoluteTransform());
             mat.copyFrom(this.getAbsoluteTransform());
@@ -856,7 +854,7 @@ module BABYLON {
             var result = Vector3.Zero();
             var result = Vector3.Zero();
 
 
             this.getRotationToRef(space, mesh, result);
             this.getRotationToRef(space, mesh, result);
-            
+
             return result;
             return result;
 
 
         }
         }
@@ -872,7 +870,7 @@ module BABYLON {
             var quat = Bone._tmpQuat;
             var quat = Bone._tmpQuat;
 
 
             this.getRotationQuaternionToRef(space, mesh, quat);
             this.getRotationQuaternionToRef(space, mesh, quat);
-            
+
             quat.toEulerAnglesToRef(result);
             quat.toEulerAnglesToRef(result);
 
 
         }
         }
@@ -899,20 +897,20 @@ module BABYLON {
          * @param mesh The mesh that this bone is attached to.  This is only used in world space.
          * @param mesh The mesh that this bone is attached to.  This is only used in world space.
          * @param result The quaternion that the rotation should be copied to.
          * @param result The quaternion that the rotation should be copied to.
          */
          */
-        public getRotationQuaternionToRef(space = Space.LOCAL, mesh: Nullable<AbstractMesh> = null, result: Quaternion): void{
+        public getRotationQuaternionToRef(space = Space.LOCAL, mesh: Nullable<AbstractMesh> = null, result: Quaternion): void {
 
 
-            if(space == Space.LOCAL){
+            if (space == Space.LOCAL) {
 
 
                 this.getLocalMatrix().decompose(Bone._tmpVecs[0], result, Bone._tmpVecs[1]);
                 this.getLocalMatrix().decompose(Bone._tmpVecs[0], result, Bone._tmpVecs[1]);
 
 
-            }else{
+            } else {
 
 
                 var mat = Bone._tmpMats[0];
                 var mat = Bone._tmpMats[0];
                 var amat = this.getAbsoluteTransform();
                 var amat = this.getAbsoluteTransform();
 
 
-                if(mesh){
+                if (mesh) {
                     amat.multiplyToRef(mesh.getWorldMatrix(), mat);
                     amat.multiplyToRef(mesh.getWorldMatrix(), mat);
-                }else{
+                } else {
                     mat.copyFrom(amat);
                     mat.copyFrom(amat);
                 }
                 }
 
 
@@ -947,20 +945,20 @@ module BABYLON {
          * @param mesh The mesh that this bone is attached to.  This is only used in world space.
          * @param mesh The mesh that this bone is attached to.  This is only used in world space.
          * @param result The quaternion that the rotation should be copied to.
          * @param result The quaternion that the rotation should be copied to.
          */
          */
-        public getRotationMatrixToRef(space = Space.LOCAL, mesh: AbstractMesh, result: Matrix): void{
+        public getRotationMatrixToRef(space = Space.LOCAL, mesh: AbstractMesh, result: Matrix): void {
 
 
-            if(space == Space.LOCAL){
+            if (space == Space.LOCAL) {
 
 
                 this.getLocalMatrix().getRotationMatrixToRef(result);
                 this.getLocalMatrix().getRotationMatrixToRef(result);
 
 
-            }else{
+            } else {
 
 
                 var mat = Bone._tmpMats[0];
                 var mat = Bone._tmpMats[0];
                 var amat = this.getAbsoluteTransform();
                 var amat = this.getAbsoluteTransform();
 
 
-                if(mesh){
+                if (mesh) {
                     amat.multiplyToRef(mesh.getWorldMatrix(), mat);
                     amat.multiplyToRef(mesh.getWorldMatrix(), mat);
-                }else{
+                } else {
                     mat.copyFrom(amat);
                     mat.copyFrom(amat);
                 }
                 }
 
 
@@ -969,7 +967,7 @@ module BABYLON {
                 mat.m[2] *= this._scalingDeterminant;
                 mat.m[2] *= this._scalingDeterminant;
 
 
                 mat.getRotationMatrixToRef(result);
                 mat.getRotationMatrixToRef(result);
-                
+
             }
             }
 
 
         }
         }
@@ -980,7 +978,7 @@ module BABYLON {
          * @param mesh The mesh that this bone is attached to.
          * @param mesh The mesh that this bone is attached to.
          * @returns The world position
          * @returns The world position
          */
          */
-        public getAbsolutePositionFromLocal(position:Vector3, mesh: Nullable<AbstractMesh> = null): Vector3{
+        public getAbsolutePositionFromLocal(position: Vector3, mesh: Nullable<AbstractMesh> = null): Vector3 {
 
 
             var result = Vector3.Zero();
             var result = Vector3.Zero();
 
 
@@ -996,23 +994,23 @@ module BABYLON {
          * @param mesh The mesh that this bone is attached to.
          * @param mesh The mesh that this bone is attached to.
          * @param result The vector3 that the world position should be copied to.
          * @param result The vector3 that the world position should be copied to.
          */
          */
-        public getAbsolutePositionFromLocalToRef(position:Vector3, mesh: Nullable<AbstractMesh> = null, result:Vector3): void{
+        public getAbsolutePositionFromLocalToRef(position: Vector3, mesh: Nullable<AbstractMesh> = null, result: Vector3): void {
 
 
             var wm: Nullable<Matrix> = null;
             var wm: Nullable<Matrix> = null;
 
 
             //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()
             //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()
-            if(mesh){
+            if (mesh) {
                 wm = mesh.getWorldMatrix();
                 wm = mesh.getWorldMatrix();
             }
             }
 
 
             this._skeleton.computeAbsoluteTransforms();
             this._skeleton.computeAbsoluteTransforms();
 
 
             var tmat = Bone._tmpMats[0];
             var tmat = Bone._tmpMats[0];
-            
+
             if (mesh && wm) {
             if (mesh && wm) {
                 tmat.copyFrom(this.getAbsoluteTransform());
                 tmat.copyFrom(this.getAbsoluteTransform());
                 tmat.multiplyToRef(wm, tmat);
                 tmat.multiplyToRef(wm, tmat);
-            }else{
+            } else {
                 tmat = this.getAbsoluteTransform();
                 tmat = this.getAbsoluteTransform();
             }
             }
 
 
@@ -1026,7 +1024,7 @@ module BABYLON {
          * @param mesh The mesh that this bone is attached to.
          * @param mesh The mesh that this bone is attached to.
          * @returns The local position
          * @returns The local position
          */
          */
-        public getLocalPositionFromAbsolute(position:Vector3, mesh: Nullable<AbstractMesh> = null): Vector3{
+        public getLocalPositionFromAbsolute(position: Vector3, mesh: Nullable<AbstractMesh> = null): Vector3 {
 
 
             var result = Vector3.Zero();
             var result = Vector3.Zero();
 
 
@@ -1042,12 +1040,12 @@ module BABYLON {
          * @param mesh The mesh that this bone is attached to.
          * @param mesh The mesh that this bone is attached to.
          * @param result The vector3 that the local position should be copied to.
          * @param result The vector3 that the local position should be copied to.
          */
          */
-        public getLocalPositionFromAbsoluteToRef(position:Vector3, mesh: Nullable<AbstractMesh> = null, result:Vector3): void{
+        public getLocalPositionFromAbsoluteToRef(position: Vector3, mesh: Nullable<AbstractMesh> = null, result: Vector3): void {
 
 
             var wm: Nullable<Matrix> = null;
             var wm: Nullable<Matrix> = null;
 
 
             //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()
             //mesh.getWorldMatrix() needs to be called before skeleton.computeAbsoluteTransforms()
-            if(mesh){
+            if (mesh) {
                 wm = mesh.getWorldMatrix();
                 wm = mesh.getWorldMatrix();
             }
             }
 
 
@@ -1056,7 +1054,7 @@ module BABYLON {
             var tmat = Bone._tmpMats[0];
             var tmat = Bone._tmpMats[0];
 
 
             tmat.copyFrom(this.getAbsoluteTransform());
             tmat.copyFrom(this.getAbsoluteTransform());
-            
+
             if (mesh && wm) {
             if (mesh && wm) {
                 tmat.multiplyToRef(wm, tmat);
                 tmat.multiplyToRef(wm, tmat);
             }
             }

+ 23 - 26
src/Cameras/babylon.arcRotateCamera.ts

@@ -1,7 +1,4 @@
-/// <reference path="babylon.targetCamera.ts" />
-/// <reference path="..\Tools\babylon.tools.ts" />
-
-module BABYLON {
+module BABYLON {
     export class ArcRotateCamera extends TargetCamera {
     export class ArcRotateCamera extends TargetCamera {
         @serialize()
         @serialize()
         public alpha: number;
         public alpha: number;
@@ -88,7 +85,7 @@ module BABYLON {
             var pointers = <ArcRotateCameraPointersInput>this.inputs.attached["pointers"];
             var pointers = <ArcRotateCameraPointersInput>this.inputs.attached["pointers"];
             if (pointers)
             if (pointers)
                 return pointers.angularSensibilityY;
                 return pointers.angularSensibilityY;
-            
+
             return 0;
             return 0;
         }
         }
 
 
@@ -127,7 +124,7 @@ module BABYLON {
             if (pointers) {
             if (pointers) {
                 pointers.pinchDeltaPercentage = value;
                 pointers.pinchDeltaPercentage = value;
             }
             }
-        }        
+        }
 
 
         public get panningSensibility(): number {
         public get panningSensibility(): number {
             var pointers = <ArcRotateCameraPointersInput>this.inputs.attached["pointers"];
             var pointers = <ArcRotateCameraPointersInput>this.inputs.attached["pointers"];
@@ -226,7 +223,7 @@ module BABYLON {
             var mousewheel = <ArcRotateCameraMouseWheelInput>this.inputs.attached["mousewheel"];
             var mousewheel = <ArcRotateCameraMouseWheelInput>this.inputs.attached["mousewheel"];
             if (mousewheel)
             if (mousewheel)
                 mousewheel.wheelDeltaPercentage = value;
                 mousewheel.wheelDeltaPercentage = value;
-        }        
+        }
 
 
         //-- end properties for backward compatibility for inputs
         //-- end properties for backward compatibility for inputs
 
 
@@ -279,7 +276,7 @@ module BABYLON {
 
 
         public get framingBehavior(): Nullable<FramingBehavior> {
         public get framingBehavior(): Nullable<FramingBehavior> {
             return this._framingBehavior;
             return this._framingBehavior;
-        }        
+        }
 
 
         public get useFramingBehavior(): boolean {
         public get useFramingBehavior(): boolean {
             return this._framingBehavior != null;
             return this._framingBehavior != null;
@@ -297,13 +294,13 @@ module BABYLON {
                 this.removeBehavior(this._framingBehavior);
                 this.removeBehavior(this._framingBehavior);
                 this._framingBehavior = null;
                 this._framingBehavior = null;
             }
             }
-        }        
+        }
 
 
         private _autoRotationBehavior: Nullable<AutoRotationBehavior>;
         private _autoRotationBehavior: Nullable<AutoRotationBehavior>;
 
 
         public get autoRotationBehavior(): Nullable<AutoRotationBehavior> {
         public get autoRotationBehavior(): Nullable<AutoRotationBehavior> {
             return this._autoRotationBehavior;
             return this._autoRotationBehavior;
-        }   
+        }
 
 
         public get useAutoRotationBehavior(): boolean {
         public get useAutoRotationBehavior(): boolean {
             return this._autoRotationBehavior != null;
             return this._autoRotationBehavior != null;
@@ -317,14 +314,14 @@ module BABYLON {
             if (value) {
             if (value) {
                 this._autoRotationBehavior = new AutoRotationBehavior();
                 this._autoRotationBehavior = new AutoRotationBehavior();
                 this.addBehavior(this._autoRotationBehavior);
                 this.addBehavior(this._autoRotationBehavior);
-            } else if(this._autoRotationBehavior) {
+            } else if (this._autoRotationBehavior) {
                 this.removeBehavior(this._autoRotationBehavior);
                 this.removeBehavior(this._autoRotationBehavior);
                 this._autoRotationBehavior = null;
                 this._autoRotationBehavior = null;
             }
             }
-        }        
+        }
 
 
         public onMeshTargetChangedObservable = new Observable<AbstractMesh>();
         public onMeshTargetChangedObservable = new Observable<AbstractMesh>();
-        
+
         // Collisions
         // Collisions
         public onCollide: (collidedMesh: AbstractMesh) => void;
         public onCollide: (collidedMesh: AbstractMesh) => void;
         public checkCollisions = false;
         public checkCollisions = false;
@@ -382,7 +379,7 @@ module BABYLON {
 
 
         protected _getTargetPosition(): Vector3 {
         protected _getTargetPosition(): Vector3 {
             if (this._targetHost && this._targetHost.getAbsolutePosition) {
             if (this._targetHost && this._targetHost.getAbsolutePosition) {
-                var pos : Vector3 = this._targetHost.getAbsolutePosition();
+                var pos: Vector3 = this._targetHost.getAbsolutePosition();
                 if (this._targetBoundingCenter) {
                 if (this._targetBoundingCenter) {
                     pos.addToRef(this._targetBoundingCenter, this._target);
                     pos.addToRef(this._targetBoundingCenter, this._target);
                 } else {
                 } else {
@@ -399,7 +396,7 @@ module BABYLON {
             return this._target;
             return this._target;
         }
         }
 
 
-       // State
+        // State
 
 
         /**
         /**
          * Store current camera state (fov, position, etc..)
          * Store current camera state (fov, position, etc..)
@@ -407,7 +404,7 @@ module BABYLON {
         private _storedAlpha: number;
         private _storedAlpha: number;
         private _storedBeta: number;
         private _storedBeta: number;
         private _storedRadius: number;
         private _storedRadius: number;
-        private _storedTarget: Vector3;     
+        private _storedTarget: Vector3;
 
 
         public storeState(): Camera {
         public storeState(): Camera {
             this._storedAlpha = this.alpha;
             this._storedAlpha = this.alpha;
@@ -436,7 +433,7 @@ module BABYLON {
             this.inertialRadiusOffset = 0;
             this.inertialRadiusOffset = 0;
             this.inertialPanningX = 0;
             this.inertialPanningX = 0;
             this.inertialPanningY = 0;
             this.inertialPanningY = 0;
-        
+
             return true;
             return true;
         }
         }
 
 
@@ -618,8 +615,8 @@ module BABYLON {
 
 
         public setTarget(target: AbstractMesh | Vector3, toBoundingCenter = false, allowSamePosition = false): void {
         public setTarget(target: AbstractMesh | Vector3, toBoundingCenter = false, allowSamePosition = false): void {
 
 
-            if ((<any>target).getBoundingInfo){
-                if (toBoundingCenter){
+            if ((<any>target).getBoundingInfo) {
+                if (toBoundingCenter) {
                     this._targetBoundingCenter = (<any>target).getBoundingInfo().boundingBox.centerWorld.clone();
                     this._targetBoundingCenter = (<any>target).getBoundingInfo().boundingBox.centerWorld.clone();
                 } else {
                 } else {
                     this._targetBoundingCenter = null;
                     this._targetBoundingCenter = null;
@@ -632,7 +629,7 @@ module BABYLON {
                 var newTarget = <Vector3>target;
                 var newTarget = <Vector3>target;
                 var currentTarget = this._getTargetPosition();
                 var currentTarget = this._getTargetPosition();
                 if (currentTarget && !allowSamePosition && currentTarget.equals(newTarget)) {
                 if (currentTarget && !allowSamePosition && currentTarget.equals(newTarget)) {
-                   return;
+                    return;
                 }
                 }
                 this._targetHost = null;
                 this._targetHost = null;
                 this._target = newTarget;
                 this._target = newTarget;
@@ -740,7 +737,7 @@ module BABYLON {
         }
         }
 
 
         public focusOn(meshesOrMinMaxVectorAndDistance: AbstractMesh[] | { min: Vector3, max: Vector3, distance: number }, doNotUpdateMaxZ = false): void {
         public focusOn(meshesOrMinMaxVectorAndDistance: AbstractMesh[] | { min: Vector3, max: Vector3, distance: number }, doNotUpdateMaxZ = false): void {
-            var meshesOrMinMaxVector: { min: Vector3, max: Vector3};
+            var meshesOrMinMaxVector: { min: Vector3, max: Vector3 };
             var distance: number;
             var distance: number;
 
 
             if ((<any>meshesOrMinMaxVectorAndDistance).min === undefined) { // meshes
             if ((<any>meshesOrMinMaxVectorAndDistance).min === undefined) { // meshes
@@ -766,7 +763,7 @@ module BABYLON {
          * Override Camera.createRigCamera
          * Override Camera.createRigCamera
          */
          */
         public createRigCamera(name: string, cameraIndex: number): Camera {
         public createRigCamera(name: string, cameraIndex: number): Camera {
-            var alphaShift : number = 0;
+            var alphaShift: number = 0;
             switch (this.cameraRigMode) {
             switch (this.cameraRigMode) {
                 case Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH:
                 case Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH:
                 case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:
                 case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:
@@ -777,7 +774,7 @@ module BABYLON {
                 case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:
                 case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:
                     alphaShift = this._cameraRigParams.stereoHalfAngle * (cameraIndex === 0 ? -1 : 1);
                     alphaShift = this._cameraRigParams.stereoHalfAngle * (cameraIndex === 0 ? -1 : 1);
                     break;
                     break;
-           }
+            }
             var rigCam = new ArcRotateCamera(name, this.alpha + alphaShift, this.beta, this.radius, this._target, this.getScene());
             var rigCam = new ArcRotateCamera(name, this.alpha + alphaShift, this.beta, this.radius, this._target, this.getScene());
             rigCam._cameraRigParams = {};
             rigCam._cameraRigParams = {};
             return rigCam;
             return rigCam;
@@ -788,7 +785,7 @@ module BABYLON {
          * Override Camera._updateRigCameras
          * Override Camera._updateRigCameras
          */
          */
         public _updateRigCameras() {
         public _updateRigCameras() {
-            var camLeft  = <ArcRotateCamera>this._rigCameras[0];
+            var camLeft = <ArcRotateCamera>this._rigCameras[0];
             var camRight = <ArcRotateCamera>this._rigCameras[1];
             var camRight = <ArcRotateCamera>this._rigCameras[1];
 
 
             camLeft.beta = camRight.beta = this.beta;
             camLeft.beta = camRight.beta = this.beta;
@@ -799,11 +796,11 @@ module BABYLON {
                 case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:
                 case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:
                 case Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER:
                 case Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER:
                 case Camera.RIG_MODE_VR:
                 case Camera.RIG_MODE_VR:
-                    camLeft.alpha  = this.alpha - this._cameraRigParams.stereoHalfAngle;
+                    camLeft.alpha = this.alpha - this._cameraRigParams.stereoHalfAngle;
                     camRight.alpha = this.alpha + this._cameraRigParams.stereoHalfAngle;
                     camRight.alpha = this.alpha + this._cameraRigParams.stereoHalfAngle;
                     break;
                     break;
                 case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:
                 case Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:
-                    camLeft.alpha  = this.alpha + this._cameraRigParams.stereoHalfAngle;
+                    camLeft.alpha = this.alpha + this._cameraRigParams.stereoHalfAngle;
                     camRight.alpha = this.alpha - this._cameraRigParams.stereoHalfAngle;
                     camRight.alpha = this.alpha - this._cameraRigParams.stereoHalfAngle;
                     break;
                     break;
             }
             }

+ 0 - 2
src/Cameras/babylon.arcRotateCameraInputsManager.ts

@@ -1,5 +1,3 @@
-/// <reference path="..\Cameras\babylon.cameraInputsManager.ts" />
-
 module BABYLON {
 module BABYLON {
     export class ArcRotateCameraInputsManager extends CameraInputsManager<ArcRotateCamera> {
     export class ArcRotateCameraInputsManager extends CameraInputsManager<ArcRotateCamera> {
         constructor(camera: ArcRotateCamera) {
         constructor(camera: ArcRotateCamera) {

+ 0 - 2
src/Cameras/babylon.deviceOrientationCamera.ts

@@ -1,5 +1,3 @@
-/// <reference path="babylon.freeCamera.ts" />
-
 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 DeviceOrientationCamera extends FreeCamera {
     export class DeviceOrientationCamera extends FreeCamera {

+ 2 - 4
src/Cameras/babylon.followCamera.ts

@@ -1,6 +1,4 @@
-/// <reference path="babylon.targetCamera.ts" />
-
-module BABYLON {
+module BABYLON {
     export class FollowCamera extends TargetCamera {
     export class FollowCamera extends TargetCamera {
         @serialize()
         @serialize()
         public radius: number = 12;
         public radius: number = 12;
@@ -99,7 +97,7 @@ module BABYLON {
             this._cartesianCoordinates.y = this.radius * Math.sin(this.beta);
             this._cartesianCoordinates.y = this.radius * Math.sin(this.beta);
             this._cartesianCoordinates.z = this.radius * Math.sin(this.alpha) * Math.cos(this.beta);
             this._cartesianCoordinates.z = this.radius * Math.sin(this.alpha) * Math.cos(this.beta);
 
 
-            var targetPosition = this.target.getAbsolutePosition();            
+            var targetPosition = this.target.getAbsolutePosition();
             this.position = targetPosition.add(this._cartesianCoordinates);
             this.position = targetPosition.add(this._cartesianCoordinates);
             this.setTarget(targetPosition);
             this.setTarget(targetPosition);
         }
         }

+ 5 - 7
src/Cameras/babylon.gamepadCamera.ts

@@ -1,5 +1,3 @@
-/// <reference path="babylon.universalCamera.ts" />
-
 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 UniversalCamera {
     export class GamepadCamera extends UniversalCamera {
@@ -11,13 +9,13 @@ module BABYLON {
 
 
             return 0;
             return 0;
         }
         }
-        
+
         public set gamepadAngularSensibility(value: number) {
         public set gamepadAngularSensibility(value: number) {
             var gamepad = <FreeCameraGamepadInput>this.inputs.attached["gamepad"];
             var gamepad = <FreeCameraGamepadInput>this.inputs.attached["gamepad"];
             if (gamepad)
             if (gamepad)
                 gamepad.gamepadAngularSensibility = value;
                 gamepad.gamepadAngularSensibility = value;
         }
         }
-        
+
         public get gamepadMoveSensibility(): number {
         public get gamepadMoveSensibility(): number {
             var gamepad = <FreeCameraGamepadInput>this.inputs.attached["gamepad"];
             var gamepad = <FreeCameraGamepadInput>this.inputs.attached["gamepad"];
             if (gamepad)
             if (gamepad)
@@ -25,15 +23,15 @@ module BABYLON {
 
 
             return 0;
             return 0;
         }
         }
-        
+
         public set gamepadMoveSensibility(value: number) {
         public set gamepadMoveSensibility(value: number) {
             var gamepad = <FreeCameraGamepadInput>this.inputs.attached["gamepad"];
             var gamepad = <FreeCameraGamepadInput>this.inputs.attached["gamepad"];
             if (gamepad)
             if (gamepad)
                 gamepad.gamepadMoveSensibility = value;
                 gamepad.gamepadMoveSensibility = value;
         }
         }
         //-- end properties for backward compatibility for inputs
         //-- end properties for backward compatibility for inputs
-        
-        
+
+
         constructor(name: string, position: Vector3, scene: Scene) {
         constructor(name: string, position: Vector3, scene: Scene) {
             super(name, position, scene);
             super(name, position, scene);
         }
         }

+ 3 - 8
src/Cameras/babylon.stereoscopicCameras.ts

@@ -1,9 +1,4 @@
-/// <reference path="babylon.freeCamera.ts" />
-/// <reference path="babylon.arcRotateCamera.ts" />
-/// <reference path="babylon.gamepadCamera.ts" />
-/// <reference path="babylon.universalCamera.ts" />
-
-module BABYLON {
+module BABYLON {
     export class AnaglyphFreeCamera extends FreeCamera {
     export class AnaglyphFreeCamera extends FreeCamera {
         constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene) {
         constructor(name: string, position: Vector3, interaxialDistance: number, scene: Scene) {
             super(name, position, scene);
             super(name, position, scene);
@@ -51,7 +46,7 @@ module BABYLON {
             return "AnaglyphUniversalCamera";
             return "AnaglyphUniversalCamera";
         }
         }
     }
     }
-    
+
     export class StereoscopicFreeCamera extends FreeCamera {
     export class StereoscopicFreeCamera extends FreeCamera {
         constructor(name: string, position: Vector3, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene) {
         constructor(name: string, position: Vector3, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene) {
             super(name, position, scene);
             super(name, position, scene);
@@ -66,7 +61,7 @@ module BABYLON {
     }
     }
 
 
     export class StereoscopicArcRotateCamera extends ArcRotateCamera {
     export class StereoscopicArcRotateCamera extends ArcRotateCamera {
-        constructor(name: string, alpha: number, beta: number, radius: number, target: Vector3, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene:Scene) {
+        constructor(name: string, alpha: number, beta: number, radius: number, target: Vector3, interaxialDistance: number, isStereoscopicSideBySide: boolean, scene: Scene) {
             super(name, alpha, beta, radius, target, scene);
             super(name, alpha, beta, radius, target, scene);
             this.interaxialDistance = interaxialDistance;
             this.interaxialDistance = interaxialDistance;
             this.isStereoscopicSideBySide = isStereoscopicSideBySide;
             this.isStereoscopicSideBySide = isStereoscopicSideBySide;

+ 2 - 4
src/Cameras/babylon.targetCamera.ts

@@ -1,6 +1,4 @@
-/// <reference path="babylon.camera.ts" />
-
-module BABYLON {
+module BABYLON {
     export class TargetCamera extends Camera {
     export class TargetCamera extends Camera {
 
 
         public cameraDirection = new Vector3(0, 0, 0);
         public cameraDirection = new Vector3(0, 0, 0);
@@ -95,7 +93,7 @@ module BABYLON {
             this.cameraRotation.copyFromFloats(0, 0);
             this.cameraRotation.copyFromFloats(0, 0);
 
 
             return true;
             return true;
-        }           
+        }
 
 
         // Cache
         // Cache
         public _initCache() {
         public _initCache() {

+ 4 - 6
src/Cameras/babylon.touchCamera.ts

@@ -1,5 +1,3 @@
-/// <reference path="babylon.freeCamera.ts" />
-
 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 TouchCamera extends FreeCamera {
     export class TouchCamera extends FreeCamera {
@@ -11,13 +9,13 @@ module BABYLON {
 
 
             return 0;
             return 0;
         }
         }
-        
+
         public set touchAngularSensibility(value: number) {
         public set touchAngularSensibility(value: number) {
             var touch = <FreeCameraTouchInput>this.inputs.attached["touch"];
             var touch = <FreeCameraTouchInput>this.inputs.attached["touch"];
             if (touch)
             if (touch)
                 touch.touchAngularSensibility = value;
                 touch.touchAngularSensibility = value;
         }
         }
-        
+
         public get touchMoveSensibility(): number {
         public get touchMoveSensibility(): number {
             var touch = <FreeCameraTouchInput>this.inputs.attached["touch"];
             var touch = <FreeCameraTouchInput>this.inputs.attached["touch"];
             if (touch)
             if (touch)
@@ -25,14 +23,14 @@ module BABYLON {
 
 
             return 0;
             return 0;
         }
         }
-        
+
         public set touchMoveSensibility(value: number) {
         public set touchMoveSensibility(value: number) {
             var touch = <FreeCameraTouchInput>this.inputs.attached["touch"];
             var touch = <FreeCameraTouchInput>this.inputs.attached["touch"];
             if (touch)
             if (touch)
                 touch.touchMoveSensibility = value;
                 touch.touchMoveSensibility = value;
         }
         }
         //-- end properties for backward compatibility for inputs
         //-- end properties for backward compatibility for inputs
-        
+
         constructor(name: string, position: Vector3, scene: Scene) {
         constructor(name: string, position: Vector3, scene: Scene) {
             super(name, position, scene);
             super(name, position, scene);
             this.inputs.addTouch();
             this.inputs.addTouch();

+ 5 - 7
src/Cameras/babylon.universalCamera.ts

@@ -1,5 +1,3 @@
-/// <reference path="babylon.touchCamera.ts" />
-
 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 UniversalCamera extends TouchCamera {
     export class UniversalCamera extends TouchCamera {
@@ -9,15 +7,15 @@ module BABYLON {
             if (gamepad)
             if (gamepad)
                 return gamepad.gamepadAngularSensibility;
                 return gamepad.gamepadAngularSensibility;
 
 
-            return 0;                
+            return 0;
         }
         }
-        
+
         public set gamepadAngularSensibility(value: number) {
         public set gamepadAngularSensibility(value: number) {
             var gamepad = <FreeCameraGamepadInput>this.inputs.attached["gamepad"];
             var gamepad = <FreeCameraGamepadInput>this.inputs.attached["gamepad"];
             if (gamepad)
             if (gamepad)
                 gamepad.gamepadAngularSensibility = value;
                 gamepad.gamepadAngularSensibility = value;
         }
         }
-        
+
         public get gamepadMoveSensibility(): number {
         public get gamepadMoveSensibility(): number {
             var gamepad = <FreeCameraGamepadInput>this.inputs.attached["gamepad"];
             var gamepad = <FreeCameraGamepadInput>this.inputs.attached["gamepad"];
             if (gamepad)
             if (gamepad)
@@ -25,14 +23,14 @@ module BABYLON {
 
 
             return 0;
             return 0;
         }
         }
-        
+
         public set gamepadMoveSensibility(value: number) {
         public set gamepadMoveSensibility(value: number) {
             var gamepad = <FreeCameraGamepadInput>this.inputs.attached["gamepad"];
             var gamepad = <FreeCameraGamepadInput>this.inputs.attached["gamepad"];
             if (gamepad)
             if (gamepad)
                 gamepad.gamepadMoveSensibility = value;
                 gamepad.gamepadMoveSensibility = value;
         }
         }
         //-- end properties for backward compatibility for inputs
         //-- end properties for backward compatibility for inputs
-        
+
         constructor(name: string, position: Vector3, scene: Scene) {
         constructor(name: string, position: Vector3, scene: Scene) {
             super(name, position, scene);
             super(name, position, scene);
             this.inputs.addGamepad();
             this.inputs.addGamepad();

+ 10 - 13
src/Layer/babylon.highlightlayer.ts

@@ -1,7 +1,4 @@
-/// <reference path="..\PostProcess\babylon.postProcess.ts" />
-/// <reference path="..\Math\babylon.math.ts" />
-
-module BABYLON {
+module BABYLON {
     /**
     /**
      * Special Glow Blur post process only blurring the alpha channel
      * Special Glow Blur post process only blurring the alpha channel
      * It enforces keeping the most luminous color in the color channel.
      * It enforces keeping the most luminous color in the color channel.
@@ -300,7 +297,7 @@ module BABYLON {
             // Create Textures and post processes
             // Create Textures and post processes
             this.createTextureAndPostProcesses();
             this.createTextureAndPostProcesses();
         }
         }
-       
+
         private _createIndexBuffer(): void {
         private _createIndexBuffer(): void {
             var engine = this._scene.getEngine();
             var engine = this._scene.getEngine();
 
 
@@ -318,14 +315,14 @@ module BABYLON {
         }
         }
 
 
         public _rebuild(): void {
         public _rebuild(): void {
-            let vb  = this._vertexBuffers[VertexBuffer.PositionKind];
+            let vb = this._vertexBuffers[VertexBuffer.PositionKind];
 
 
             if (vb) {
             if (vb) {
                 vb._rebuild();
                 vb._rebuild();
             }
             }
 
 
             this._createIndexBuffer();
             this._createIndexBuffer();
-        }        
+        }
 
 
         /**
         /**
          * Creates the render target textures and post processes used in the highlight layer.
          * Creates the render target textures and post processes used in the highlight layer.
@@ -409,9 +406,9 @@ module BABYLON {
                 let internalTexture = this._blurTexture.getInternalTexture();
                 let internalTexture = this._blurTexture.getInternalTexture();
 
 
                 if (internalTexture) {
                 if (internalTexture) {
-                this._scene.postProcessManager.directRender(
-                    [this._downSamplePostprocess, this._horizontalBlurPostprocess, this._verticalBlurPostprocess],
-                    internalTexture, true);
+                    this._scene.postProcessManager.directRender(
+                        [this._downSamplePostprocess, this._horizontalBlurPostprocess, this._verticalBlurPostprocess],
+                        internalTexture, true);
                 }
                 }
 
 
                 this.onAfterBlurObservable.notifyObservers(this);
                 this.onAfterBlurObservable.notifyObservers(this);
@@ -513,14 +510,14 @@ module BABYLON {
                 var index: number;
                 var index: number;
 
 
                 let engine = this._scene.getEngine();
                 let engine = this._scene.getEngine();
-                
+
                 if (depthOnlySubMeshes.length) {
                 if (depthOnlySubMeshes.length) {
-                    engine.setColorWrite(false);            
+                    engine.setColorWrite(false);
                     for (index = 0; index < depthOnlySubMeshes.length; index++) {
                     for (index = 0; index < depthOnlySubMeshes.length; index++) {
                         renderSubMesh(depthOnlySubMeshes.data[index]);
                         renderSubMesh(depthOnlySubMeshes.data[index]);
                     }
                     }
                     engine.setColorWrite(true);
                     engine.setColorWrite(true);
-                }                
+                }
 
 
                 for (index = 0; index < opaqueSubMeshes.length; index++) {
                 for (index = 0; index < opaqueSubMeshes.length; index++) {
                     renderSubMesh(opaqueSubMeshes.data[index]);
                     renderSubMesh(opaqueSubMeshes.data[index]);

+ 9 - 11
src/Lights/babylon.directionalLight.ts

@@ -1,6 +1,4 @@
-/// <reference path="babylon.light.ts" />
-
-module BABYLON {
+module BABYLON {
     export class DirectionalLight extends ShadowLight {
     export class DirectionalLight extends ShadowLight {
 
 
         private _shadowFrustumSize = 0;
         private _shadowFrustumSize = 0;
@@ -152,12 +150,12 @@ module BABYLON {
         }
         }
 
 
         protected _buildUniformLayout(): void {
         protected _buildUniformLayout(): void {
-             this._uniformBuffer.addUniform("vLightData", 4);
-             this._uniformBuffer.addUniform("vLightDiffuse", 4);
-             this._uniformBuffer.addUniform("vLightSpecular", 3);
-             this._uniformBuffer.addUniform("shadowsInfo", 3);
-             this._uniformBuffer.addUniform("depthValues", 2);
-             this._uniformBuffer.create();
+            this._uniformBuffer.addUniform("vLightData", 4);
+            this._uniformBuffer.addUniform("vLightDiffuse", 4);
+            this._uniformBuffer.addUniform("vLightSpecular", 3);
+            this._uniformBuffer.addUniform("shadowsInfo", 3);
+            this._uniformBuffer.addUniform("depthValues", 2);
+            this._uniformBuffer.create();
         }
         }
 
 
         /**
         /**
@@ -166,7 +164,7 @@ module BABYLON {
          */
          */
         public transferToEffect(effect: Effect, lightIndex: string): DirectionalLight {
         public transferToEffect(effect: Effect, lightIndex: string): DirectionalLight {
             if (this.computeTransformedInformation()) {
             if (this.computeTransformedInformation()) {
-               this._uniformBuffer.updateFloat4("vLightData", this.transformedDirection.x, this.transformedDirection.y, this.transformedDirection.z, 1, lightIndex);
+                this._uniformBuffer.updateFloat4("vLightData", this.transformedDirection.x, this.transformedDirection.y, this.transformedDirection.z, 1, lightIndex);
                 return this;
                 return this;
             }
             }
             this._uniformBuffer.updateFloat4("vLightData", this.direction.x, this.direction.y, this.direction.z, 1, lightIndex);
             this._uniformBuffer.updateFloat4("vLightData", this.direction.x, this.direction.y, this.direction.z, 1, lightIndex);
@@ -192,7 +190,7 @@ module BABYLON {
          * @param activeCamera 
          * @param activeCamera 
          */
          */
         public getDepthMaxZ(activeCamera: Camera): number {
         public getDepthMaxZ(activeCamera: Camera): number {
-             return 1;
+            return 1;
         }
         }
     }
     }
 }  
 }  

+ 3 - 7
src/Materials/Textures/Procedurals/babylon.customProceduralTexture.ts

@@ -1,6 +1,4 @@
-/// <reference path="babylon.proceduralTexture.ts" />
-
-module BABYLON {
+module BABYLON {
     export class CustomProceduralTexture extends ProceduralTexture {
     export class CustomProceduralTexture extends ProceduralTexture {
         private _animate: boolean = true;
         private _animate: boolean = true;
         private _time: number = 0;
         private _time: number = 0;
@@ -17,12 +15,10 @@ module BABYLON {
         }
         }
 
 
         private loadJson(jsonUrl: string): void {
         private loadJson(jsonUrl: string): void {
-            var that = this;
-
-            function noConfigFile() {
+            let noConfigFile = () => {
                 Tools.Log("No config file found in " + jsonUrl + " trying to use ShadersStore or DOM element");
                 Tools.Log("No config file found in " + jsonUrl + " trying to use ShadersStore or DOM element");
                 try {
                 try {
-                    that.setFragment(that._texturePath);
+                    this.setFragment(this._texturePath);
                 }
                 }
                 catch (ex) {
                 catch (ex) {
                     Tools.Error("No json or ShaderStore or DOM element found for CustomProceduralTexture");
                     Tools.Error("No json or ShaderStore or DOM element found for CustomProceduralTexture");

+ 6 - 8
src/Materials/Textures/babylon.dynamicTexture.ts

@@ -1,6 +1,4 @@
-/// <reference path="babylon.texture.ts" />
-
-module BABYLON {
+module BABYLON {
     export class DynamicTexture extends Texture {
     export class DynamicTexture extends Texture {
         private _generateMipMaps: boolean;
         private _generateMipMaps: boolean;
         private _canvas: HTMLCanvasElement;
         private _canvas: HTMLCanvasElement;
@@ -62,7 +60,7 @@ module BABYLON {
         public scaleTo(width: number, height: number): void {
         public scaleTo(width: number, height: number): void {
             var textureSize = this.getSize();
             var textureSize = this.getSize();
 
 
-            textureSize.width  = width;
+            textureSize.width = width;
             textureSize.height = height;
             textureSize.height = height;
 
 
             this._recreate(textureSize);
             this._recreate(textureSize);
@@ -89,15 +87,15 @@ module BABYLON {
             }
             }
 
 
             this._context.font = font;
             this._context.font = font;
-            if (x === null  || x === undefined) {
+            if (x === null || x === undefined) {
                 var textSize = this._context.measureText(text);
                 var textSize = this._context.measureText(text);
                 x = (size.width - textSize.width) / 2;
                 x = (size.width - textSize.width) / 2;
             }
             }
             if (y === null || y === undefined) {
             if (y === null || y === undefined) {
-                var fontSize = parseInt((font.replace(/\D/g,'')));;
-                y = (size.height /2) + (fontSize/3.65);
+                var fontSize = parseInt((font.replace(/\D/g, '')));;
+                y = (size.height / 2) + (fontSize / 3.65);
             }
             }
-            
+
             this._context.fillStyle = color;
             this._context.fillStyle = color;
             this._context.fillText(text, x, y);
             this._context.fillText(text, x, y);
 
 

+ 7 - 9
src/Materials/Textures/babylon.mirrorTexture.ts

@@ -1,6 +1,4 @@
-/// <reference path="babylon.renderTargetTexture.ts" />
-
-module BABYLON {
+module BABYLON {
     export class MirrorTexture extends RenderTargetTexture {
     export class MirrorTexture extends RenderTargetTexture {
         public mirrorPlane = new Plane(0, 1, 0, 1);
         public mirrorPlane = new Plane(0, 1, 0, 1);
 
 
@@ -30,7 +28,7 @@ module BABYLON {
         public set blurKernel(value: number) {
         public set blurKernel(value: number) {
             this.blurKernelX = value;
             this.blurKernelX = value;
             this.blurKernelY = value;
             this.blurKernelY = value;
-        }        
+        }
 
 
         public set blurKernelX(value: number) {
         public set blurKernelX(value: number) {
             if (this._blurKernelX === value) {
             if (this._blurKernelX === value) {
@@ -43,7 +41,7 @@ module BABYLON {
 
 
         public get blurKernelX(): number {
         public get blurKernelX(): number {
             return this._blurKernelX;
             return this._blurKernelX;
-        }        
+        }
 
 
         public set blurKernelY(value: number) {
         public set blurKernelY(value: number) {
             if (this._blurKernelY === value) {
             if (this._blurKernelY === value) {
@@ -56,7 +54,7 @@ module BABYLON {
 
 
         public get blurKernelY(): number {
         public get blurKernelY(): number {
             return this._blurKernelY;
             return this._blurKernelY;
-        }             
+        }
 
 
         constructor(name: string, size: any, scene: Scene, generateMipMaps?: boolean, type: number = Engine.TEXTURETYPE_UNSIGNED_INT, samplingMode = Texture.BILINEAR_SAMPLINGMODE, generateDepthBuffer = true) {
         constructor(name: string, size: any, scene: Scene, generateMipMaps?: boolean, type: number = Engine.TEXTURETYPE_UNSIGNED_INT, samplingMode = Texture.BILINEAR_SAMPLINGMODE, generateDepthBuffer = true) {
             super(name, size, scene, generateMipMaps, true, type, false, samplingMode, generateDepthBuffer);
             super(name, size, scene, generateMipMaps, true, type, false, samplingMode, generateDepthBuffer);
@@ -85,7 +83,7 @@ module BABYLON {
 
 
                 delete scene.clipPlane;
                 delete scene.clipPlane;
             });
             });
-        }     
+        }
 
 
         private _preparePostProcesses(): void {
         private _preparePostProcesses(): void {
             this.clearPostProcesses(true);
             this.clearPostProcesses(true);
@@ -109,9 +107,9 @@ module BABYLON {
                 this._blurY.alwaysForcePOT = this._blurRatio !== 1;
                 this._blurY.alwaysForcePOT = this._blurRatio !== 1;
 
 
                 this.addPostProcess(this._blurX);
                 this.addPostProcess(this._blurX);
-                this.addPostProcess(this._blurY);   
+                this.addPostProcess(this._blurY);
             }
             }
-        }   
+        }
 
 
         public clone(): MirrorTexture {
         public clone(): MirrorTexture {
             let scene = this.getScene();
             let scene = this.getScene();

+ 1 - 3
src/Materials/Textures/babylon.refractionTexture.ts

@@ -1,6 +1,4 @@
-/// <reference path="babylon.renderTargetTexture.ts" />
-
-module BABYLON {
+module BABYLON {
     /**
     /**
     * Creates a refraction texture used by refraction channel of the standard material.
     * Creates a refraction texture used by refraction channel of the standard material.
     * @param name the texture name
     * @param name the texture name

+ 3 - 5
src/Mesh/babylon.groundMesh.ts

@@ -1,11 +1,9 @@
-/// <reference path="babylon.mesh.ts" />
-
-module BABYLON {
+module BABYLON {
     export class GroundMesh extends Mesh {
     export class GroundMesh extends Mesh {
         public generateOctree = false;
         public generateOctree = false;
 
 
         private _heightQuads: { slope: Vector2; facet1: Vector4; facet2: Vector4 }[];
         private _heightQuads: { slope: Vector2; facet1: Vector4; facet2: Vector4 }[];
-        
+
         public _subdivisionsX: number;
         public _subdivisionsX: number;
         public _subdivisionsY: number;
         public _subdivisionsY: number;
         public _width: number;
         public _width: number;
@@ -21,7 +19,7 @@ module BABYLON {
 
 
         public getClassName(): string {
         public getClassName(): string {
             return "GroundMesh";
             return "GroundMesh";
-        }        
+        }
 
 
         public get subdivisions(): number {
         public get subdivisions(): number {
             return Math.min(this._subdivisionsX, this._subdivisionsY);
             return Math.min(this._subdivisionsX, this._subdivisionsY);

+ 6 - 8
src/Mesh/babylon.linesMesh.ts

@@ -1,6 +1,4 @@
-/// <reference path="babylon.mesh.ts" />
-
-module BABYLON {
+module BABYLON {
     export class LinesMesh extends Mesh {
     export class LinesMesh extends Mesh {
         public color = new Color3(1, 1, 1);
         public color = new Color3(1, 1, 1);
         public alpha = 1;
         public alpha = 1;
@@ -34,7 +32,7 @@ module BABYLON {
         private _intersectionThreshold: number;
         private _intersectionThreshold: number;
         private _colorShader: ShaderMaterial;
         private _colorShader: ShaderMaterial;
 
 
-        constructor(name: string, scene: Nullable<Scene> = null, parent: Nullable<Node> = null, source?: LinesMesh, doNotCloneChildren?: boolean, public useVertexColor? : boolean) {
+        constructor(name: string, scene: Nullable<Scene> = null, parent: Nullable<Node> = null, source?: LinesMesh, doNotCloneChildren?: boolean, public useVertexColor?: boolean) {
             super(name, scene, parent, source, doNotCloneChildren);
             super(name, scene, parent, source, doNotCloneChildren);
 
 
             if (source) {
             if (source) {
@@ -44,13 +42,13 @@ module BABYLON {
             }
             }
 
 
             this._intersectionThreshold = 0.1;
             this._intersectionThreshold = 0.1;
-            
+
             var options = {
             var options = {
                 attributes: [VertexBuffer.PositionKind],
                 attributes: [VertexBuffer.PositionKind],
                 uniforms: ["world", "viewProjection"],
                 uniforms: ["world", "viewProjection"],
                 needAlphaBlending: false,
                 needAlphaBlending: false,
             };
             };
-            
+
             if (!useVertexColor) {
             if (!useVertexColor) {
                 options.uniforms.push("color");
                 options.uniforms.push("color");
                 options.needAlphaBlending = true;
                 options.needAlphaBlending = true;
@@ -64,7 +62,7 @@ module BABYLON {
          */
          */
         public getClassName(): string {
         public getClassName(): string {
             return "LinesMesh";
             return "LinesMesh";
-        }      
+        }
 
 
         public get material(): Material {
         public get material(): Material {
             return this._colorShader;
             return this._colorShader;
@@ -83,7 +81,7 @@ module BABYLON {
                 return this;
                 return this;
             }
             }
             // VBOs
             // VBOs
-            this._geometry._bind(this._colorShader.getEffect() );
+            this._geometry._bind(this._colorShader.getEffect());
 
 
             // Color
             // Color
             if (!this.useVertexColor) {
             if (!this.useVertexColor) {

+ 14 - 16
src/Mesh/babylon.polygonMesh.ts

@@ -1,5 +1,3 @@
-/// <reference path="..\Math\babylon.math.ts" />
-
 module BABYLON {
 module BABYLON {
     class IndexedVector2 extends Vector2 {
     class IndexedVector2 extends Vector2 {
         constructor(original: Vector2, public index: number) {
         constructor(original: Vector2, public index: number) {
@@ -77,7 +75,7 @@ module BABYLON {
                 result.push(new Vector2(
                 result.push(new Vector2(
                     cx + Math.cos(angle) * radius,
                     cx + Math.cos(angle) * radius,
                     cy + Math.sin(angle) * radius
                     cy + Math.sin(angle) * radius
-                    ));
+                ));
                 angle -= increment;
                 angle -= increment;
             }
             }
 
 
@@ -138,16 +136,16 @@ module BABYLON {
         addHole(hole: Vector2[]): PolygonMeshBuilder {
         addHole(hole: Vector2[]): PolygonMeshBuilder {
             this._points.add(hole);
             this._points.add(hole);
             var holepoints = new PolygonPoints();
             var holepoints = new PolygonPoints();
-            holepoints.add(hole); 
+            holepoints.add(hole);
             this._holes.push(holepoints);
             this._holes.push(holepoints);
 
 
-            this._eholes.push(this._epoints.length/2);
+            this._eholes.push(this._epoints.length / 2);
             this._addToepoint(hole);
             this._addToepoint(hole);
 
 
             return this;
             return this;
         }
         }
 
 
-        build(updatable: boolean = false, depth:number = 0): Mesh {
+        build(updatable: boolean = false, depth: number = 0): Mesh {
             var result = new Mesh(this._name, this._scene);
             var result = new Mesh(this._name, this._scene);
 
 
             var normals = new Array<number>();
             var normals = new Array<number>();
@@ -171,11 +169,11 @@ module BABYLON {
 
 
             if (depth > 0) {
             if (depth > 0) {
                 var positionscount = (positions.length / 3); //get the current pointcount
                 var positionscount = (positions.length / 3); //get the current pointcount
-               
+
                 this._points.elements.forEach((p) => { //add the elements at the depth
                 this._points.elements.forEach((p) => { //add the elements at the depth
-                    normals.push(0, -1.0, 0);                   
-                    positions.push(p.x, -depth, p.y);                
-                    uvs.push(1-(p.x - bounds.min.x) / bounds.width,1-(p.y - bounds.min.y) / bounds.height);
+                    normals.push(0, -1.0, 0);
+                    positions.push(p.x, -depth, p.y);
+                    uvs.push(1 - (p.x - bounds.min.x) / bounds.width, 1 - (p.y - bounds.min.y) / bounds.height);
                 });
                 });
 
 
                 let totalCount = indices.length;
                 let totalCount = indices.length;
@@ -194,7 +192,7 @@ module BABYLON {
 
 
                 this._holes.forEach((hole) => {
                 this._holes.forEach((hole) => {
                     this.addSide(positions, normals, uvs, indices, bounds, hole, depth, true);
                     this.addSide(positions, normals, uvs, indices, bounds, hole, depth, true);
-                });                               
+                });
             }
             }
 
 
             result.setVerticesData(VertexBuffer.PositionKind, positions, updatable);
             result.setVerticesData(VertexBuffer.PositionKind, positions, updatable);
@@ -203,9 +201,9 @@ module BABYLON {
             result.setIndices(indices);
             result.setIndices(indices);
 
 
             return result;
             return result;
-        } 
+        }
 
 
-       private addSide(positions: any[], normals: any[], uvs: any[], indices:any[],bounds: any, points: PolygonPoints, depth:number, flip:boolean ){
+        private addSide(positions: any[], normals: any[], uvs: any[], indices: any[], bounds: any, points: PolygonPoints, depth: number, flip: boolean) {
             var StartIndex: number = positions.length / 3;
             var StartIndex: number = positions.length / 3;
             var ulength: number = 0;
             var ulength: number = 0;
             for (var i: number = 0; i < points.elements.length; i++) {
             for (var i: number = 0; i < points.elements.length; i++) {
@@ -229,7 +227,7 @@ module BABYLON {
                 var v4 = new Vector3(0, 1, 0);
                 var v4 = new Vector3(0, 1, 0);
                 var vn = Vector3.Cross(v3, v4);
                 var vn = Vector3.Cross(v3, v4);
                 vn = vn.normalize();
                 vn = vn.normalize();
-                
+
                 uvs.push(ulength / bounds.width, 0);
                 uvs.push(ulength / bounds.width, 0);
                 uvs.push(ulength / bounds.width, 1);
                 uvs.push(ulength / bounds.width, 1);
                 ulength += v3.length();
                 ulength += v3.length();
@@ -237,7 +235,7 @@ module BABYLON {
                 uvs.push((ulength / bounds.width), 1);
                 uvs.push((ulength / bounds.width), 1);
 
 
                 if (!flip) {
                 if (!flip) {
-                    normals.push(-vn.x,- vn.y, -vn.z);
+                    normals.push(-vn.x, - vn.y, -vn.z);
                     normals.push(-vn.x, -vn.y, -vn.z);
                     normals.push(-vn.x, -vn.y, -vn.z);
                     normals.push(-vn.x, -vn.y, -vn.z);
                     normals.push(-vn.x, -vn.y, -vn.z);
                     normals.push(-vn.x, -vn.y, -vn.z);
                     normals.push(-vn.x, -vn.y, -vn.z);
@@ -263,7 +261,7 @@ module BABYLON {
                     indices.push(StartIndex + 1);
                     indices.push(StartIndex + 1);
                     indices.push(StartIndex + 2);
                     indices.push(StartIndex + 2);
                     indices.push(StartIndex + 3);
                     indices.push(StartIndex + 3);
-                }                
+                }
                 StartIndex += 4;
                 StartIndex += 4;
             };
             };
         }
         }

+ 2 - 3
src/Tools/babylon.database.ts

@@ -124,12 +124,11 @@ module BABYLON {
         }
         }
 
 
         public openAsync(successCallback: () => void, errorCallback: () => void) {
         public openAsync(successCallback: () => void, errorCallback: () => void) {
-            function handleError() {
-                that.isSupported = false;
+            let handleError = () => {
+                this.isSupported = false;
                 if (errorCallback) errorCallback();
                 if (errorCallback) errorCallback();
             }
             }
 
 
-            var that = this;
             if (!this.idbFactory || !(this._enableSceneOffline || this._enableTexturesOffline)) {
             if (!this.idbFactory || !(this._enableSceneOffline || this._enableTexturesOffline)) {
                 // Your browser doesn't support IndexedDB
                 // Your browser doesn't support IndexedDB
                 this.isSupported = false;
                 this.isSupported = false;

+ 7 - 9
src/babylon.node.ts

@@ -1,6 +1,4 @@
-/// <reference path="Tools\babylon.decorators.ts" />
-
-module BABYLON {
+module BABYLON {
 
 
     /**
     /**
      * Node is the basic class for all scene objects (Mesh, Light Camera).
      * Node is the basic class for all scene objects (Mesh, Light Camera).
@@ -127,14 +125,14 @@ module BABYLON {
 
 
             if (index === -1) {
             if (index === -1) {
                 return this;
                 return this;
-            } 
+            }
 
 
             this._behaviors[index].detach();
             this._behaviors[index].detach();
             this._behaviors.splice(index, 1);
             this._behaviors.splice(index, 1);
 
 
             return this;
             return this;
-        }     
-        
+        }
+
         public get behaviors(): Behavior<Node>[] {
         public get behaviors(): Behavior<Node>[] {
             return this._behaviors;
             return this._behaviors;
         }
         }
@@ -309,8 +307,8 @@ module BABYLON {
             this._getDescendants(results, directDescendantsOnly, predicate);
             this._getDescendants(results, directDescendantsOnly, predicate);
 
 
             return results;
             return results;
-        }    
-        
+        }
+
         /**
         /**
          * Get all child-meshes of this node.
          * Get all child-meshes of this node.
          */
          */
@@ -422,7 +420,7 @@ module BABYLON {
 
 
             this._behaviors = [];
             this._behaviors = [];
         }
         }
-        
+
         public static ParseAnimationRanges(node: Node, parsedNode: any, scene: Scene): void {
         public static ParseAnimationRanges(node: Node, parsedNode: any, scene: Scene): void {
             if (parsedNode.ranges) {
             if (parsedNode.ranges) {
                 for (var index = 0; index < parsedNode.ranges.length; index++) {
                 for (var index = 0; index < parsedNode.ranges.length; index++) {