bevy/crates
Antony e7a31d000e
Add border radius to UI nodes (adopted) (#12500)
# Objective

Implements border radius for UI nodes. Adopted from #8973, but excludes
shadows.

## Solution

- Add a component `BorderRadius` which contains a radius value for each
corner of the UI node.
- Use a fragment shader to generate the rounded corners using a signed
distance function.

<img width="50%"
src="https://github.com/bevyengine/bevy/assets/26204416/16b2ba95-e274-4ce7-adb2-34cc41a776a5"></img>

## Changelog

- `BorderRadius`: New component that holds the border radius values.
- `NodeBundle` & `ButtonBundle`: Added a `border_radius: BorderRadius`
field.
- `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.
- Examples: Added rounded corners to the UI element in the `button`
example, and a `rounded_borders` example.

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: Zachary Harrold <zac@harrold.com.au>
Co-authored-by: Pablo Reinhardt <126117294+pablo-lua@users.noreply.github.com>
2024-03-19 22:44:00 +00:00
..
bevy_a11y Bump Version after Release (#12020) 2024-02-21 20:58:59 +00:00
bevy_animation Use async-fn in traits rather than BoxedFuture (#12550) 2024-03-18 17:56:57 +00:00
bevy_app Add "all-features = true" to docs.rs metadata for most crates (#12366) 2024-03-08 20:03:09 +00:00
bevy_asset Use async-fn in traits rather than BoxedFuture (#12550) 2024-03-18 17:56:57 +00:00
bevy_audio Use async-fn in traits rather than BoxedFuture (#12550) 2024-03-18 17:56:57 +00:00
bevy_color bevy_color: Add Tailwind palette (#12080) 2024-03-18 18:06:07 +00:00
bevy_core Add "all-features = true" to docs.rs metadata for most crates (#12366) 2024-03-08 20:03:09 +00:00
bevy_core_pipeline Explain Camera2dBundle.projection needs to be set carefully (#11115) 2024-03-18 17:35:33 +00:00
bevy_derive Bump Version after Release (#12020) 2024-02-21 20:58:59 +00:00
bevy_dev_tools Add a gizmo-based overlay to show UI node outlines (Adopted) (#11237) 2024-03-18 18:11:06 +00:00
bevy_diagnostic Add "all-features = true" to docs.rs metadata for most crates (#12366) 2024-03-08 20:03:09 +00:00
bevy_dylib Bump Version after Release (#12020) 2024-02-21 20:58:59 +00:00
bevy_dynamic_plugin Document all members of bevy_dynamic_plugin (#12029) 2024-02-22 13:28:52 +00:00
bevy_ecs Remove WorldCell (#12551) 2024-03-18 06:28:31 +00:00
bevy_ecs_compile_fail_tests Remove APIs deprecated in 0.13 (#11974) 2024-02-19 19:04:47 +00:00
bevy_encase_derive Bump Version after Release (#12020) 2024-02-21 20:58:59 +00:00
bevy_gilrs Send GamepadEvent for gamepads connected at startup (#12424) 2024-03-11 20:05:10 +00:00
bevy_gizmos Gizmo 3d grids (#12430) 2024-03-13 18:51:53 +00:00
bevy_gltf Use async-fn in traits rather than BoxedFuture (#12550) 2024-03-18 17:56:57 +00:00
bevy_hierarchy Add "all-features = true" to docs.rs metadata for most crates (#12366) 2024-03-08 20:03:09 +00:00
bevy_input Add table showing complexity of methods for Input (#10126) 2024-03-10 23:00:20 +00:00
bevy_internal refactor: separate out PanicHandlerPlugin (#12557) 2024-03-19 00:56:49 +00:00
bevy_log refactor: separate out PanicHandlerPlugin (#12557) 2024-03-19 00:56:49 +00:00
bevy_macro_utils fix deprecations from toml_edit (#12421) 2024-03-11 17:53:38 +00:00
bevy_macros_compile_fail_tests Standardize toml format with taplo (#10594) 2023-11-21 01:04:14 +00:00
bevy_math Add methods to return the inner value for direction types (#12516) 2024-03-18 17:49:58 +00:00
bevy_mikktspace fix some typos (#12038) 2024-02-22 18:55:22 +00:00
bevy_panic_handler refactor: separate out PanicHandlerPlugin (#12557) 2024-03-19 00:56:49 +00:00
bevy_pbr Add setting to enable/disable shadows to MaterialPlugin (#12538) 2024-03-18 17:54:41 +00:00
bevy_ptr Add more comprehensive crate level docs for bevy_ptr (#12391) 2024-03-12 14:04:16 +00:00
bevy_reflect add reflect for BinaryHeap (#12503) 2024-03-17 22:24:04 +00:00
bevy_reflect_compile_fail_tests bevy_reflect: Recursive registration (#5781) 2024-03-04 19:04:10 +00:00
bevy_render Use async-fn in traits rather than BoxedFuture (#12550) 2024-03-18 17:56:57 +00:00
bevy_scene Use async-fn in traits rather than BoxedFuture (#12550) 2024-03-18 17:56:57 +00:00
bevy_sprite Update to fixedbitset 0.5 (#12512) 2024-03-17 18:43:05 +00:00
bevy_tasks Add "all-features = true" to docs.rs metadata for most crates (#12366) 2024-03-08 20:03:09 +00:00
bevy_text Use async-fn in traits rather than BoxedFuture (#12550) 2024-03-18 17:56:57 +00:00
bevy_time Add "all-features = true" to docs.rs metadata for most crates (#12366) 2024-03-08 20:03:09 +00:00
bevy_transform remove link to inexistent example (#12531) 2024-03-17 19:35:00 +00:00
bevy_ui Add border radius to UI nodes (adopted) (#12500) 2024-03-19 22:44:00 +00:00
bevy_utils Use async-fn in traits rather than BoxedFuture (#12550) 2024-03-18 17:56:57 +00:00
bevy_window Expose Winit's with_skip_taskbar on window creation (#12450) 2024-03-18 17:41:42 +00:00
bevy_winit Expose Winit's with_skip_taskbar on window creation (#12450) 2024-03-18 17:41:42 +00:00