Skip to content
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

Split RapierContext #585

Merged
merged 31 commits into from
Dec 10, 2024
Merged

Split RapierContext #585

merged 31 commits into from
Dec 10, 2024

Conversation

Vrixyz
Copy link
Contributor

@Vrixyz Vrixyz commented Sep 11, 2024

Opportunities for parallelized execution seem limited, but exist, this also enables better separation of systems, with more typed information leading to a clearer intent.

I'm not 100% convinced it's a net positive in terms of maintainability, bevy_mod_debugdump is currently harder to read due to this bug: jakobhellermann/bevy_mod_debugdump#50.

@Vrixyz Vrixyz force-pushed the split_rapiercontext branch from 8a05e9a to 3e98da1 Compare October 15, 2024 08:08
Vrixyz added a commit to Vrixyz/rapier.rs that referenced this pull request Oct 15, 2024
@Vrixyz Vrixyz marked this pull request as ready for review October 15, 2024 08:35
Vrixyz added a commit to Vrixyz/rapier.rs that referenced this pull request Oct 15, 2024
@Vrixyz Vrixyz mentioned this pull request Oct 31, 2024
3 tasks
@Vrixyz Vrixyz requested a review from sebcrozet October 31, 2024 15:21
Copy link
Member

@sebcrozet sebcrozet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

Comment on lines +93 to +95
let context = rapier_context.single();
// Then cast the ray.
let hit = rapier_context.cast_ray(
let hit = context.cast_ray(
Copy link
Contributor Author

@Vrixyz Vrixyz Dec 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could avoid this indirection to single() if we implemented all methods of RapierContext on its systemParam ; but:

  • it would require making the query each time we call a method
    • Probably not so much of an issue if queries are cached
  • it would require to add another 400 lines of code, I already fear for the maintenance of current layer of indirection, I'd like to keep it at the minimum.
    • a declarative macro to generate those ended up a bit too complex, and not much lines saved
    • maybe a procedural or a template step could be interesting.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of added lines come from this file, which holds a shortcut to functions users are accustomed to. Rather than looking up which component they have to rely on, they have a RapierContext-like API, and can look into it to see what queries it resolves to if they want.

@Vrixyz Vrixyz merged commit ac4fb03 into dimforge:master Dec 10, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants