bevy/examples/2d
Rob Parrett f8e0fc190a Add RegularPolygon and Circle meshes (#3730)
# Objective

Bevy users often want to create circles and other simple shapes.

All the machinery is in place to accomplish this, and there are external crates that help. But when writing code for e.g. a new bevy example, it's not really possible to draw a circle without bringing in a new asset, writing a bunch of scary looking mesh code, or adding a dependency.

In particular, this PR was inspired by this interaction in another PR: https://github.com/bevyengine/bevy/pull/3721#issuecomment-1016774535

## Solution

This PR adds `shape::RegularPolygon` and `shape::Circle` (which is just a `RegularPolygon` that defaults to a large number of sides)

## Discussion

There's a lot of ongoing discussion about shapes in <https://github.com/bevyengine/rfcs/pull/12> and at least one other lingering shape PR (although it seems incomplete).

That RFC currently includes `RegularPolygon` and `Circle` shapes, so I don't think that having working mesh generation code in the engine for those shapes would add much burden to an author of an implementation.

But if we'd prefer not to add additional shapes until after that's sorted out, I'm happy to close this for now.

## Alternatives for users

For any users stumbling on this issue, here are some plugins that will help if you need more shapes.

https://github.com/Nilirad/bevy_prototype_lyon
https://github.com/johanhelsing/bevy_smud
https://github.com/Weasy666/bevy_svg
https://github.com/redpandamonium/bevy_more_shapes
https://github.com/ForesightMiningSoftwareCorporation/bevy_polyline
2022-05-05 00:03:47 +00:00
..
mesh2d.rs default() shorthand (#4071) 2022-03-01 20:52:09 +00:00
mesh2d_manual.rs Move float_ord from bevy_core to bevy_utils (#4189) 2022-04-27 18:02:05 +00:00
move_sprite.rs default() shorthand (#4071) 2022-03-01 20:52:09 +00:00
rotation.rs default() shorthand (#4071) 2022-03-01 20:52:09 +00:00
shapes.rs Add RegularPolygon and Circle meshes (#3730) 2022-05-05 00:03:47 +00:00
sprite.rs default() shorthand (#4071) 2022-03-01 20:52:09 +00:00
sprite_flipping.rs default() shorthand (#4071) 2022-03-01 20:52:09 +00:00
sprite_sheet.rs bevy_derive: Add derives for Deref and DerefMut (#4328) 2022-03-29 02:10:06 +00:00
text2d.rs Move Size to bevy_ui (#4285) 2022-04-25 13:54:46 +00:00
texture_atlas.rs default() shorthand (#4071) 2022-03-01 20:52:09 +00:00