diff options
Diffstat (limited to 'res/shaders/glsl330/line.fs')
| -rw-r--r-- | res/shaders/glsl330/line.fs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/res/shaders/glsl330/line.fs b/res/shaders/glsl330/line.fs new file mode 100644 index 0000000..d7a8d48 --- /dev/null +++ b/res/shaders/glsl330/line.fs | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | #version 330 core | ||
| 2 | |||
| 3 | uniform float time; | ||
| 4 | uniform vec2 resolution; | ||
| 5 | uniform vec2 mouse; | ||
| 6 | |||
| 7 | out vec4 color; | ||
| 8 | |||
| 9 | float | ||
| 10 | plot (vec2 st) | ||
| 11 | { | ||
| 12 | return smoothstep (0.01, 0.0, abs (st.y - st.x)); | ||
| 13 | } | ||
| 14 | |||
| 15 | void | ||
| 16 | main () { | ||
| 17 | vec2 st = gl_FragCoord.xy/resolution; | ||
| 18 | |||
| 19 | float y = st.x; | ||
| 20 | |||
| 21 | vec3 c = vec3 (y); | ||
| 22 | |||
| 23 | float pct = plot (st); | ||
| 24 | c = (1.0 - pct)*c + pct*vec3 (0.0, 1.0, 0.0); | ||
| 25 | |||
| 26 | color = vec4 (c, 1.0); | ||
| 27 | } | ||
