bevy/crates/bevy_mesh
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
..
src Create missing constructors for 2D primitive mesh builders (#17291) 2025-01-14 19:38:45 +00:00
Cargo.toml Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00