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 camera #42

Merged
merged 7 commits into from
Nov 13, 2024
Merged

Conversation

thatcomputerguy0101
Copy link
Contributor

This adds another camera projection mode planar for which the view space is projected to a plane at zero depth. The way the projection frustum is computed allows the FOV to be zero or negative, effectively combining the perspective and orthographic camera modes. However, since the focal point usually does not coincide with the camera position, this works best as an orbit/third-person camera. This projection mode is based on #40 to correctly scale during zoom inputs. The math for this projection was merged into cgmath in rustgd/cgmath#556, but is unlikely to see a release soon so it was also copied to the math file of this crate.

Zooming may be possible without #40, but the combination of height and camera position affecting zoom in perspective mode might not work as well as purely scaling the view transform.

@asny
Copy link
Owner

asny commented Nov 13, 2024

Looks good to me. What exactly do you need it for? 🤔

@asny asny merged commit 2d34e6d into asny:main Nov 13, 2024
4 checks passed
@thatcomputerguy0101
Copy link
Contributor Author

I'm working on a program similar to https://hypercubing.xyz/hyperspeedcube/ but less 4d, where the focus is always on the same object at the same size. Therefore, when the FOV is adjusted, I wanted the puzzle to stay the same visual magnitude, and negative FOV was a free bonus of the math I ended on to allow that.

asny added a commit that referenced this pull request Nov 27, 2024
asny added a commit that referenced this pull request Nov 27, 2024
* Revert "Planar projection camera (#42)"

This reverts commit 2d34e6d.

* Revert scale camera zoom based on distance to target

* Minor clean-up

* Scale orthographic projection based on distance to target

* Zoom factor functions

* Doc

* Update Orthographic projection when position/target changes
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