mirror of
https://github.com/ioquake/ioq3.git
synced 2024-11-10 07:11:46 +00:00
OpenGL2: Speed up fog shader slightly.
This commit is contained in:
parent
a408a2bdae
commit
5985cca2e6
2 changed files with 13 additions and 19 deletions
|
@ -85,16 +85,13 @@ float CalcFog(vec4 position)
|
|||
float s = dot(position, u_FogDistance) * 8.0;
|
||||
float t = dot(position, u_FogDepth);
|
||||
|
||||
if (t < 1.0)
|
||||
{
|
||||
t = step(step(0.0, -u_FogEyeT), t);
|
||||
}
|
||||
else
|
||||
{
|
||||
t /= t - min(u_FogEyeT, 0.0);
|
||||
}
|
||||
|
||||
return s * t;
|
||||
bool eyeOutside = u_FogEyeT < 0.0;
|
||||
float t2 = float(t >= float(eyeOutside));
|
||||
|
||||
if (eyeOutside)
|
||||
t2 *= t / (t - u_FogEyeT);
|
||||
|
||||
return s * t2;
|
||||
}
|
||||
|
||||
void main()
|
||||
|
|
|
@ -194,16 +194,13 @@ float CalcFog(vec4 position)
|
|||
float s = dot(position, u_FogDistance) * 8.0;
|
||||
float t = dot(position, u_FogDepth);
|
||||
|
||||
if (t < 1.0)
|
||||
{
|
||||
t = step(step(0.0, -u_FogEyeT), t);
|
||||
}
|
||||
else
|
||||
{
|
||||
t /= t - min(u_FogEyeT, 0.0);
|
||||
}
|
||||
bool eyeOutside = u_FogEyeT < 0.0;
|
||||
float t2 = float(t >= float(eyeOutside));
|
||||
|
||||
return s * t;
|
||||
if (eyeOutside)
|
||||
t2 *= t / (t - u_FogEyeT);
|
||||
|
||||
return s * t2;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue