mirror of
https://github.com/ZDoom/ZDRay.git
synced 2024-11-25 05:11:20 +00:00
Fix bad control flow in GPU sunlight normal test
This commit is contained in:
parent
4675ab5b81
commit
e97babc617
1 changed files with 16 additions and 12 deletions
|
@ -93,7 +93,9 @@ void main()
|
||||||
const float dist = 32768.0;
|
const float dist = 32768.0;
|
||||||
|
|
||||||
float attenuation = 0.0;
|
float attenuation = 0.0;
|
||||||
if (PassType == 0 && surfaceIndex >= 0 && dot(normal, SunDir) > 0.0)
|
if (PassType == 0 && surfaceIndex >= 0)
|
||||||
|
{
|
||||||
|
if(dot(normal, SunDir) > 0.0)
|
||||||
{
|
{
|
||||||
vec3 e0 = normalize(cross(normal, abs(normal.x) < abs(normal.y) ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0)));
|
vec3 e0 = normalize(cross(normal, abs(normal.x) < abs(normal.y) ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0)));
|
||||||
vec3 e1 = cross(normal, e0);
|
vec3 e1 = cross(normal, e0);
|
||||||
|
@ -108,14 +110,16 @@ void main()
|
||||||
attenuation += payload.hitAttenuation;
|
attenuation += payload.hitAttenuation;
|
||||||
}
|
}
|
||||||
attenuation *= 1.0 / float(SampleCount);
|
attenuation *= 1.0 / float(SampleCount);
|
||||||
|
incoming.rgb += SunColor * (attenuation * SunIntensity * incoming.w);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
traceRayEXT(acc, gl_RayFlagsOpaqueEXT, 0xff, 2, 0, 2, origin, minDistance, SunDir, dist, 0);
|
traceRayEXT(acc, gl_RayFlagsOpaqueEXT, 0xff, 2, 0, 2, origin, minDistance, SunDir, dist, 0);
|
||||||
attenuation = payload.hitAttenuation;
|
attenuation = payload.hitAttenuation;
|
||||||
}
|
|
||||||
incoming.rgb += SunColor * (attenuation * SunIntensity * incoming.w);
|
incoming.rgb += SunColor * (attenuation * SunIntensity * incoming.w);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (uint j = LightStart; j < LightEnd; j++)
|
for (uint j = LightStart; j < LightEnd; j++)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue