瀏覽代碼

Fixing textures flags

Deltakosh 11 年之前
父節點
當前提交
c970e352b7
共有 1 個文件被更改,包括 23 次插入21 次删除
  1. 23 21
      Babylon/Materials/babylon.standardMaterial.js

+ 23 - 21
Babylon/Materials/babylon.standardMaterial.js

@@ -64,7 +64,7 @@ var BABYLON = BABYLON || {};
 
 
         // Textures
         // Textures
         if (this._scene.texturesEnabled) {
         if (this._scene.texturesEnabled) {
-            if (this.diffuseTexture && BABYLON.StandardMaterial.diffuseTextureEnabled) {
+            if (this.diffuseTexture && BABYLON.StandardMaterial.DiffuseTextureEnabled) {
                 if (!this.diffuseTexture.isReady()) {
                 if (!this.diffuseTexture.isReady()) {
                     return false;
                     return false;
                 } else {
                 } else {
@@ -72,7 +72,7 @@ var BABYLON = BABYLON || {};
                 }
                 }
             }
             }
 
 
-            if (this.ambientTexture && BABYLON.StandardMaterial.ambientTextureEnabled) {
+            if (this.ambientTexture && BABYLON.StandardMaterial.AmbientTextureEnabled) {
                 if (!this.ambientTexture.isReady()) {
                 if (!this.ambientTexture.isReady()) {
                     return false;
                     return false;
                 } else {
                 } else {
@@ -80,7 +80,7 @@ var BABYLON = BABYLON || {};
                 }
                 }
             }
             }
 
 
-            if (this.opacityTexture && BABYLON.StandardMaterial.opacityTextureEnabled) {
+            if (this.opacityTexture && BABYLON.StandardMaterial.OpacityTextureEnabled) {
                 if (!this.opacityTexture.isReady()) {
                 if (!this.opacityTexture.isReady()) {
                     return false;
                     return false;
                 } else {
                 } else {
@@ -88,7 +88,7 @@ var BABYLON = BABYLON || {};
                 }
                 }
             }
             }
 
 
-            if (this.reflectionTexture && BABYLON.StandardMaterial.reflectionTextureEnabled) {
+            if (this.reflectionTexture && BABYLON.StandardMaterial.ReflectionTextureEnabled) {
                 if (!this.reflectionTexture.isReady()) {
                 if (!this.reflectionTexture.isReady()) {
                     return false;
                     return false;
                 } else {
                 } else {
@@ -96,7 +96,7 @@ var BABYLON = BABYLON || {};
                 }
                 }
             }
             }
 
 
-            if (this.emissiveTexture && BABYLON.StandardMaterial.emissiveTextureEnabled) {
+            if (this.emissiveTexture && BABYLON.StandardMaterial.EmissiveTextureEnabled) {
                 if (!this.emissiveTexture.isReady()) {
                 if (!this.emissiveTexture.isReady()) {
                     return false;
                     return false;
                 } else {
                 } else {
@@ -104,7 +104,7 @@ var BABYLON = BABYLON || {};
                 }
                 }
             }
             }
 
 
-            if (this.specularTexture && BABYLON.StandardMaterial.specularTextureEnabled) {
+            if (this.specularTexture && BABYLON.StandardMaterial.SpecularTextureEnabled) {
                 if (!this.specularTexture.isReady()) {
                 if (!this.specularTexture.isReady()) {
                     return false;
                     return false;
                 } else {
                 } else {
@@ -114,7 +114,7 @@ var BABYLON = BABYLON || {};
             }
             }
         }
         }
 
 
-        if (this._scene.getEngine().getCaps().standardDerivatives && this.bumpTexture && BABYLON.StandardMaterial.bumpTextureEnabled) {
+        if (this._scene.getEngine().getCaps().standardDerivatives && this.bumpTexture && BABYLON.StandardMaterial.BumpTextureEnabled) {
             if (!this.bumpTexture.isReady()) {
             if (!this.bumpTexture.isReady()) {
                 return false;
                 return false;
             } else {
             } else {
@@ -290,7 +290,7 @@ var BABYLON = BABYLON || {};
         }
         }
 
 
         // Textures        
         // Textures        
-        if (this.diffuseTexture) {
+        if (this.diffuseTexture && BABYLON.StandardMaterial.DiffuseTextureEnabled) {
             this._effect.setTexture("diffuseSampler", this.diffuseTexture);
             this._effect.setTexture("diffuseSampler", this.diffuseTexture);
 
 
             this._effect.setFloat2("vDiffuseInfos", this.diffuseTexture.coordinatesIndex, this.diffuseTexture.level);
             this._effect.setFloat2("vDiffuseInfos", this.diffuseTexture.coordinatesIndex, this.diffuseTexture.level);
@@ -299,21 +299,21 @@ var BABYLON = BABYLON || {};
             this._baseColor.copyFromFloats(1, 1, 1);
             this._baseColor.copyFromFloats(1, 1, 1);
         }
         }
 
 
-        if (this.ambientTexture) {
+        if (this.ambientTexture && BABYLON.StandardMaterial.AmbientTextureEnabled) {
             this._effect.setTexture("ambientSampler", this.ambientTexture);
             this._effect.setTexture("ambientSampler", this.ambientTexture);
 
 
             this._effect.setFloat2("vAmbientInfos", this.ambientTexture.coordinatesIndex, this.ambientTexture.level);
             this._effect.setFloat2("vAmbientInfos", this.ambientTexture.coordinatesIndex, this.ambientTexture.level);
             this._effect.setMatrix("ambientMatrix", this.ambientTexture._computeTextureMatrix());
             this._effect.setMatrix("ambientMatrix", this.ambientTexture._computeTextureMatrix());
         }
         }
 
 
-        if (this.opacityTexture) {
+        if (this.opacityTexture && BABYLON.StandardMaterial.OpacityTextureEnabled) {
             this._effect.setTexture("opacitySampler", this.opacityTexture);
             this._effect.setTexture("opacitySampler", this.opacityTexture);
 
 
             this._effect.setFloat2("vOpacityInfos", this.opacityTexture.coordinatesIndex, this.opacityTexture.level);
             this._effect.setFloat2("vOpacityInfos", this.opacityTexture.coordinatesIndex, this.opacityTexture.level);
             this._effect.setMatrix("opacityMatrix", this.opacityTexture._computeTextureMatrix());
             this._effect.setMatrix("opacityMatrix", this.opacityTexture._computeTextureMatrix());
         }
         }
 
 
-        if (this.reflectionTexture) {
+        if (this.reflectionTexture && BABYLON.StandardMaterial.ReflectionTextureEnabled) {
             if (this.reflectionTexture.isCube) {
             if (this.reflectionTexture.isCube) {
                 this._effect.setTexture("reflectionCubeSampler", this.reflectionTexture);
                 this._effect.setTexture("reflectionCubeSampler", this.reflectionTexture);
             } else {
             } else {
@@ -324,21 +324,21 @@ var BABYLON = BABYLON || {};
             this._effect.setFloat3("vReflectionInfos", this.reflectionTexture.coordinatesMode, this.reflectionTexture.level, this.reflectionTexture.isCube ? 1 : 0);
             this._effect.setFloat3("vReflectionInfos", this.reflectionTexture.coordinatesMode, this.reflectionTexture.level, this.reflectionTexture.isCube ? 1 : 0);
         }
         }
 
 
-        if (this.emissiveTexture) {
+        if (this.emissiveTexture && BABYLON.StandardMaterial.EmissiveTextureEnabled) {
             this._effect.setTexture("emissiveSampler", this.emissiveTexture);
             this._effect.setTexture("emissiveSampler", this.emissiveTexture);
 
 
             this._effect.setFloat2("vEmissiveInfos", this.emissiveTexture.coordinatesIndex, this.emissiveTexture.level);
             this._effect.setFloat2("vEmissiveInfos", this.emissiveTexture.coordinatesIndex, this.emissiveTexture.level);
             this._effect.setMatrix("emissiveMatrix", this.emissiveTexture._computeTextureMatrix());
             this._effect.setMatrix("emissiveMatrix", this.emissiveTexture._computeTextureMatrix());
         }
         }
 
 
-        if (this.specularTexture) {
+        if (this.specularTexture && BABYLON.StandardMaterial.SpecularTextureEnabled) {
             this._effect.setTexture("specularSampler", this.specularTexture);
             this._effect.setTexture("specularSampler", this.specularTexture);
 
 
             this._effect.setFloat2("vSpecularInfos", this.specularTexture.coordinatesIndex, this.specularTexture.level);
             this._effect.setFloat2("vSpecularInfos", this.specularTexture.coordinatesIndex, this.specularTexture.level);
             this._effect.setMatrix("specularMatrix", this.specularTexture._computeTextureMatrix());
             this._effect.setMatrix("specularMatrix", this.specularTexture._computeTextureMatrix());
         }
         }
 
 
-        if (this.bumpTexture && this._scene.getEngine().getCaps().standardDerivatives) {
+        if (this.bumpTexture && this._scene.getEngine().getCaps().standardDerivatives && BABYLON.StandardMaterial.BumpTextureEnabled) {
             this._effect.setTexture("bumpSampler", this.bumpTexture);
             this._effect.setTexture("bumpSampler", this.bumpTexture);
 
 
             this._effect.setFloat2("vBumpInfos", this.bumpTexture.coordinatesIndex, this.bumpTexture.level);
             this._effect.setFloat2("vBumpInfos", this.bumpTexture.coordinatesIndex, this.bumpTexture.level);
@@ -525,13 +525,15 @@ var BABYLON = BABYLON || {};
         return newStandardMaterial;
         return newStandardMaterial;
     };
     };
 
 
+    // Statics
+
     // Flags used to enable or disable a type of texture for all Standard Materials
     // Flags used to enable or disable a type of texture for all Standard Materials
-    BABYLON.StandardMaterial.diffuseTextureEnabled = true;
-    BABYLON.StandardMaterial.ambientTextureEnabled = true;
-    BABYLON.StandardMaterial.opacityTextureEnabled = true;
-    BABYLON.StandardMaterial.reflectionTextureEnabled = true;
-    BABYLON.StandardMaterial.emissiveTextureEnabled = true;
-    BABYLON.StandardMaterial.specularTextureEnabled = true;
-    BABYLON.StandardMaterial.bumpTextureEnabled = true;
+    BABYLON.StandardMaterial.DiffuseTextureEnabled = true;
+    BABYLON.StandardMaterial.AmbientTextureEnabled = true;
+    BABYLON.StandardMaterial.OpacityTextureEnabled = true;
+    BABYLON.StandardMaterial.ReflectionTextureEnabled = true;
+    BABYLON.StandardMaterial.EmissiveTextureEnabled = true;
+    BABYLON.StandardMaterial.SpecularTextureEnabled = true;
+    BABYLON.StandardMaterial.BumpTextureEnabled = true;
 
 
 })();
 })();