aboutsummaryrefslogtreecommitdiff
path: root/client/player/marker/interact_marker.gdshader
blob: 1c9105668070dc4cc09080dcd5720c575a83e610 (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
    Hurry Curry! - a game about cooking
    Copyright 2025 tpart
    Copyright 2024 nokoe

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as published by
    the Free Software Foundation, version 3 of the License only.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.

*/
shader_type spatial;
render_mode depth_test_disabled;

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

void fragment() {
    if (interacting) {
        ALBEDO = vec3(0., 0., 15.);
    } else {
        ALBEDO = vec3(15., 0., 0.);
    }
    vec2 uv = abs(2. * UV.xy - 1.);
    float m_length = marker_length / max_width;
    float anim = sin(TIME * pulse_speed) * .5 + 2.;
    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;
}