mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-26 01:53:47 +00:00
shader preprocessor fixes
some hardware/apis do not evalueate 'not defined' as '0', so always ensure there's *some* value when doing macro value comparisons
This commit is contained in:
parent
e2cb62e252
commit
d76a76a1c4
2 changed files with 29 additions and 5 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue