This commit is contained in:
Antoine Pilote
2023-07-14 12:32:26 -04:00
parent 94ba63cc28
commit 6384c39efd
4 changed files with 4 additions and 22 deletions

View File

@@ -259,7 +259,7 @@ void GizmoDrawer::DrawGizmos(Ref<Scene> 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);
}

View File

@@ -372,6 +372,7 @@ namespace Nuake {
{
Ref<EditorCamera> editorCam = Engine::GetCurrentScene()->m_EditorCamera;
Vector3 camDirection = entity.GetComponent<CameraComponent>().CameraInstance->GetDirection();
camDirection.z *= -1.0f;
editorCam->SetTransform(glm::inverse(entity.GetComponent<TransformComponent>().GetGlobalTransform()));
}
ImGui::Separator();

View File

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

View File

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