исправление
This commit is contained in:
24
Shaders/opt_btn.gdshader
Normal file
24
Shaders/opt_btn.gdshader
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user