From 2bb276d4ed15277cb0172353250fd7e92bf12840 Mon Sep 17 00:00:00 2001 From: Martin Michalec Date: Wed, 11 Feb 2026 07:50:35 +0300 Subject: add resources --- res/shaders/glsl330/curved-line.fs | 55 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 res/shaders/glsl330/curved-line.fs (limited to 'res/shaders/glsl330/curved-line.fs') diff --git a/res/shaders/glsl330/curved-line.fs b/res/shaders/glsl330/curved-line.fs new file mode 100644 index 0000000..58e65ed --- /dev/null +++ b/res/shaders/glsl330/curved-line.fs @@ -0,0 +1,55 @@ +#version 330 core + +#define PI 3.14159265359 + +uniform vec2 resolution; +uniform vec2 mouse; +uniform float time; + +out vec4 color; + +float +plot (vec2 st, float pct) +{ + return + smoothstep (pct - 0.02, pct, st.y) - + smoothstep (pct, pct + 0.02, st.y); +} + +void +main () +{ + vec2 st = gl_FragCoord.xy/resolution; + vec2 mt = mouse/resolution; + + float x = st.x; + float y; + + y = pow (x, PI); + // y = exp (x - 1); + // y = log (x + 1); + // y = sqrt (x); + // y = step (mt.x, x); + // y = smoothstep (mt.x, 1 - mt.x, x); + // y = + // smoothstep (.2, .5, x) - + // smoothstep (.5, .8, x); + // y = (sin (2*PI*x + time) + 1)/2; + // y = (cos (2*PI*x + time) + 1)/2; + // y = mod (x, 1./4)*4; + // y = fract (x*4); + // y = ceil (x*4)/4; + // y = floor (x*4)/4; + // y = sign (x - 0.5); + // y = abs (x - 1./2)*2; + // y = (clamp (x, 1./4, 3./4) - 1./4)*2; + // y = min (1./2, x)*2; + // y = (max (.5, x) - 1./2)*2; + + vec3 c = vec3 (y); + + float pct = plot (st, y); + c = (1 - pct)*c + pct*vec3 (0, 1, 0); + + color = vec4 (c, 1); +} -- cgit v1.3