You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-26 15:46:23 +00:00
Eliminate collision checks between geometry in rendering BVH.
Later logic using the `pairable_mask` would catch cases preventing pairing callbacks between geometry. However the collision checks were still taking place, wasting performance. Here we utilize the `tree_mask` feature of BVH to totally eliminate unnecessary collision checks between geometry.
This commit is contained in:
@@ -184,8 +184,8 @@ VisualServerScene::SpatialPartitionID VisualServerScene::SpatialPartitioningScen
|
||||
p_userdata->bvh_pairable_mask = p_pairable_mask;
|
||||
p_userdata->bvh_pairable_type = p_pairable_type;
|
||||
|
||||
uint32_t tree_id = p_pairable ? 1 : 0;
|
||||
uint32_t tree_collision_mask = 3;
|
||||
uint32_t tree_collision_mask = 0;
|
||||
uint32_t tree_id = find_tree_id_and_collision_mask(p_pairable, tree_collision_mask);
|
||||
|
||||
return _bvh.create(p_userdata, p_userdata->visible, tree_id, tree_collision_mask, p_aabb, p_subindex) + 1;
|
||||
}
|
||||
@@ -227,8 +227,8 @@ void VisualServerScene::SpatialPartitioningScene_BVH::set_pairable(Instance *p_i
|
||||
p_instance->bvh_pairable_mask = p_pairable_mask;
|
||||
p_instance->bvh_pairable_type = p_pairable_type;
|
||||
|
||||
uint32_t tree_id = p_pairable ? 1 : 0;
|
||||
uint32_t tree_collision_mask = 3;
|
||||
uint32_t tree_collision_mask = 0;
|
||||
uint32_t tree_id = find_tree_id_and_collision_mask(p_pairable, tree_collision_mask);
|
||||
|
||||
_bvh.set_tree(handle - 1, tree_id, tree_collision_mask);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user