added constexpr support for radar

This commit is contained in:
2026-07-05 05:53:28 +03:00
parent 9299ea8960
commit b4f4917aec
2 changed files with 16 additions and 3 deletions
+3 -1
View File
@@ -1,6 +1,7 @@
//
// Created by Vlad on 27.08.2024.
//
#include "omath/algorithm/radar.hpp"
#include "omath/engines/unity_engine/camera.hpp"
#include <complex>
#include <gtest/gtest.h>
@@ -1283,8 +1284,9 @@ TEST(UnitTestProjection, TriangleFarToSideCulled)
TEST(UnitTestProjection, TriangleStraddlingFrustumNotCulled)
{
constexpr auto fov = omath::projection::FieldOfView::from_degrees(90.f);
const auto cam = omath::source_engine::Camera({0.f, 0.f, 0.f}, {}, {1920.f, 1080.f}, fov, 0.01f, 1000.f);
constexpr auto cam = omath::source_engine::Camera({0.f, 0.f, 0.f}, {}, {1920.f, 1080.f}, fov, 0.01f, 1000.f);
constexpr auto position = omath::algorithm::world_to_radar(cam, {-1.f, 0.f, 0.f}, 0.1f);
// Large triangle with vertices on both sides of the frustum — should not be culled
const omath::Triangle<omath::Vector3<float>> tri{{100.f, 0.f, 0.f}, {100.f, 5000.f, 0.f}, {100.f, 0.f, 5000.f}};
EXPECT_FALSE(cam.is_culled_by_frustum(tri));