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

Add Mat4::ortho #32

Closed
icefoxen opened this issue Nov 17, 2019 · 2 comments · Fixed by #33
Closed

Add Mat4::ortho #32

icefoxen opened this issue Nov 17, 2019 · 2 comments · Fixed by #33

Comments

@icefoxen
Copy link
Contributor

Because orthographic projections are cool. If you want this, I'll happily PR it.

@bitshifter
Copy link
Owner

Hi, yeah I'd happily accept a PR for orthographic projections! I'd suggest following the current naming convention that's used for perspective projections like Mat4::perspective_infinite_rh and Mat4::perspective_infinite_reverse_rh. Note that there's only right handed perspective creation functions because that's what people have contributed. Up to you if you provide right or left handed or both. Current perspective creation functions are in the 0 to to 1 depth range.

So perhaps Mat4::orthographic_rh or whatever. If it makes sense for it to be "infinite" like the others include that I guess (see #23). I'm no expert on projection matrices though, whatever makes sense to you.

Also I've tried to add tests for most functionality in glam, but coming up with tests for projection matrices is a bit annoying so definitely not a requirement for a PR.

@bitshifter
Copy link
Owner

bitshifter commented Nov 18, 2019

Note to self, I found some projection matrix unit tests in handmade math that I might give me some ideas for glam https://github.com/HandmadeMath/Handmade-Math/blob/master/test/categories/Projection.h

icefoxen added a commit to icefoxen/glam-rs that referenced this issue Nov 21, 2019
A little WIP at the moment still, but it's Code That I've Used
So I Know It Works(tm).  Barring typos, I guess.  Also checked
against `glm::ortho`.  I agree that we do want actual unit tests
though, so that's what I'm going to attempt next.

Will resolve bitshifter#32.
bitshifter pushed a commit that referenced this issue Nov 21, 2019
* Basic right-handed orthographic matrix function.

A little WIP at the moment still, but it's Code That I've Used
So I Know It Works(tm).  Barring typos, I guess.  Also checked
against `glm::ortho`.  I agree that we do want actual unit tests
though, so that's what I'm going to attempt next.

Will resolve #32.

* Added unit tests for Mat4::orthographic_rh()

Which actually revealed significant bugs.  XD  Well,
that's what the test is for!

* aw heck, I left in commented-out code.  Removed.
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 a pull request may close this issue.

2 participants