34 lines
709 B
Plaintext
34 lines
709 B
Plaintext
shader_type spatial;
|
|
render_mode unshaded;
|
|
|
|
uniform vec4 albedo : hint_color;
|
|
uniform float percent;
|
|
const float PI = 3.14159;
|
|
|
|
vec3 circle(vec2 p) {
|
|
float v = (1.0-smoothstep(0.49, 0.50, length(p))) * smoothstep(0.19, 0.2, length(p));
|
|
return vec3(v, v,v);
|
|
}
|
|
|
|
float atan2(in float y, in float x) {
|
|
bool s = (abs(x) > abs(y));
|
|
if (s) {
|
|
return PI/2.0 - atan(x,y);
|
|
} else {
|
|
return atan(y,x);
|
|
}
|
|
}
|
|
|
|
float wipe(vec2 pos, float p_percent) {
|
|
float angle = atan2(pos.y , pos.x);
|
|
float alpha = step(p_percent *PI * 2.25, angle + PI);
|
|
return alpha;
|
|
}
|
|
|
|
void fragment() {
|
|
vec2 base_uv = UV;
|
|
vec2 pos = UV - vec2(0.5, 0.5);
|
|
ALBEDO = circle(pos) * albedo.xyz;
|
|
ALPHA = circle(pos).x * wipe(pos, percent);
|
|
}
|