Ver Fonte

Merge pull request #378 from Azaezel/alpha40MacCompilePreprocessor

shader preprocessor fixes
Brian Roberts há 4 anos atrás
pai
commit
f5f0eb2bb4

+ 17 - 5
Templates/BaseGame/game/core/rendering/shaders/gl/lighting.glsl

@@ -24,7 +24,7 @@
 #include "./brdf.glsl"
 
 #ifndef TORQUE_SHADERGEN
-#line 26
+#line 27
 // These are the uniforms used by most lighting shaders.
 
 uniform vec4 inLightPos[4];
@@ -52,6 +52,18 @@ uniform vec4 albedo;
 
 #define MAX_FORWARD_LIGHT 4
 
+#ifndef CAPTURING
+#define CAPTURING 0
+#endif
+
+#ifndef DEBUGVIZ_ATTENUATION
+#define DEBUGVIZ_ATTENUATION 0
+#endif
+
+#ifndef DEBUGVIZ_CONTRIB
+#define DEBUGVIZ_CONTRIB 0
+#endif
+
 vec3 getDistanceVectorToPlane( vec3 origin, vec3 direction, vec4 plane )
 {
    float denum = dot( plane.xyz, direction.xyz );
@@ -219,7 +231,7 @@ vec3 evaluateStandardBRDF(Surface surface, SurfaceToLight surfaceToLight)
    float D = D_GGX(surfaceToLight.NdotH, surface.linearRoughnessSq);
    vec3 Fr = D * F * Vis;
 
-#if CAPTURING == true
+#if (CAPTURING == 1)
    return mix(Fd + Fr,surface.f0,surface.metalness);
 #else
    return Fd + Fr;
@@ -416,7 +428,7 @@ vec4 computeForwardProbes(Surface surface,
       }
    }
 
-#if DEBUGVIZ_ATTENUATION == 1
+#if (DEBUGVIZ_ATTENUATION == 1)
       float contribAlpha = 1;
       for (i = 0; i < numProbes; ++i)
       {
@@ -426,7 +438,7 @@ vec4 computeForwardProbes(Surface surface,
       return vec4(1 - contribAlpha, 1 - contribAlpha, 1 - contribAlpha, 1);
 #endif
 
-#if DEBUGVIZ_CONTRIB == 1
+#if (DEBUGVIZ_CONTRIB == 1)
    vec3 probeContribColors[4];
    probeContribColors[0] = vec3(1,0,0);
    probeContribColors[1] = vec3(0,1,0);
@@ -653,4 +665,4 @@ vec4 debugVizForwardProbes(Surface surface,
    horizon *= horizon;
 
    return vec4((irradiance + specular) * horizon, 0);//alpha writes disabled
-}
+}

+ 12 - 0
Templates/BaseGame/game/core/rendering/shaders/lighting.hlsl

@@ -53,6 +53,18 @@ uniform float4 albedo;
 
 #define MAX_FORWARD_LIGHT 4
 
+#ifndef CAPTURING
+#define CAPTURING 0
+#endif
+
+#ifndef DEBUGVIZ_ATTENUATION
+#define DEBUGVIZ_ATTENUATION 0
+#endif
+
+#ifndef DEBUGVIZ_CONTRIB
+#define DEBUGVIZ_CONTRIB 0
+#endif
+
 inline float3 getDistanceVectorToPlane( float3 origin, float3 direction, float4 plane )
 {
    float denum = dot( plane.xyz, direction.xyz );