aboutsummaryrefslogtreecommitdiff
path: root/shaders/rounded_rectangle.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'shaders/rounded_rectangle.glsl')
-rw-r--r--shaders/rounded_rectangle.glsl4
1 files changed, 2 insertions, 2 deletions
diff --git a/shaders/rounded_rectangle.glsl b/shaders/rounded_rectangle.glsl
index 7c797f2..ec3a5c1 100644
--- a/shaders/rounded_rectangle.glsl
+++ b/shaders/rounded_rectangle.glsl
@@ -15,11 +15,11 @@ void main() {
vec2 size = (resolution - shadow_offset * 2.0) * 0.5;
float rect_dist = rounded_rect(uv - center, size, radius);
- float a = 1.0 - smoothstep(0.0, 2.0, rect_dist);
+ float a = clamp(1.0 - smoothstep(0.0, 2.0, rect_dist), 0.0, 1.0);
// same as: if(uv.x >= band_pos.x && uv.x <= band_pos.x + band_size.x && uv.y >= band_pos.y && uv.y <= band_pos.y + band_size.y)
vec2 band_blend = step(band_pos, uv) - step(band_pos + band_size, uv);
vec4 front_color = mix(gl_Color, band_color, band_blend.x*band_blend.y);
- float shadow_a = 1.0 - smoothstep(0.0, shadow_offset.x, rect_dist);
+ float shadow_a = clamp(1.0 - smoothstep(0.0, shadow_offset.x, rect_dist), 0.0, 1.0);
front_color.a *= a;
gl_FragColor = mix(front_color, vec4(0.0, 0.0, 0.0, 0.14), clamp(shadow_a - a, 0.0, 1.0));
} \ No newline at end of file