From 7bb8dcbb8ca026453dfc756e860fe373c9b836cd Mon Sep 17 00:00:00 2001 From: Orange Date: Tue, 3 Sep 2024 22:19:17 +0300 Subject: [PATCH] changed return type --- include/omath/projection/Camera.h | 2 +- source/projection/Camera.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/omath/projection/Camera.h b/include/omath/projection/Camera.h index a7ab73b..a3bfbe1 100644 --- a/include/omath/projection/Camera.h +++ b/include/omath/projection/Camera.h @@ -30,7 +30,7 @@ namespace omath::projection [[nodiscard]] Matrix GetViewMatrix() const; - [[nodiscard]] std::expected WorldToScreen(const Vector3& worldPosition) const; + [[nodiscard]] std::expected WorldToScreen(const Vector3& worldPosition) const; ViewPort m_viewPort{}; float m_fieldOfView; diff --git a/source/projection/Camera.cpp b/source/projection/Camera.cpp index f0f7baf..5f67a6e 100644 --- a/source/projection/Camera.cpp +++ b/source/projection/Camera.cpp @@ -30,7 +30,7 @@ namespace omath::projection return Matrix::TranslationMatrix(-m_origin) * Matrix::OrientationMatrix(forward, right, up); } - std::expected Camera::WorldToScreen(const Vector3 &worldPosition) const + std::expected Camera::WorldToScreen(const Vector3 &worldPosition) const { const auto posVecAsMatrix = Matrix({{worldPosition.x, worldPosition.y, worldPosition.z, 1.f}}); @@ -51,6 +51,6 @@ namespace omath::projection projected *= Matrix::ToScreenMatrix(m_viewPort.m_width, m_viewPort.m_height); - return Vector3{projected.At(0, 0), projected.At(0, 1), projected.At(0, 2)}; + return Vector2{projected.At(0, 0), projected.At(0, 1)}; } }