From 0f1b06f74e49976d98cb9b325723c952fd4af664 Mon Sep 17 00:00:00 2001 From: viktorljung Date: Thu, 17 Dec 2015 11:13:34 +0100 Subject: [PATCH] Fixed camera rotation bug --- assets | 2 +- deps | 2 +- {include => src}/Engine/Rendering/RenderSystem.cpp | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) rename {include => src}/Engine/Rendering/RenderSystem.cpp (96%) diff --git a/assets b/assets index 008f7278..6b574962 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 008f7278216a1750e9f270c70a75c1cd1859bf1f +Subproject commit 6b5749627cc78cddfd4beae6b5a3728cc432a4a5 diff --git a/deps b/deps index f20b9cc1..1ae6ba5b 160000 --- a/deps +++ b/deps @@ -1 +1 @@ -Subproject commit f20b9cc13bffa39c3b5144bacc5eacd34d43052c +Subproject commit 1ae6ba5b1297ed71b560aee211b9f0007ba52547 diff --git a/include/Engine/Rendering/RenderSystem.cpp b/src/Engine/Rendering/RenderSystem.cpp similarity index 96% rename from include/Engine/Rendering/RenderSystem.cpp rename to src/Engine/Rendering/RenderSystem.cpp index e9183f7a..b35f69ab 100644 --- a/include/Engine/Rendering/RenderSystem.cpp +++ b/src/Engine/Rendering/RenderSystem.cpp @@ -31,7 +31,7 @@ void RenderSystem::Initialize() void RenderSystem::UpdateViewMatrix(ComponentWrapper& cameraTransform) { - glm::quat orientation = cameraTransform["Orientation"]; + glm::quat orientation = glm::quat((glm::vec3)cameraTransform["Orientation"]); glm::vec3 position = cameraTransform["Position"]; m_ViewMatrix = glm::toMat4(glm::inverse(orientation)) * glm::translate(-position); @@ -198,7 +198,7 @@ void RenderSystem::Update(World* world, double dt) ComponentWrapper& cameraComponent = world->GetComponent(m_CurrentCamera, "Camera"); ComponentWrapper& cameraTransform = world->GetComponent(m_CurrentCamera, "Transform"); - firstPersonInputController.SetOrientation((glm::quat)cameraTransform["Orientation"]); + firstPersonInputController.SetOrientation(glm::quat((glm::vec3)cameraTransform["Orientation"])); firstPersonInputController.SetPosition((glm::vec3)cameraTransform["Position"]); } } @@ -209,7 +209,7 @@ void RenderSystem::Update(World* world, double dt) ComponentWrapper& cameraTransform = world->GetComponent(m_CurrentCamera, "Transform"); firstPersonInputController.Update(dt); - (glm::quat&)cameraTransform["Orientation"] = firstPersonInputController.Orientation(); + (glm::vec3&)cameraTransform["Orientation"] = glm::eulerAngles(firstPersonInputController.Orientation()); (glm::vec3&)cameraTransform["Position"] = firstPersonInputController.Position();