1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-23 15:16:17 +00:00

Physics interpolation - Move out of Scenario

Move VisualServer interpolation data out of Scenario and into VisualServerScene, so the interpolation data and enabled status is now common to all Scenarios.

Fix physics interpolation in multithreaded mode by ensuring tick and pre-draw are called.
This commit is contained in:
lawnjelly
2022-04-04 15:18:44 +01:00
parent 33500a1529
commit d2b1d29634
9 changed files with 155 additions and 229 deletions

View File

@@ -507,13 +507,7 @@ void SceneTree::set_physics_interpolation_enabled(bool p_enabled) {
}
_physics_interpolation_enabled = p_enabled;
if (root->get_world().is_valid()) {
RID scenario = root->get_world()->get_scenario();
if (scenario.is_valid()) {
VisualServer::get_singleton()->scenario_set_physics_interpolation_enabled(scenario, p_enabled);
}
}
VisualServer::get_singleton()->set_physics_interpolation_enabled(p_enabled);
}
bool SceneTree::is_physics_interpolation_enabled() const {
@@ -535,11 +529,8 @@ bool SceneTree::iteration(float p_time) {
current_frame++;
if (root->get_world().is_valid()) {
RID scenario = root->get_world()->get_scenario();
if (scenario.is_valid()) {
VisualServer::get_singleton()->scenario_tick(scenario);
}
if (_physics_interpolation_enabled) {
VisualServer::get_singleton()->tick();
}
// Any objects performing client physics interpolation
@@ -686,11 +677,8 @@ bool SceneTree::idle(float p_time) {
#endif
if (root->get_world().is_valid()) {
RID scenario = root->get_world()->get_scenario();
if (scenario.is_valid()) {
VisualServer::get_singleton()->scenario_pre_draw(scenario, true);
}
if (_physics_interpolation_enabled) {
VisualServer::get_singleton()->pre_draw(true);
}
return _quit;