diff --git a/include/omath/projection/camera.hpp b/include/omath/projection/camera.hpp index e0dd8ca..a281630 100644 --- a/include/omath/projection/camera.hpp +++ b/include/omath/projection/camera.hpp @@ -119,11 +119,12 @@ namespace omath::projection auto normalizedCords = WorldToViewPort(worldPosition); if (!normalizedCords.has_value()) - return normalizedCords; + return std::unexpected{normalizedCords.error()}; return NdcToScreenPosition(*normalizedCords); } + [[nodiscard]] std::expected, Error> WorldToViewPort(const Vector3& worldPosition) const { auto projected = GetViewProjectionMatrix() * diff --git a/tests/engines/unit_test_unity_engine.cpp b/tests/engines/unit_test_unity_engine.cpp index 95d4495..ed953a3 100644 --- a/tests/engines/unit_test_unity_engine.cpp +++ b/tests/engines/unit_test_unity_engine.cpp @@ -30,7 +30,7 @@ TEST(UnitTestUnityEngine, UpVector) EXPECT_EQ(up, omath::unity_engine::kAbsUp); } -/*TEST(UnitTestUnityEngine, ProjectTargetMovedFromCamera) +TEST(UnitTestUnityEngine, ProjectTargetMovedFromCamera) { constexpr auto fov = omath::projection::FieldOfView::FromDegrees(60.f); const auto cam = omath::unity_engine::Camera({0, 0, 0}, {}, {1280.f, 720.f}, fov, 0.01f, 1000.f); @@ -48,7 +48,7 @@ TEST(UnitTestUnityEngine, UpVector) EXPECT_NEAR(projected->x, 640, 0.00001f); EXPECT_NEAR(projected->y, 360, 0.00001f); } -}*/ +} TEST(UnitTestUnityEngine, Project) { constexpr auto fov = omath::projection::FieldOfView::FromDegrees(60.f);