aboutsummaryrefslogtreecommitdiff
path: root/pass1.frag
blob: 784a9a260d3bd1eab0e66d21733ddaac369f919e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#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);

void main() {
	vec2 point = vec2(sin(time), cos(time)) * 0.7;
	point.x *= float(res.y) / float(res.x); // adjust for aspect ratio
	point = ((point + 1.0) / 2.0) * res.xy; // convert to screen coords
	float r = 20.0; // circle radius

	color = vec4(0.0);
	if (length(gl_FragCoord.xy - point) < r)
		color = vec4(1.0);

	color += texture(buf, gl_FragCoord.xy / res.xy) * 0.95;
}