Browse Source

Make sure we exclude some variable names

Popov72 5 years ago
parent
commit
d3e791f910

+ 8 - 0
src/Materials/Node/Blocks/Fragment/PBR/ambientOcclusionBlock.ts

@@ -26,6 +26,14 @@ export class AmbientOcclusionBlock extends NodeMaterialBlock {
     public useAmbientInGrayScale: boolean = false;
 
     /**
+     * Initialize the block and prepare the context for build
+     * @param state defines the state that will be used for the build
+     */
+    public initialize(state: NodeMaterialBuildState) {
+        state._excludeVariableName("aoOut");
+    }
+
+    /**
      * Gets the current class name
      * @returns the class name
      */

+ 12 - 0
src/Materials/Node/Blocks/Fragment/PBR/metallicRoughnessTextureBlock.ts

@@ -1,4 +1,5 @@
 import { NodeMaterial, NodeMaterialDefines } from '../../../nodeMaterial';
+import { NodeMaterialBuildState } from '../../../nodeMaterialBuildState';
 import { _TypeStore } from '../../../../../Misc/typeStore';
 import { editableInPropertyPage, PropertyTypeForEdition } from "../../../nodeMaterialDecorator";
 import { AbstractMesh } from '../../../../../Meshes/abstractMesh';
@@ -44,6 +45,17 @@ export class MetallicRoughnessTextureBlock extends TextureBlock {
     }
 
     /**
+     * Initialize the block and prepare the context for build
+     * @param state defines the state that will be used for the build
+     */
+    public initialize(state: NodeMaterialBuildState) {
+        state._excludeVariableName("baseColor");
+        state._excludeVariableName("reflectivityOut");
+        state._excludeVariableName("microSurface");
+        state._excludeVariableName("roughness");
+    }
+
+    /**
      * Gets the current class name
      * @returns the class name
      */

+ 25 - 2
src/Materials/Node/Blocks/Fragment/PBR/pbrMetallicRoughnessBlock.ts

@@ -87,11 +87,34 @@ export class PBRMetallicRoughnessBlock extends NodeMaterialBlock {
      * @param state defines the state that will be used for the build
      */
     public initialize(state: NodeMaterialBuildState) {
+        state._excludeVariableName("geometricNormalW");
+        state._excludeVariableName("normalW");
+        state._excludeVariableName("faceNormal");
+
+        state._excludeVariableName("albedoOpacityOut");
         state._excludeVariableName("surfaceAlbedo");
         state._excludeVariableName("alpha");
-        state._excludeVariableName("baseColor");
+
+        state._excludeVariableName("NdotVUnclamped");
+        state._excludeVariableName("NdotV");
+        state._excludeVariableName("alphaG");
+        state._excludeVariableName("AARoughnessFactors");
+        state._excludeVariableName("environmentBrdf");
+        state._excludeVariableName("ambientMonochrome");
+        state._excludeVariableName("seo");
+        state._excludeVariableName("eho");
+
         state._excludeVariableName("diffuseBase");
-        state._excludeVariableName("metallicRoughness");
+        state._excludeVariableName("specularBase");
+        state._excludeVariableName("preInfo");
+        state._excludeVariableName("info");
+        state._excludeVariableName("shadow");
+
+        state._excludeVariableName("finalDiffuse");
+        state._excludeVariableName("finalAmbient");
+        state._excludeVariableName("ambientOcclusionForDirectDiffuse");
+
+        state._excludeVariableName("finalColor");
     }
 
     /**