From 29f15472f31feec20fb01b0151192fd0c26f5ae9 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 4 Feb 2024 10:17:32 +0100 Subject: a --- editor/tests/raycast-test.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'editor/tests') diff --git a/editor/tests/raycast-test.cpp b/editor/tests/raycast-test.cpp index fc1f8f1a..f74d3091 100644 --- a/editor/tests/raycast-test.cpp +++ b/editor/tests/raycast-test.cpp @@ -146,8 +146,9 @@ constexpr Vector2i chunk_offsets[3][3] = { template constexpr bool within_chunk_bounds(Math::Vector2 p0, Math::Vector2 p1) { - constexpr auto max_bb_size = Math::Vector2{T{0xff+1}, T{0xff+1}}; - constexpr auto start = -max_bb_size/2, end = chunk_size + max_bb_size/2; + constexpr auto max_bb_size = Math::Vector2{T{0xff}, T{0xff}}; + constexpr auto half_bb = (max_bb_size + Math::Vector2{T{1}}) / T{2}; + constexpr auto start = -half_bb, end = chunk_size + half_bb; return !(start.x() > p1.x() || end.x() < p0.x() || start.y() > p1.y() || end.y() < p0.y()); @@ -206,11 +207,7 @@ void do_raycasting(result_s& result, auto dir = V.normalized(); if (abs(dir.x()) < eps && abs(dir.y()) < eps) [[unlikely]] - { dir = {eps, eps}; - //fm_error("raycast: bad dir? {%f, %f}", dir.x(), dir.y()); - //return; - } unsigned long_axis, short_axis; -- cgit v1.2.3