Revert "- check light direction in the shader."

This reverts commit e9f7383279.

It was not needed in the old version.
This commit is contained in:
drfrag666 2018-05-25 20:38:26 +02:00
parent 15b28aadd9
commit 1b7312c0d0

View file

@ -9,10 +9,6 @@ vec3 lightContribution(int i, vec3 normal)
float lightdistance = distance(lightpos.xyz, pixelpos.xyz);
if (lightpos.w < lightdistance)
return vec3(0.0); // Early out lights touching surface but not this fragment
vec3 lightdir = normalize(lightpos.xyz - pixelpos.xyz);
float dotprod = dot(normal, lightdir);
if (dotprod < -0.0001) return vec3(0.0); // light hits from the backside. This can happen with full sector light lists and must be rejected for all cases. Note that this can cause precision issues.
float attenuation = clamp((lightpos.w - lightdistance) / lightpos.w, 0.0, 1.0);
@ -21,7 +17,8 @@ vec3 lightContribution(int i, vec3 normal)
if (lightcolor.a < 0.0) // Sign bit is the attenuated light flag
{
attenuation *= clamp(dotprod, 0.0, 1.0);
vec3 lightdir = normalize(lightpos.xyz - pixelpos.xyz);
attenuation *= clamp(dot(normal, lightdir), 0.0, 1.0);
}
if (attenuation > 0.0) // Skip shadow map test if possible