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

How do I mirror the camera along the X axis without offsetting the camera's position? #336

Open
badasahog opened this issue Jul 16, 2023 · 2 comments

Comments

@badasahog
Copy link

I want to mirror the screen along the X axis.

Right now I've implemented this by hand using the following code:

glm_lookat_lh(cameraPosition, cameraFront, cameraUp, cameraViewMat);	
cameraViewMat[0][0] *= -1.f;
cameraViewMat[0][1] *= -1.f;
cameraViewMat[0][2] *= -1.f;
cameraViewMat[0][3] *= -1.f;

This approach makes it so that the X coordinate of the camera's position is inverted, which I don't want.

@recp
Copy link
Owner

recp commented Jul 17, 2023

Hi @badasahog,

What about flipping cameraUp for instance {1,0,0} to {-1,0,0}? glm_vec4_negate() will simply flip the vector.

glm_mirror_x(view), glm_mirror_y(view), glm_mirror_z(view), glm_mirror(vec, view, dest) could also help to flip existing view maybe 🤔

Modifying projected matrix could also be an option to flip scene

@badasahog
Copy link
Author

that won't work because it would just flip the scene upside down (z axis).

What I want to do is use a coordinate system where x increases in the opposite direction that it does by default.

as for glm_mirror_x, etc, these functions don't appear to exist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants