Add border radius to UI nodes (adopted)#12500
Add border radius to UI nodes (adopted)#12500alice-i-cecile merged 25 commits intobevyengine:mainfrom
Conversation
|
I think |
|
From previous conversation with @viridia about the precursor:
|
|
I don't want to delay this unnecessarily, but here are my initial thoughts:
|
|
Assuming that you can get the rendering folks to sign off on the extra overhead involved in adding additional vertex params to UI node rendering, I would support this PR. It doesn't do everything I need, but a lot of people have wanted this for a long time, and as mentioned, I can always write custom shaders to fill the gaps. What would be helpful, I think, is if we could post some actual perf data showing the impact. I'm not so familiar on how to do this, but I know that for my previous PR @cart posted some numbers. |
|
pablo-lua
left a comment
There was a problem hiding this comment.
Just a reflection comment.
Co-authored-by: Pablo Reinhardt <126117294+pablo-lua@users.noreply.github.com>
|
Awesome, merging now: we can refine this more before 0.14 if issues come up <3 Thank you, I've wanted this feature for literally years. |
) # Objective - #12500 broke images and background colors in UI. Try examples `overflow`, `ui_scaling` or `ui_texture_atlas` ## Solution - Makes the component `BorderRadius` optional in the query, as it's not always present. Use `[0.; 4]` as border radius in the extracted node when none was found
# Objective - A new example `rounded_borders` was introduced in #12500, similar to the `borders` example, but containing labels to describe each border, leaving inconsistency between the examples. ## Solution - Update the `borders` example to be consistent with `rounded_borders`. Co-authored-by: François Mockers <mockersf@gmail.com>
# Objective - #12500 added dead code to the ui shader ## Solution - Remove it
# Objective - #12500 broke rotating ui nodes, see examples `pbr` (missing "metallic" label) or `overflow_debug` (bottom right box is empty) ## Solution - Pass the untransformed node size to the shader
Objective
Implements border radius for UI nodes. Adopted from #8973, but excludes shadows.
Solution
BorderRadiuswhich contains a radius value for each corner of the UI node.Changelog
BorderRadius: New component that holds the border radius values.NodeBundle&ButtonBundle: Added aborder_radius: BorderRadiusfield.extract_uinode_borders: Stripped down, most of the work is done in the shader now. Borders are no longer assembled from multiple rects, instead the shader uses a signed distance function to draw the border.UiVertex: Added size, border and radius fields.UiPipeline: Added three vertex attributes to the vertex buffer layout, to accept the UI node's size, border thickness and border radius.buttonexample, and arounded_bordersexample.