Apply the frame time cap to Ogre's ControllerManager (Fixes #2154)

This fixes particle systems getting out of whack due to a particularly long frame time, e.g. after a loading screen.
loadfix
scrawl 10 years ago
parent ada4e37556
commit d36dfbe779

@ -79,8 +79,7 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
{ {
try try
{ {
float frametime = std::min(evt.timeSinceLastFrame, 0.2f); float frametime = evt.timeSinceLastFrame;
mEnvironment.setFrameDuration (frametime); mEnvironment.setFrameDuration (frametime);
// update input // update input
@ -478,9 +477,15 @@ void OMW::Engine::go()
} }
// Start the main rendering loop // Start the main rendering loop
Ogre::Timer timer;
while (!MWBase::Environment::get().getStateManager()->hasQuitRequest()) while (!MWBase::Environment::get().getStateManager()->hasQuitRequest())
Ogre::Root::getSingleton().renderOneFrame(); {
float dt = timer.getMilliseconds()/1000.f;
dt = std::min(dt, 0.2f);
timer.reset();
Ogre::Root::getSingleton().renderOneFrame(dt);
}
// Save user settings // Save user settings
settings.saveUser(settingspath); settings.saveUser(settingspath);

Loading…
Cancel
Save