Improved collision system use of BVH

This commit is contained in:
Yousef Khadadeh 2025-07-21 16:54:48 +03:00
parent f74298d21d
commit f75a5133d5
5 changed files with 38 additions and 8 deletions

View file

@ -163,13 +163,7 @@ void DrawingProgram::parallel_loop_all_components(std::function<void(const std::
}
void DrawingProgram::check_all_collisions_base(const SCollision::ColliderCollection<WorldScalar>& checkAgainstWorld, const SCollision::ColliderCollection<float>& checkAgainstCam) {
for(auto& c : components.client_list())
c->obj->globalCollisionCheck = false;
compCache.traverse_bvh_run_function(checkAgainstWorld.bounds, [&](const std::shared_ptr<DrawingProgramCache::BVHNode>& node, const std::vector<CollabListType::ObjectInfoPtr>& comps) {
for(auto& c : comps)
c->obj->globalCollisionCheck = c->obj->collides_with(world.drawData.cam.c, checkAgainstWorld, checkAgainstCam, colliderAllocated);
return true;
});
compCache.traverse_bvh_collision_check(checkAgainstWorld, checkAgainstCam);
}
void DrawingProgram::check_all_collisions(const SCollision::ColliderCollection<WorldScalar>& checkAgainst) {