UFO: Alien Invasion
Toggle main menu visibility
Loading...
Searching...
No Matches
write_fragment_fs.glsl
Go to the documentation of this file.
1
/**
2
* @file
3
* @brief Writes given fragment color to the rendering buffer. Adds glow if needed.
4
*/
5
6
#ifndef glsl110
7
#if r_postprocess
8
/** After glsl1110 this need to be explicitly declared; used by fixed functionality at the end of the OpenGL pipeline.*/
9
out vec4 gl_FragData[2];
10
#else
11
/** After glsl1110 this need to be explicitly declared; used by fixed functionality at the end of the OpenGL pipeline.*/
12
out vec4 gl_FragColor;
13
#endif
14
#endif
15
16
uniform float GLOWSCALE;
17
18
/** Glowmap.*/
19
uniform sampler2D SAMPLER_GLOWMAP;
20
21
void writeFragment(vec4 color) {
22
#if r_postprocess
23
gl_FragData[0] = color;
24
if (GLOWSCALE > 0.01) {
25
vec4 glowcolor = texture2D(SAMPLER_GLOWMAP, gl_TexCoord[0].st);
26
gl_FragData[1].rgb = glowcolor.rgb * glowcolor.a * GLOWSCALE;
27
gl_FragData[1].a = 1.0;
28
} else {
29
gl_FragData[1] = vec4(0,0,0,1);
30
}
31
#else
32
if (GLOWSCALE > 0.01) {
33
vec4 glowcolor = texture2D(SAMPLER_GLOWMAP, gl_TexCoord[0].st);
34
color.rgb += glowcolor.rgb * glowcolor.a * GLOWSCALE;
35
}
36
gl_FragColor = color;
37
#endif
38
}
base
shaders
write_fragment_fs.glsl
Generated on __DATE__ __TIME__ for UFO: Alien Invasion by
1.17.0