fix: support per-corner radius
also adjusts the radius by half of the outline thickness. I believe this is the radius at the center of the outline.
This commit is contained in:
parent
b3aa10436a
commit
c6320eec0c
5 changed files with 67 additions and 28 deletions
|
|
@ -8,10 +8,14 @@ varying vec2 v_coords;
|
|||
|
||||
uniform vec3 color;
|
||||
uniform float thickness;
|
||||
uniform float radius;
|
||||
uniform vec4 radius;
|
||||
|
||||
float rounded_box(vec2 center, vec2 size, float radius) {
|
||||
return length(max(abs(center) - size + radius, 0.0)) - radius;
|
||||
float rounded_box(in vec2 p, in vec2 b, in vec4 r)
|
||||
{
|
||||
r.xy = (p.x > 0.0) ? r.xy : r.zw;
|
||||
r.x = (p.y > 0.0) ? r.x : r.y;
|
||||
vec2 q = abs(p) - b + r.x;
|
||||
return min(max(q.x, q.y), 0.0) + length(max(q, 0.0)) - r.x;
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue