aboutsummaryrefslogtreecommitdiff
path: root/src/main/resources/assets/oneconfig/shaders/rounded_rect.fsh
blob: f0bec7c9e767ca15d6dde731ed101c63ff2808de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#version 110

uniform float u_Radius;
uniform vec4 u_InnerRect;

varying vec2 f_Position;

//out vec4 fragColor;

void main() {
    vec2 tl = u_InnerRect.xy - f_Position;
    vec2 br = f_Position - u_InnerRect.zw;
    vec2 dis = max(br, tl);

    float v = length(max(vec2(0.0), dis)) - u_Radius;
    float a = 1.0 - smoothstep(0.0, 1.0, v);
    gl_FragColor = gl_Color * vec4(1.0, 1.0, 1.0, a);
}