diff options
author | SmileTheory <SmileTheory@gmail.com> | 2013-09-16 23:20:44 -0700 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2014-06-17 17:43:34 +0100 |
commit | a204b2fbd9b9efc8ae5a65c1fc3abdf1a3042849 (patch) | |
tree | e1dc35619acc6a2c8759c48de899197c58ee0265 /src/renderergl2/glsl/fogpass_vp.glsl | |
parent | c97e014cfe5cad85cedfdf89efcb25d8defbb0c8 (diff) |
OpenGL2: Speed up fog shader slightly.
Diffstat (limited to 'src/renderergl2/glsl/fogpass_vp.glsl')
-rw-r--r-- | src/renderergl2/glsl/fogpass_vp.glsl | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/renderergl2/glsl/fogpass_vp.glsl b/src/renderergl2/glsl/fogpass_vp.glsl index f18bc707..40d14d9f 100644 --- a/src/renderergl2/glsl/fogpass_vp.glsl +++ b/src/renderergl2/glsl/fogpass_vp.glsl @@ -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() |