|
@@ -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;
|
|
|
})();
|