Debian Codegraph @

src/scene/glsl/source/shadow_map_generate.fs

raw
1 /* Fragment shader when generating shadow maps. */
2
3 #ifdef ALPHA_TEST
4 uniform sampler2D castle_texture_0;
5 varying vec2 castle_TexCoord0_XY;
6 #endif
7
8 void main(void)
9 {
10 #ifdef ALPHA_TEST
11 /* Alpha test texture.
12 TODO: This assumes the alpha-tested texture is 2D and is in 0th channel. */
13 if (texture2D(castle_texture_0, castle_TexCoord0_XY).a < 0.5)
14 discard;
15 #endif
16
17 #ifdef VARIANCE_SHADOW_MAPS
18 /* Encode depth is format necessary for Variance Shadow Maps.
19
20 Note: No need to divide gl_FragCoord.z by gl_FragCoord.w,
21 as far as I understand GLSL spec. */
22 gl_FragColor = vec4(gl_FragCoord.z, gl_FragCoord.z * gl_FragCoord.z, 0.0, 1.0);
23 #endif
24
25 /* For classic shadow maps (not Variance Shadow Maps),
26 it doesn't matter what we write to the color buffer. */
27 // gl_FragColor = vec4(1.0, 0.0, 1.0, 1.0);
28 }