исправление

This commit is contained in:
2025-02-07 08:32:14 +03:00
parent ea6933935a
commit 2ff430c381
8 changed files with 172 additions and 18 deletions

24
Shaders/opt_btn.gdshader Normal file
View File

@@ -0,0 +1,24 @@
shader_type canvas_item;
uniform float range: hint_range(0.0, 0.5);
uniform vec4 color: source_color;
const float ds = 0.01; /* Относительное расстояние на котором выполняется сглаживание краёв */
const vec2 center = vec2(0.125, 0.125); /* Центр должен быть в (0.5, 0.5), но это не так */
const float radius = 0.125 - ds * 2.0; /* Радиус должен быть 0.5, но это не так */
float smooth_px(float r, float R)
{
return 1.0 - smoothstep(R - ds, R + ds, r);
}
void fragment()
{
vec2 centere = vec2(0.5);
float df = distance(UV, centere);
float circlee = step(range, df);
COLOR *= color * smooth_px(circlee, radius);
}