Move Frustum, HalfSpace from bevy_render to bevy_math#13882
Move Frustum, HalfSpace from bevy_render to bevy_math#13882torsteingrindvik wants to merge 4 commits intobevyengine:mainfrom
Conversation
|
When moving baggage into the legacy module (as suggested in #13878 (comment)) I had to also make docs for those, but since it's a legacy module I just mocked the docs. Let me know what should be done there (if not that). Also the |
| pub use frustum::Frustum; | ||
| mod half_space; | ||
| pub use half_space::HalfSpace; | ||
| /// Clean me up! |
There was a problem hiding this comment.
This needs real docs explaining why this exists, and linking to an issue made to track their clean-up.
alice-i-cecile
left a comment
There was a problem hiding this comment.
Good, just a few notes:
- IMO we should remove the legacy notes docs and simply blanket allow missing docs on the legacy_bevy_render module.
- We should also remove
Spherefrombevy_renderduring this PR rather than duplicating it, and note that in the migration guide. - We should make an issue specifically for eliminating
bevy_render::primitivesand link it in the module docs of both thebevy_mathandbevy_rendermodules.
Perhaps I misunderstood the goal/scope of point 1. and 2. in the issue, but could you elaborate? Linking to changes seems a bit buggy, but it's deleted from If you mean it's duplicated because it's now in the legacy module and we should remove that definition altogether then I would need to figure out the implications since the |
I just misread the diff, sorry for the confusion! I can make the follow-up issue, so the only thing I want from you is the missing_docs change. |
…lso move necessary baggage. Signed-off-by: Torstein Grindvik <torstein.grindvik@muybridge.com>
Signed-off-by: Torstein Grindvik <torstein.grindvik@muybridge.com>
…flict for rust lints Signed-off-by: Torstein Grindvik <torstein.grindvik@muybridge.com>
591e4ee to
be45e64
Compare
Was questioning my sanity for a bit there 😅 I made a placeholder issue and linked to it in the PR: #13931 , will you edit it when needed? |
alice-i-cecile
left a comment
There was a problem hiding this comment.
Great: I'll merge this as soon as 0.14 is out the door. Merging refactors like this will make cherrypicking fixes harder, so I'm going to hold off for just a bit.
As for the The main "issue" with option (1) is that |
There was a problem hiding this comment.
Personally, I don't really like adding a legacy rendering module like this to bevy_math especially since it's not gated behind feature flags, and I don't really see the utility. It just feels like extra complexity and is not something bevy_math should have at all, even momentarily imo.
Sphere is a type that we should pretty easily be able to just remove, and Aabb is a type we need to keep around in some form in bevy_render anyway. I'd just add an aabb module (or similar) in bevy_render, or even leave it where it was, and leave refactoring/renaming the type to a follow-up. Similarly for Frustum, if it needs to be a component, it just means that we need a newtype in bevy_render.
| #[cfg_attr(feature = "bevy_ecs", derive(Component))] | ||
| #[cfg_attr( | ||
| feature = "bevy_reflect", | ||
| derive(Reflect), | ||
| reflect(Debug, PartialEq, Default) | ||
| )] | ||
| #[cfg_attr( | ||
| all(feature = "serialize", feature = "bevy_reflect"), | ||
| reflect(Serialize, Deserialize) | ||
| )] | ||
| #[cfg_attr( | ||
| all(feature = "bevy_ecs", feature = "bevy_reflect"), | ||
| reflect(Component) | ||
| )] | ||
| pub struct HalfSpace { |
There was a problem hiding this comment.
This should not be a component. The old one isn't either.
|
@Jondolf how do you think we should tackle this broader initiative of "don't have weird primitives in bevy_render" as a whole? I really value your judgement here, and it's not clear what can / should be done first. |
|
My response became so long that I just wrote it up into its own issue 😅 See #13945 for the full context. TLDR concerning this PR: The My opinion is that this PR should just do what the PR title says:
No legacy modules or other unrelated changes, just these two (or just (1)). The Feel free to disagree, these are just my thoughts on this :) |
Thanks for the explanation. This PR was originally just to address a chore when I had some extra time but there are more moving parts involved- so I think it's simplest for me to close this out for now. |
…m `bevy_camera` to `bevy_math` (#22684) # Objective - Does the latter half of #13945 - Does the first two thirds of #13878 - Finish some of what #13882 started ## Solution - Moves `bevy_camera::primitives::HalfSpace` to `bevy_math::primitives::HalfSpace` (first commit) - Moves some of `bevy_camera::primitives::Frustum` to `bevy_math::primitives::ViewFrustum` (second commit) - I basically followed Jondolf’s directions on the two refactorings. aabb, obb, and sphere stuff stays in bevy_camera (for now? If sphere is refactored, it has been stressed to be done as a follow up ) ## Testing I ran the `lighting`, `2d_gizmos`, and `3d_gizmos` example just to make sure the lights… and camera… (and action!) were still working. Everything seems to be fine there compared to main. If there are any other examples I should run to make sure things look good, let me know.
Also move necessary baggage.
Objective
Fixes #13878
Solution
FrustumandHalfSpacefrombevy_rendertobevy_mathSphereandAabbstructs frombevy_renderto a legacy module inbevy_math, to be refactored laterChangelog
FrustumandHalfSpacefrombevy_rendertobevy_mathMigration Guide
FrustumandHalfSpacemust now be imported frombevy_math::primitives::{Frustum, HalfSpace}instead of frombevy_render.