mirror of
https://github.com/JoeyDeVries/LearnOpenGL.git
synced 2026-01-02 04:37:54 +08:00
Fix a minor bug in rear view mirror
Rotating both the Yaw and Pitch would cause the mirror to display whatever was in front but with Pitch * -1, this fixes this behaviour. Tested.
This commit is contained in:
@@ -250,11 +250,9 @@ int main()
|
||||
shader.use();
|
||||
glm::mat4 model = glm::mat4(1.0f);
|
||||
camera.Yaw += 180.0f; // rotate the camera's yaw 180 degrees around
|
||||
camera.Pitch += 180.0f; // rotate the camera's pitch 180 degrees around
|
||||
camera.ProcessMouseMovement(0, 0, false); // call this to make sure it updates its camera vectors, note that we disable pitch constrains for this specific case (otherwise we can't reverse camera's pitch values)
|
||||
glm::mat4 view = camera.GetViewMatrix();
|
||||
camera.Yaw -= 180.0f; // reset it back to its original orientation
|
||||
camera.Pitch -= 180.0f;
|
||||
camera.ProcessMouseMovement(0, 0, true);
|
||||
glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);
|
||||
shader.setMat4("view", view);
|
||||
|
||||
Reference in New Issue
Block a user