1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-18 14:21:41 +00:00

Dynamic BVH for rendering and godot physics

Complete rewrite of spatial partitioning using a bounding volume hierarchy rather than octree.

Switchable in project settings between using octree or BVH for rendering and physics.
This commit is contained in:
lawnjelly
2020-10-21 13:13:20 +01:00
parent 0a8cc0a565
commit 690e07b509
23 changed files with 3647 additions and 38 deletions

View File

@@ -31,8 +31,10 @@
#include "physics_server_sw.h"
#include "broad_phase_basic.h"
#include "broad_phase_bvh.h"
#include "broad_phase_octree.h"
#include "core/os/os.h"
#include "core/project_settings.h"
#include "core/script_language.h"
#include "joints/cone_twist_joint_sw.h"
#include "joints/generic_6dof_joint_sw.h"
@@ -1565,7 +1567,15 @@ void PhysicsServerSW::_shape_col_cbk(const Vector3 &p_point_A, const Vector3 &p_
PhysicsServerSW *PhysicsServerSW::singleton = NULL;
PhysicsServerSW::PhysicsServerSW() {
singleton = this;
BroadPhaseSW::create_func = BroadPhaseOctree::_create;
bool use_bvh_or_octree = GLOBAL_GET("physics/3d/godot_physics/use_bvh");
if (use_bvh_or_octree) {
BroadPhaseSW::create_func = BroadPhaseBVH::_create;
} else {
BroadPhaseSW::create_func = BroadPhaseOctree::_create;
}
island_count = 0;
active_objects = 0;
collision_pairs = 0;