style: cleaned up rounded corner shader
This commit is contained in:
parent
e6cb4e9fa0
commit
ed130cdacc
|
@ -123,24 +123,20 @@ const GLchar corner_fragment_src[] =
|
|||
"}\n"
|
||||
"\n"
|
||||
"void main() {\n"
|
||||
" gl_FragColor = v_color;\n"
|
||||
" vec2 center = gl_FragCoord.xy - position - half_size;\n"
|
||||
" float distance = roundedBoxSDF(center, half_size - half_thickness, radius + half_thickness);\n"
|
||||
" float smoothedAlphaOuter = 1.0 - smoothstep(-1.0, 1.0, distance - half_thickness);\n"
|
||||
// Create an inner circle that isn't as anti-aliased as the outer ring
|
||||
" float smoothedAlphaInner = 1.0 - smoothstep(-1.0, 0.5, distance + half_thickness);\n"
|
||||
" gl_FragColor = mix(vec4(0), gl_FragColor, smoothedAlphaOuter - smoothedAlphaInner);\n"
|
||||
" gl_FragColor = mix(vec4(0), v_color, smoothedAlphaOuter - smoothedAlphaInner);\n"
|
||||
"\n"
|
||||
" if (is_top_left && (center.y > 0.0 || center.x > 0.0)) {\n"
|
||||
" discard;\n"
|
||||
" }\n"
|
||||
" else if (is_top_right && (center.y > 0.0 || center.x < 0.0)) {\n"
|
||||
" } else if (is_top_right && (center.y > 0.0 || center.x < 0.0)) {\n"
|
||||
" discard;\n"
|
||||
" }\n"
|
||||
" else if (is_bottom_left && (center.y < 0.0 || center.x > 0.0)) {\n"
|
||||
" } else if (is_bottom_left && (center.y < 0.0 || center.x > 0.0)) {\n"
|
||||
" discard;\n"
|
||||
" }\n"
|
||||
" else if (is_bottom_right && (center.y < 0.0 || center.x < 0.0)) {\n"
|
||||
" } else if (is_bottom_right && (center.y < 0.0 || center.x < 0.0)) {\n"
|
||||
" discard;\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
|
|
Loading…
Reference in a new issue