bitshifter / glam-rs

A simple and fast linear algebra library for games and graphics
Apache License 2.0
1.5k stars 152 forks source link

Make `Vec3A::from_vec4` const #545

Closed herabit closed 1 month ago

herabit commented 2 months ago

All of the implementations of Vec3A::from_vec4 do not seem to require non-const functionality, so marking them all as const fn will increase their versatility for API consumers.

I would make a pull request if I was more familiar with contributing to open source, as this seems like a minor change, though yeah I'd need to look into how to, do that.

herabit commented 2 months ago

Wish I had read the contributing guide, I'll make this into a discussion. I'll leave this open for now just in case this is the preferred channel for communication. Close this if it you desire as, yeah I will create the discussion.

bitshifter commented 2 months ago

If it's any consolation almost no one reads the contributing guide :) I really need to make an issue template directing people to discussions. I replied to your discussion thread but I'll leave this open until the PR is merged.

bitshifter commented 1 month ago

It turns out this is not currently possible because Vec3::from_vec4 invokes deref to access the x,y & z values which can't be done in a const context.

At some point this might be possible https://github.com/rust-lang/rust/issues/67792.