mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-12-11 05:01:09 +00:00
36 lines
820 B
GLSL
36 lines
820 B
GLSL
in vec4 pixelpos;
|
|
in vec2 glowdist;
|
|
out vec4 FragColor;
|
|
|
|
//===========================================================================
|
|
//
|
|
// 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 > uClipHeightTop) discard;
|
|
if (pixelpos.y < uClipHeightBottom) 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);
|
|
FragColor = vec4(uFogColor.rgb, 1.0 - fogfactor);
|
|
}
|
|
|