From 5023fe64ce82a3204f164e01efab292f705461b6 Mon Sep 17 00:00:00 2001 From: ohyzha Date: Thu, 18 Jul 2024 14:47:34 +0300 Subject: [PATCH] fix flipped camera movements --- openVulkanoCpp/Scene/Camera.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openVulkanoCpp/Scene/Camera.hpp b/openVulkanoCpp/Scene/Camera.hpp index 478176b..af6696c 100644 --- a/openVulkanoCpp/Scene/Camera.hpp +++ b/openVulkanoCpp/Scene/Camera.hpp @@ -99,7 +99,7 @@ namespace OpenVulkano::Scene { //TODO this should be done based on the clipspace used by the rendering api // In vulkan the screen space is defined as y=0=top and y=1=bottom and thus the coordinate have to be flipped - m_viewProjection = m_projection * Math::Matrix4f(1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1) * m_view; + m_viewProjection = m_projection * m_view; } void UpdateWorldMatrix(const Math::Matrix4f& parentWorldMat) override @@ -252,6 +252,7 @@ namespace OpenVulkano::Scene void UpdateProjectionMatrix() override { m_projection = Math::Utils::perspectiveRH_ZO(m_fov, m_aspect, m_nearPlane, m_farPlane); + m_projection *= Math::Matrix4f(1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); UpdateViewProjectionMatrix(); }