diff --git a/framework/organizer_scene/src/mm/services/organizer_scene.cpp b/framework/organizer_scene/src/mm/services/organizer_scene.cpp index 9741109..696a3aa 100644 --- a/framework/organizer_scene/src/mm/services/organizer_scene.cpp +++ b/framework/organizer_scene/src/mm/services/organizer_scene.cpp @@ -68,19 +68,17 @@ void OrganizerSceneService::sceneFixedUpdate(Engine&) { ZoneScoped; auto newNow = clock::now(); - auto deltaTime = std::chrono::duration_cast(newNow - _last_time); + std::chrono::duration> deltaTime = newNow - _last_time; _last_time = newNow; _accumulator += deltaTime.count(); - const double dt = f_delta * 1'000'000'000.0; size_t continuous_counter = 0; auto& time_ctx = _scene->ctx_or_set(f_delta, initial_delta_factor); time_ctx.tickDelta = f_delta * time_ctx.deltaFactor; - // TODO: this while is just cancer - while (_accumulator >= static_cast(dt)){ - _accumulator -= static_cast(dt); + while (_accumulator >= f_delta){ + _accumulator -= f_delta; continuous_counter++; for (auto&& v : _scene->ctx>()) { @@ -133,7 +131,7 @@ void OrganizerSceneService::updateOrganizerVertices(Scene& scene) { void OrganizerSceneService::resetTime(void) { _last_time = clock::now(); - _accumulator = 0; + _accumulator = 0.0; } } // MM::Services diff --git a/framework/organizer_scene/src/mm/services/organizer_scene.hpp b/framework/organizer_scene/src/mm/services/organizer_scene.hpp index dc5e27d..e7cadd1 100644 --- a/framework/organizer_scene/src/mm/services/organizer_scene.hpp +++ b/framework/organizer_scene/src/mm/services/organizer_scene.hpp @@ -14,7 +14,7 @@ namespace MM::Services { std::unique_ptr _next_scene; // enqueued next scene using clock = std::chrono::high_resolution_clock; - long long int _accumulator = 0; + double _accumulator = 0.0; std::chrono::time_point _last_time; public: