summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-06-06 10:18:52 +0200
committerStanislaw Halik <sthalik@misaki.pl>2024-06-06 10:18:52 +0200
commitd9a4a52a8b3ffafa0e99fdd4d933056df147b8d7 (patch)
tree00c6ee26752c00afb8a50d5ef38335c9bd7027d6
parent95bce33f87a1c595333716fa4e6db33478ee9225 (diff)
fix collision overlay showing hovered tile
-rw-r--r--editor/draw.cpp11
1 files 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<collision_data>(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<collision_data>(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);