Debian Codegraph @

src/base_rendering/glsl/source/image.fs

raw
1 varying vec2 tex_coord_frag;
2 uniform sampler2D image_texture;
3
4 #ifdef COLOR_UNIFORM
5 uniform vec4 color;
6 #endif
7
8 #ifdef CLIP_LINE
9 uniform vec3 clip_line;
10 /* Not using "gl_FragCoord​.xy / gl_FragCoord​.w", for unknown reason it doesn't
11 * compile (tested on Mesa OpenGL ES, and Nexus 5 OpenGL ES). */
12 varying vec2 frag_coord;
13 #endif
14
15 void main(void)
16 {
17 #ifdef COLOR_UNIFORM
18 gl_FragColor = color;
19 #ifdef TEXTURE_HAS_ONLY_ALPHA
20 gl_FragColor.a *= texture2D(image_texture, tex_coord_frag).a;
21 #else
22 gl_FragColor *= texture2D(image_texture, tex_coord_frag);
23 #endif
24 #else
25 gl_FragColor = texture2D(image_texture, tex_coord_frag);
26 #endif
27
28 #ifdef ALPHA_TEST
29 if (gl_FragColor.a < 0.5) discard;
30 #endif
31 #ifdef CLIP_LINE
32 if (dot(clip_line.xy, tex_coord_frag) + clip_line.z < 0.0) discard;
33 #endif
34 }