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:
cyaneko
2021-08-19 21:10:57 +02:00
committed by GitHub
parent e48244d8b6
commit b7a196ba4a

View File

@@ -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);