File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
src/vulkan-renderer/world Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -22,18 +22,17 @@ OctreeCollisionSolver::find_all_ray_octree_collisions(const std::vector<std::sha
2222 found_collisions.reserve (worlds.size ());
2323
2424 // We need a critical section because we are modifying m_collision_candidates.
25- std::scoped_lock lock (m_collision_solver_mutex);
2625 {
26+ std::scoped_lock lock (m_collision_solver_mutex);
27+
2728 // TODO: Optimize this! Avoid memory re-allocation if possible and benchmark it.
2829 m_collision_candidates.clear ();
2930 m_collision_candidates.reserve (worlds.size ());
3031
3132 for (const auto &world : worlds) {
32- if (! is_bounding_box_and_bounding_sphere_hit (world, position, direction)) {
33- continue ;
33+ if (is_bounding_box_and_bounding_sphere_hit (world, position, direction)) {
34+ m_collision_candidates. emplace_back ( std::make_pair (world, glm::distance2 (position, direction))) ;
3435 }
35-
36- m_collision_candidates.emplace_back (std::make_pair (world, glm::distance2 (position, direction)));
3736 }
3837
3938 // Sort the octree collision candidates by increasing square of distance between cube center and camera.
You can’t perform that action at this time.
0 commit comments