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

Fix Mat4::look_at_lh/rh #20

Merged
merged 2 commits into from
Sep 17, 2019
Merged

Conversation

repi
Copy link
Contributor

@repi repi commented Sep 17, 2019

The Mat4::look_at_lh implementation was a broken with lacking normalization, doing the cross products in the wrong order and some flips.

I'm not 100% sure if this is correct but with these fixes it matches the behavior of glm::look_at_rh and also the implementation in DirectXMath XMMatrixLookToLH, though I've only in practice tested the right-handed version as that is what we use.

src/f32/mat4.rs Outdated Show resolved Hide resolved
@bitshifter bitshifter merged commit 083f6a7 into bitshifter:master Sep 17, 2019
@bitshifter
Copy link
Owner

Thanks. I don't use these in my little hobby projects so they haven't really had any love. I think I copied them from nalgebra or something but obviously messed it up.

They're still not public though, are you using them somehow or did you just notice they were incorrect?

@repi
Copy link
Contributor Author

repi commented Sep 17, 2019

Yeah easy to get something wrong with it. The Mat4::look_to_lh is not public but Mat4::look_to_lh and Mat4::look_to_rh that uses it are public. And we use Mat4::look_at_rh.

Thanks for quick merge!

@khyperia khyperia deleted the mat4-look-at branch June 1, 2021 10:05
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.

3 participants