@@ -50,7 +50,7 @@ TEST(UnitTestProjection, ScreenToNdcBottomLeft)
5050 EXPECT_NEAR (ndc_bottom_left.y , 0 .519615293f , 0 .0001f );
5151}
5252
53- TEST (UnitTestProjection, NotClipWorldToScreenInBounds )
53+ TEST (UnitTestProjection, UnclippedWorldToScreenInBounds )
5454{
5555 constexpr auto fov = omath::Angle<float , 0 .f , 180 .f , omath::AngleFlags::Clamped>::from_degrees (90 .f );
5656 const auto cam = omath::source_engine::Camera ({0 , 0 , 0 }, omath::source_engine::ViewAngles{}, {1920 .f , 1080 .f }, fov,
@@ -62,7 +62,7 @@ TEST(UnitTestProjection, NotClipWorldToScreenInBounds)
6262 EXPECT_NEAR (projected->y , 504 .f , 0 .001f );
6363}
6464
65- TEST (UnitTestProjection, NotClipWorldToScreenMatchesWorldToScreenWhenInBounds )
65+ TEST (UnitTestProjection, UnclippedWorldToScreenMatchesWorldToScreenWhenInBounds )
6666{
6767 constexpr auto fov = omath::Angle<float , 0 .f , 180 .f , omath::AngleFlags::Clamped>::from_degrees (90 .f );
6868 const auto cam = omath::source_engine::Camera ({0 , 0 , 0 }, omath::source_engine::ViewAngles{}, {1920 .f , 1080 .f }, fov,
@@ -78,7 +78,7 @@ TEST(UnitTestProjection, NotClipWorldToScreenMatchesWorldToScreenWhenInBounds)
7878 EXPECT_NEAR (w2s->z , no_clip->z , 0 .001f );
7979}
8080
81- TEST (UnitTestProjection, NotClipWorldToScreenRejectsBehindCamera )
81+ TEST (UnitTestProjection, UnclippedWorldToScreenRejectsBehindCamera )
8282{
8383 constexpr auto fov = omath::Angle<float , 0 .f , 180 .f , omath::AngleFlags::Clamped>::from_degrees (90 .f );
8484 const auto cam = omath::source_engine::Camera ({0 , 0 , 0 }, omath::source_engine::ViewAngles{}, {1920 .f , 1080 .f }, fov,
@@ -89,30 +89,29 @@ TEST(UnitTestProjection, NotClipWorldToScreenRejectsBehindCamera)
8989 EXPECT_EQ (projected.error (), omath::projection::Error::WORLD_POSITION_IS_OUT_OF_SCREEN_BOUNDS);
9090}
9191
92- TEST (UnitTestProjection, NotClipWorldToScreenRejectsOutOfBoundsNdc )
92+ TEST (UnitTestProjection, UnclippedWorldToScreenAllowsOutOfBoundsNdc )
9393{
9494 constexpr auto fov = omath::Angle<float , 0 .f , 180 .f , omath::AngleFlags::Clamped>::from_degrees (90 .f );
9595 const auto cam = omath::source_engine::Camera ({0 , 0 , 0 }, omath::source_engine::ViewAngles{}, {1920 .f , 1080 .f }, fov,
9696 0 .01f , 1000 .f );
9797
98- // Point far to the side should exceed NDC [-1,1] bounds
98+ // Point far to the side exceeds NDC [-1,1] bounds but unclipped returns it anyway
9999 const auto projected = cam.world_to_screen_unclipped ({100 .f , 5000 .f , 0 });
100- EXPECT_FALSE (projected.has_value ());
101- EXPECT_EQ (projected.error (), omath::projection::Error::WORLD_POSITION_IS_OUT_OF_SCREEN_BOUNDS);
100+ EXPECT_TRUE (projected.has_value ());
102101}
103102
104- TEST (UnitTestProjection, WorldToScreenAllowsOutOfBoundsNdc )
103+ TEST (UnitTestProjection, WorldToScreenRejectsOutOfBoundsNdc )
105104{
106105 constexpr auto fov = omath::Angle<float , 0 .f , 180 .f , omath::AngleFlags::Clamped>::from_degrees (90 .f );
107106 const auto cam = omath::source_engine::Camera ({0 , 0 , 0 }, omath::source_engine::ViewAngles{}, {1920 .f , 1080 .f }, fov,
108107 0 .01f , 1000 .f );
109108
110- // Same point that not_clip rejects should succeed with world_to_screen
109+ // Same point that unclipped allows — clipped world_to_screen rejects it
111110 const auto projected = cam.world_to_screen ({100 .f , 5000 .f , 0 });
112- EXPECT_TRUE (projected.has_value ());
111+ EXPECT_FALSE (projected.has_value ());
113112}
114113
115- TEST (UnitTestProjection, NotClipWorldToScreenBottomLeftCorner )
114+ TEST (UnitTestProjection, UnclippedWorldToScreenBottomLeftCorner )
116115{
117116 constexpr auto fov = omath::Angle<float , 0 .f , 180 .f , omath::AngleFlags::Clamped>::from_degrees (90 .f );
118117 const auto cam = omath::source_engine::Camera ({0 , 0 , 0 }, omath::source_engine::ViewAngles{}, {1920 .f , 1080 .f }, fov,
@@ -129,7 +128,7 @@ TEST(UnitTestProjection, NotClipWorldToScreenBottomLeftCorner)
129128 EXPECT_NEAR (top_left->y + bottom_left->y , 1080 .f , 0 .001f );
130129}
131130
132- TEST (UnitTestProjection, NotClipWorldToScreenRoundTrip )
131+ TEST (UnitTestProjection, UnclippedWorldToScreenRoundTrip )
133132{
134133 std::mt19937 gen (42 );
135134 std::uniform_real_distribution dist_fwd (100 .f , 900 .f );
@@ -158,7 +157,7 @@ TEST(UnitTestProjection, NotClipWorldToScreenRoundTrip)
158157 }
159158}
160159
161- TEST (UnitTestProjection, NotClipWorldToScreenUnityEngine )
160+ TEST (UnitTestProjection, UnclippedWorldToScreenUnityEngine )
162161{
163162 constexpr auto fov = omath::projection::FieldOfView::from_degrees (60 .f );
164163 const auto cam = omath::unity_engine::Camera ({0 , 0 , 0 }, {}, {1280 .f , 720 .f }, fov, 0 .03f , 1000 .f );
0 commit comments