From 8561e450c1edf54eb5879122275f3dc21effea39 Mon Sep 17 00:00:00 2001 From: turanszkij Date: Fri, 19 Apr 2019 11:01:33 +0100 Subject: [PATCH] fixes --- WickedEngine/MainComponent.cpp | 17 ++++++----------- WickedEngine/wiProfiler.cpp | 3 +-- WickedEngine/wiVersion.cpp | 2 +- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/WickedEngine/MainComponent.cpp b/WickedEngine/MainComponent.cpp index dffad1157..59ed2f768 100644 --- a/WickedEngine/MainComponent.cpp +++ b/WickedEngine/MainComponent.cpp @@ -123,28 +123,23 @@ void MainComponent::Run() wiProfiler::BeginFrame(); wiProfiler::BeginRange("CPU Frame", wiProfiler::DOMAIN_CPU); - if (framerate_lock) - { - deltaTime = 1.0f / targetFrameRate; - } - else - { - deltaTime = float(max(0, timer.elapsed() / 1000.0)); - } + deltaTime = float(max(0, timer.elapsed() / 1000.0)); timer.record(); if (wiWindowRegistration::IsWindowActive()) { // If the application is active, run Update loops: - fadeManager.Update(deltaTime); + const float dt = framerate_lock ? (1.0f / targetFrameRate) : deltaTime; + + fadeManager.Update(dt); // Fixed time update: wiProfiler::BeginRange("Fixed Update", wiProfiler::DOMAIN_CPU); { if (frameskip) { - deltaTimeAccumulator += deltaTime; + deltaTimeAccumulator += dt; if (deltaTimeAccumulator > 10) { // application probably lost control, fixed update would be take long @@ -167,7 +162,7 @@ void MainComponent::Run() // Variable-timed update: wiProfiler::BeginRange("Update", wiProfiler::DOMAIN_CPU); - Update(deltaTime); + Update(dt); wiProfiler::EndRange(); // Update wiInputManager::Update(); diff --git a/WickedEngine/wiProfiler.cpp b/WickedEngine/wiProfiler.cpp index ae9383458..fa3708f44 100644 --- a/WickedEngine/wiProfiler.cpp +++ b/WickedEngine/wiProfiler.cpp @@ -154,10 +154,9 @@ namespace wiProfiler } void EndRange(GRAPHICSTHREAD threadID) { - if (!ENABLED || !initialized) + if (!ENABLED || !initialized || rangeStack.empty()) return; - assert(!rangeStack.empty() && "There is no range to end!"); const std::string& top = rangeStack.top(); auto& it = ranges.find(top); diff --git a/WickedEngine/wiVersion.cpp b/WickedEngine/wiVersion.cpp index 17ebbf58b..8ad290b18 100644 --- a/WickedEngine/wiVersion.cpp +++ b/WickedEngine/wiVersion.cpp @@ -9,7 +9,7 @@ namespace wiVersion // minor features, major updates const int minor = 26; // minor bug fixes, alterations, refactors, updates - const int revision = 11; + const int revision = 12; long GetVersion()