mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-20 22:23:52 +00:00
Fix the Viewer's FrameStamp not being set correctly during Engine::frame
This commit is contained in:
parent
f70250a296
commit
195e1a8410
2 changed files with 16 additions and 13 deletions
|
@ -82,7 +82,7 @@ void OMW::Engine::executeLocalScripts()
|
|||
localScripts.setIgnore (MWWorld::Ptr());
|
||||
}
|
||||
|
||||
double OMW::Engine::frame(float frametime)
|
||||
void OMW::Engine::frame(float frametime)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -101,17 +101,14 @@ double OMW::Engine::frame(float frametime)
|
|||
if (mUseSound)
|
||||
MWBase::Environment::get().getSoundManager()->update(frametime);
|
||||
|
||||
// GUI active? Most game processing will be paused, but scripts still run.
|
||||
bool guiActive = MWBase::Environment::get().getWindowManager()->isGuiMode();
|
||||
if (!guiActive)
|
||||
mSimulationTime += frametime;
|
||||
|
||||
// Main menu opened? Then scripts are also paused.
|
||||
bool paused = MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_MainMenu);
|
||||
|
||||
// update game state
|
||||
MWBase::Environment::get().getStateManager()->update (frametime);
|
||||
|
||||
bool guiActive = MWBase::Environment::get().getWindowManager()->isGuiMode();
|
||||
|
||||
osg::Timer_t beforeScriptTick = osg::Timer::instance()->tick();
|
||||
if (MWBase::Environment::get().getStateManager()->getState()==
|
||||
MWBase::StateManager::State_Running)
|
||||
|
@ -193,7 +190,6 @@ double OMW::Engine::frame(float frametime)
|
|||
{
|
||||
std::cerr << "Error in framelistener: " << e.what() << std::endl;
|
||||
}
|
||||
return mSimulationTime;
|
||||
}
|
||||
|
||||
OMW::Engine::Engine(Files::ConfigurationManager& configurationManager)
|
||||
|
@ -214,7 +210,6 @@ OMW::Engine::Engine(Files::ConfigurationManager& configurationManager)
|
|||
, mFSStrict (false)
|
||||
, mScriptBlacklistUse (true)
|
||||
, mNewGame (false)
|
||||
, mSimulationTime(0.0)
|
||||
, mCfgMgr(configurationManager)
|
||||
{
|
||||
Misc::Rng::init();
|
||||
|
@ -679,14 +674,24 @@ void OMW::Engine::go()
|
|||
|
||||
// Start the main rendering loop
|
||||
osg::Timer frameTimer;
|
||||
double simulationTime = 0.0;
|
||||
while (!mViewer->done() && !MWBase::Environment::get().getStateManager()->hasQuitRequest())
|
||||
{
|
||||
double dt = frameTimer.time_s();
|
||||
frameTimer.setStartTick();
|
||||
dt = std::min(dt, 0.2);
|
||||
|
||||
double simulationTime = frame(dt);
|
||||
mViewer->frame(simulationTime);
|
||||
bool guiActive = MWBase::Environment::get().getWindowManager()->isGuiMode();
|
||||
if (!guiActive)
|
||||
simulationTime += dt;
|
||||
|
||||
mViewer->advance(simulationTime);
|
||||
|
||||
frame(dt);
|
||||
|
||||
mViewer->eventTraversal();
|
||||
mViewer->updateTraversal();
|
||||
mViewer->renderingTraversals();
|
||||
}
|
||||
|
||||
// Save user settings
|
||||
|
|
|
@ -106,7 +106,6 @@ namespace OMW
|
|||
bool mNewGame;
|
||||
|
||||
osg::Timer_t mStartTick;
|
||||
double mSimulationTime;
|
||||
|
||||
// not implemented
|
||||
Engine (const Engine&);
|
||||
|
@ -114,8 +113,7 @@ namespace OMW
|
|||
|
||||
void executeLocalScripts();
|
||||
|
||||
/// @return The new simulationTime
|
||||
double frame (float dt);
|
||||
void frame (float dt);
|
||||
|
||||
/// Load settings from various files, returns the path to the user settings file
|
||||
std::string loadSettings (Settings::Manager & settings);
|
||||
|
|
Loading…
Reference in a new issue