File: drop.glsl

package info (click to toggle)
python-moderngl-window 3.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 69,096 kB
  • sloc: python: 12,076; makefile: 21
file content (41 lines) | stat: -rw-r--r-- 777 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
#version 330

#if defined VERTEX_SHADER

in vec3 in_position;
in vec2 in_texcoord_0;

uniform mat4 m_proj;
uniform vec2 pos;

out vec2 uv0;

void main() {
    gl_Position = m_proj * vec4(vec3(in_position.xy + pos.xy, 0.0), 1.0);
    uv0 = in_texcoord_0;
}

#elif defined FRAGMENT_SHADER

// uniform sampler2D texture0;
uniform float write_value;
uniform float force;

out float fragColor;
in vec2 uv0;


void main() {
    // float val = texture(texture0, uv0).r;
    // if (val > 0.99) {
    //     fragColor = write_value;
    // }
    // else {
    //     discard;
    // }
    vec2 center = uv0 - vec2(0.5);
    float c = step(0.0, 0.5 - length(center));
    if (c > 0.99) fragColor = write_value * force;
    else discard;
}
#endif