From d9a4a52a8b3ffafa0e99fdd4d933056df147b8d7 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 6 Jun 2024 10:18:52 +0200 Subject: fix collision overlay showing hovered tile --- editor/draw.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/editor/draw.cpp b/editor/draw.cpp index 051583d1..d0aa82b8 100644 --- a/editor/draw.cpp +++ b/editor/draw.cpp @@ -135,15 +135,14 @@ void app::draw_collision_boxes() const auto* rtree = c.rtree(); rtree->Search(min2f, max2f, [&](object_id data, const rect_type& rect) { [[maybe_unused]] auto x = std::bit_cast(data); -#if 0 // todo! +#if 0 if (x.tag == (uint64_t)collision_type::geometry) return true; -#else +#endif if (x.tag == (uint64_t)collision_type::geometry) if (x.pass == (uint64_t)pass_mode::pass) if (x.data < TILE_COUNT*2+1) return true; -#endif Vector2 start(rect.m_min[0], rect.m_min[1]), end(rect.m_max[0], rect.m_max[1]); auto size = (end - start); auto center = Vector3(start + size*.5f, 0.f); @@ -183,8 +182,14 @@ void app::draw_collision_boxes() const auto* rtree = c.rtree(); rtree->Search(t0.data(), t1.data(), [&](uint64_t data, const rect_type& rect) { [[maybe_unused]] auto x = std::bit_cast(data); +#if 0 if (x.tag == (uint64_t)collision_type::geometry) return true; +#endif + if (x.tag == (uint64_t)collision_type::geometry) + if (x.pass == (uint64_t)pass_mode::pass) + if (x.data < TILE_COUNT*2+1) + return true; Vector2 start(rect.m_min[0], rect.m_min[1]), end(rect.m_max[0], rect.m_max[1]); auto size = end - start; auto center = Vector3(start + size*.5f, 0.f); -- cgit v1.2.3