summaryrefslogtreecommitdiff
path: root/client/textures/interact_marker.gdshader
blob: 94b7323d799c73a2801ecee205e3db023aaedca9 (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
25
26
27
shader_type spatial;

uniform float max_width = .1;
uniform float marker_length = .5;
uniform float pulse_speed = 4.;
uniform bool interactive = false;

void fragment() {
	if (interactive) {
		ALBEDO = vec3(15., 0., 0.);
	} else {
		ALBEDO = vec3(.1, .1, .1);
	}
	vec2 uv = abs(2. * UV.xy - 1.);
	float m_length = marker_length / max_width;
	float anim;
	if (interactive) {
		anim = sin(TIME * pulse_speed) * .5 + 1.;
	} else {
		anim = .5;
	}
	float alpha = step(
		1. - max_width * anim, max(uv.x, uv.y))
			* step(1. - max_width * m_length, min(uv.x, uv.y)
	);
	ALPHA = alpha;
}