diff --git a/Editor/src/Misc/GizmoDrawer.cpp b/Editor/src/Misc/GizmoDrawer.cpp index 2618377b..3a9524ee 100644 --- a/Editor/src/Misc/GizmoDrawer.cpp +++ b/Editor/src/Misc/GizmoDrawer.cpp @@ -259,7 +259,7 @@ void GizmoDrawer::DrawGizmos(Ref scene) flatShader->SetUniformVec4("u_Color", Vector4(0.0f, 1.0f, 0.4f, 1.0f)); const auto scaledTransform = glm::scale(transformComponent.GetGlobalTransform(), Vector3(0.25f, 0.25f, 0.25f)); - //renderList.AddToRenderList(_gizmos["player"]->GetMeshes()[0], scaledTransform); + renderList.AddToRenderList(_gizmos["player"]->GetMeshes()[0], scaledTransform); renderList.Flush(flatShader, true); } diff --git a/Editor/src/Windows/EditorInterface.cpp b/Editor/src/Windows/EditorInterface.cpp index 6c24d27a..5af71753 100644 --- a/Editor/src/Windows/EditorInterface.cpp +++ b/Editor/src/Windows/EditorInterface.cpp @@ -372,6 +372,7 @@ namespace Nuake { { Ref editorCam = Engine::GetCurrentScene()->m_EditorCamera; Vector3 camDirection = entity.GetComponent().CameraInstance->GetDirection(); + camDirection.z *= -1.0f; editorCam->SetTransform(glm::inverse(entity.GetComponent().GetGlobalTransform())); } ImGui::Separator(); diff --git a/Nuake/src/Core/Maths.cpp b/Nuake/src/Core/Maths.cpp index e1edc573..884f4339 100644 --- a/Nuake/src/Core/Maths.cpp +++ b/Nuake/src/Core/Maths.cpp @@ -65,7 +65,6 @@ Quat Nuake::QuatFromEuler(float x, float y, float z) Vector3 Nuake::QuatToDirection(const Quat& quat) { return glm::normalize(quat * Vector3(0, 0, -1)); - //return glm::normalize(glm::rotate(glm::inverse(quat), glm::vec3(-1.0, 0.0, 0.0))); } void Nuake::Decompose(const Matrix4& m, Vector3& pos, Quat& rot, Vector3& scale) diff --git a/Nuake/src/Rendering/Camera.cpp b/Nuake/src/Rendering/Camera.cpp index 11342a89..f44b340c 100644 --- a/Nuake/src/Rendering/Camera.cpp +++ b/Nuake/src/Rendering/Camera.cpp @@ -45,30 +45,15 @@ namespace Nuake void Camera::SetDirection(Vector3 direction) { - //cam->cameraDirection.x = cos(glm::radians(Yaw)) * cos(glm::radians(Pitch)); - //cam->cameraDirection.y = sin(glm::radians(Pitch)); - //cam->cameraDirection.z = sin(glm::radians(Yaw)) * cos(glm::radians(Pitch)); - //cam->cameraFront = glm::normalize(cam->cameraDirection); - //cam->cameraRight = glm::normalize(glm::cross(cam->up, cam->cameraFront)); Direction = glm::normalize(direction); Right = glm::normalize(glm::cross(Vector3(0, 1, 0), Direction)); m_View = lookAt(Translation, Translation + glm::normalize(Direction), Vector3(0, 1, 0)); - - //Up = glm::normalize(glm::cross(Direction, Right)); } void Camera::SetDirection(const Quat& direction) { - //cam->cameraDirection.x = cos(glm::radians(Yaw)) * cos(glm::radians(Pitch)); - //cam->cameraDirection.y = sin(glm::radians(Pitch)); - //cam->cameraDirection.z = sin(glm::radians(Yaw)) * cos(glm::radians(Pitch)); - //cam->cameraFront = glm::normalize(cam->cameraDirection); - //cam->cameraRight = glm::normalize(glm::cross(cam->up, cam->cameraFront)); - - //glm::quatLookAt(); - //Direction = glm::normalize(direction); - //Right = glm::normalize(glm::cross(Vector3(0, 1, 0), Direction)); - //Up = glm::normalize(glm::cross(Direction, Right)); + // TODO: Calculate forward and Right from quaternion. + assert("Not implemented!"); } Vector3 Camera::GetTranslation() { @@ -89,14 +74,11 @@ namespace Nuake void Camera::SetTransform(const Matrix4& transform) { m_View = transform; - } Matrix4 Camera::GetTransform() { return m_View; - glm::mat4 tr = lookAt(Translation, Translation + glm::normalize(Direction), Vector3(0, 1, 0)); - return tr; } Matrix4 Camera::GetTransformRotation()