diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-03 19:53:43 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-03 20:34:02 +0100 |
commit | 3836f0340841c47a846604328e0b0cd7c5244316 (patch) | |
tree | a62b2732065a0008474a26a6b640614d50cf29fb /src | |
parent | 3d7ae4c401d5bd6109a7fd25eb22e5bc77f0a4aa (diff) |
src: simplify bbox update check
Diffstat (limited to 'src')
-rw-r--r-- | src/chunk.inl | 3 | ||||
-rw-r--r-- | src/scenery.cpp | 9 | ||||
-rw-r--r-- | src/scenery.hpp | 1 |
3 files changed, 1 insertions, 12 deletions
diff --git a/src/chunk.inl b/src/chunk.inl index 6b01510a..23013099 100644 --- a/src/chunk.inl +++ b/src/chunk.inl @@ -21,8 +21,7 @@ void chunk::with_scenery_update(std::size_t idx, F&& fun) return; if (bbox bb; !is_passability_modified()) - if (bool b = _bbox_for_scenery(idx, bb); - b != b0 || scenery::is_collision_modified(s0, s)) + if (bool b = _bbox_for_scenery(idx, bb); b != b0 || bb != bb0) _replace_bbox(bb0, bb, b0, b); if (!is_scenery_modified() && scenery::is_mesh_modified(s0, s)) mark_scenery_modified(false); diff --git a/src/scenery.cpp b/src/scenery.cpp index 6b338635..e2ebdb49 100644 --- a/src/scenery.cpp +++ b/src/scenery.cpp @@ -152,15 +152,6 @@ bool scenery::is_mesh_modified(const scenery& s0, const scenery& s) return false; } -bool scenery::is_collision_modified(const scenery& s0, const scenery& s) -{ - // passability value is stored as object's id - // so don't optimize into (s.pass == pass) != (s0.pass == pass) - return s.r != s0.r || s.passability != s0.passability || - s.offset != s0.offset || - s.bbox_offset != s0.bbox_offset || s.bbox_size != s0.bbox_size; -} - #ifdef __GNUG__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wfloat-equal" diff --git a/src/scenery.hpp b/src/scenery.hpp index 439a83fc..9d9ad6e6 100644 --- a/src/scenery.hpp +++ b/src/scenery.hpp @@ -49,7 +49,6 @@ struct scenery final Vector2b offset, Vector2b bbox_offset, Vector2ub bbox_size); static bool is_mesh_modified(const scenery& s1, const scenery& s2); - static bool is_collision_modified(const scenery& s1, const scenery& s2); bool operator==(const scenery&) const noexcept; }; |