-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Meshing for Annulus primitive
#12734
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
You added a new example but didn't add metadata for it. Please update the root Cargo.toml file. |
Jondolf
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI is screaming but it seems to be for unrelated reasons (as usual). LGTM!
I agree it'd be nice to add radial/polar UV mapping as a configuration option for Circle and Ellipse (and RegularPolygon?) in a follow-up.
Chubercik
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM ^^
# Objective - Depends on #12734. Since adding the `Annulus` primitive shape (#12706, #12734), the `2d_shapes` example has become outdated. ## Solution This PR adds the annulus shape to the `2d_shapes` example:  --- ## Changelog ### Added - `Annulus` shape to the `2d_shapes` example (~~as an added bonus, the example now features Newton's [ROYGBIV](https://en.wikipedia.org/wiki/ROYGBIV) rainbow palette ^^~~ no it doesn't, but one can shoehorn..)
# Objective Related to bevyengine#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>
# Objective - Depends on bevyengine#12734. Since adding the `Annulus` primitive shape (bevyengine#12706, bevyengine#12734), the `2d_shapes` example has become outdated. ## Solution This PR adds the annulus shape to the `2d_shapes` example:  --- ## Changelog ### Added - `Annulus` shape to the `2d_shapes` example (~~as an added bonus, the example now features Newton's [ROYGBIV](https://en.wikipedia.org/wiki/ROYGBIV) rainbow palette ^^~~ no it doesn't, but one can shoehorn..)
Objective
Related to #10572
Allow the
Annulusprimitive to be meshed.Solution
We introduce a

Meshablestructure,AnnulusMeshBuilder, which allows theAnnulusprimitive 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:Other features are essentially identical to the implementations for
Circle/Ellipse.Changelog
AnnulusMeshBuilderMeshableforAnnuluswithOutput = AnnulusMeshBuilderFrom<Annulus>andFrom<AnnulusMeshBuilder>forMeshimpl_reflect!declaration forAnnulusandTriangle3dinbevy_reflectDiscussion
Design considerations
The only interesting wrinkle here is that the existing UV-mapping of
Ellipse(and hence ofCircleandRegularPolygon) is non-radial (it's skew-free, created by situating the mesh in a bounding rectangle), so the UV-mapping ofAnnulusdoesn't limit to that ofCircleas its inner radius tends to zero, for instance. I don't see this as a real issue forAnnulus, which should almost certainly have this kind of UV-mapping, but I think we ought to at least consider allowing mesh configuration forCircle/Ellipsethat 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.)