From 418b7c0e7e189fdec016a9aa4797a1e992e47898 Mon Sep 17 00:00:00 2001 From: Orange Date: Tue, 9 Sep 2025 02:13:45 +0300 Subject: [PATCH] Fixes float type conversion in world_to_screen Fixes a potential type conversion issue by explicitly casting the x-coordinate to float in the world_to_screen test. This prevents possible compiler warnings and ensures the intended behavior. --- include/omath/projection/camera.hpp | 6 +++++- tests/general/unit_test_projection.cpp | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/omath/projection/camera.hpp b/include/omath/projection/camera.hpp index b2c2515..6d84cb6 100644 --- a/include/omath/projection/camera.hpp +++ b/include/omath/projection/camera.hpp @@ -10,9 +10,12 @@ #include #include #include + #ifdef OMATH_BUILD_TESTS +// ReSharper disable once CppInconsistentNaming class UnitTestProjection_Projection_Test; #endif + namespace omath::projection { class ViewPort final @@ -47,8 +50,9 @@ namespace omath::projection requires CameraEngineConcept class Camera final { +#ifdef OMATH_BUILD_TESTS friend UnitTestProjection_Projection_Test; - +#endif public: ~Camera() = default; Camera(const Vector3& position, const ViewAnglesType& view_angles, const ViewPort& view_port, diff --git a/tests/general/unit_test_projection.cpp b/tests/general/unit_test_projection.cpp index 03c5e42..b2ba6d7 100644 --- a/tests/general/unit_test_projection.cpp +++ b/tests/general/unit_test_projection.cpp @@ -13,7 +13,7 @@ TEST(UnitTestProjection, Projection) const auto cam = omath::source_engine::Camera({0, 0, 0}, omath::source_engine::ViewAngles{}, {1920.f, 1080.f}, fov, 0.01f, 1000.f); - const auto projected = cam.world_to_screen({1000, 0, 50.f}); + const auto projected = cam.world_to_screen({1000.f, 0, 50.f}); const auto result = cam.screen_to_world(projected.value()); const auto result2 = cam.world_to_screen(result.value());