0
0
Fork 0
mirror of https://github.com/ZDoom/gzdoom.git synced 2024-12-19 17:12:25 +00:00
gzdoom/wadsrc/static/shaders/glsl/fogboundary.fp
Christoph Oelckers eb9d2d9917 - reactivate compatibility profile so that immediate mode drawing can be used on older hardware not supporting persistently mapped buffers.
- reactivate alpha testing per fixed function pipeline
- use the 'modern' way to define clip planes (GL_CLIP_DISTANCE). This is far more portable than the old glClipPlane method and a lot more robust than checking this in the fragment shader.
2014-07-17 02:37:18 +02:00

30 lines
554 B
GLSL

in vec4 pixelpos;
in vec2 glowdist;
out vec4 FragColor;
//===========================================================================
//
// Main shader routine
//
//===========================================================================
void main()
{
float fogdist;
float fogfactor;
//
// calculate fog factor
//
if (uFogEnabled == -1)
{
fogdist = pixelpos.w;
}
else
{
fogdist = max(16.0, distance(pixelpos.xyz, uCameraPos.xyz));
}
fogfactor = exp2 (uFogDensity * fogdist);
FragColor = vec4(uFogColor.rgb, 1.0 - fogfactor);
}