File: blend_include.glsl

package info (click to toggle)
python-moderngl-window 2.4.2-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 69,260 kB
  • sloc: python: 11,225; makefile: 20
file content (44 lines) | stat: -rw-r--r-- 871 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#version 330

#if defined VERTEX_SHADER

in vec3 in_position;
in vec2 in_texcoord_0;
out vec2 uv0;

void main() {
    gl_Position = vec4(in_position, 1);
    uv0 = in_texcoord_0;
}

#elif defined FRAGMENT_SHADER

out vec4 fragColor;
uniform sampler2D texture0;
uniform sampler2D texture1;
in vec2 uv0;

#include programs/utils/library.glsl

void main() {
    vec4 c1 = texture(texture0, uv0);
    vec4 c2 = texture(texture1, uv0);

    if (uv0.x > 0.5) {
        if (uv0.y > 0.5) {
            fragColor = vec4(blendGlow(c1.rgb, c2.rgb), 1.0);
        }
        else {
            fragColor = vec4(blendColorBurn(c1.rgb, c2.rgb), 1.0);
        }
    }
    else {
        if (uv0.y > 0.5) {
            fragColor = vec4(blendNegation(c1.rgb, c2.rgb), 1.0);
        }
        else {
            fragColor = vec4(blendReflect(c1.rgb, c2.rgb), 1.0);
        }
    }
}
#endif