Просмотр исходного кода

Merge pull request #306 from demonixis/master

Added the possibility to disable the fog for a specific material
David Catuhe 10 лет назад
Родитель
Сommit
d472fd6be2

+ 2 - 1
Babylon/Materials/babylon.standardMaterial.js

@@ -32,6 +32,7 @@ var BABYLON;
             this.emissiveColor = new BABYLON.Color3(0, 0, 0);
             this.useAlphaFromDiffuseTexture = false;
             this.useSpecularOverAlpha = true;
+			this.fogEnabled = true;
             this._cachedDefines = null;
             this._renderTargets = new BABYLON.SmartArray(16);
             this._worldViewProjectionMatrix = BABYLON.Matrix.Zero();
@@ -170,7 +171,7 @@ var BABYLON;
             }
 
             // Fog
-            if (scene.fogMode !== BABYLON.Scene.FOGMODE_NONE) {
+            if (scene.fogMode !== BABYLON.Scene.FOGMODE_NONE && this.fogEnabled) {
                 defines.push("#define FOG");
                 fallbacks.addFallback(1, "FOG");
             }

+ 2 - 1
Babylon/Materials/babylon.standardMaterial.ts

@@ -25,6 +25,7 @@
         public emissiveColor = new BABYLON.Color3(0, 0, 0);
         public useAlphaFromDiffuseTexture = false;
         public useSpecularOverAlpha = true;
+		public fogEnabled = true;
 
         public diffuseFresnelParameters: FresnelParameters;
         public opacityFresnelParameters: FresnelParameters;
@@ -174,7 +175,7 @@
             }
 
             // Fog
-            if (scene.fogMode !== BABYLON.Scene.FOGMODE_NONE) {
+            if (scene.fogMode !== BABYLON.Scene.FOGMODE_NONE && this.fogEnabled) {
                 defines.push("#define FOG");
                 fallbacks.addFallback(1, "FOG");
             }