bevy/crates
Joona Aalto 9bad607df9
Implement meshing for Capsule2d (#11639)
# Objective

The `Capsule2d` primitive was added in #11585. It should support meshing
like the other 2D primitives.

## Solution

Implement meshing for `Capsule2d`.

It doesn't currently support "rings" like Bevy's `Capsule` shape (not
`Capsule3d`), but it does support resolution to control the number of
vertices used for one hemicircle. The total vertex count is two times
the resolution; if we allowed setting the full vertex count, odd numbers
would lead to uneven vertex counts for the top and bottom hemicircles
and produce potentially unwanted results.

The capsule looks like this (with UV visualization and wireframe) using
resolutions of 16, 8, and 3:

![Resolution
16](https://github.com/bevyengine/bevy/assets/57632562/feae22de-bdc5-438a-861f-848284b67a52)
![Resolution
8](https://github.com/bevyengine/bevy/assets/57632562/e95aab8e-793f-45ac-8a74-8be39f7626dd)
![Resolution of
3](https://github.com/bevyengine/bevy/assets/57632562/bcf01d23-1d8b-4cdb-966a-c9022a07c287)

The `2d_shapes` example now includes the capsule, so we also get one
more color of the rainbow 🌈

![New 2D shapes
example](https://github.com/bevyengine/bevy/assets/57632562/1c45b5f5-d26a-4e8c-8e8a-e106ab14d46e)
2024-02-03 18:03:43 +00:00
..
bevy_a11y resolve all internal ambiguities (#10411) 2024-01-09 19:08:15 +00:00
bevy_animation Animatable trait for interpolation and blending (#4482) 2024-02-02 21:19:37 +00:00
bevy_app System Stepping implemented as Resource (#8453) 2024-02-03 05:18:38 +00:00
bevy_asset Fix AssetTransformer breaking LabeledAssets (#11626) 2024-02-02 14:57:31 +00:00
bevy_audio Optional override for global spatial scale (#10419) 2024-01-25 16:29:35 +00:00
bevy_core Adding derive Reflect for tick structs (#11641) 2024-02-01 16:11:32 +00:00
bevy_core_pipeline RenderGraph Labelization (#10644) 2024-01-31 14:51:19 +00:00
bevy_derive Reexport winit::platform::android::activity::* in bevy_winit (#11011) 2023-12-19 20:15:03 +00:00
bevy_diagnostic Replace DiagnosticId by DiagnosticPath (#9266) 2024-01-20 15:42:51 +00:00
bevy_dylib Add [lints] table, fix adding #![allow(clippy::type_complexity)] everywhere (#10011) 2023-11-18 20:58:48 +00:00
bevy_dynamic_plugin Mark DynamicPluginLoadError internal error types as source (#11618) 2024-01-30 23:37:00 +00:00
bevy_ecs System Stepping implemented as Resource (#8453) 2024-02-03 05:18:38 +00:00
bevy_ecs_compile_fail_tests Dynamic queries and builder API (#9774) 2024-01-16 19:16:49 +00:00
bevy_encase_derive Add [lints] table, fix adding #![allow(clippy::type_complexity)] everywhere (#10011) 2023-11-18 20:58:48 +00:00
bevy_gilrs Remove unnecessary path prefixes (#10749) 2023-11-28 23:43:40 +00:00
bevy_gizmos Drawing Primitives with Gizmos (#11072) 2024-02-02 21:13:03 +00:00
bevy_gltf RenderAssetPersistencePolicy → RenderAssetUsages (#11399) 2024-01-30 13:22:10 +00:00
bevy_hierarchy Make the MapEntities trait generic over Mappers, and add a simpler EntityMapper (#11428) 2024-01-28 19:51:46 +00:00
bevy_input Fix cyclic dep (#11523) 2024-01-25 17:44:32 +00:00
bevy_internal System Stepping implemented as Resource (#8453) 2024-02-03 05:18:38 +00:00
bevy_log move once from bevy_log to bevy_utils, to allow for it's use in bevy_ecs (#11419) 2024-01-19 06:07:41 +00:00
bevy_macro_utils Bump toml_edit in build-template-pages tool (#11342) 2024-01-16 05:23:18 +00:00
bevy_macros_compile_fail_tests Standardize toml format with taplo (#10594) 2023-11-21 01:04:14 +00:00
bevy_math Implement meshing for Capsule2d (#11639) 2024-02-03 18:03:43 +00:00
bevy_mikktspace Enable the unsafe_op_in_unsafe_fn lint (#11591) 2024-01-28 23:18:11 +00:00
bevy_pbr Gate diffuse and specular transmission behind shader defs (#11627) 2024-02-02 15:01:56 +00:00
bevy_ptr bevy_ptr: fix unsafe_op_in_unsafe_fn lint (#11610) 2024-01-30 23:37:29 +00:00
bevy_reflect Add the ability to manually create ParsedPaths (+ cleanup) (#11029) 2024-02-01 19:22:40 +00:00
bevy_reflect_compile_fail_tests bevy_reflect: Type parameter bounds (#9046) 2024-01-28 16:24:03 +00:00
bevy_render Implement meshing for Capsule2d (#11639) 2024-02-03 18:03:43 +00:00
bevy_scene Make the MapEntities trait generic over Mappers, and add a simpler EntityMapper (#11428) 2024-01-28 19:51:46 +00:00
bevy_sprite RenderAssetPersistencePolicy → RenderAssetUsages (#11399) 2024-01-30 13:22:10 +00:00
bevy_tasks Fix wrong transmuted type in TaskPool::scope_with_executor_inner (#11455) 2024-01-21 18:08:45 +00:00
bevy_text Subtract 1 from text positions to account for glyph texture padding. (#11662) 2024-02-02 20:01:01 +00:00
bevy_time Fix bug where events are not being dropped (#11528) 2024-02-02 21:14:54 +00:00
bevy_transform return Direction3d from Transform::up and friends (#11604) 2024-02-02 15:05:35 +00:00
bevy_ui RenderGraph Labelization (#10644) 2024-01-31 14:51:19 +00:00
bevy_utils impl Borrow and AsRef for CowArc (#11616) 2024-01-30 14:27:53 +00:00
bevy_window Update cursor.rs (#11617) 2024-01-30 16:34:17 +00:00
bevy_winit Cleanup bevy winit (#11489) 2024-01-28 21:09:23 +00:00