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

Planar projection (perspective/orthographic combination projection) #556

Merged
merged 4 commits into from
Oct 27, 2024

Conversation

thatcomputerguy0101
Copy link
Contributor

This adds a new type, PlanarFOV, and a new function planar to create a projection matrix for which the view space is projected to a plane at zero depth, currently two units high. This allows the focal point to move freely according to the specified vertical field of view, making for a continuous transition from positive FOV to zero or even negative FOV.

I'm unsure of using the name PlanarFOV for this, which was derived from how it keeps a plane's transformation fixed as the FOV is adjusted. Additionally, it may be appropriate to add a height parameter to customize the height of the fixed plane instead of fixing it to extend one unit in each direction.

If desired, I can add some test cases to verify the boundary constraints that this projection was derived from.

@aloucks
Copy link
Collaborator

aloucks commented Oct 26, 2024

Why was the value two selected for the height? It seems arbitrary. Could this be configurable?

With that said, cgmath hasn't had a release in nearly 4 years and doesn't currently have a full time maintainer. You might try starting a discussion on the glam library repo and see if there is interest in adding this functionality .

@thatcomputerguy0101
Copy link
Contributor Author

A height of two units was where the math of a symmetric view worked out to be the simplest, with one unit above the origin and one unit below the origin. However, it isn't too complicated to make the height configurable, so that can be changed.

I was making this PR upstream of the crate that I'm directly using (three-d), so I hadn't considered the space of equivalent math crates.

@aloucks aloucks merged commit 53e3f91 into rustgd:master Oct 27, 2024
13 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