|
@@ -2730,25 +2730,36 @@ var __extends = (this && this.__extends) || (function () {
|
|
BABYLON.Quaternion = Quaternion;
|
|
BABYLON.Quaternion = Quaternion;
|
|
var Matrix = (function () {
|
|
var Matrix = (function () {
|
|
function Matrix() {
|
|
function Matrix() {
|
|
|
|
+ this._isIdentity = false;
|
|
|
|
+ this._isIdentityDirty = true;
|
|
this.m = new Float32Array(16);
|
|
this.m = new Float32Array(16);
|
|
this._markAsUpdated();
|
|
this._markAsUpdated();
|
|
}
|
|
}
|
|
Matrix.prototype._markAsUpdated = function () {
|
|
Matrix.prototype._markAsUpdated = function () {
|
|
this.updateFlag = Matrix._updateFlagSeed++;
|
|
this.updateFlag = Matrix._updateFlagSeed++;
|
|
|
|
+ this._isIdentityDirty = true;
|
|
};
|
|
};
|
|
// Properties
|
|
// Properties
|
|
/**
|
|
/**
|
|
* Boolean : True is the matrix is the identity matrix
|
|
* Boolean : True is the matrix is the identity matrix
|
|
*/
|
|
*/
|
|
Matrix.prototype.isIdentity = function () {
|
|
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)
|
|
|
|
- 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)
|
|
|
|
- return false;
|
|
|
|
- return true;
|
|
|
|
|
|
+ if (this._isIdentityDirty) {
|
|
|
|
+ this._isIdentityDirty = false;
|
|
|
|
+ if (this.m[0] !== 1.0 || this.m[5] !== 1.0 || this.m[10] !== 1.0 || this.m[15] !== 1.0) {
|
|
|
|
+ this._isIdentity = 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[11] !== 0.0 ||
|
|
|
|
+ this.m[12] !== 0.0 || this.m[13] !== 0.0 || this.m[14] !== 0.0) {
|
|
|
|
+ this._isIdentity = false;
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ this._isIdentity = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return this._isIdentity;
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
* Returns the matrix determinant (float).
|
|
* Returns the matrix determinant (float).
|
|
@@ -19498,6 +19509,7 @@ var BABYLON;
|
|
t.z += 0.5;
|
|
t.z += 0.5;
|
|
};
|
|
};
|
|
Texture.prototype.getTextureMatrix = function () {
|
|
Texture.prototype.getTextureMatrix = function () {
|
|
|
|
+ var _this = this;
|
|
if (this.uOffset === this._cachedUOffset &&
|
|
if (this.uOffset === this._cachedUOffset &&
|
|
this.vOffset === this._cachedVOffset &&
|
|
this.vOffset === this._cachedVOffset &&
|
|
this.uScale === this._cachedUScale &&
|
|
this.uScale === this._cachedUScale &&
|
|
@@ -19537,9 +19549,13 @@ var BABYLON;
|
|
this._cachedTextureMatrix.m[8] = this._t0.x;
|
|
this._cachedTextureMatrix.m[8] = this._t0.x;
|
|
this._cachedTextureMatrix.m[9] = this._t0.y;
|
|
this._cachedTextureMatrix.m[9] = this._t0.y;
|
|
this._cachedTextureMatrix.m[10] = this._t0.z;
|
|
this._cachedTextureMatrix.m[10] = this._t0.z;
|
|
|
|
+ this.getScene().markAllMaterialsAsDirty(BABYLON.Material.TextureDirtyFlag, function (mat) {
|
|
|
|
+ return (mat.getActiveTextures().indexOf(_this) !== -1);
|
|
|
|
+ });
|
|
return this._cachedTextureMatrix;
|
|
return this._cachedTextureMatrix;
|
|
};
|
|
};
|
|
Texture.prototype.getReflectionTextureMatrix = function () {
|
|
Texture.prototype.getReflectionTextureMatrix = function () {
|
|
|
|
+ var _this = this;
|
|
if (this.uOffset === this._cachedUOffset &&
|
|
if (this.uOffset === this._cachedUOffset &&
|
|
this.vOffset === this._cachedVOffset &&
|
|
this.vOffset === this._cachedVOffset &&
|
|
this.uScale === this._cachedUScale &&
|
|
this.uScale === this._cachedUScale &&
|
|
@@ -19575,6 +19591,9 @@ var BABYLON;
|
|
BABYLON.Matrix.IdentityToRef(this._cachedTextureMatrix);
|
|
BABYLON.Matrix.IdentityToRef(this._cachedTextureMatrix);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
+ this.getScene().markAllMaterialsAsDirty(BABYLON.Material.TextureDirtyFlag, function (mat) {
|
|
|
|
+ return (mat.getActiveTextures().indexOf(_this) !== -1);
|
|
|
|
+ });
|
|
return this._cachedTextureMatrix;
|
|
return this._cachedTextureMatrix;
|
|
};
|
|
};
|
|
Texture.prototype.clone = function () {
|
|
Texture.prototype.clone = function () {
|
|
@@ -24413,6 +24432,9 @@ var BABYLON;
|
|
Material.prototype.getActiveTextures = function () {
|
|
Material.prototype.getActiveTextures = function () {
|
|
return [];
|
|
return [];
|
|
};
|
|
};
|
|
|
|
+ Material.prototype.hasTexture = function (texture) {
|
|
|
|
+ return false;
|
|
|
|
+ };
|
|
Material.prototype.clone = function (name) {
|
|
Material.prototype.clone = function (name) {
|
|
return null;
|
|
return null;
|
|
};
|
|
};
|
|
@@ -36860,6 +36882,39 @@ var BABYLON;
|
|
}
|
|
}
|
|
return activeTextures;
|
|
return activeTextures;
|
|
};
|
|
};
|
|
|
|
+ PBRMaterial.prototype.hasTexture = function (texture) {
|
|
|
|
+ if (_super.prototype.hasTexture.call(this, texture)) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ if (this._albedoTexture === texture) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ if (this._ambientTexture === texture) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ if (this._opacityTexture === texture) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ if (this._reflectionTexture === texture) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ if (this._metallicTexture === texture) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ if (this._microSurfaceTexture === texture) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ if (this._bumpTexture === texture) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ if (this._lightmapTexture === texture) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ if (this._refractionTexture === texture) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ };
|
|
PBRMaterial.prototype.clone = function (name) {
|
|
PBRMaterial.prototype.clone = function (name) {
|
|
var _this = this;
|
|
var _this = this;
|
|
return BABYLON.SerializationHelper.Clone(function () { return new PBRMaterial(name, _this.getScene()); }, this);
|
|
return BABYLON.SerializationHelper.Clone(function () { return new PBRMaterial(name, _this.getScene()); }, this);
|
|
@@ -37136,6 +37191,18 @@ var BABYLON;
|
|
}
|
|
}
|
|
return activeTextures;
|
|
return activeTextures;
|
|
};
|
|
};
|
|
|
|
+ PBRMetallicRoughnessMaterial.prototype.hasTexture = function (texture) {
|
|
|
|
+ if (_super.prototype.hasTexture.call(this, texture)) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ if (this.baseTexture === texture) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ if (this.metallicRoughnessTexture === texture) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ };
|
|
PBRMetallicRoughnessMaterial.prototype.clone = function (name) {
|
|
PBRMetallicRoughnessMaterial.prototype.clone = function (name) {
|
|
var _this = this;
|
|
var _this = this;
|
|
return BABYLON.SerializationHelper.Clone(function () { return new PBRMetallicRoughnessMaterial(name, _this.getScene()); }, this);
|
|
return BABYLON.SerializationHelper.Clone(function () { return new PBRMetallicRoughnessMaterial(name, _this.getScene()); }, this);
|
|
@@ -37227,6 +37294,18 @@ var BABYLON;
|
|
}
|
|
}
|
|
return activeTextures;
|
|
return activeTextures;
|
|
};
|
|
};
|
|
|
|
+ PBRSpecularGlossinessMaterial.prototype.hasTexture = function (texture) {
|
|
|
|
+ if (_super.prototype.hasTexture.call(this, texture)) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ if (this.diffuseTexture === texture) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ if (this.specularGlossinessTexture === texture) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ };
|
|
PBRSpecularGlossinessMaterial.prototype.clone = function (name) {
|
|
PBRSpecularGlossinessMaterial.prototype.clone = function (name) {
|
|
var _this = this;
|
|
var _this = this;
|
|
return BABYLON.SerializationHelper.Clone(function () { return new PBRSpecularGlossinessMaterial(name, _this.getScene()); }, this);
|
|
return BABYLON.SerializationHelper.Clone(function () { return new PBRSpecularGlossinessMaterial(name, _this.getScene()); }, this);
|
|
@@ -37571,6 +37650,25 @@ var BABYLON;
|
|
}
|
|
}
|
|
return activeTextures;
|
|
return activeTextures;
|
|
};
|
|
};
|
|
|
|
+ ShaderMaterial.prototype.hasTexture = function (texture) {
|
|
|
|
+ if (_super.prototype.hasTexture.call(this, texture)) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ for (var name in this._textures) {
|
|
|
|
+ if (this._textures[name] === texture) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ for (var name in this._textureArrays) {
|
|
|
|
+ var array = this._textureArrays[name];
|
|
|
|
+ for (var index = 0; index < array.length; index++) {
|
|
|
|
+ if (array[index] === texture) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ };
|
|
ShaderMaterial.prototype.clone = function (name) {
|
|
ShaderMaterial.prototype.clone = function (name) {
|
|
var newShaderMaterial = new ShaderMaterial(name, this.getScene(), this._shaderPath, this._options);
|
|
var newShaderMaterial = new ShaderMaterial(name, this.getScene(), this._shaderPath, this._options);
|
|
return newShaderMaterial;
|
|
return newShaderMaterial;
|
|
@@ -43154,6 +43252,39 @@ var BABYLON;
|
|
}
|
|
}
|
|
return activeTextures;
|
|
return activeTextures;
|
|
};
|
|
};
|
|
|
|
+ StandardMaterial.prototype.hasTexture = function (texture) {
|
|
|
|
+ if (_super.prototype.hasTexture.call(this, texture)) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ if (this._diffuseTexture === texture) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ if (this._ambientTexture === texture) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ if (this._opacityTexture === texture) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ if (this._reflectionTexture === texture) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ if (this._emissiveTexture === texture) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ if (this._specularTexture === texture) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ if (this._bumpTexture === texture) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ if (this._lightmapTexture === texture) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ if (this._refractionTexture === texture) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ };
|
|
StandardMaterial.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures) {
|
|
StandardMaterial.prototype.dispose = function (forceDisposeEffect, forceDisposeTextures) {
|
|
if (forceDisposeTextures) {
|
|
if (forceDisposeTextures) {
|
|
if (this._diffuseTexture) {
|
|
if (this._diffuseTexture) {
|