24 lines
841 B
Text
24 lines
841 B
Text
shader_type spatial;
|
|
// Billboarded radial progress ring above a crop unit while a thief takes it. Fills clockwise
|
|
// from the top; drawn over the scene so crops and buildings never hide it.
|
|
render_mode unshaded, cull_disabled, depth_test_disabled, shadows_disabled;
|
|
|
|
uniform float progress : hint_range(0.0, 1.0) = 0.0;
|
|
uniform vec4 fill_color : source_color = vec4(1.0, 0.45, 0.1, 1.0);
|
|
uniform vec4 back_color : source_color = vec4(0.05, 0.05, 0.05, 0.6);
|
|
|
|
void vertex() {
|
|
MODELVIEW_MATRIX = VIEW_MATRIX * mat4(INV_VIEW_MATRIX[0], INV_VIEW_MATRIX[1], INV_VIEW_MATRIX[2], MODEL_MATRIX[3]);
|
|
}
|
|
|
|
void fragment() {
|
|
vec2 p = UV * 2.0 - 1.0;
|
|
float r = length(p);
|
|
if (r > 1.0 || r < 0.58) {
|
|
discard;
|
|
}
|
|
float a = fract(atan(p.x, -p.y) / 6.2831853 + 1.0);
|
|
vec4 c = a <= progress ? fill_color : back_color;
|
|
ALBEDO = c.rgb;
|
|
ALPHA = c.a;
|
|
}
|