bevy/crates/bevy_reflect/src
Matty c8aa3ac7d1
Meshing for Annulus primitive (#12734)
# Objective

Related to #10572 
Allow the `Annulus` primitive to be meshed.

## Solution

We introduce a `Meshable` structure, `AnnulusMeshBuilder`, which allows
the `Annulus` primitive to be meshed, leaving optional configuration of
the number of angular sudivisions to the user. Here is a picture of the
annulus's UV-mapping:
<img width="1440" alt="Screenshot 2024-03-26 at 10 39 48 AM"
src="https://github.com/bevyengine/bevy/assets/2975848/b170291d-cba7-441b-90ee-2ad6841eaedb">

Other features are essentially identical to the implementations for
`Circle`/`Ellipse`.

---

## Changelog

- Introduced `AnnulusMeshBuilder`
- Implemented `Meshable` for `Annulus` with `Output =
AnnulusMeshBuilder`
- Implemented `From<Annulus>` and `From<AnnulusMeshBuilder>` for `Mesh`
- Added `impl_reflect!` declaration for `Annulus` and `Triangle3d` in
`bevy_reflect`

---

## Discussion

### Design considerations

The only interesting wrinkle here is that the existing UV-mapping of
`Ellipse` (and hence of `Circle` and `RegularPolygon`) is non-radial
(it's skew-free, created by situating the mesh in a bounding rectangle),
so the UV-mapping of `Annulus` doesn't limit to that of `Circle` as its
inner radius tends to zero, for instance. I don't see this as a real
issue for `Annulus`, which should almost certainly have this kind of
UV-mapping, but I think we ought to at least consider allowing mesh
configuration for `Circle`/`Ellipse` that performs radial UV-mapping
instead. (In these cases in particular, it would be especially easy,
since we wouldn't need a different parameter set in the builder.)

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
2024-04-01 21:55:49 +00:00
..
enums Add ReflectKind (#11664) 2024-02-07 00:36:23 +00:00
impls Meshing for Annulus primitive (#12734) 2024-04-01 21:55:49 +00:00
path Remove redundant imports (#12817) 2024-04-01 19:59:08 +00:00
serde bevy_reflect: Rename UntypedReflectDeserializer to ReflectDeserializer (#12721) 2024-03-26 19:58:29 +00:00
array.rs Add ReflectKind (#11664) 2024-02-07 00:36:23 +00:00
fields.rs
from_reflect.rs
lib.rs bevy_reflect: Rename UntypedReflectDeserializer to ReflectDeserializer (#12721) 2024-03-26 19:58:29 +00:00
list.rs Add ReflectKind (#11664) 2024-02-07 00:36:23 +00:00
map.rs Added reflect support for std::HashSet, BTreeSet and BTreeMap. (#12124) 2024-02-26 16:36:04 +00:00
reflect.rs Add ReflectKind (#11664) 2024-02-07 00:36:23 +00:00
std_traits.rs
struct_trait.rs Add ReflectKind (#11664) 2024-02-07 00:36:23 +00:00
tuple_struct.rs Add ReflectKind (#11664) 2024-02-07 00:36:23 +00:00
tuple.rs bevy_reflect: Recursive registration (#5781) 2024-03-04 19:04:10 +00:00
type_info.rs
type_path.rs bevy_reflect: Rename UntypedReflectDeserializer to ReflectDeserializer (#12721) 2024-03-26 19:58:29 +00:00
type_registry.rs Forbid unsafe in most crates in the engine (#12684) 2024-03-27 03:30:08 +00:00
utility.rs Rework animation to be done in two phases. (#11707) 2024-02-19 14:59:54 +00:00