|
@@ -7437,6 +7437,8 @@ var BABYLON;
|
|
function Matrix() {
|
|
function Matrix() {
|
|
this._isIdentity = false;
|
|
this._isIdentity = false;
|
|
this._isIdentityDirty = true;
|
|
this._isIdentityDirty = true;
|
|
|
|
+ this._isIdentity3x2 = true;
|
|
|
|
+ this._isIdentity3x2Dirty = true;
|
|
/**
|
|
/**
|
|
* Gets or sets the internal data of the matrix
|
|
* Gets or sets the internal data of the matrix
|
|
*/
|
|
*/
|
|
@@ -7447,18 +7449,17 @@ var BABYLON;
|
|
Matrix.prototype._markAsUpdated = function () {
|
|
Matrix.prototype._markAsUpdated = function () {
|
|
this.updateFlag = Matrix._updateFlagSeed++;
|
|
this.updateFlag = Matrix._updateFlagSeed++;
|
|
this._isIdentityDirty = true;
|
|
this._isIdentityDirty = true;
|
|
|
|
+ this._isIdentity3x2Dirty = true;
|
|
};
|
|
};
|
|
// Properties
|
|
// Properties
|
|
/**
|
|
/**
|
|
- * Check if the current matrix is indentity
|
|
|
|
- * @param considerAsTextureMatrix defines if the current matrix must be considered as a texture matrix (3x2)
|
|
|
|
|
|
+ * Check if the current matrix is identity
|
|
* @returns true is the matrix is the identity matrix
|
|
* @returns true is the matrix is the identity matrix
|
|
*/
|
|
*/
|
|
- Matrix.prototype.isIdentity = function (considerAsTextureMatrix) {
|
|
|
|
- if (considerAsTextureMatrix === void 0) { considerAsTextureMatrix = false; }
|
|
|
|
|
|
+ Matrix.prototype.isIdentity = function () {
|
|
if (this._isIdentityDirty) {
|
|
if (this._isIdentityDirty) {
|
|
this._isIdentityDirty = false;
|
|
this._isIdentityDirty = false;
|
|
- if (this.m[0] !== 1.0 || this.m[5] !== 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) {
|
|
this._isIdentity = false;
|
|
this._isIdentity = false;
|
|
}
|
|
}
|
|
else if (this.m[1] !== 0.0 || this.m[2] !== 0.0 || this.m[3] !== 0.0 ||
|
|
else if (this.m[1] !== 0.0 || this.m[2] !== 0.0 || this.m[3] !== 0.0 ||
|
|
@@ -7470,13 +7471,32 @@ var BABYLON;
|
|
else {
|
|
else {
|
|
this._isIdentity = true;
|
|
this._isIdentity = true;
|
|
}
|
|
}
|
|
- if (!considerAsTextureMatrix && this.m[10] !== 1.0) {
|
|
|
|
- this._isIdentity = false;
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
return this._isIdentity;
|
|
return this._isIdentity;
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
|
|
+ * Check if the current matrix is identity as a texture matrix (3x2 store in 4x4)
|
|
|
|
+ * @returns true is the matrix is the identity matrix
|
|
|
|
+ */
|
|
|
|
+ Matrix.prototype.isIdentityAs3x2 = function () {
|
|
|
|
+ if (this._isIdentity3x2Dirty) {
|
|
|
|
+ this._isIdentity3x2Dirty = false;
|
|
|
|
+ if (this.m[0] !== 1.0 || this.m[5] !== 1.0 || this.m[15] !== 1.0) {
|
|
|
|
+ this._isIdentity3x2 = false;
|
|
|
|
+ }
|
|
|
|
+ else 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[10] !== 0.0 || this.m[11] !== 0.0 ||
|
|
|
|
+ this.m[12] !== 0.0 || this.m[13] !== 0.0 || this.m[14] !== 0.0) {
|
|
|
|
+ this._isIdentity3x2 = false;
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ this._isIdentity3x2 = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return this._isIdentity3x2;
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
* Gets the determinant of the matrix
|
|
* Gets the determinant of the matrix
|
|
* @returns the matrix determinant
|
|
* @returns the matrix determinant
|
|
*/
|
|
*/
|
|
@@ -42835,7 +42855,7 @@ var BABYLON;
|
|
MaterialHelper.PrepareDefinesForMergedUV = function (texture, defines, key) {
|
|
MaterialHelper.PrepareDefinesForMergedUV = function (texture, defines, key) {
|
|
defines._needUVs = true;
|
|
defines._needUVs = true;
|
|
defines[key] = true;
|
|
defines[key] = true;
|
|
- if (texture.getTextureMatrix().isIdentity(true)) {
|
|
|
|
|
|
+ if (texture.getTextureMatrix().isIdentityAs3x2()) {
|
|
defines[key + "DIRECTUV"] = texture.coordinatesIndex + 1;
|
|
defines[key + "DIRECTUV"] = texture.coordinatesIndex + 1;
|
|
if (texture.coordinatesIndex === 0) {
|
|
if (texture.coordinatesIndex === 0) {
|
|
defines["MAINUV1"] = true;
|
|
defines["MAINUV1"] = true;
|
|
@@ -42856,7 +42876,7 @@ var BABYLON;
|
|
*/
|
|
*/
|
|
MaterialHelper.BindTextureMatrix = function (texture, uniformBuffer, key) {
|
|
MaterialHelper.BindTextureMatrix = function (texture, uniformBuffer, key) {
|
|
var matrix = texture.getTextureMatrix();
|
|
var matrix = texture.getTextureMatrix();
|
|
- if (!matrix.isIdentity(true)) {
|
|
|
|
|
|
+ if (!matrix.isIdentityAs3x2()) {
|
|
uniformBuffer.updateMatrix(key + "Matrix", matrix);
|
|
uniformBuffer.updateMatrix(key + "Matrix", matrix);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -50761,8 +50781,9 @@ var BABYLON;
|
|
delta = event.wheelDelta / (_this.wheelPrecision * 40);
|
|
delta = event.wheelDelta / (_this.wheelPrecision * 40);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- else if (event.detail || event.deltaY) {
|
|
|
|
- delta = -(event.detail || event.deltaY) / _this.wheelPrecision;
|
|
|
|
|
|
+ else {
|
|
|
|
+ var deltaValue = event.deltaY || event.detail;
|
|
|
|
+ delta = -deltaValue / _this.wheelPrecision;
|
|
}
|
|
}
|
|
if (delta) {
|
|
if (delta) {
|
|
_this.camera.inertialRadiusOffset += delta;
|
|
_this.camera.inertialRadiusOffset += delta;
|