bevy/crates
BD103 e53c8e0933
Create missing constructors for 2D primitive mesh builders (#17291)
# Objective

- While all
[`MeshBuilder`](https://dev-docs.bevyengine.org/bevy/prelude/trait.MeshBuilder.html)s
can be created by first creating the primitive `bevy_math` type and
using
[`Meshable`](https://dev-docs.bevyengine.org/bevy/prelude/trait.Meshable.html),
most builders have their own `const` constructors that can be used
instead. Some builders are missing constructors, however, making them
unavailable in `const` contexts.

## Solution

- Add a `const` constructor for `RegularPolygonMeshBuilder`,
`RhombusMeshBuilder`, `Triangle2dMeshBuilder`, and
`RectangleMeshBuilder`.
- Add a note on the requirements of `ConvexPolygonMeshBuilder`, and
recommend using `ConvexPolygon::new().mesh()` instead.
- A constructor cannot easily be created for this type, since it
requires duplicating all of `ConvexPolygon::new()`'s verification code.
I may be able to work around this, but it requires touching a bit more
code surface. Opinions?

## Testing

Not much beyond CI! The changes are trivial enough that only a cursory
glance for typos and switched variables should be necessary.

## Note for Reviewers

Hi! I haven't directly used the types I modify in this PR beyond some
benchmarking work I did this morning. If you're familiar with these
types, please let me know if any of the constructors need additional
validation (or if the constructors shouldn't be there at all). Thanks!

---------

Co-authored-by: IQuick 143 <IQuick143cz@gmail.com>
2025-01-14 19:38:45 +00:00
..
bevy_a11y Downgrade clippy::allow_attributes and clippy::allow_attributes_without_reason to warn (#17320) 2025-01-12 05:28:26 +00:00
bevy_animation Downgrade clippy::allow_attributes and clippy::allow_attributes_without_reason to warn (#17320) 2025-01-12 05:28:26 +00:00
bevy_app Downgrade clippy::allow_attributes and clippy::allow_attributes_without_reason to warn (#17320) 2025-01-12 05:28:26 +00:00
bevy_asset Downgrade clippy::allow_attributes and clippy::allow_attributes_without_reason to warn (#17320) 2025-01-12 05:28:26 +00:00
bevy_audio Downgrade clippy::allow_attributes and clippy::allow_attributes_without_reason to warn (#17320) 2025-01-12 05:28:26 +00:00
bevy_color Downgrade clippy::allow_attributes and clippy::allow_attributes_without_reason to warn (#17320) 2025-01-12 05:28:26 +00:00
bevy_core_pipeline Key render phases off the main world view entity, not the render world view entity. (#16942) 2025-01-12 20:24:17 +00:00
bevy_derive Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_dev_tools Allow users to customize history length in FrameTimeDiagnosticsPlugin (#17259) 2025-01-12 18:18:14 +00:00
bevy_diagnostic Diagnostics smoothing factor fix (#17354) 2025-01-14 01:13:24 +00:00
bevy_dylib Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_ecs Refactor event system documentation in system_param.rs (#17364) 2025-01-14 19:38:25 +00:00
bevy_encase_derive Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_gilrs Downgrade clippy::allow_attributes and clippy::allow_attributes_without_reason to warn (#17320) 2025-01-12 05:28:26 +00:00
bevy_gizmos Key render phases off the main world view entity, not the render world view entity. (#16942) 2025-01-12 20:24:17 +00:00
bevy_gltf Downgrade clippy::allow_attributes and clippy::allow_attributes_without_reason to warn (#17320) 2025-01-12 05:28:26 +00:00
bevy_hierarchy Downgrade clippy::allow_attributes and clippy::allow_attributes_without_reason to warn (#17320) 2025-01-12 05:28:26 +00:00
bevy_image Downgrade clippy::allow_attributes and clippy::allow_attributes_without_reason to warn (#17320) 2025-01-12 05:28:26 +00:00
bevy_input Downgrade clippy::allow_attributes and clippy::allow_attributes_without_reason to warn (#17320) 2025-01-12 05:28:26 +00:00
bevy_input_focus Add a simple directional UI navigation example (#17224) 2025-01-09 21:15:28 +00:00
bevy_internal Downgrade clippy::allow_attributes and clippy::allow_attributes_without_reason to warn (#17320) 2025-01-12 05:28:26 +00:00
bevy_log Downgrade clippy::allow_attributes and clippy::allow_attributes_without_reason to warn (#17320) 2025-01-12 05:28:26 +00:00
bevy_macro_utils Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_math Downgrade clippy::allow_attributes and clippy::allow_attributes_without_reason to warn (#17320) 2025-01-12 05:28:26 +00:00
bevy_mesh Create missing constructors for 2D primitive mesh builders (#17291) 2025-01-14 19:38:45 +00:00
bevy_mikktspace Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_pbr Ambient component (#17343) 2025-01-14 08:10:15 +00:00
bevy_picking Rename PickingBehavior to Pickable (#17266) 2025-01-12 05:36:52 +00:00
bevy_ptr Downgrade clippy::allow_attributes and clippy::allow_attributes_without_reason to warn (#17320) 2025-01-12 05:28:26 +00:00
bevy_reflect Downgrade clippy::allow_attributes and clippy::allow_attributes_without_reason to warn (#17320) 2025-01-12 05:28:26 +00:00
bevy_remote Add BRP method to mutate a component (#16940) 2025-01-14 07:55:40 +00:00
bevy_render Key render phases off the main world view entity, not the render world view entity. (#16942) 2025-01-12 20:24:17 +00:00
bevy_scene Downgrade clippy::allow_attributes and clippy::allow_attributes_without_reason to warn (#17320) 2025-01-12 05:28:26 +00:00
bevy_sprite Key render phases off the main world view entity, not the render world view entity. (#16942) 2025-01-12 20:24:17 +00:00
bevy_state Downgrade clippy::allow_attributes and clippy::allow_attributes_without_reason to warn (#17320) 2025-01-12 05:28:26 +00:00
bevy_tasks Downgrade clippy::allow_attributes and clippy::allow_attributes_without_reason to warn (#17320) 2025-01-12 05:28:26 +00:00
bevy_text update_text2d_layout creates new font atlases when the primary window is closed (#7849) 2025-01-14 01:01:31 +00:00
bevy_time Fix bevy_time tests occasionally failing on optimised Windows builds (#17349) 2025-01-14 00:30:07 +00:00
bevy_transform Downgrade clippy::allow_attributes and clippy::allow_attributes_without_reason to warn (#17320) 2025-01-12 05:28:26 +00:00
bevy_ui Key render phases off the main world view entity, not the render world view entity. (#16942) 2025-01-12 20:24:17 +00:00
bevy_utils Downgrade clippy::allow_attributes and clippy::allow_attributes_without_reason to warn (#17320) 2025-01-12 05:28:26 +00:00
bevy_window Downgrade clippy::allow_attributes and clippy::allow_attributes_without_reason to warn (#17320) 2025-01-12 05:28:26 +00:00
bevy_winit Make InputFocus optional in bevy_winit (#17358) 2025-01-14 05:08:20 +00:00