diff options
author | Ricardo Buring <ricardo.buring@gmail.com> | 2024-05-26 19:39:28 +0200 |
---|---|---|
committer | Ricardo Buring <ricardo.buring@gmail.com> | 2024-07-07 22:15:23 +0200 |
commit | 2f8ab4a6540e65fa4097d1f58988eb03cb81ad65 (patch) | |
tree | 863471888f7bd0832d9d57931cd3885d4b739504 /main | |
parent | 42e5b3ac2da07d2105c775977b39e6949c723ded (diff) | |
download | redot-engine-2f8ab4a6540e65fa4097d1f58988eb03cb81ad65.tar.gz |
Fixed Timestep Interpolation (3D)
Adds 3D fixed timestep interpolation to the rendering server.
This does not yet include support for multimeshes or particles.
Co-authored-by: lawnjelly <lawnjelly@gmail.com>
Diffstat (limited to 'main')
-rw-r--r-- | main/main.cpp | 14 | ||||
-rw-r--r-- | main/main_timer_sync.cpp | 11 |
2 files changed, 9 insertions, 16 deletions
diff --git a/main/main.cpp b/main/main.cpp index 060b3fe2f6..7d17ec8ab8 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -2380,6 +2380,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph GLOBAL_DEF("debug/settings/stdout/print_fps", false); GLOBAL_DEF("debug/settings/stdout/print_gpu_profile", false); GLOBAL_DEF("debug/settings/stdout/verbose_stdout", false); + GLOBAL_DEF("debug/settings/physics_interpolation/enable_warnings", true); if (!OS::get_singleton()->_verbose_stdout) { // Not manually overridden. OS::get_singleton()->_verbose_stdout = GLOBAL_GET("debug/settings/stdout/verbose_stdout"); @@ -4047,16 +4048,16 @@ bool Main::iteration() { uint64_t physics_begin = OS::get_singleton()->get_ticks_usec(); -#ifndef _3D_DISABLED - PhysicsServer3D::get_singleton()->sync(); - PhysicsServer3D::get_singleton()->flush_queries(); -#endif // _3D_DISABLED - // Prepare the fixed timestep interpolated nodes BEFORE they are updated // by the physics server, otherwise the current and previous transforms // may be the same, and no interpolation takes place. OS::get_singleton()->get_main_loop()->iteration_prepare(); +#ifndef _3D_DISABLED + PhysicsServer3D::get_singleton()->sync(); + PhysicsServer3D::get_singleton()->flush_queries(); +#endif // _3D_DISABLED + PhysicsServer2D::get_singleton()->sync(); PhysicsServer2D::get_singleton()->flush_queries(); @@ -4066,6 +4067,7 @@ bool Main::iteration() { #endif // _3D_DISABLED PhysicsServer2D::get_singleton()->end_sync(); + Engine::get_singleton()->_in_physics = false; exit = true; break; } @@ -4089,6 +4091,8 @@ bool Main::iteration() { message_queue->flush(); + OS::get_singleton()->get_main_loop()->iteration_end(); + physics_process_ticks = MAX(physics_process_ticks, OS::get_singleton()->get_ticks_usec() - physics_begin); // keep the largest one for reference physics_process_max = MAX(OS::get_singleton()->get_ticks_usec() - physics_begin, physics_process_max); diff --git a/main/main_timer_sync.cpp b/main/main_timer_sync.cpp index d358d9fa93..569930d427 100644 --- a/main/main_timer_sync.cpp +++ b/main/main_timer_sync.cpp @@ -299,17 +299,6 @@ int64_t MainTimerSync::DeltaSmoother::smooth_delta(int64_t p_delta) { // before advance_core considers changing the physics_steps return from // the typical values as defined by typical_physics_steps double MainTimerSync::get_physics_jitter_fix() { - // Turn off jitter fix when using fixed timestep interpolation. - // Note this shouldn't be on UNTIL 3d interpolation is implemented, - // otherwise we will get people making 3d games with the physics_interpolation - // set to on getting jitter fix disabled unexpectedly. -#if 0 - if (Engine::get_singleton()->is_physics_interpolation_enabled()) { - // Would be better to write a simple bypass for jitter fix but this will do to get started. - return 0.0; - } -#endif - return Engine::get_singleton()->get_physics_jitter_fix(); } |