Fixed left/right offsets

This commit is contained in:
Sascha Willems 2023-09-14 22:43:37 +02:00
parent 5868234f4f
commit 3532ea8696

View file

@ -3,7 +3,7 @@
* *
* Uses VK_KHR_multiview for simultaneously rendering to multiple views and displays these with barrel distortion using a fragment shader * Uses VK_KHR_multiview for simultaneously rendering to multiple views and displays these with barrel distortion using a fragment shader
* *
* Copyright (C) 2018 by Sascha Willems - www.saschawillems.de * Copyright (C) 2018-2023 by Sascha Willems - www.saschawillems.de
* *
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) * This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
*/ */
@ -622,8 +622,8 @@ public:
rotM = glm::rotate(rotM, glm::radians(camera.rotation.z), glm::vec3(0.0f, 0.0f, 1.0f)); rotM = glm::rotate(rotM, glm::radians(camera.rotation.z), glm::vec3(0.0f, 0.0f, 1.0f));
// Left eye // Left eye
left = -aspectRatio * wd2 + 0.5f * eyeSeparation * ndfl; left = -aspectRatio * wd2 - 0.5f * eyeSeparation * ndfl;
right = aspectRatio * wd2 + 0.5f * eyeSeparation * ndfl; right = aspectRatio * wd2 - 0.5f * eyeSeparation * ndfl;
transM = glm::translate(glm::mat4(1.0f), camera.position - camRight * (eyeSeparation / 2.0f)); transM = glm::translate(glm::mat4(1.0f), camera.position - camRight * (eyeSeparation / 2.0f));
@ -631,8 +631,8 @@ public:
ubo.modelview[0] = rotM * transM; ubo.modelview[0] = rotM * transM;
// Right eye // Right eye
left = -aspectRatio * wd2 - 0.5f * eyeSeparation * ndfl; left = -aspectRatio * wd2 + 0.5f * eyeSeparation * ndfl;
right = aspectRatio * wd2 - 0.5f * eyeSeparation * ndfl; right = aspectRatio * wd2 + 0.5f * eyeSeparation * ndfl;
transM = glm::translate(glm::mat4(1.0f), camera.position + camRight * (eyeSeparation / 2.0f)); transM = glm::translate(glm::mat4(1.0f), camera.position + camRight * (eyeSeparation / 2.0f));