Преглед изворни кода

Added new material.hasTexture

David Catuhe пре 8 година
родитељ
комит
7104e45378
52 измењених фајлова са 6457 додато и 5732 уклоњено
  1. 870 864
      dist/preview release/babylon.d.ts
  2. 31 30
      dist/preview release/babylon.js
  3. 120 0
      dist/preview release/babylon.max.js
  4. 870 864
      dist/preview release/babylon.module.d.ts
  5. 31 30
      dist/preview release/babylon.worker.js
  6. 1957 1949
      dist/preview release/customConfigurations/minimalViewer/babylon.d.ts
  7. 29 29
      dist/preview release/customConfigurations/minimalViewer/babylon.js
  8. 139 8
      dist/preview release/customConfigurations/minimalViewer/babylon.max.js
  9. 1957 1949
      dist/preview release/customConfigurations/minimalViewer/babylon.module.d.ts
  10. 1 0
      dist/preview release/materialsLibrary/babylon.cellMaterial.d.ts
  11. 6 0
      dist/preview release/materialsLibrary/babylon.cellMaterial.js
  12. 1 1
      dist/preview release/materialsLibrary/babylon.cellMaterial.min.js
  13. 1 0
      dist/preview release/materialsLibrary/babylon.fireMaterial.d.ts
  14. 15 0
      dist/preview release/materialsLibrary/babylon.fireMaterial.js
  15. 1 1
      dist/preview release/materialsLibrary/babylon.fireMaterial.min.js
  16. 1 0
      dist/preview release/materialsLibrary/babylon.furMaterial.d.ts
  17. 12 0
      dist/preview release/materialsLibrary/babylon.furMaterial.js
  18. 1 1
      dist/preview release/materialsLibrary/babylon.furMaterial.min.js
  19. 1 0
      dist/preview release/materialsLibrary/babylon.lavaMaterial.d.ts
  20. 9 0
      dist/preview release/materialsLibrary/babylon.lavaMaterial.js
  21. 1 1
      dist/preview release/materialsLibrary/babylon.lavaMaterial.min.js
  22. 1 0
      dist/preview release/materialsLibrary/babylon.normalMaterial.d.ts
  23. 9 0
      dist/preview release/materialsLibrary/babylon.normalMaterial.js
  24. 1 1
      dist/preview release/materialsLibrary/babylon.normalMaterial.min.js
  25. 1 0
      dist/preview release/materialsLibrary/babylon.simpleMaterial.d.ts
  26. 9 0
      dist/preview release/materialsLibrary/babylon.simpleMaterial.js
  27. 1 1
      dist/preview release/materialsLibrary/babylon.simpleMaterial.min.js
  28. 1 0
      dist/preview release/materialsLibrary/babylon.terrainMaterial.d.ts
  29. 27 0
      dist/preview release/materialsLibrary/babylon.terrainMaterial.js
  30. 1 1
      dist/preview release/materialsLibrary/babylon.terrainMaterial.min.js
  31. 1 0
      dist/preview release/materialsLibrary/babylon.triPlanarMaterial.d.ts
  32. 24 0
      dist/preview release/materialsLibrary/babylon.triPlanarMaterial.js
  33. 1 1
      dist/preview release/materialsLibrary/babylon.triPlanarMaterial.min.js
  34. 1 0
      dist/preview release/materialsLibrary/babylon.waterMaterial.d.ts
  35. 9 0
      dist/preview release/materialsLibrary/babylon.waterMaterial.js
  36. 1 1
      dist/preview release/materialsLibrary/babylon.waterMaterial.min.js
  37. 8 0
      materialsLibrary/src/cell/babylon.cellMaterial.ts
  38. 20 0
      materialsLibrary/src/fire/babylon.fireMaterial.ts
  39. 16 0
      materialsLibrary/src/fur/babylon.furMaterial.ts
  40. 12 0
      materialsLibrary/src/lava/babylon.lavaMaterial.ts
  41. 12 0
      materialsLibrary/src/normal/babylon.normalMaterial.ts
  42. 12 0
      materialsLibrary/src/simple/babylon.simpleMaterial.ts
  43. 36 0
      materialsLibrary/src/terrain/babylon.terrainMaterial.ts
  44. 31 0
      materialsLibrary/src/triPlanar/babylon.triPlanarMaterial.ts
  45. 12 0
      materialsLibrary/src/water/babylon.waterMaterial.ts
  46. 44 0
      src/Materials/PBR/babylon.pbrMaterial.ts
  47. 16 0
      src/Materials/PBR/babylon.pbrMetallicRoughnessMaterial.ts
  48. 16 0
      src/Materials/PBR/babylon.pbrSpecularGlossinessMaterial.ts
  49. 9 0
      src/Materials/Textures/babylon.texture.ts
  50. 4 0
      src/Materials/babylon.material.ts
  51. 23 0
      src/Materials/babylon.shaderMaterial.ts
  52. 44 0
      src/Materials/babylon.standardMaterial.ts

Разлика између датотеке није приказан због своје велике величине
+ 870 - 864
dist/preview release/babylon.d.ts


Разлика између датотеке није приказан због своје велике величине
+ 31 - 30
dist/preview release/babylon.js


+ 120 - 0
dist/preview release/babylon.max.js

@@ -19509,6 +19509,7 @@ var BABYLON;
             t.z += 0.5;
         };
         Texture.prototype.getTextureMatrix = function () {
+            var _this = this;
             if (this.uOffset === this._cachedUOffset &&
                 this.vOffset === this._cachedVOffset &&
                 this.uScale === this._cachedUScale &&
@@ -19548,9 +19549,13 @@ var BABYLON;
             this._cachedTextureMatrix.m[8] = this._t0.x;
             this._cachedTextureMatrix.m[9] = this._t0.y;
             this._cachedTextureMatrix.m[10] = this._t0.z;
+            this.getScene().markAllMaterialsAsDirty(BABYLON.Material.TextureDirtyFlag, function (mat) {
+                return (mat.getActiveTextures().indexOf(_this) !== -1);
+            });
             return this._cachedTextureMatrix;
         };
         Texture.prototype.getReflectionTextureMatrix = function () {
+            var _this = this;
             if (this.uOffset === this._cachedUOffset &&
                 this.vOffset === this._cachedVOffset &&
                 this.uScale === this._cachedUScale &&
@@ -19586,6 +19591,9 @@ var BABYLON;
                     BABYLON.Matrix.IdentityToRef(this._cachedTextureMatrix);
                     break;
             }
+            this.getScene().markAllMaterialsAsDirty(BABYLON.Material.TextureDirtyFlag, function (mat) {
+                return (mat.getActiveTextures().indexOf(_this) !== -1);
+            });
             return this._cachedTextureMatrix;
         };
         Texture.prototype.clone = function () {
@@ -24424,6 +24432,9 @@ var BABYLON;
         Material.prototype.getActiveTextures = function () {
             return [];
         };
+        Material.prototype.hasTexture = function (texture) {
+            return false;
+        };
         Material.prototype.clone = function (name) {
             return null;
         };
@@ -29632,6 +29643,39 @@ var BABYLON;
             }
             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) {
             if (forceDisposeTextures) {
                 if (this._diffuseTexture) {
@@ -31725,6 +31769,39 @@ var BABYLON;
             }
             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) {
             var _this = this;
             return BABYLON.SerializationHelper.Clone(function () { return new PBRMaterial(name, _this.getScene()); }, this);
@@ -32001,6 +32078,18 @@ var BABYLON;
             }
             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) {
             var _this = this;
             return BABYLON.SerializationHelper.Clone(function () { return new PBRMetallicRoughnessMaterial(name, _this.getScene()); }, this);
@@ -32092,6 +32181,18 @@ var BABYLON;
             }
             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) {
             var _this = this;
             return BABYLON.SerializationHelper.Clone(function () { return new PBRSpecularGlossinessMaterial(name, _this.getScene()); }, this);
@@ -41120,6 +41221,25 @@ var BABYLON;
             }
             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) {
             var newShaderMaterial = new ShaderMaterial(name, this.getScene(), this._shaderPath, this._options);
             return newShaderMaterial;

Разлика између датотеке није приказан због своје велике величине
+ 870 - 864
dist/preview release/babylon.module.d.ts


Разлика између датотеке није приказан због своје велике величине
+ 31 - 30
dist/preview release/babylon.worker.js


Разлика између датотеке није приказан због своје велике величине
+ 1957 - 1949
dist/preview release/customConfigurations/minimalViewer/babylon.d.ts


Разлика између датотеке није приказан због своје велике величине
+ 29 - 29
dist/preview release/customConfigurations/minimalViewer/babylon.js


+ 139 - 8
dist/preview release/customConfigurations/minimalViewer/babylon.max.js

@@ -2730,25 +2730,36 @@ var __extends = (this && this.__extends) || (function () {
     BABYLON.Quaternion = Quaternion;
     var Matrix = (function () {
         function Matrix() {
+            this._isIdentity = false;
+            this._isIdentityDirty = true;
             this.m = new Float32Array(16);
             this._markAsUpdated();
         }
         Matrix.prototype._markAsUpdated = function () {
             this.updateFlag = Matrix._updateFlagSeed++;
+            this._isIdentityDirty = true;
         };
         // Properties
         /**
          * Boolean : True is the matrix is the identity matrix
          */
         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).
@@ -19498,6 +19509,7 @@ var BABYLON;
             t.z += 0.5;
         };
         Texture.prototype.getTextureMatrix = function () {
+            var _this = this;
             if (this.uOffset === this._cachedUOffset &&
                 this.vOffset === this._cachedVOffset &&
                 this.uScale === this._cachedUScale &&
@@ -19537,9 +19549,13 @@ var BABYLON;
             this._cachedTextureMatrix.m[8] = this._t0.x;
             this._cachedTextureMatrix.m[9] = this._t0.y;
             this._cachedTextureMatrix.m[10] = this._t0.z;
+            this.getScene().markAllMaterialsAsDirty(BABYLON.Material.TextureDirtyFlag, function (mat) {
+                return (mat.getActiveTextures().indexOf(_this) !== -1);
+            });
             return this._cachedTextureMatrix;
         };
         Texture.prototype.getReflectionTextureMatrix = function () {
+            var _this = this;
             if (this.uOffset === this._cachedUOffset &&
                 this.vOffset === this._cachedVOffset &&
                 this.uScale === this._cachedUScale &&
@@ -19575,6 +19591,9 @@ var BABYLON;
                     BABYLON.Matrix.IdentityToRef(this._cachedTextureMatrix);
                     break;
             }
+            this.getScene().markAllMaterialsAsDirty(BABYLON.Material.TextureDirtyFlag, function (mat) {
+                return (mat.getActiveTextures().indexOf(_this) !== -1);
+            });
             return this._cachedTextureMatrix;
         };
         Texture.prototype.clone = function () {
@@ -24413,6 +24432,9 @@ var BABYLON;
         Material.prototype.getActiveTextures = function () {
             return [];
         };
+        Material.prototype.hasTexture = function (texture) {
+            return false;
+        };
         Material.prototype.clone = function (name) {
             return null;
         };
@@ -36860,6 +36882,39 @@ var BABYLON;
             }
             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) {
             var _this = this;
             return BABYLON.SerializationHelper.Clone(function () { return new PBRMaterial(name, _this.getScene()); }, this);
@@ -37136,6 +37191,18 @@ var BABYLON;
             }
             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) {
             var _this = this;
             return BABYLON.SerializationHelper.Clone(function () { return new PBRMetallicRoughnessMaterial(name, _this.getScene()); }, this);
@@ -37227,6 +37294,18 @@ var BABYLON;
             }
             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) {
             var _this = this;
             return BABYLON.SerializationHelper.Clone(function () { return new PBRSpecularGlossinessMaterial(name, _this.getScene()); }, this);
@@ -37571,6 +37650,25 @@ var BABYLON;
             }
             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) {
             var newShaderMaterial = new ShaderMaterial(name, this.getScene(), this._shaderPath, this._options);
             return newShaderMaterial;
@@ -43154,6 +43252,39 @@ var BABYLON;
             }
             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) {
             if (forceDisposeTextures) {
                 if (this._diffuseTexture) {

Разлика између датотеке није приказан због своје велике величине
+ 1957 - 1949
dist/preview release/customConfigurations/minimalViewer/babylon.module.d.ts


+ 1 - 0
dist/preview release/materialsLibrary/babylon.cellMaterial.d.ts

@@ -21,6 +21,7 @@ declare module BABYLON {
         bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
         getAnimatables(): IAnimatable[];
         getActiveTextures(): BaseTexture[];
+        hasTexture(texture: BaseTexture): boolean;
         dispose(forceDisposeEffect?: boolean): void;
         clone(name: string): CellMaterial;
         serialize(): any;

+ 6 - 0
dist/preview release/materialsLibrary/babylon.cellMaterial.js

@@ -227,6 +227,12 @@ var BABYLON;
             }
             return activeTextures;
         };
+        CellMaterial.prototype.hasTexture = function (texture) {
+            if (_super.prototype.hasTexture.call(this, texture)) {
+                return true;
+            }
+            return this._diffuseTexture === texture;
+        };
         CellMaterial.prototype.dispose = function (forceDisposeEffect) {
             if (this._diffuseTexture) {
                 this._diffuseTexture.dispose();

Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
dist/preview release/materialsLibrary/babylon.cellMaterial.min.js


+ 1 - 0
dist/preview release/materialsLibrary/babylon.fireMaterial.d.ts

@@ -20,6 +20,7 @@ declare module BABYLON {
         bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
         getAnimatables(): IAnimatable[];
         getActiveTextures(): BaseTexture[];
+        hasTexture(texture: BaseTexture): boolean;
         dispose(forceDisposeEffect?: boolean): void;
         clone(name: string): FireMaterial;
         serialize(): any;

+ 15 - 0
dist/preview release/materialsLibrary/babylon.fireMaterial.js

@@ -222,6 +222,21 @@ var BABYLON;
             }
             return activeTextures;
         };
+        FireMaterial.prototype.hasTexture = function (texture) {
+            if (_super.prototype.hasTexture.call(this, texture)) {
+                return true;
+            }
+            if (this._diffuseTexture === texture) {
+                return true;
+            }
+            if (this._distortionTexture === texture) {
+                return true;
+            }
+            if (this._opacityTexture === texture) {
+                return true;
+            }
+            return false;
+        };
         FireMaterial.prototype.dispose = function (forceDisposeEffect) {
             if (this._diffuseTexture) {
                 this._diffuseTexture.dispose();

Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
dist/preview release/materialsLibrary/babylon.fireMaterial.min.js


+ 1 - 0
dist/preview release/materialsLibrary/babylon.furMaterial.d.ts

@@ -34,6 +34,7 @@ declare module BABYLON {
         bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
         getAnimatables(): IAnimatable[];
         getActiveTextures(): BaseTexture[];
+        hasTexture(texture: BaseTexture): boolean;
         dispose(forceDisposeEffect?: boolean): void;
         clone(name: string): FurMaterial;
         serialize(): any;

+ 12 - 0
dist/preview release/materialsLibrary/babylon.furMaterial.js

@@ -295,6 +295,18 @@ var BABYLON;
             }
             return activeTextures;
         };
+        FurMaterial.prototype.hasTexture = function (texture) {
+            if (_super.prototype.hasTexture.call(this, texture)) {
+                return true;
+            }
+            if (this.diffuseTexture === texture) {
+                return true;
+            }
+            if (this._heightTexture === texture) {
+                return true;
+            }
+            return false;
+        };
         FurMaterial.prototype.dispose = function (forceDisposeEffect) {
             if (this.diffuseTexture) {
                 this.diffuseTexture.dispose();

Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
dist/preview release/materialsLibrary/babylon.furMaterial.min.js


+ 1 - 0
dist/preview release/materialsLibrary/babylon.lavaMaterial.d.ts

@@ -26,6 +26,7 @@ declare module BABYLON {
         bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
         getAnimatables(): IAnimatable[];
         getActiveTextures(): BaseTexture[];
+        hasTexture(texture: BaseTexture): boolean;
         dispose(forceDisposeEffect?: boolean): void;
         clone(name: string): LavaMaterial;
         serialize(): any;

+ 9 - 0
dist/preview release/materialsLibrary/babylon.lavaMaterial.js

@@ -278,6 +278,15 @@ var BABYLON;
             }
             return activeTextures;
         };
+        LavaMaterial.prototype.hasTexture = function (texture) {
+            if (_super.prototype.hasTexture.call(this, texture)) {
+                return true;
+            }
+            if (this.diffuseTexture === texture) {
+                return true;
+            }
+            return false;
+        };
         LavaMaterial.prototype.dispose = function (forceDisposeEffect) {
             if (this.diffuseTexture) {
                 this.diffuseTexture.dispose();

Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
dist/preview release/materialsLibrary/babylon.lavaMaterial.min.js


+ 1 - 0
dist/preview release/materialsLibrary/babylon.normalMaterial.d.ts

@@ -19,6 +19,7 @@ declare module BABYLON {
         bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
         getAnimatables(): IAnimatable[];
         getActiveTextures(): BaseTexture[];
+        hasTexture(texture: BaseTexture): boolean;
         dispose(forceDisposeEffect?: boolean): void;
         clone(name: string): NormalMaterial;
         serialize(): any;

+ 9 - 0
dist/preview release/materialsLibrary/babylon.normalMaterial.js

@@ -254,6 +254,15 @@ var BABYLON;
             }
             return activeTextures;
         };
+        NormalMaterial.prototype.hasTexture = function (texture) {
+            if (_super.prototype.hasTexture.call(this, texture)) {
+                return true;
+            }
+            if (this.diffuseTexture === texture) {
+                return true;
+            }
+            return false;
+        };
         NormalMaterial.prototype.dispose = function (forceDisposeEffect) {
             if (this.diffuseTexture) {
                 this.diffuseTexture.dispose();

Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
dist/preview release/materialsLibrary/babylon.normalMaterial.min.js


+ 1 - 0
dist/preview release/materialsLibrary/babylon.simpleMaterial.d.ts

@@ -19,6 +19,7 @@ declare module BABYLON {
         bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
         getAnimatables(): IAnimatable[];
         getActiveTextures(): BaseTexture[];
+        hasTexture(texture: BaseTexture): boolean;
         dispose(forceDisposeEffect?: boolean): void;
         clone(name: string): SimpleMaterial;
         serialize(): any;

+ 9 - 0
dist/preview release/materialsLibrary/babylon.simpleMaterial.js

@@ -221,6 +221,15 @@ var BABYLON;
             }
             return activeTextures;
         };
+        SimpleMaterial.prototype.hasTexture = function (texture) {
+            if (_super.prototype.hasTexture.call(this, texture)) {
+                return true;
+            }
+            if (this.diffuseTexture === texture) {
+                return true;
+            }
+            return false;
+        };
         SimpleMaterial.prototype.dispose = function (forceDisposeEffect) {
             if (this._diffuseTexture) {
                 this._diffuseTexture.dispose();

Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
dist/preview release/materialsLibrary/babylon.simpleMaterial.min.js


+ 1 - 0
dist/preview release/materialsLibrary/babylon.terrainMaterial.d.ts

@@ -32,6 +32,7 @@ declare module BABYLON {
         bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
         getAnimatables(): IAnimatable[];
         getActiveTextures(): BaseTexture[];
+        hasTexture(texture: BaseTexture): boolean;
         dispose(forceDisposeEffect?: boolean): void;
         clone(name: string): TerrainMaterial;
         serialize(): any;

+ 27 - 0
dist/preview release/materialsLibrary/babylon.terrainMaterial.js

@@ -275,6 +275,33 @@ var BABYLON;
             }
             return activeTextures;
         };
+        TerrainMaterial.prototype.hasTexture = function (texture) {
+            if (_super.prototype.hasTexture.call(this, texture)) {
+                return true;
+            }
+            if (this._mixTexture === texture) {
+                return true;
+            }
+            if (this._diffuseTexture1 === texture) {
+                return true;
+            }
+            if (this._diffuseTexture2 === texture) {
+                return true;
+            }
+            if (this._diffuseTexture3 === texture) {
+                return true;
+            }
+            if (this._bumpTexture1 === texture) {
+                return true;
+            }
+            if (this._bumpTexture2 === texture) {
+                return true;
+            }
+            if (this._bumpTexture3 === texture) {
+                return true;
+            }
+            return false;
+        };
         TerrainMaterial.prototype.dispose = function (forceDisposeEffect) {
             if (this.mixTexture) {
                 this.mixTexture.dispose();

Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
dist/preview release/materialsLibrary/babylon.terrainMaterial.min.js


+ 1 - 0
dist/preview release/materialsLibrary/babylon.triPlanarMaterial.d.ts

@@ -32,6 +32,7 @@ declare module BABYLON {
         bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
         getAnimatables(): IAnimatable[];
         getActiveTextures(): BaseTexture[];
+        hasTexture(texture: BaseTexture): boolean;
         dispose(forceDisposeEffect?: boolean): void;
         clone(name: string): TriPlanarMaterial;
         serialize(): any;

+ 24 - 0
dist/preview release/materialsLibrary/babylon.triPlanarMaterial.js

@@ -273,6 +273,30 @@ var BABYLON;
             }
             return activeTextures;
         };
+        TriPlanarMaterial.prototype.hasTexture = function (texture) {
+            if (_super.prototype.hasTexture.call(this, texture)) {
+                return true;
+            }
+            if (this._diffuseTextureX === texture) {
+                return true;
+            }
+            if (this._diffuseTextureY === texture) {
+                return true;
+            }
+            if (this._diffuseTextureZ === texture) {
+                return true;
+            }
+            if (this._normalTextureX === texture) {
+                return true;
+            }
+            if (this._normalTextureY === texture) {
+                return true;
+            }
+            if (this._normalTextureZ === texture) {
+                return true;
+            }
+            return false;
+        };
         TriPlanarMaterial.prototype.dispose = function (forceDisposeEffect) {
             if (this.mixTexture) {
                 this.mixTexture.dispose();

Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
dist/preview release/materialsLibrary/babylon.triPlanarMaterial.min.js


+ 1 - 0
dist/preview release/materialsLibrary/babylon.waterMaterial.d.ts

@@ -93,6 +93,7 @@ declare module BABYLON {
         private _createRenderTargets(scene, renderTargetSize);
         getAnimatables(): IAnimatable[];
         getActiveTextures(): BaseTexture[];
+        hasTexture(texture: BaseTexture): boolean;
         dispose(forceDisposeEffect?: boolean): void;
         clone(name: string): WaterMaterial;
         serialize(): any;

+ 9 - 0
dist/preview release/materialsLibrary/babylon.waterMaterial.js

@@ -451,6 +451,15 @@ var BABYLON;
             }
             return activeTextures;
         };
+        WaterMaterial.prototype.hasTexture = function (texture) {
+            if (_super.prototype.hasTexture.call(this, texture)) {
+                return true;
+            }
+            if (this._bumpTexture === texture) {
+                return true;
+            }
+            return false;
+        };
         WaterMaterial.prototype.dispose = function (forceDisposeEffect) {
             if (this.bumpTexture) {
                 this.bumpTexture.dispose();

Разлика између датотеке није приказан због своје велике величине
+ 1 - 1
dist/preview release/materialsLibrary/babylon.waterMaterial.min.js


+ 8 - 0
materialsLibrary/src/cell/babylon.cellMaterial.ts

@@ -280,6 +280,14 @@ module BABYLON {
             return activeTextures;
         }
 
+        public hasTexture(texture: BaseTexture): boolean {
+            if (super.hasTexture(texture)) {
+                return true;
+            }
+
+            return this._diffuseTexture === texture;
+        }
+
         public dispose(forceDisposeEffect?: boolean): void {
             if (this._diffuseTexture) {
                 this._diffuseTexture.dispose();

+ 20 - 0
materialsLibrary/src/fire/babylon.fireMaterial.ts

@@ -276,6 +276,26 @@ module BABYLON {
             return activeTextures;
         }
 
+        public hasTexture(texture: BaseTexture): boolean {
+            if (super.hasTexture(texture)) {
+                return true;
+            }
+
+            if (this._diffuseTexture === texture) {
+                return true;
+            }
+
+            if (this._distortionTexture === texture) {
+                return true;
+            }    
+
+            if (this._opacityTexture === texture) {
+                return true;
+            }            
+
+            return false;    
+        }         
+
         public dispose(forceDisposeEffect?: boolean): void {
             if (this._diffuseTexture) {
                 this._diffuseTexture.dispose();

+ 16 - 0
materialsLibrary/src/fur/babylon.furMaterial.ts

@@ -383,6 +383,22 @@ module BABYLON {
             return activeTextures;
         }
 
+        public hasTexture(texture: BaseTexture): boolean {
+            if (super.hasTexture(texture)) {
+                return true;
+            }
+
+            if (this.diffuseTexture === texture) {
+                return true;
+            }
+
+            if (this._heightTexture === texture) {
+                return true;
+            }        
+
+            return false;    
+        }        
+
         public dispose(forceDisposeEffect?: boolean): void {
             if (this.diffuseTexture) {
                 this.diffuseTexture.dispose();

+ 12 - 0
materialsLibrary/src/lava/babylon.lavaMaterial.ts

@@ -349,6 +349,18 @@ module BABYLON {
             return activeTextures;
         }
 
+        public hasTexture(texture: BaseTexture): boolean {
+            if (super.hasTexture(texture)) {
+                return true;
+            }
+
+            if (this.diffuseTexture === texture) {
+                return true;
+            }
+            
+            return false;    
+        }        
+
         public dispose(forceDisposeEffect?: boolean): void {
             if (this.diffuseTexture) {
                 this.diffuseTexture.dispose();

+ 12 - 0
materialsLibrary/src/normal/babylon.normalMaterial.ts

@@ -303,6 +303,18 @@ module BABYLON {
             return activeTextures;
         }
 
+        public hasTexture(texture: BaseTexture): boolean {
+            if (super.hasTexture(texture)) {
+                return true;
+            }
+
+            if (this.diffuseTexture === texture) {
+                return true;
+            }  
+
+            return false;    
+        }        
+
         public dispose(forceDisposeEffect?: boolean): void {
             if (this.diffuseTexture) {
                 this.diffuseTexture.dispose();

+ 12 - 0
materialsLibrary/src/simple/babylon.simpleMaterial.ts

@@ -269,6 +269,18 @@ module BABYLON {
             return activeTextures;
         }
 
+        public hasTexture(texture: BaseTexture): boolean {
+            if (super.hasTexture(texture)) {
+                return true;
+            }
+
+            if (this.diffuseTexture === texture) {
+                return true;
+            } 
+
+            return false;    
+        }        
+
         public dispose(forceDisposeEffect?: boolean): void {
             if (this._diffuseTexture) {
                 this._diffuseTexture.dispose();

+ 36 - 0
materialsLibrary/src/terrain/babylon.terrainMaterial.ts

@@ -366,6 +366,42 @@ module BABYLON {
             return activeTextures;
         }
 
+        public hasTexture(texture: BaseTexture): boolean {
+            if (super.hasTexture(texture)) {
+                return true;
+            }
+
+            if (this._mixTexture === texture) {
+                return true;
+            }
+
+            if (this._diffuseTexture1 === texture) {
+                return true;
+            }    
+
+            if (this._diffuseTexture2 === texture) {
+                return true;
+            }
+
+            if (this._diffuseTexture3 === texture) {
+                return true;
+            }        
+
+            if (this._bumpTexture1 === texture) {
+                return true;
+            }
+
+            if (this._bumpTexture2 === texture) {
+                return true;
+            }        
+
+            if (this._bumpTexture3 === texture) {
+                return true;
+            }      
+
+            return false;    
+        }        
+
         public dispose(forceDisposeEffect?: boolean): void {
             if (this.mixTexture) {
                 this.mixTexture.dispose();

+ 31 - 0
materialsLibrary/src/triPlanar/babylon.triPlanarMaterial.ts

@@ -362,6 +362,37 @@ module BABYLON {
             return activeTextures;
         }
 
+        public hasTexture(texture: BaseTexture): boolean {
+            if (super.hasTexture(texture)) {
+                return true;
+            }
+
+            if (this._diffuseTextureX === texture) {
+                return true;
+            }    
+
+            if (this._diffuseTextureY === texture) {
+                return true;
+            }         
+
+            if (this._diffuseTextureZ === texture) {
+                return true;
+            }
+
+            if (this._normalTextureX === texture) {
+                return true;
+            }     
+
+            if (this._normalTextureY === texture) {
+                return true;
+            }     
+
+            if (this._normalTextureZ === texture) {
+                return true;
+            }                                 
+            return false;    
+        }        
+
         public dispose(forceDisposeEffect?: boolean): void {
             if (this.mixTexture) {
                 this.mixTexture.dispose();

+ 12 - 0
materialsLibrary/src/water/babylon.waterMaterial.ts

@@ -558,6 +558,18 @@ module BABYLON {
             return activeTextures;
         }
 
+        public hasTexture(texture: BaseTexture): boolean {
+            if (super.hasTexture(texture)) {
+                return true;
+            }
+
+            if (this._bumpTexture === texture) {
+                return true;
+            }        
+
+            return false;    
+        }
+
         public dispose(forceDisposeEffect?: boolean): void {
             if (this.bumpTexture) {
                 this.bumpTexture.dispose();

+ 44 - 0
src/Materials/PBR/babylon.pbrMaterial.ts

@@ -570,6 +570,50 @@
             return activeTextures;
         }
 
+        public hasTexture(texture: BaseTexture): boolean {
+            if (super.hasTexture(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;    
+        }         
+
         public clone(name: string): PBRMaterial {
             return SerializationHelper.Clone(() => new PBRMaterial(name, this.getScene()), this);
         }

+ 16 - 0
src/Materials/PBR/babylon.pbrMetallicRoughnessMaterial.ts

@@ -86,6 +86,22 @@
             return activeTextures;
         }
 
+        public hasTexture(texture: BaseTexture): boolean {
+            if (super.hasTexture(texture)) {
+                return true;
+            }
+
+            if (this.baseTexture === texture) {
+                return true;
+            }
+
+            if (this.metallicRoughnessTexture === texture) {
+                return true;
+            }        
+
+            return false;    
+        }        
+
         public clone(name: string): PBRMetallicRoughnessMaterial {
             return SerializationHelper.Clone(() => new PBRMetallicRoughnessMaterial(name, this.getScene()), this);
         }

+ 16 - 0
src/Materials/PBR/babylon.pbrSpecularGlossinessMaterial.ts

@@ -78,6 +78,22 @@
             return activeTextures;
         }
 
+        public hasTexture(texture: BaseTexture): boolean {
+            if (super.hasTexture(texture)) {
+                return true;
+            }
+
+            if (this.diffuseTexture === texture) {
+                return true;
+            }
+
+            if (this.specularGlossinessTexture === texture) {
+                return true;
+            }        
+
+            return false;    
+        }
+
         public clone(name: string): PBRSpecularGlossinessMaterial {
             return SerializationHelper.Clone(() => new PBRSpecularGlossinessMaterial(name, this.getScene()), this);
         }

+ 9 - 0
src/Materials/Textures/babylon.texture.ts

@@ -233,6 +233,10 @@
             this._cachedTextureMatrix.m[4] = this._t2.x; this._cachedTextureMatrix.m[5] = this._t2.y; this._cachedTextureMatrix.m[6] = this._t2.z;
             this._cachedTextureMatrix.m[8] = this._t0.x; this._cachedTextureMatrix.m[9] = this._t0.y; this._cachedTextureMatrix.m[10] = this._t0.z;
 
+            this.getScene().markAllMaterialsAsDirty(Material.TextureDirtyFlag, (mat) => {
+                return mat.hasTexture(this);
+            });
+
             return this._cachedTextureMatrix;
         }
 
@@ -278,6 +282,11 @@
                     Matrix.IdentityToRef(this._cachedTextureMatrix);
                     break;
             }
+            
+            this.getScene().markAllMaterialsAsDirty(Material.TextureDirtyFlag, (mat) => {
+                return (mat.getActiveTextures().indexOf(this) !== -1);
+            });
+
             return this._cachedTextureMatrix;
         }
 

+ 4 - 0
src/Materials/babylon.material.ts

@@ -494,6 +494,10 @@
             return [];
         }
 
+        public hasTexture(texture: BaseTexture): boolean {
+            return false;
+        }
+
         public clone(name: string): Material {
             return null;
         }

+ 23 - 0
src/Materials/babylon.shaderMaterial.ts

@@ -378,6 +378,29 @@
             return activeTextures;
         }
 
+        public hasTexture(texture: BaseTexture): boolean {
+            if (super.hasTexture(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;    
+        }
+
         public clone(name: string): ShaderMaterial {
             var newShaderMaterial = new ShaderMaterial(name, this.getScene(), this._shaderPath, this._options);
 

+ 44 - 0
src/Materials/babylon.standardMaterial.ts

@@ -1221,6 +1221,50 @@ module BABYLON {
             return activeTextures;
         }
 
+        public hasTexture(texture: BaseTexture): boolean {
+            if (super.hasTexture(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;    
+        }        
+
         public dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void {
             if (forceDisposeTextures) {
                 if (this._diffuseTexture) {