Merge pull request #45335 from lawnjelly/bvh_revert_update

Partially revert change to BVH render tree update method
This commit is contained in:
Rémi Verschelde 2021-01-20 21:07:21 +01:00 committed by GitHub
commit c97837d0ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 1 additions and 26 deletions

View file

@ -104,7 +104,6 @@ void VisualServerRaster::draw(bool p_swap_buffers, double frame_step) {
VSG::rasterizer->begin_frame(frame_step);
VSG::scene->update_dirty_instances(); //update scene stuff
VSG::scene->update_scenarios(); // render tree collision detection (pairing)
VSG::viewport->draw_viewports();
VSG::scene->render_probes();

View file

@ -3578,47 +3578,24 @@ void VisualServerScene::_update_dirty_instance(Instance *p_instance) {
p_instance->update_materials = false;
}
void VisualServerScene::update_scenarios() {
// go through all scenarios and update BVH in each
if (!_use_bvh) {
return;
}
List<RID> owned;
scenario_owner.get_owned_list(&owned);
for (List<RID>::Element *E = owned.front(); E; E = E->next()) {
RID rid = E->get();
Scenario *scenario = scenario_owner.get(rid);
scenario->sps->update();
}
}
void VisualServerScene::update_dirty_instances() {
VSG::storage->update_dirty_resources();
// only define this if you run into problems with missed pairing collisions for debugging
//#define GODOT_RENDER_SPS_EXTRA_COLLISION_CHECKS
#ifdef GODOT_RENDER_SPS_EXTRA_COLLISION_CHECKS
// this is just to get access to scenario so we can update the spatial partitioning scheme
Scenario *scenario = nullptr;
if (_instance_update_list.first()) {
scenario = _instance_update_list.first()->self()->scenario;
}
#endif
while (_instance_update_list.first()) {
_update_dirty_instance(_instance_update_list.first()->self());
}
#ifdef GODOT_RENDER_SPS_EXTRA_COLLISION_CHECKS
if (scenario) {
scenario->sps->update_collisions();
scenario->sps->update();
}
#endif
}
bool VisualServerScene::free(RID p_rid) {

View file

@ -554,7 +554,6 @@ public:
void render_camera(RID p_camera, RID p_scenario, Size2 p_viewport_size, RID p_shadow_atlas);
void render_camera(Ref<ARVRInterface> &p_interface, ARVRInterface::Eyes p_eye, RID p_camera, RID p_scenario, Size2 p_viewport_size, RID p_shadow_atlas);
void update_dirty_instances();
void update_scenarios();
//probes
struct GIProbeDataHeader {