summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-11-18 02:53:30 +0100
committerStanislaw Halik <sthalik@misaki.pl>2024-11-18 03:00:17 +0100
commit722f12e2dce94820eb79fc5a74320b43b9828b22 (patch)
tree3fee38ff1f196eadaa937c2e5d2bfdb5a6180d0f
parentd1bca7ebeb2fdd4707f0fd734fb27767660499ac (diff)
e
-rw-r--r--src/chunk-collision.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/chunk-collision.cpp b/src/chunk-collision.cpp
index 6b266543..8cc74741 100644
--- a/src/chunk-collision.cpp
+++ b/src/chunk-collision.cpp
@@ -139,12 +139,13 @@ void chunk::ensure_passability() noexcept
//Debug{} << ".. reset passability" << _coord;
bool has_holes = false;
+ auto& rtree = *_rtree;
{
- has_holes |= add_holes_from_chunk<false>(*_rtree, *this, {});
+ has_holes |= add_holes_from_chunk<false>(rtree, *this, {});
const auto nbs = _world->neighbors(_coord);
for (auto i = 0u; i < 8; i++)
if (nbs[i])
- has_holes |= add_holes_from_chunk<true>(*_rtree, *nbs[i], world::neighbor_offsets[i]);
+ has_holes |= add_holes_from_chunk<true>(rtree, *nbs[i], world::neighbor_offsets[i]);
}
for (auto i = 0u; i < TILE_COUNT; i++)
@@ -156,7 +157,7 @@ void chunk::ensure_passability() noexcept
if (pass == pass_mode::pass) [[likely]]
continue;
auto id = make_id(collision_type::geometry, pass, i+1);
- filter_through_holes(*_rtree, id, min, max, has_holes);
+ filter_through_holes(rtree, id, min, max, has_holes);
}
}
for (auto i = 0u; i < TILE_COUNT; i++)
@@ -166,19 +167,19 @@ void chunk::ensure_passability() noexcept
{
auto [min, max] = wall_north(i, (float)atlas->info().depth);
auto id = make_id(collision_type::geometry, atlas->info().passability, TILE_COUNT+i+1);
- filter_through_holes(*_rtree, id, min, max, has_holes);
+ filter_through_holes(rtree, id, min, max, has_holes);
if (tile.wall_west_atlas())
{
auto [min, max] = wall_pillar(i, (float)atlas->info().depth);
- filter_through_holes(*_rtree, id, min, max, has_holes);
+ filter_through_holes(rtree, id, min, max, has_holes);
}
}
if (const auto* atlas = tile.wall_west_atlas().get())
{
auto [min, max] = wall_west(i, (float)atlas->info().depth);
auto id = make_id(collision_type::geometry, atlas->info().passability, TILE_COUNT*2+i+1);
- filter_through_holes(*_rtree, id, min, max, has_holes);
+ filter_through_holes(rtree, id, min, max, has_holes);
}
}
for (const bptr<object>& eʹ : objects())
@@ -189,7 +190,7 @@ void chunk::ensure_passability() noexcept
if (_bbox_for_scenery(*eʹ, bb))
{
if (!eʹ->is_dynamic())
- filter_through_holes(*_rtree, std::bit_cast<object_id>(bb.data), Vector2(bb.start), Vector2(bb.end), has_holes);
+ filter_through_holes(rtree, std::bit_cast<object_id>(bb.data), Vector2(bb.start), Vector2(bb.end), has_holes);
else
_add_bbox_dynamic(bb);
}