diff options
author | Gustav Lund <glu@gamblify.com> | 2018-05-09 08:11:43 +0200 |
---|---|---|
committer | Gustav Lund <glu@gamblify.com> | 2018-06-05 16:33:02 +0200 |
commit | 35eb7f2d6a1f872435dad3a295dc8b93721086aa (patch) | |
tree | b84b9f1a2852af32ee9fb0981b5be73fae8f59a4 /main/main.cpp | |
parent | 6a69f92370ba82befdfdf3c2f798b6b2fd6df1fb (diff) |
Rasterizers are now in sync with engine
The rasterisers (both GLES3 and GLES2) were calculating their own frame delta time
This fix lets the rasterizers get the frame delta through the draw call
That way any regulations to the frame step from the main script will not cause particle systems to process at a different step than the rest of the Engine.
Remove unused rasterizer storage variable
frame.prev_tick variable were not used anywhere and has been removed
Diffstat (limited to 'main/main.cpp')
-rw-r--r-- | main/main.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/main/main.cpp b/main/main.cpp index 119d1ee345..dfedeba1b8 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1734,8 +1734,11 @@ bool Main::iteration() { int physics_fps = Engine::get_singleton()->get_iterations_per_second(); float frame_slice = 1.0 / physics_fps; + float time_scale = Engine::get_singleton()->get_time_scale(); + MainFrameTime advance = main_timer_sync.advance(frame_slice, physics_fps); double step = advance.idle_step; + double scaled_step = step * time_scale; Engine::get_singleton()->_frame_step = step; @@ -1757,8 +1760,6 @@ bool Main::iteration() { advance.physics_steps = max_physics_steps; } - float time_scale = Engine::get_singleton()->get_time_scale(); - bool exit = false; Engine::get_singleton()->_in_physics = true; @@ -1805,11 +1806,11 @@ bool Main::iteration() { if ((!force_redraw_requested) && OS::get_singleton()->is_in_low_processor_usage_mode()) { if (VisualServer::get_singleton()->has_changed()) { - VisualServer::get_singleton()->draw(); // flush visual commands + VisualServer::get_singleton()->draw(true, scaled_step); // flush visual commands Engine::get_singleton()->frames_drawn++; } } else { - VisualServer::get_singleton()->draw(); // flush visual commands + VisualServer::get_singleton()->draw(true, scaled_step); // flush visual commands Engine::get_singleton()->frames_drawn++; force_redraw_requested = false; } |