-Made visual server time affected by global time scale, closes #5583

-Restored time rollover in visual server
This commit is contained in:
Juan Linietsky 2017-08-08 08:25:35 -03:00
parent de219e5cbe
commit 78177483b5
2 changed files with 17 additions and 1 deletions

View file

@ -197,7 +197,16 @@ void RasterizerGLES3::begin_frame() {
uint64_t tick = OS::get_singleton()->get_ticks_usec();
double time_total = double(tick) / 1000000.0;
double delta = double(tick - prev_ticks) / 1000000.0;
delta *= Engine::get_singleton()->get_time_scale();
time_total += delta;
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
storage->frame.time[0] = time_total;
storage->frame.time[1] = Math::fmod(time_total, 3600);
@ -408,6 +417,7 @@ void RasterizerGLES3::register_config() {
GLOBAL_DEF("rendering/quality/filters/use_nearest_mipmap_filter", false);
GLOBAL_DEF("rendering/quality/filters/anisotropic_filter_level", 4.0);
GLOBAL_DEF("rendering/limits/time/time_rollover_secs", 3600);
}
RasterizerGLES3::RasterizerGLES3() {
@ -420,6 +430,9 @@ RasterizerGLES3::RasterizerGLES3() {
storage->canvas = canvas;
scene->storage = storage;
storage->scene = scene;
prev_ticks = 0;
time_total = 0;
}
RasterizerGLES3::~RasterizerGLES3() {

View file

@ -43,6 +43,9 @@ class RasterizerGLES3 : public Rasterizer {
RasterizerCanvasGLES3 *canvas;
RasterizerSceneGLES3 *scene;
uint64_t prev_ticks;
double time_total;
public:
virtual RasterizerStorage *get_storage();
virtual RasterizerCanvas *get_canvas();