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

f32 and f64 additive features #21

Closed
wants to merge 2 commits into from

Conversation

johanhelsing
Copy link
Contributor

@johanhelsing johanhelsing commented Mar 17, 2023

Another option. I wanted to see what it would take to have both f32 and f64 function at the same time.

This makes each implementation available under bevy_xpbd_3d::single::XpbdPlugin and bevy_xpbd_3d::double::XpbdPlugin. If only one of them is defined, adds re-exports at the crate level, i.e. bevy_xpbd_3d::XpbdPlugin.

Not sure what I think of it though, but just thought I'd share.

@Jondolf
Copy link
Owner

Jondolf commented Mar 17, 2023

Interesting idea, haven't seen it before. This does maybe feel a bit hacky though, and seems to basically accomplish the same thing as making separate crates for f32 and f64, except with features and modules

@johanhelsing
Copy link
Contributor Author

Yeah, definitely feels hacky.

Another option would be to use generics, so XpbdPlugin<f32> for instance, and then use associated types for everything (XpbdPlugin<f32>::Vector would be Vec3)... if it's even doable it would probably be a lot less readable, and everything would probably have to go into impl blocks.

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.

None yet

2 participants