#version 460 core #include "consts.h" layout(location = 0) out vec4 color; in vec4 gl_FragCoord; layout(location = U_LOC_TIME) uniform float time; layout(location = U_LOC_PASS1) uniform sampler2D buf; ivec2 res = ivec2(RES_H, RES_V); const float step = 0.04; const float turns = 9.0; void main() { vec2 uv = gl_FragCoord.xy / res.xy; float r = 20.0; // circle radius vec2 norm = (uv - 0.5) * 2.0; norm.x *= float(res.x) / float(res.y); // adjust for aspect ratio float offset = time * 7.0; float mag = 1.3 + 0.5 * sin(2 * time); float size = 0.4 + 0.1 * sin(3 * time); color = vec4(0.0); for (float t = 0.0; t < PI_2; t += step) { // vec2 f = vec2( cos(t) + mag * cos(turns * t + offset), sin(t) + mag * sin(turns * t + offset) ); f *= size; if (length(f - norm) < 0.01) { color = vec4(1.0, 1.0, 1.0, 1.0); } } color += texture(buf, ((uv - 0.5) * 0.99) + 0.5) * 0.97; }