Bläddra i källkod

Renaming Path to Path2 and Arc to Arc2

David Catuhe 10 år sedan
förälder
incheckning
e75813b9e9

+ 5 - 3
Babylon/Materials/Textures/babylon.baseTexture.js

@@ -91,14 +91,16 @@
             }
         };
 
-        BaseTexture.prototype._getFromCache = function (url, noMipmap) {
+        BaseTexture.prototype._getFromCache = function (url, noMipmap, sampling) {
             var texturesCache = this._scene.getEngine().getLoadedTexturesCache();
             for (var index = 0; index < texturesCache.length; index++) {
                 var texturesCacheEntry = texturesCache[index];
 
                 if (texturesCacheEntry.url === url && texturesCacheEntry.noMipmap === noMipmap) {
-                    texturesCacheEntry.references++;
-                    return texturesCacheEntry;
+                    if (!sampling || sampling === texturesCacheEntry.samplingMode) {
+                        texturesCacheEntry.references++;
+                        return texturesCacheEntry;
+                    }
                 }
             }
 

+ 5 - 3
Babylon/Materials/Textures/babylon.baseTexture.ts

@@ -94,14 +94,16 @@
             }
         }
 
-        public _getFromCache(url: string, noMipmap: boolean): WebGLTexture {
+        public _getFromCache(url: string, noMipmap: boolean, sampling?: number): WebGLTexture {
             var texturesCache = this._scene.getEngine().getLoadedTexturesCache();
             for (var index = 0; index < texturesCache.length; index++) {
                 var texturesCacheEntry = texturesCache[index];
 
                 if (texturesCacheEntry.url === url && texturesCacheEntry.noMipmap === noMipmap) {
-                    texturesCacheEntry.references++;
-                    return texturesCacheEntry;
+                    if (!sampling || sampling === texturesCacheEntry.samplingMode) {
+                        texturesCacheEntry.references++;
+                        return texturesCacheEntry;
+                    }
                 }
             }
 

+ 2 - 2
Babylon/Materials/Textures/babylon.texture.js

@@ -35,7 +35,7 @@ var BABYLON;
                 return;
             }
 
-            this._texture = this._getFromCache(url, noMipmap);
+            this._texture = this._getFromCache(url, noMipmap, samplingMode);
 
             if (!this._texture) {
                 if (!scene.useDelayedTextureLoading) {
@@ -54,7 +54,7 @@ var BABYLON;
             }
 
             this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_LOADED;
-            this._texture = this._getFromCache(this.url, this._noMipmap);
+            this._texture = this._getFromCache(this.url, this._noMipmap, this._samplingMode);
 
             if (!this._texture) {
                 this._texture = this.getScene().getEngine().createTexture(this.url, this._noMipmap, this._invertY, this.getScene(), this._samplingMode, null, null, this._buffer);

+ 2 - 2
Babylon/Materials/Textures/babylon.texture.ts

@@ -62,7 +62,7 @@
                 return;
             }
 
-            this._texture = this._getFromCache(url, noMipmap);
+            this._texture = this._getFromCache(url, noMipmap, samplingMode);
 
             if (!this._texture) {
                 if (!scene.useDelayedTextureLoading) {
@@ -82,7 +82,7 @@
             }
 
             this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_LOADED;
-            this._texture = this._getFromCache(this.url, this._noMipmap);
+            this._texture = this._getFromCache(this.url, this._noMipmap, this._samplingMode);
 
             if (!this._texture) {
                 this._texture = this.getScene().getEngine().createTexture(this.url, this._noMipmap, this._invertY, this.getScene(), this._samplingMode, null, null, this._buffer);

+ 44 - 44
Babylon/Math/babylon.math.js

@@ -220,7 +220,7 @@
         Color4.Lerp = function (left, right, amount) {
             var result = new Color4(0, 0, 0, 0);
 
-            BABYLON.Color4.LerpToRef(left, right, amount, result);
+            Color4.LerpToRef(left, right, amount, result);
 
             return result;
         };
@@ -843,7 +843,7 @@
             var cx = viewport.x;
             var cy = viewport.y;
 
-            var viewportMatrix = BABYLON.Matrix.FromValues(cw / 2.0, 0, 0, 0, 0, -ch / 2.0, 0, 0, 0, 0, 1, 0, cx + cw / 2.0, ch / 2.0 + cy, 0, 1);
+            var viewportMatrix = Matrix.FromValues(cw / 2.0, 0, 0, 0, 0, -ch / 2.0, 0, 0, 0, 0, 1, 0, cx + cw / 2.0, ch / 2.0 + cy, 0, 1);
 
             var finalMatrix = world.multiply(transform).multiply(viewportMatrix);
 
@@ -855,7 +855,7 @@
             matrix.invert();
             source.x = source.x / viewportWidth * 2 - 1;
             source.y = -(source.y / viewportHeight * 2 - 1);
-            var vector = BABYLON.Vector3.TransformCoordinates(source, matrix);
+            var vector = Vector3.TransformCoordinates(source, matrix);
             var num = source.x * matrix.m[3] + source.y * matrix.m[7] + source.z * matrix.m[11] + matrix.m[15];
 
             if (BABYLON.Tools.WithinEpsilon(num, 1.0)) {
@@ -870,7 +870,7 @@
             matrix.invert();
             source.x = source.x / viewportWidth * 2 - 1;
             source.y = -(source.y / viewportHeight * 2 - 1);
-            var vector = BABYLON.Vector3.TransformCoordinates(source, matrix);
+            var vector = Vector3.TransformCoordinates(source, matrix);
             var num = source.x * matrix.m[3] + source.y * matrix.m[7] + source.z * matrix.m[11] + matrix.m[15];
 
             if (BABYLON.Tools.WithinEpsilon(num, 1.0)) {
@@ -1310,12 +1310,12 @@
 
             var determinant = sqx + sqy;
 
-            if (determinant != 0.000 && determinant != 1.000) {
+            if (determinant !== 0.000 && determinant !== 1.000) {
                 result.x = Math.atan2(qxz + qwy, qwx - qyz);
                 result.y = Math.acos(1 - 2 * determinant);
                 result.z = Math.atan2(qxz - qwy, qwx + qyz);
             } else {
-                if (determinant == 0.000) {
+                if (determinant === 0.0) {
                     result.x = 0.0;
                     result.y = 0.0;
                     result.z = Math.atan2(qxy - qwz, 0.5 - sqy - qz * qz); //actually, degeneracy gives us choice with x+z=Math.atan2(qxy-qwz,0.5-sqy-qz*qz)
@@ -1490,10 +1490,10 @@
         }
         // Properties
         Matrix.prototype.isIdentity = function () {
-            if (this.m[0] != 1.0 || this.m[5] != 1.0 || this.m[10] != 1.0 || this.m[15] != 1.0)
+            if (this.m[0] !== 1.0 || this.m[5] !== 1.0 || this.m[10] !== 1.0 || this.m[15] !== 1.0)
                 return false;
 
-            if (this.m[1] != 0.0 || this.m[2] != 0.0 || this.m[3] != 0.0 || this.m[4] != 0.0 || this.m[6] != 0.0 || this.m[7] != 0.0 || this.m[8] != 0.0 || this.m[9] != 0.0 || this.m[11] != 0.0 || this.m[12] != 0.0 || this.m[13] != 0.0 || this.m[14] != 0.0)
+            if (this.m[1] !== 0.0 || this.m[2] !== 0.0 || this.m[3] !== 0.0 || this.m[4] !== 0.0 || this.m[6] !== 0.0 || this.m[7] !== 0.0 || this.m[8] !== 0.0 || this.m[9] !== 0.0 || this.m[11] !== 0.0 || this.m[12] !== 0.0 || this.m[13] !== 0.0 || this.m[14] !== 0.0)
                 return false;
 
             return true;
@@ -2128,7 +2128,7 @@
             var norm = (Math.sqrt((this.normal.x * this.normal.x) + (this.normal.y * this.normal.y) + (this.normal.z * this.normal.z)));
             var magnitude = 0;
 
-            if (norm != 0) {
+            if (norm !== 0) {
                 magnitude = 1.0 / norm;
             }
 
@@ -2171,7 +2171,7 @@
             var pyth = (Math.sqrt((yz * yz) + (xz * xz) + (xy * xy)));
             var invPyth;
 
-            if (pyth != 0) {
+            if (pyth !== 0) {
                 invPyth = 1.0 / pyth;
             } else {
                 invPyth = 0;
@@ -2195,11 +2195,11 @@
 
         // Statics
         Plane.FromArray = function (array) {
-            return new BABYLON.Plane(array[0], array[1], array[2], array[3]);
+            return new Plane(array[0], array[1], array[2], array[3]);
         };
 
         Plane.FromPoints = function (point1, point2, point3) {
-            var result = new BABYLON.Plane(0, 0, 0, 0);
+            var result = new Plane(0, 0, 0, 0);
 
             result.copyFromPoints(point1, point2, point3);
 
@@ -2207,7 +2207,7 @@
         };
 
         Plane.FromPositionAndNormal = function (origin, normal) {
-            var result = new BABYLON.Plane(0, 0, 0, 0);
+            var result = new Plane(0, 0, 0, 0);
             normal.normalize();
 
             result.normal = normal;
@@ -2324,7 +2324,7 @@
                 var min = (minimum.x - this.origin.x) * inv;
                 var max = (maximum.x - this.origin.x) * inv;
 
-                if (max == -Infinity) {
+                if (max === -Infinity) {
                     max = Infinity;
                 }
 
@@ -2351,7 +2351,7 @@
                 min = (minimum.y - this.origin.y) * inv;
                 max = (maximum.y - this.origin.y) * inv;
 
-                if (max == -Infinity) {
+                if (max === -Infinity) {
                     max = Infinity;
                 }
 
@@ -2378,7 +2378,7 @@
                 min = (minimum.z - this.origin.z) * inv;
                 max = (maximum.z - this.origin.z) * inv;
 
-                if (max == -Infinity) {
+                if (max === -Infinity) {
                     max = Infinity;
                 }
 
@@ -2425,16 +2425,16 @@
 
         Ray.prototype.intersectsTriangle = function (vertex0, vertex1, vertex2) {
             if (!this._edge1) {
-                this._edge1 = BABYLON.Vector3.Zero();
-                this._edge2 = BABYLON.Vector3.Zero();
-                this._pvec = BABYLON.Vector3.Zero();
-                this._tvec = BABYLON.Vector3.Zero();
-                this._qvec = BABYLON.Vector3.Zero();
+                this._edge1 = Vector3.Zero();
+                this._edge2 = Vector3.Zero();
+                this._pvec = Vector3.Zero();
+                this._tvec = Vector3.Zero();
+                this._qvec = Vector3.Zero();
             }
 
             vertex1.subtractToRef(vertex0, this._edge1);
             vertex2.subtractToRef(vertex0, this._edge2);
-            BABYLON.Vector3.CrossToRef(this.direction, this._edge2, this._pvec);
+            Vector3.CrossToRef(this.direction, this._edge2, this._pvec);
             var det = Vector3.Dot(this._edge1, this._pvec);
 
             if (det === 0) {
@@ -2470,8 +2470,8 @@
 
         // Statics
         Ray.CreateNew = function (x, y, viewportWidth, viewportHeight, world, view, projection) {
-            var start = BABYLON.Vector3.Unproject(new BABYLON.Vector3(x, y, 0), viewportWidth, viewportHeight, world, view, projection);
-            var end = BABYLON.Vector3.Unproject(new BABYLON.Vector3(x, y, 1), viewportWidth, viewportHeight, world, view, projection);
+            var start = Vector3.Unproject(new Vector3(x, y, 0), viewportWidth, viewportHeight, world, view, projection);
+            var end = Vector3.Unproject(new Vector3(x, y, 1), viewportWidth, viewportHeight, world, view, projection);
 
             var direction = end.subtract(start);
             direction.normalize();
@@ -2487,7 +2487,7 @@
         * @param world a matrix to transform the ray to. Default is the identity matrix.
         */
         Ray.CreateNewFromTo = function (origin, end, world) {
-            if (typeof world === "undefined") { world = BABYLON.Matrix.Identity(); }
+            if (typeof world === "undefined") { world = Matrix.Identity(); }
             var direction = end.subtract(origin);
             var length = Math.sqrt((direction.x * direction.x) + (direction.y * direction.y) + (direction.z * direction.z));
             direction.normalize();
@@ -2496,8 +2496,8 @@
         };
 
         Ray.Transform = function (ray, matrix) {
-            var newOrigin = BABYLON.Vector3.TransformCoordinates(ray.origin, matrix);
-            var newDirection = BABYLON.Vector3.TransformNormal(ray.direction, matrix);
+            var newOrigin = Vector3.TransformCoordinates(ray.origin, matrix);
+            var newDirection = Vector3.TransformNormal(ray.direction, matrix);
 
             return new Ray(newOrigin, newDirection, ray.length);
         };
@@ -2514,9 +2514,9 @@
     var Axis = (function () {
         function Axis() {
         }
-        Axis.X = new BABYLON.Vector3(1, 0, 0);
-        Axis.Y = new BABYLON.Vector3(0, 1, 0);
-        Axis.Z = new BABYLON.Vector3(0, 0, 1);
+        Axis.X = new Vector3(1, 0, 0);
+        Axis.Y = new Vector3(0, 1, 0);
+        Axis.Z = new Vector3(0, 0, 1);
         return Axis;
     })();
     BABYLON.Axis = Axis;
@@ -2585,8 +2585,8 @@
     })();
     BABYLON.Angle = Angle;
 
-    var Arc = (function () {
-        function Arc(startPoint, midPoint, endPoint) {
+    var Arc2 = (function () {
+        function Arc2(startPoint, midPoint, endPoint) {
             this.startPoint = startPoint;
             this.midPoint = midPoint;
             this.endPoint = endPoint;
@@ -2618,27 +2618,27 @@
             this.orientation = (a2 - a1) < 0 ? 0 /* CW */ : 1 /* CCW */;
             this.angle = Angle.FromDegrees(this.orientation === 0 /* CW */ ? a1 - a3 : a3 - a1);
         }
-        return Arc;
+        return Arc2;
     })();
-    BABYLON.Arc = Arc;
+    BABYLON.Arc2 = Arc2;
 
-    var Path = (function () {
-        function Path(x, y) {
+    var Path2 = (function () {
+        function Path2(x, y) {
             this._points = [];
             this._points.push(new Vector2(x, y));
         }
-        Path.prototype.addLineTo = function (x, y) {
+        Path2.prototype.addLineTo = function (x, y) {
             this._points.push(new Vector2(x, y));
             return this;
         };
 
-        Path.prototype.addArcTo = function (midX, midY, endX, endY, numberOfSegments) {
+        Path2.prototype.addArcTo = function (midX, midY, endX, endY, numberOfSegments) {
             if (typeof numberOfSegments === "undefined") { numberOfSegments = 36; }
             var startPoint = this._points[this._points.length - 1];
             var midPoint = new Vector2(midX, midY);
             var endPoint = new Vector2(endX, endY);
 
-            var arc = new Arc(startPoint, midPoint, endPoint);
+            var arc = new Arc2(startPoint, midPoint, endPoint);
 
             var increment = arc.angle.radians() / numberOfSegments;
             if (arc.orientation === 0 /* CW */)
@@ -2654,15 +2654,15 @@
             return this;
         };
 
-        Path.prototype.close = function () {
+        Path2.prototype.close = function () {
             return this._points;
         };
 
-        Path.StartingAt = function (x, y) {
-            return new Path(x, y);
+        Path2.StartingAt = function (x, y) {
+            return new Path2(x, y);
         };
-        return Path;
+        return Path2;
     })();
-    BABYLON.Path = Path;
+    BABYLON.Path2 = Path2;
 })(BABYLON || (BABYLON = {}));
 //# sourceMappingURL=babylon.math.js.map

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

@@ -190,7 +190,7 @@
         public static Lerp(left: Color4, right: Color4, amount: number): Color4 {
             var result = new Color4(0, 0, 0, 0);
 
-            BABYLON.Color4.LerpToRef(left, right, amount, result);
+            Color4.LerpToRef(left, right, amount, result);
 
             return result;
         }
@@ -814,7 +814,7 @@
             var cx = viewport.x;
             var cy = viewport.y;
 
-            var viewportMatrix = BABYLON.Matrix.FromValues(
+            var viewportMatrix = Matrix.FromValues(
                 cw / 2.0, 0, 0, 0,
                 0, -ch / 2.0, 0, 0,
                 0, 0, 1, 0,
@@ -830,10 +830,10 @@
             matrix.invert();
             source.x = source.x / viewportWidth * 2 - 1;
             source.y = -(source.y / viewportHeight * 2 - 1);
-            var vector = BABYLON.Vector3.TransformCoordinates(source, matrix);
+            var vector = Vector3.TransformCoordinates(source, matrix);
             var num = source.x * matrix.m[3] + source.y * matrix.m[7] + source.z * matrix.m[11] + matrix.m[15];
 
-            if (BABYLON.Tools.WithinEpsilon(num, 1.0)) {
+            if (Tools.WithinEpsilon(num, 1.0)) {
                 vector = vector.scale(1.0 / num);
             }
 
@@ -845,10 +845,10 @@
             matrix.invert();
             source.x = source.x / viewportWidth * 2 - 1;
             source.y = -(source.y / viewportHeight * 2 - 1);
-            var vector = BABYLON.Vector3.TransformCoordinates(source, matrix);
+            var vector = Vector3.TransformCoordinates(source, matrix);
             var num = source.x * matrix.m[3] + source.y * matrix.m[7] + source.z * matrix.m[11] + matrix.m[15];
 
-            if (BABYLON.Tools.WithinEpsilon(num, 1.0)) {
+            if (Tools.WithinEpsilon(num, 1.0)) {
                 vector = vector.scale(1.0 / num);
             }
 
@@ -1267,12 +1267,12 @@
 
             var determinant = sqx + sqy;
 
-            if (determinant != 0.000 && determinant != 1.000) {
+            if (determinant !== 0.000 && determinant !== 1.000) {
                 result.x = Math.atan2(qxz + qwy, qwx - qyz);
                 result.y = Math.acos(1 - 2 * determinant);
                 result.z = Math.atan2(qxz - qwy, qwx + qyz);
             } else {
-                if (determinant == 0.000) {
+                if (determinant === 0.0) {
                     result.x = 0.0;
                     result.y = 0.0;
                     result.z = Math.atan2(qxy - qwz, 0.5 - sqy - qz * qz); //actually, degeneracy gives us choice with x+z=Math.atan2(qxy-qwz,0.5-sqy-qz*qz)
@@ -1454,13 +1454,13 @@
 
         // Properties
         public isIdentity(): boolean {
-            if (this.m[0] != 1.0 || this.m[5] != 1.0 || this.m[10] != 1.0 || this.m[15] != 1.0)
+            if (this.m[0] !== 1.0 || this.m[5] !== 1.0 || this.m[10] !== 1.0 || this.m[15] !== 1.0)
                 return false;
 
-            if (this.m[1] != 0.0 || this.m[2] != 0.0 || this.m[3] != 0.0 ||
-                this.m[4] != 0.0 || this.m[6] != 0.0 || this.m[7] != 0.0 ||
-                this.m[8] != 0.0 || this.m[9] != 0.0 || this.m[11] != 0.0 ||
-                this.m[12] != 0.0 || this.m[13] != 0.0 || this.m[14] != 0.0)
+            if (this.m[1] !== 0.0 || this.m[2] !== 0.0 || this.m[3] !== 0.0 ||
+                this.m[4] !== 0.0 || this.m[6] !== 0.0 || this.m[7] !== 0.0 ||
+                this.m[8] !== 0.0 || this.m[9] !== 0.0 || this.m[11] !== 0.0 ||
+                this.m[12] !== 0.0 || this.m[13] !== 0.0 || this.m[14] !== 0.0)
                 return false;
 
             return true;
@@ -2132,7 +2132,7 @@
             var norm = (Math.sqrt((this.normal.x * this.normal.x) + (this.normal.y * this.normal.y) + (this.normal.z * this.normal.z)));
             var magnitude = 0;
 
-            if (norm != 0) {
+            if (norm !== 0) {
                 magnitude = 1.0 / norm;
             }
 
@@ -2176,7 +2176,7 @@
             var pyth = (Math.sqrt((yz * yz) + (xz * xz) + (xy * xy)));
             var invPyth;
 
-            if (pyth != 0) {
+            if (pyth !== 0) {
                 invPyth = 1.0 / pyth;
             }
             else {
@@ -2201,11 +2201,11 @@
 
         // Statics
         static FromArray(array: number[]): Plane {
-            return new BABYLON.Plane(array[0], array[1], array[2], array[3]);
+            return new Plane(array[0], array[1], array[2], array[3]);
         }
 
         static FromPoints(point1, point2, point3): Plane {
-            var result = new BABYLON.Plane(0, 0, 0, 0);
+            var result = new Plane(0, 0, 0, 0);
 
             result.copyFromPoints(point1, point2, point3);
 
@@ -2213,7 +2213,7 @@
         }
 
         static FromPositionAndNormal(origin: Vector3, normal: Vector3): Plane {
-            var result = new BABYLON.Plane(0, 0, 0, 0);
+            var result = new Plane(0, 0, 0, 0);
             normal.normalize();
 
             result.normal = normal;
@@ -2323,7 +2323,7 @@
                 var min = (minimum.x - this.origin.x) * inv;
                 var max = (maximum.x - this.origin.x) * inv;
 
-                if (max == -Infinity) {
+                if (max === -Infinity) {
                     max = Infinity;
                 }
 
@@ -2351,7 +2351,7 @@
                 min = (minimum.y - this.origin.y) * inv;
                 max = (maximum.y - this.origin.y) * inv;
 
-                if (max == -Infinity) {
+                if (max === -Infinity) {
                     max = Infinity;
                 }
 
@@ -2379,7 +2379,7 @@
                 min = (minimum.z - this.origin.z) * inv;
                 max = (maximum.z - this.origin.z) * inv;
 
-                if (max == -Infinity) {
+                if (max === -Infinity) {
                     max = Infinity;
                 }
 
@@ -2426,16 +2426,16 @@
 
         public intersectsTriangle(vertex0: Vector3, vertex1: Vector3, vertex2: Vector3): IntersectionInfo {
             if (!this._edge1) {
-                this._edge1 = BABYLON.Vector3.Zero();
-                this._edge2 = BABYLON.Vector3.Zero();
-                this._pvec = BABYLON.Vector3.Zero();
-                this._tvec = BABYLON.Vector3.Zero();
-                this._qvec = BABYLON.Vector3.Zero();
+                this._edge1 = Vector3.Zero();
+                this._edge2 = Vector3.Zero();
+                this._pvec = Vector3.Zero();
+                this._tvec = Vector3.Zero();
+                this._qvec = Vector3.Zero();
             }
 
             vertex1.subtractToRef(vertex0, this._edge1);
             vertex2.subtractToRef(vertex0, this._edge2);
-            BABYLON.Vector3.CrossToRef(this.direction, this._edge2, this._pvec);
+            Vector3.CrossToRef(this.direction, this._edge2, this._pvec);
             var det = Vector3.Dot(this._edge1, this._pvec);
 
             if (det === 0) {
@@ -2471,8 +2471,8 @@
 
         // Statics
         public static CreateNew(x: number, y: number, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Ray {
-            var start = BABYLON.Vector3.Unproject(new BABYLON.Vector3(x, y, 0), viewportWidth, viewportHeight, world, view, projection);
-            var end = BABYLON.Vector3.Unproject(new BABYLON.Vector3(x, y, 1), viewportWidth, viewportHeight, world, view, projection);
+            var start = Vector3.Unproject(new Vector3(x, y, 0), viewportWidth, viewportHeight, world, view, projection);
+            var end = Vector3.Unproject(new Vector3(x, y, 1), viewportWidth, viewportHeight, world, view, projection);
 
             var direction = end.subtract(start);
             direction.normalize();
@@ -2487,7 +2487,7 @@
         * @param end The end point
         * @param world a matrix to transform the ray to. Default is the identity matrix.
         */
-        public static CreateNewFromTo(origin: BABYLON.Vector3, end: BABYLON.Vector3, world: Matrix = BABYLON.Matrix.Identity()): Ray {
+        public static CreateNewFromTo(origin: Vector3, end: Vector3, world: Matrix = Matrix.Identity()): Ray {
             var direction = end.subtract(origin);
             var length = Math.sqrt((direction.x * direction.x) + (direction.y * direction.y) + (direction.z * direction.z));
             direction.normalize();
@@ -2496,8 +2496,8 @@
         }
 
         public static Transform(ray: Ray, matrix: Matrix): Ray {
-            var newOrigin = BABYLON.Vector3.TransformCoordinates(ray.origin, matrix);
-            var newDirection = BABYLON.Vector3.TransformNormal(ray.direction, matrix);
+            var newOrigin = Vector3.TransformCoordinates(ray.origin, matrix);
+            var newDirection = Vector3.TransformNormal(ray.direction, matrix);
 
             return new Ray(newOrigin, newDirection, ray.length);
         }
@@ -2509,9 +2509,9 @@
     }
 
     export class Axis {
-        public static X: Vector3 = new BABYLON.Vector3(1, 0, 0);
-        public static Y: Vector3 = new BABYLON.Vector3(0, 1, 0);
-        public static Z: Vector3 = new BABYLON.Vector3(0, 0, 1);
+        public static X: Vector3 = new Vector3(1, 0, 0);
+        public static Y: Vector3 = new Vector3(0, 1, 0);
+        public static Z: Vector3 = new Vector3(0, 0, 1);
     };
 
     export class BezierCurve {
@@ -2542,113 +2542,113 @@
         }
     }
 
-    export enum Orientation {
-        CW = 0,
-        CCW = 1
+    export enum Orientation {
+        CW = 0,
+        CCW = 1
     }
 
-    export class Angle {
-        private _radians: number;
-
-        constructor(radians: number) {
-            this._radians = radians;
-            if (this._radians < 0) this._radians += (2 * Math.PI);
-        }
-
-        degrees = () => this._radians * 180 / Math.PI;
-        radians = () => this._radians;
-
-        static BetweenTwoPoints(a: Vector2, b: Vector2): Angle {
-            var delta = b.subtract(a);
-            var theta = Math.atan2(delta.y, delta.x);
-            return new Angle(theta);
-        }
-
-        static FromRadians(radians: number): Angle {
-            return new Angle(radians);
-        }
-
-        static FromDegrees(degrees: number): Angle {
-            return new Angle(degrees * Math.PI / 180);
-        }
+    export class Angle {
+        private _radians: number;
+
+        constructor(radians: number) {
+            this._radians = radians;
+            if (this._radians < 0) this._radians += (2 * Math.PI);
+        }
+
+        degrees = () => this._radians * 180 / Math.PI;
+        radians = () => this._radians;
+
+        static BetweenTwoPoints(a: Vector2, b: Vector2): Angle {
+            var delta = b.subtract(a);
+            var theta = Math.atan2(delta.y, delta.x);
+            return new Angle(theta);
+        }
+
+        static FromRadians(radians: number): Angle {
+            return new Angle(radians);
+        }
+
+        static FromDegrees(degrees: number): Angle {
+            return new Angle(degrees * Math.PI / 180);
+        }
     }
 
-    export class Arc {
-        centerPoint: Vector2;
-        radius: number;
-        angle: Angle;
-        startAngle: Angle;
-        orientation: Orientation;
-
-        constructor(public startPoint: Vector2, public midPoint: Vector2, public endPoint: Vector2) {
-
-            var temp = Math.pow(midPoint.x, 2) + Math.pow(midPoint.y, 2);
-            var startToMid = (Math.pow(startPoint.x, 2) + Math.pow(startPoint.y, 2) - temp) / 2.;
-            var midToEnd = (temp - Math.pow(endPoint.x, 2) - Math.pow(endPoint.y, 2)) / 2.;
-            var det = (startPoint.x - midPoint.x) * (midPoint.y - endPoint.y) - (midPoint.x - endPoint.x) * (startPoint.y - midPoint.y);
-
-            this.centerPoint = new Vector2(
-                (startToMid * (midPoint.y - endPoint.y) - midToEnd * (startPoint.y - midPoint.y)) / det,
-                ((startPoint.x - midPoint.x) * midToEnd - (midPoint.x - endPoint.x) * startToMid) / det
-                );
-
-            this.radius = this.centerPoint.subtract(this.startPoint).length();
-
-            this.startAngle = Angle.BetweenTwoPoints(this.centerPoint, this.startPoint);
-
-            var a1 = this.startAngle.degrees();
-            var a2 = Angle.BetweenTwoPoints(this.centerPoint, this.midPoint).degrees();
-            var a3 = Angle.BetweenTwoPoints(this.centerPoint, this.endPoint).degrees();
-
-            // angles correction
-            if (a2 - a1 > +180.0) a2 -= 360.0;
-            if (a2 - a1 < -180.0) a2 += 360.0;
-            if (a3 - a2 > +180.0) a3 -= 360.0;
-            if (a3 - a2 < -180.0) a3 += 360.0;
-
-            this.orientation = (a2 - a1) < 0 ? Orientation.CW : Orientation.CCW;
-            this.angle = Angle.FromDegrees(this.orientation === Orientation.CW ? a1 - a3 : a3 - a1);
-        }
+    export class Arc2 {
+        centerPoint: Vector2;
+        radius: number;
+        angle: Angle;
+        startAngle: Angle;
+        orientation: Orientation;
+
+        constructor(public startPoint: Vector2, public midPoint: Vector2, public endPoint: Vector2) {
+
+            var temp = Math.pow(midPoint.x, 2) + Math.pow(midPoint.y, 2);
+            var startToMid = (Math.pow(startPoint.x, 2) + Math.pow(startPoint.y, 2) - temp) / 2.;
+            var midToEnd = (temp - Math.pow(endPoint.x, 2) - Math.pow(endPoint.y, 2)) / 2.;
+            var det = (startPoint.x - midPoint.x) * (midPoint.y - endPoint.y) - (midPoint.x - endPoint.x) * (startPoint.y - midPoint.y);
+
+            this.centerPoint = new Vector2(
+                (startToMid * (midPoint.y - endPoint.y) - midToEnd * (startPoint.y - midPoint.y)) / det,
+                ((startPoint.x - midPoint.x) * midToEnd - (midPoint.x - endPoint.x) * startToMid) / det
+                );
+
+            this.radius = this.centerPoint.subtract(this.startPoint).length();
+
+            this.startAngle = Angle.BetweenTwoPoints(this.centerPoint, this.startPoint);
+
+            var a1 = this.startAngle.degrees();
+            var a2 = Angle.BetweenTwoPoints(this.centerPoint, this.midPoint).degrees();
+            var a3 = Angle.BetweenTwoPoints(this.centerPoint, this.endPoint).degrees();
+
+            // angles correction
+            if (a2 - a1 > +180.0) a2 -= 360.0;
+            if (a2 - a1 < -180.0) a2 += 360.0;
+            if (a3 - a2 > +180.0) a3 -= 360.0;
+            if (a3 - a2 < -180.0) a3 += 360.0;
+
+            this.orientation = (a2 - a1) < 0 ? Orientation.CW : Orientation.CCW;
+            this.angle = Angle.FromDegrees(this.orientation === Orientation.CW ? a1 - a3 : a3 - a1);
+        }
     }
-
-    export class Path {
-        private _points: Vector2[] = [];
-
-        constructor(x: number, y: number) {
-            this._points.push(new Vector2(x, y));
-        }
-
-        addLineTo(x: number, y: number): Path {
-            this._points.push(new Vector2(x, y));
-            return this;
-        }
-
-        addArcTo(midX: number, midY: number, endX: number, endY: number, numberOfSegments = 36): Path {
-            var startPoint = this._points[this._points.length - 1];
-            var midPoint = new Vector2(midX, midY);
-            var endPoint = new Vector2(endX, endY);
-
-            var arc = new Arc(startPoint, midPoint, endPoint);
-
-            var increment = arc.angle.radians() / numberOfSegments;
-            if (arc.orientation === Orientation.CW) increment *= -1;
-            var currentAngle = arc.startAngle.radians() + increment;
-
-            for (var i = 0; i < numberOfSegments; i++) {
-                var x = Math.cos(currentAngle) * arc.radius + arc.centerPoint.x;
-                var y = Math.sin(currentAngle) * arc.radius + arc.centerPoint.y;
-                this.addLineTo(x, y);
-                currentAngle += increment;
-            }
-            return this;
-        }
-
-        close(): Vector2[] {
-            return this._points;
-        }
-
-        static StartingAt(x: number, y: number): Path {
-            return new Path(x, y);
-        }
+
+    export class Path2 {
+        private _points: Vector2[] = [];
+
+        constructor(x: number, y: number) {
+            this._points.push(new Vector2(x, y));
+        }
+
+        addLineTo(x: number, y: number): Path2 {
+            this._points.push(new Vector2(x, y));
+            return this;
+        }
+
+        addArcTo(midX: number, midY: number, endX: number, endY: number, numberOfSegments = 36): Path2 {
+            var startPoint = this._points[this._points.length - 1];
+            var midPoint = new Vector2(midX, midY);
+            var endPoint = new Vector2(endX, endY);
+
+            var arc = new Arc2(startPoint, midPoint, endPoint);
+
+            var increment = arc.angle.radians() / numberOfSegments;
+            if (arc.orientation === Orientation.CW) increment *= -1;
+            var currentAngle = arc.startAngle.radians() + increment;
+
+            for (var i = 0; i < numberOfSegments; i++) {
+                var x = Math.cos(currentAngle) * arc.radius + arc.centerPoint.x;
+                var y = Math.sin(currentAngle) * arc.radius + arc.centerPoint.y;
+                this.addLineTo(x, y);
+                currentAngle += increment;
+            }
+            return this;
+        }
+
+        close(): Vector2[] {
+            return this._points;
+        }
+
+        static StartingAt(x: number, y: number): Path2 {
+            return new Path2(x, y);
+        }
     }
 }

+ 2 - 2
Babylon/Mesh/babylon.polygonmesh.js

@@ -23,7 +23,7 @@ var BABYLON;
             var _this = this;
             var result = new Array();
             originalPoints.forEach(function (point) {
-                if (result.length == 0 || !(BABYLON.Tools.WithinEpsilon(point.x, result[0].x) && BABYLON.Tools.WithinEpsilon(point.y, result[0].y))) {
+                if (result.length === 0 || !(BABYLON.Tools.WithinEpsilon(point.x, result[0].x) && BABYLON.Tools.WithinEpsilon(point.y, result[0].y))) {
                     var newPoint = new IndexedVector2(point, _this.elements.length);
                     result.push(newPoint);
                     _this.elements.push(newPoint);
@@ -104,7 +104,7 @@ var BABYLON;
         };
 
         Polygon.StartingAt = function (x, y) {
-            return BABYLON.Path.StartingAt(x, y);
+            return BABYLON.Path2.StartingAt(x, y);
         };
         return Polygon;
     })();

+ 3 - 3
Babylon/Mesh/babylon.polygonmesh.ts

@@ -12,7 +12,7 @@
 
             var result = new Array<IndexedVector2>();
             originalPoints.forEach(point => {
-                if (result.length == 0 || !(Tools.WithinEpsilon(point.x, result[0].x) && Tools.WithinEpsilon(point.y, result[0].y))) {
+                if (result.length === 0 || !(Tools.WithinEpsilon(point.x, result[0].x) && Tools.WithinEpsilon(point.y, result[0].y))) {
                     var newPoint = new IndexedVector2(point, this.elements.length);
                     result.push(newPoint);
                     this.elements.push(newPoint);
@@ -91,8 +91,8 @@
             return result;
         }
 
-        static StartingAt(x: number, y: number): Path {
-            return Path.StartingAt(x, y);
+        static StartingAt(x: number, y: number): Path2 {
+            return Path2.StartingAt(x, y);
         }
     }     
 

+ 6 - 0
Babylon/babylon.engine.js

@@ -317,6 +317,7 @@
         texture._width = potWidth;
         texture._height = potHeight;
         texture.isReady = true;
+        texture.samplingMode = samplingMode;
         scene._removePendingData(texture);
     };
 
@@ -1319,6 +1320,8 @@
             gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, minFilter);
 
             gl.bindTexture(gl.TEXTURE_2D, null);
+
+            texture.samplingMode = samplingMode;
         };
 
         Engine.prototype.createTexture = function (url, noMipmap, invertY, scene, samplingMode, onLoad, onError, buffer) {
@@ -1476,6 +1479,7 @@
             texture._height = height;
             texture.isReady = true;
             texture.references = 1;
+            texture.samplingMode = samplingMode;
 
             this._loadedTexturesCache.push(texture);
 
@@ -1504,6 +1508,7 @@
             texture.isReady = false;
             texture.generateMipMaps = generateMipMaps;
             texture.references = 1;
+            texture.samplingMode = samplingMode;
 
             this._loadedTexturesCache.push(texture);
 
@@ -1612,6 +1617,7 @@
             texture.isReady = true;
             texture.generateMipMaps = generateMipMaps;
             texture.references = 1;
+            texture.samplingMode = samplingMode;
             this._activeTexturesCache = [];
 
             this._loadedTexturesCache.push(texture);

+ 6 - 0
Babylon/babylon.engine.ts

@@ -291,6 +291,7 @@
         texture._width = potWidth;
         texture._height = potHeight;
         texture.isReady = true;
+        texture.samplingMode = samplingMode;
         scene._removePendingData(texture);
     };
 
@@ -1319,6 +1320,8 @@
             gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, minFilter);
 
             gl.bindTexture(gl.TEXTURE_2D, null);
+
+            texture.samplingMode = samplingMode;
         }
 
         public createTexture(url: string, noMipmap: boolean, invertY: boolean, scene: Scene, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE, onLoad: () => void = null, onError: () => void = null, buffer: any = null): WebGLTexture {
@@ -1477,6 +1480,7 @@
             texture._height = height;
             texture.isReady = true;
             texture.references = 1;
+            texture.samplingMode = samplingMode;
 
             this._loadedTexturesCache.push(texture);
 
@@ -1505,6 +1509,7 @@
             texture.isReady = false;
             texture.generateMipMaps = generateMipMaps;
             texture.references = 1;
+            texture.samplingMode = samplingMode;
 
             this._loadedTexturesCache.push(texture);
 
@@ -1611,6 +1616,7 @@
             texture.isReady = true;
             texture.generateMipMaps = generateMipMaps;
             texture.references = 1;
+            texture.samplingMode = samplingMode;
             this._activeTexturesCache = [];
 
             this._loadedTexturesCache.push(texture);

+ 1 - 0
Babylon/babylon.mixins.ts

@@ -48,6 +48,7 @@ interface WebGLTexture {
     isCube:boolean;
     url: string;
     noMipmap: boolean;
+    samplingMode: number;
     references: number;
     generateMipMaps: boolean;
     _size: number;

+ 59 - 51
babylon.2.0-alpha.debug.js

@@ -225,7 +225,7 @@ var __extends = this.__extends || function (d, b) {
         Color4.Lerp = function (left, right, amount) {
             var result = new Color4(0, 0, 0, 0);
 
-            BABYLON.Color4.LerpToRef(left, right, amount, result);
+            Color4.LerpToRef(left, right, amount, result);
 
             return result;
         };
@@ -848,7 +848,7 @@ var __extends = this.__extends || function (d, b) {
             var cx = viewport.x;
             var cy = viewport.y;
 
-            var viewportMatrix = BABYLON.Matrix.FromValues(cw / 2.0, 0, 0, 0, 0, -ch / 2.0, 0, 0, 0, 0, 1, 0, cx + cw / 2.0, ch / 2.0 + cy, 0, 1);
+            var viewportMatrix = Matrix.FromValues(cw / 2.0, 0, 0, 0, 0, -ch / 2.0, 0, 0, 0, 0, 1, 0, cx + cw / 2.0, ch / 2.0 + cy, 0, 1);
 
             var finalMatrix = world.multiply(transform).multiply(viewportMatrix);
 
@@ -860,7 +860,7 @@ var __extends = this.__extends || function (d, b) {
             matrix.invert();
             source.x = source.x / viewportWidth * 2 - 1;
             source.y = -(source.y / viewportHeight * 2 - 1);
-            var vector = BABYLON.Vector3.TransformCoordinates(source, matrix);
+            var vector = Vector3.TransformCoordinates(source, matrix);
             var num = source.x * matrix.m[3] + source.y * matrix.m[7] + source.z * matrix.m[11] + matrix.m[15];
 
             if (BABYLON.Tools.WithinEpsilon(num, 1.0)) {
@@ -875,7 +875,7 @@ var __extends = this.__extends || function (d, b) {
             matrix.invert();
             source.x = source.x / viewportWidth * 2 - 1;
             source.y = -(source.y / viewportHeight * 2 - 1);
-            var vector = BABYLON.Vector3.TransformCoordinates(source, matrix);
+            var vector = Vector3.TransformCoordinates(source, matrix);
             var num = source.x * matrix.m[3] + source.y * matrix.m[7] + source.z * matrix.m[11] + matrix.m[15];
 
             if (BABYLON.Tools.WithinEpsilon(num, 1.0)) {
@@ -1315,12 +1315,12 @@ var __extends = this.__extends || function (d, b) {
 
             var determinant = sqx + sqy;
 
-            if (determinant != 0.000 && determinant != 1.000) {
+            if (determinant !== 0.000 && determinant !== 1.000) {
                 result.x = Math.atan2(qxz + qwy, qwx - qyz);
                 result.y = Math.acos(1 - 2 * determinant);
                 result.z = Math.atan2(qxz - qwy, qwx + qyz);
             } else {
-                if (determinant == 0.000) {
+                if (determinant === 0.0) {
                     result.x = 0.0;
                     result.y = 0.0;
                     result.z = Math.atan2(qxy - qwz, 0.5 - sqy - qz * qz); //actually, degeneracy gives us choice with x+z=Math.atan2(qxy-qwz,0.5-sqy-qz*qz)
@@ -1495,10 +1495,10 @@ var __extends = this.__extends || function (d, b) {
         }
         // Properties
         Matrix.prototype.isIdentity = function () {
-            if (this.m[0] != 1.0 || this.m[5] != 1.0 || this.m[10] != 1.0 || this.m[15] != 1.0)
+            if (this.m[0] !== 1.0 || this.m[5] !== 1.0 || this.m[10] !== 1.0 || this.m[15] !== 1.0)
                 return false;
 
-            if (this.m[1] != 0.0 || this.m[2] != 0.0 || this.m[3] != 0.0 || this.m[4] != 0.0 || this.m[6] != 0.0 || this.m[7] != 0.0 || this.m[8] != 0.0 || this.m[9] != 0.0 || this.m[11] != 0.0 || this.m[12] != 0.0 || this.m[13] != 0.0 || this.m[14] != 0.0)
+            if (this.m[1] !== 0.0 || this.m[2] !== 0.0 || this.m[3] !== 0.0 || this.m[4] !== 0.0 || this.m[6] !== 0.0 || this.m[7] !== 0.0 || this.m[8] !== 0.0 || this.m[9] !== 0.0 || this.m[11] !== 0.0 || this.m[12] !== 0.0 || this.m[13] !== 0.0 || this.m[14] !== 0.0)
                 return false;
 
             return true;
@@ -2133,7 +2133,7 @@ var __extends = this.__extends || function (d, b) {
             var norm = (Math.sqrt((this.normal.x * this.normal.x) + (this.normal.y * this.normal.y) + (this.normal.z * this.normal.z)));
             var magnitude = 0;
 
-            if (norm != 0) {
+            if (norm !== 0) {
                 magnitude = 1.0 / norm;
             }
 
@@ -2176,7 +2176,7 @@ var __extends = this.__extends || function (d, b) {
             var pyth = (Math.sqrt((yz * yz) + (xz * xz) + (xy * xy)));
             var invPyth;
 
-            if (pyth != 0) {
+            if (pyth !== 0) {
                 invPyth = 1.0 / pyth;
             } else {
                 invPyth = 0;
@@ -2200,11 +2200,11 @@ var __extends = this.__extends || function (d, b) {
 
         // Statics
         Plane.FromArray = function (array) {
-            return new BABYLON.Plane(array[0], array[1], array[2], array[3]);
+            return new Plane(array[0], array[1], array[2], array[3]);
         };
 
         Plane.FromPoints = function (point1, point2, point3) {
-            var result = new BABYLON.Plane(0, 0, 0, 0);
+            var result = new Plane(0, 0, 0, 0);
 
             result.copyFromPoints(point1, point2, point3);
 
@@ -2212,7 +2212,7 @@ var __extends = this.__extends || function (d, b) {
         };
 
         Plane.FromPositionAndNormal = function (origin, normal) {
-            var result = new BABYLON.Plane(0, 0, 0, 0);
+            var result = new Plane(0, 0, 0, 0);
             normal.normalize();
 
             result.normal = normal;
@@ -2329,7 +2329,7 @@ var __extends = this.__extends || function (d, b) {
                 var min = (minimum.x - this.origin.x) * inv;
                 var max = (maximum.x - this.origin.x) * inv;
 
-                if (max == -Infinity) {
+                if (max === -Infinity) {
                     max = Infinity;
                 }
 
@@ -2356,7 +2356,7 @@ var __extends = this.__extends || function (d, b) {
                 min = (minimum.y - this.origin.y) * inv;
                 max = (maximum.y - this.origin.y) * inv;
 
-                if (max == -Infinity) {
+                if (max === -Infinity) {
                     max = Infinity;
                 }
 
@@ -2383,7 +2383,7 @@ var __extends = this.__extends || function (d, b) {
                 min = (minimum.z - this.origin.z) * inv;
                 max = (maximum.z - this.origin.z) * inv;
 
-                if (max == -Infinity) {
+                if (max === -Infinity) {
                     max = Infinity;
                 }
 
@@ -2430,16 +2430,16 @@ var __extends = this.__extends || function (d, b) {
 
         Ray.prototype.intersectsTriangle = function (vertex0, vertex1, vertex2) {
             if (!this._edge1) {
-                this._edge1 = BABYLON.Vector3.Zero();
-                this._edge2 = BABYLON.Vector3.Zero();
-                this._pvec = BABYLON.Vector3.Zero();
-                this._tvec = BABYLON.Vector3.Zero();
-                this._qvec = BABYLON.Vector3.Zero();
+                this._edge1 = Vector3.Zero();
+                this._edge2 = Vector3.Zero();
+                this._pvec = Vector3.Zero();
+                this._tvec = Vector3.Zero();
+                this._qvec = Vector3.Zero();
             }
 
             vertex1.subtractToRef(vertex0, this._edge1);
             vertex2.subtractToRef(vertex0, this._edge2);
-            BABYLON.Vector3.CrossToRef(this.direction, this._edge2, this._pvec);
+            Vector3.CrossToRef(this.direction, this._edge2, this._pvec);
             var det = Vector3.Dot(this._edge1, this._pvec);
 
             if (det === 0) {
@@ -2475,8 +2475,8 @@ var __extends = this.__extends || function (d, b) {
 
         // Statics
         Ray.CreateNew = function (x, y, viewportWidth, viewportHeight, world, view, projection) {
-            var start = BABYLON.Vector3.Unproject(new BABYLON.Vector3(x, y, 0), viewportWidth, viewportHeight, world, view, projection);
-            var end = BABYLON.Vector3.Unproject(new BABYLON.Vector3(x, y, 1), viewportWidth, viewportHeight, world, view, projection);
+            var start = Vector3.Unproject(new Vector3(x, y, 0), viewportWidth, viewportHeight, world, view, projection);
+            var end = Vector3.Unproject(new Vector3(x, y, 1), viewportWidth, viewportHeight, world, view, projection);
 
             var direction = end.subtract(start);
             direction.normalize();
@@ -2492,7 +2492,7 @@ var __extends = this.__extends || function (d, b) {
         * @param world a matrix to transform the ray to. Default is the identity matrix.
         */
         Ray.CreateNewFromTo = function (origin, end, world) {
-            if (typeof world === "undefined") { world = BABYLON.Matrix.Identity(); }
+            if (typeof world === "undefined") { world = Matrix.Identity(); }
             var direction = end.subtract(origin);
             var length = Math.sqrt((direction.x * direction.x) + (direction.y * direction.y) + (direction.z * direction.z));
             direction.normalize();
@@ -2501,8 +2501,8 @@ var __extends = this.__extends || function (d, b) {
         };
 
         Ray.Transform = function (ray, matrix) {
-            var newOrigin = BABYLON.Vector3.TransformCoordinates(ray.origin, matrix);
-            var newDirection = BABYLON.Vector3.TransformNormal(ray.direction, matrix);
+            var newOrigin = Vector3.TransformCoordinates(ray.origin, matrix);
+            var newDirection = Vector3.TransformNormal(ray.direction, matrix);
 
             return new Ray(newOrigin, newDirection, ray.length);
         };
@@ -2519,9 +2519,9 @@ var __extends = this.__extends || function (d, b) {
     var Axis = (function () {
         function Axis() {
         }
-        Axis.X = new BABYLON.Vector3(1, 0, 0);
-        Axis.Y = new BABYLON.Vector3(0, 1, 0);
-        Axis.Z = new BABYLON.Vector3(0, 0, 1);
+        Axis.X = new Vector3(1, 0, 0);
+        Axis.Y = new Vector3(0, 1, 0);
+        Axis.Z = new Vector3(0, 0, 1);
         return Axis;
     })();
     BABYLON.Axis = Axis;
@@ -2590,8 +2590,8 @@ var __extends = this.__extends || function (d, b) {
     })();
     BABYLON.Angle = Angle;
 
-    var Arc = (function () {
-        function Arc(startPoint, midPoint, endPoint) {
+    var Arc2 = (function () {
+        function Arc2(startPoint, midPoint, endPoint) {
             this.startPoint = startPoint;
             this.midPoint = midPoint;
             this.endPoint = endPoint;
@@ -2623,27 +2623,27 @@ var __extends = this.__extends || function (d, b) {
             this.orientation = (a2 - a1) < 0 ? 0 /* CW */ : 1 /* CCW */;
             this.angle = Angle.FromDegrees(this.orientation === 0 /* CW */ ? a1 - a3 : a3 - a1);
         }
-        return Arc;
+        return Arc2;
     })();
-    BABYLON.Arc = Arc;
+    BABYLON.Arc2 = Arc2;
 
-    var Path = (function () {
-        function Path(x, y) {
+    var Path2 = (function () {
+        function Path2(x, y) {
             this._points = [];
             this._points.push(new Vector2(x, y));
         }
-        Path.prototype.addLineTo = function (x, y) {
+        Path2.prototype.addLineTo = function (x, y) {
             this._points.push(new Vector2(x, y));
             return this;
         };
 
-        Path.prototype.addArcTo = function (midX, midY, endX, endY, numberOfSegments) {
+        Path2.prototype.addArcTo = function (midX, midY, endX, endY, numberOfSegments) {
             if (typeof numberOfSegments === "undefined") { numberOfSegments = 36; }
             var startPoint = this._points[this._points.length - 1];
             var midPoint = new Vector2(midX, midY);
             var endPoint = new Vector2(endX, endY);
 
-            var arc = new Arc(startPoint, midPoint, endPoint);
+            var arc = new Arc2(startPoint, midPoint, endPoint);
 
             var increment = arc.angle.radians() / numberOfSegments;
             if (arc.orientation === 0 /* CW */)
@@ -2659,16 +2659,16 @@ var __extends = this.__extends || function (d, b) {
             return this;
         };
 
-        Path.prototype.close = function () {
+        Path2.prototype.close = function () {
             return this._points;
         };
 
-        Path.StartingAt = function (x, y) {
-            return new Path(x, y);
+        Path2.StartingAt = function (x, y) {
+            return new Path2(x, y);
         };
-        return Path;
+        return Path2;
     })();
-    BABYLON.Path = Path;
+    BABYLON.Path2 = Path2;
 })(BABYLON || (BABYLON = {}));
 //# sourceMappingURL=babylon.math.js.map
 var BABYLON;
@@ -3796,6 +3796,7 @@ var BABYLON;
         texture._width = potWidth;
         texture._height = potHeight;
         texture.isReady = true;
+        texture.samplingMode = samplingMode;
         scene._removePendingData(texture);
     };
 
@@ -4798,6 +4799,8 @@ var BABYLON;
             gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, minFilter);
 
             gl.bindTexture(gl.TEXTURE_2D, null);
+
+            texture.samplingMode = samplingMode;
         };
 
         Engine.prototype.createTexture = function (url, noMipmap, invertY, scene, samplingMode, onLoad, onError, buffer) {
@@ -4955,6 +4958,7 @@ var BABYLON;
             texture._height = height;
             texture.isReady = true;
             texture.references = 1;
+            texture.samplingMode = samplingMode;
 
             this._loadedTexturesCache.push(texture);
 
@@ -4983,6 +4987,7 @@ var BABYLON;
             texture.isReady = false;
             texture.generateMipMaps = generateMipMaps;
             texture.references = 1;
+            texture.samplingMode = samplingMode;
 
             this._loadedTexturesCache.push(texture);
 
@@ -5091,6 +5096,7 @@ var BABYLON;
             texture.isReady = true;
             texture.generateMipMaps = generateMipMaps;
             texture.references = 1;
+            texture.samplingMode = samplingMode;
             this._activeTexturesCache = [];
 
             this._loadedTexturesCache.push(texture);
@@ -12846,14 +12852,16 @@ var BABYLON;
             }
         };
 
-        BaseTexture.prototype._getFromCache = function (url, noMipmap) {
+        BaseTexture.prototype._getFromCache = function (url, noMipmap, sampling) {
             var texturesCache = this._scene.getEngine().getLoadedTexturesCache();
             for (var index = 0; index < texturesCache.length; index++) {
                 var texturesCacheEntry = texturesCache[index];
 
                 if (texturesCacheEntry.url === url && texturesCacheEntry.noMipmap === noMipmap) {
-                    texturesCacheEntry.references++;
-                    return texturesCacheEntry;
+                    if (!sampling || sampling === texturesCacheEntry.samplingMode) {
+                        texturesCacheEntry.references++;
+                        return texturesCacheEntry;
+                    }
                 }
             }
 
@@ -13144,7 +13152,7 @@ var BABYLON;
                 return;
             }
 
-            this._texture = this._getFromCache(url, noMipmap);
+            this._texture = this._getFromCache(url, noMipmap, samplingMode);
 
             if (!this._texture) {
                 if (!scene.useDelayedTextureLoading) {
@@ -13163,7 +13171,7 @@ var BABYLON;
             }
 
             this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_LOADED;
-            this._texture = this._getFromCache(this.url, this._noMipmap);
+            this._texture = this._getFromCache(this.url, this._noMipmap, this._samplingMode);
 
             if (!this._texture) {
                 this._texture = this.getScene().getEngine().createTexture(this.url, this._noMipmap, this._invertY, this.getScene(), this._samplingMode, null, null, this._buffer);
@@ -30324,7 +30332,7 @@ var BABYLON;
             var _this = this;
             var result = new Array();
             originalPoints.forEach(function (point) {
-                if (result.length == 0 || !(BABYLON.Tools.WithinEpsilon(point.x, result[0].x) && BABYLON.Tools.WithinEpsilon(point.y, result[0].y))) {
+                if (result.length === 0 || !(BABYLON.Tools.WithinEpsilon(point.x, result[0].x) && BABYLON.Tools.WithinEpsilon(point.y, result[0].y))) {
                     var newPoint = new IndexedVector2(point, _this.elements.length);
                     result.push(newPoint);
                     _this.elements.push(newPoint);
@@ -30405,7 +30413,7 @@ var BABYLON;
         };
 
         Polygon.StartingAt = function (x, y) {
-            return BABYLON.Path.StartingAt(x, y);
+            return BABYLON.Path2.StartingAt(x, y);
         };
         return Polygon;
     })();

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 7 - 7
babylon.2.0-alpha.js