Skip to content
Snippets Groups Projects
Commit 61ed3bac authored by Philip Trettner's avatar Philip Trettner
Browse files

frustum test

parent b07b36ec
No related branches found
No related tags found
No related merge requests found
Pipeline #17604 passed
typed-geometry @ 6dd433f3
Subproject commit 284afd6d95f579066d800345648367e7d986d8cf
Subproject commit 6dd433f303977ebd6c92759041590d41288b25a1
#include "test.hh"
TG_FUZZ_TEST(Frustum, BasicFuzzer)
{
auto const bb = tg::aabb3(-10, 10);
auto const eye = uniform(rng, bb);
auto const target = uniform(rng, bb);
auto const view = tg::look_at_opengl(eye, target, tg::dir3::pos_y);
auto const proj = tg::perspective_opengl(uniform(rng, 30_deg, 80_deg), uniform(rng, 0.5f, 2.0f), uniform(rng, 0.1f, 1.f), uniform(rng, 100.f, 500.f));
auto const view_proj = proj * view;
auto const inv_view_proj = inverse(view_proj);
auto const frustum = tg::frustum3::from_view_proj(view_proj);
for (auto p : frustum.vertices)
CHECK(contains(frustum, p, 0.01f));
for (auto i = 0; i < 10; ++i)
{
auto const p = inv_view_proj * uniform(rng, tg::aabb3::minus_one_to_one);
CHECK(contains(frustum, p, 0.01f));
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment