1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-30 07:21:12 +00:00

Decouple rendering simulation time from Lua simulation time (bug 7576)

This commit is contained in:
Andrei Kortunov 2023-09-26 14:39:38 +04:00
parent 0e4a599656
commit 442c032373
2 changed files with 10 additions and 2 deletions

View File

@ -945,7 +945,7 @@ void OMW::Engine::go()
.count() .count()
* timeManager.getSimulationTimeScale(); * timeManager.getSimulationTimeScale();
mViewer->advance(timeManager.getSimulationTime()); mViewer->advance(timeManager.getRenderingSimulationTime());
if (!frame(dt)) if (!frame(dt))
{ {
@ -954,7 +954,10 @@ void OMW::Engine::go()
} }
timeManager.updateIsPaused(); timeManager.updateIsPaused();
if (!timeManager.isPaused()) if (!timeManager.isPaused())
{
timeManager.setSimulationTime(timeManager.getSimulationTime() + dt); timeManager.setSimulationTime(timeManager.getSimulationTime() + dt);
timeManager.setRenderingSimulationTime(timeManager.getRenderingSimulationTime() + dt);
}
if (stats) if (stats)
{ {

View File

@ -29,7 +29,11 @@ namespace MWWorld
float getGameTimeScale() const { return mGameTimeScale; } float getGameTimeScale() const { return mGameTimeScale; }
void setGameTimeScale(float scale); // game time to simulation time ratio void setGameTimeScale(float scale); // game time to simulation time ratio
// Simulation time (the number of seconds passed from the beginning of the game). // Rendering simulation time (summary simulation time of rendering frames since application start).
double getRenderingSimulationTime() const { return mRenderingSimulationTime; }
void setRenderingSimulationTime(double t) { mRenderingSimulationTime = t; }
// World simulation time (the number of seconds passed from the beginning of the game).
double getSimulationTime() const { return mSimulationTime; } double getSimulationTime() const { return mSimulationTime; }
void setSimulationTime(double t) { mSimulationTime = t; } void setSimulationTime(double t) { mSimulationTime = t; }
float getSimulationTimeScale() const { return mSimulationTimeScale; } float getSimulationTimeScale() const { return mSimulationTimeScale; }
@ -64,6 +68,7 @@ namespace MWWorld
float mGameHour = 0.f; float mGameHour = 0.f;
float mGameTimeScale = 0.f; float mGameTimeScale = 0.f;
float mSimulationTimeScale = 1.0; float mSimulationTimeScale = 1.0;
double mRenderingSimulationTime = 0.0;
double mSimulationTime = 0.0; double mSimulationTime = 0.0;
bool mPaused = false; bool mPaused = false;
std::set<std::string, std::less<>> mPausedTags; std::set<std::string, std::less<>> mPausedTags;