Fix the frameNumber not being incremented in certain frames

openmw-37
scrawl 9 years ago
parent 0210b87ffc
commit 6e69808129

@ -282,7 +282,13 @@ namespace MWGui
MWBase::Environment::get().getInputManager()->update(0, true, true);
//osg::Timer timer;
mViewer->frame(mViewer->getFrameStamp()->getSimulationTime());
// at the time this function is called we are in the middle of a frame,
// so out of order calls are necessary to get a correct frameNumber for the next frame.
// refer to the advance() and frame() order in Engine::go()
mViewer->eventTraversal();
mViewer->updateTraversal();
mViewer->renderingTraversals();
mViewer->advance(mViewer->getFrameStamp()->getSimulationTime());
//std::cout << "frame took " << timer.time_m() << std::endl;
//if (mViewer->getIncrementalCompileOperation())

@ -859,7 +859,13 @@ namespace MWGui
mMessageBoxManager->onFrame(0.f);
MWBase::Environment::get().getInputManager()->update(0, true, false);
mViewer->frame(mViewer->getFrameStamp()->getSimulationTime());
// at the time this function is called we are in the middle of a frame,
// so out of order calls are necessary to get a correct frameNumber for the next frame.
// refer to the advance() and frame() order in Engine::go()
mViewer->eventTraversal();
mViewer->updateTraversal();
mViewer->renderingTraversals();
mViewer->advance(mViewer->getFrameStamp()->getSimulationTime());
}
}
}
@ -1756,7 +1762,13 @@ namespace MWGui
{
MWBase::Environment::get().getInputManager()->update(0, true, false);
mViewer->frame(mViewer->getFrameStamp()->getSimulationTime());
// at the time this function is called we are in the middle of a frame,
// so out of order calls are necessary to get a correct frameNumber for the next frame.
// refer to the advance() and frame() order in Engine::go()
mViewer->eventTraversal();
mViewer->updateTraversal();
mViewer->renderingTraversals();
mViewer->advance(mViewer->getFrameStamp()->getSimulationTime());
}
mVideoWidget->stop();

@ -521,10 +521,18 @@ namespace MWRender
osg::ref_ptr<NotifyDrawCompletedCallback> callback (new NotifyDrawCompletedCallback);
rttCamera->setFinalDrawCallback(callback);
mViewer->frame(mViewer->getFrameStamp()->getSimulationTime());
// at the time this function is called we are in the middle of a frame,
// so out of order calls are necessary to get a correct frameNumber for the next frame.
// refer to the advance() and frame() order in Engine::go()
mViewer->eventTraversal();
mViewer->updateTraversal();
mViewer->renderingTraversals();
callback->waitTillDone();
// now that we've "used up" the current frame, get a fresh framenumber for the next frame() following after the screenshot is completed
mViewer->advance(mViewer->getFrameStamp()->getSimulationTime());
rttCamera->removeChildren(0, rttCamera->getNumChildren());
rttCamera->setGraphicsContext(NULL);
mRootNode->removeChild(rttCamera);

Loading…
Cancel
Save