mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-07 13:30:16 +00:00
35 lines
814 B
GLSL
35 lines
814 B
GLSL
in vec4 pixelpos;
|
|
in vec2 glowdist;
|
|
|
|
//===========================================================================
|
|
//
|
|
// Main shader routine
|
|
//
|
|
//===========================================================================
|
|
|
|
void main()
|
|
{
|
|
#ifndef NO_DISCARD
|
|
// clip plane emulation for plane reflections. These are always perfectly horizontal so a simple check of the pixelpos's y coordinate is sufficient.
|
|
if (pixelpos.y > uClipHeight + 65536.0) discard;
|
|
if (pixelpos.y < uClipHeight - 65536.0) discard;
|
|
#endif
|
|
|
|
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);
|
|
gl_FragColor = vec4(uFogColor.rgb, 1.0 - fogfactor);
|
|
}
|
|
|