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 /drivers/gles2/rasterizer_gles2.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 'drivers/gles2/rasterizer_gles2.cpp')
-rw-r--r-- | drivers/gles2/rasterizer_gles2.cpp | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/drivers/gles2/rasterizer_gles2.cpp b/drivers/gles2/rasterizer_gles2.cpp index ab48e682d6..5bf52733ba 100644 --- a/drivers/gles2/rasterizer_gles2.cpp +++ b/drivers/gles2/rasterizer_gles2.cpp @@ -227,21 +227,14 @@ void RasterizerGLES2::initialize() { scene->initialize(); } -void RasterizerGLES2::begin_frame() { - uint64_t tick = OS::get_singleton()->get_ticks_usec(); +void RasterizerGLES2::begin_frame(double frame_step) { + time_total += frame_step; - double delta = double(tick - prev_ticks) / 1000000.0; - delta *= Engine::get_singleton()->get_time_scale(); - - time_total += delta; - - if (delta == 0) { + if (frame_step == 0) { //to avoid hiccups - delta = 0.001; + frame_step = 0.001; } - prev_ticks = tick; - // double time_roll_over = GLOBAL_GET("rendering/limits/time/time_rollover_secs"); // if (time_total > time_roll_over) // time_total = 0; //roll over every day (should be customz @@ -251,9 +244,7 @@ void RasterizerGLES2::begin_frame() { storage->frame.time[2] = Math::fmod(time_total, 900); storage->frame.time[3] = Math::fmod(time_total, 60); storage->frame.count++; - storage->frame.delta = delta; - - storage->frame.prev_tick = tick; + storage->frame.delta = frame_step; storage->update_dirty_resources(); @@ -452,7 +443,6 @@ RasterizerGLES2::RasterizerGLES2() { scene->storage = storage; storage->scene = scene; - prev_ticks = 0; time_total = 0; } |