Switched to shader for corner rounding

This commit is contained in:
Adalyn Black
2024-07-24 14:53:53 -07:00
committed by galister
parent 32e0e7656a
commit a98b7a210f
2 changed files with 57 additions and 126 deletions

View File

@@ -27,15 +27,30 @@ pub mod frag_color {
layout (set = 0, binding = 0) uniform ColorBlock {
uniform vec4 in_color;
uniform vec2 corner_radius;
};
void main()
{
out_color.r = corner_radius.r;
out_color = in_color;
vec2 uv_circ = ((1. - corner_radius) - (abs(in_uv + vec2(-0.5)) * 2.))/corner_radius;
float dist = length(uv_circ);
out_color.a = mix(out_color.a, 0.,
float(dist > 1.)
* float(uv_circ.x < 0.)
* float(uv_circ.y < 0.));
}
",
}
}
//layout (location = 1) in float corner_radius;
//out_color = in_color;
// Some equation that determines whether to keep the pixel
// Use Lerp not if
//out_color.a = 0;
pub mod frag_glyph {
vulkano_shaders::shader! {