-
Notifications
You must be signed in to change notification settings - Fork 409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for setting corner radius per corner #5959
base: master
Are you sure you want to change the base?
Conversation
Previously: #3652 (comment) |
While messing with edge effect rendering code, all that i managed to learn is that bottom-right quarter size is left unchanged from actual container size, and top-left quarters are growing in size so that glow "overrun" is equal to effect radius. Removing inflation in There is obviously something with either UV or diff --git a/osu.Framework/Resources/Shaders/sh_Masking.h b/osu.Framework/Resources/Shaders/sh_Masking.h
index e9190362a..68fd25ce1 100644
--- a/osu.Framework/Resources/Shaders/sh_Masking.h
+++ b/osu.Framework/Resources/Shaders/sh_Masking.h
@@ -63,7 +63,7 @@ lowp vec4 getBorderColour()
highp float getCornerRadius()
{
- highp vec2 relativeTexCoord = v_MaskingPosition / (g_MaskingRect.zw - g_MaskingRect.xy);
+ highp vec2 relativeTexCoord = v_MaskingPosition / ((g_MaskingRect.zw - g_MaskingRect.xy)-vec2(g_MaskingBlendRange*2, g_MaskingBlendRange*2));
highp float top = mix(g_CornerRadius.x, g_CornerRadius.z, step(0.5, relativeTexCoord.x));
highp float bottom = mix(g_CornerRadius.y, g_CornerRadius.w, step(0.5, relativeTexCoord.x));
return mix(top, bottom, step(0.5, relativeTexCoord.y));
@@ -71,7 +71,7 @@ highp float getCornerRadius()
highp float getInnerCornerRadius()
{
- highp vec2 relativeTexCoord = v_MaskingPosition / (g_MaskingRect.zw - g_MaskingRect.xy);
+ highp vec2 relativeTexCoord = v_MaskingPosition / ((g_MaskingRect.zw - g_MaskingRect.xy)-vec2(g_MaskingBlendRange*2, g_MaskingBlendRange*2));
highp float top = mix(g_InnerCornerRadius.x, g_InnerCornerRadius.z, step(0.5, relativeTexCoord.x));
highp float bottom = mix(g_InnerCornerRadius.y, g_InnerCornerRadius.w, step(0.5, relativeTexCoord.x));
return mix(top, bottom, step(0.5, relativeTexCoord.y)); Is this even a valid fix? |
... i.e. now you can have 3 corners with radius 100 and the 4th with 10, for example.
Half-broken and non-mergeable at this state. Game probably won't run due to transforms.
If the direction is ok, i need help with bounding box calculation (now it calculates using the biggest radius) and uniforms buffer - there are too many paddings and idk how to rearrange the fields so nothing breaks.
Also, non-rounded borders and rounded renders in different manner so their combination looks weird. Didn't understand what to do with this too.
(bottom one is 0/50, top one is 5/50, notice the step where rounding begins)
xmldocs and interpolations will be done later.done