mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 07:03:25 +00:00
Improves test accuracy and adds .gitignore entry
Updates unit tests to include more accurate assertions for camera projections. Adds .idea/workspace.xml to .gitignore to prevent tracking local IDE settings. Refactors some test fixture class names for consistency.
This commit is contained in:
@@ -9,9 +9,13 @@
|
||||
|
||||
TEST(UnitTestProjection, Projection)
|
||||
{
|
||||
const auto x = omath::Angle<float, 0.f, 180.f, omath::AngleFlags::Clamped>::from_degrees(90.f);
|
||||
auto cam = omath::source_engine::Camera({0, 0, 0}, omath::source_engine::ViewAngles{}, {1920.f, 1080.f}, x, 0.01f, 1000.f);
|
||||
constexpr auto fov = omath::Angle<float, 0.f, 180.f, omath::AngleFlags::Clamped>::from_degrees(90.f);
|
||||
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});
|
||||
std::print("{} {} {}", projected->x, projected->y, projected->z);
|
||||
|
||||
EXPECT_NEAR(projected->x, 960.f, 0.001f);
|
||||
EXPECT_NEAR(projected->y, 504.f, 0.001f);
|
||||
EXPECT_NEAR(projected->z, 1.f, 0.001f);
|
||||
}
|
||||
Reference in New Issue
Block a user