diff --git a/apps/openmw/mwgui/loadingscreen.cpp b/apps/openmw/mwgui/loadingscreen.cpp index d56c77bdd..cdb2d6bdf 100644 --- a/apps/openmw/mwgui/loadingscreen.cpp +++ b/apps/openmw/mwgui/loadingscreen.cpp @@ -30,6 +30,7 @@ namespace MWGui : WindowBase("openmw_loading_screen.layout") , mVFS(vfs) , mViewer(viewer) + , mTargetFrameRate(120.0) , mLastWallpaperChangeTime(0.0) , mLastRenderTime(0.0) , mLoadingOnTime(0.0) @@ -52,6 +53,10 @@ namespace MWGui findSplashScreens(); } + LoadingScreen::~LoadingScreen() + { + } + void LoadingScreen::findSplashScreens() { const std::map& index = mVFS->getIndex(); @@ -86,10 +91,6 @@ namespace MWGui mLoadingBox->setPosition(mMainWidget->getWidth()/2 - mLoadingBox->getWidth()/2, mLoadingBox->getTop()); } - LoadingScreen::~LoadingScreen() - { - } - void LoadingScreen::setVisible(bool visible) { WindowBase::setVisible(visible); @@ -105,9 +106,8 @@ namespace MWGui if (mViewer->getIncrementalCompileOperation()) { - mViewer->getIncrementalCompileOperation()->setMaximumNumOfObjectsToCompilePerFrame(200); - // keep this in sync with loadingScreenFps - mViewer->getIncrementalCompileOperation()->setTargetFrameRate(1.0/120.0); + mViewer->getIncrementalCompileOperation()->setMaximumNumOfObjectsToCompilePerFrame(100); + mViewer->getIncrementalCompileOperation()->setTargetFrameRate(mTargetFrameRate); } bool showWallpaper = (MWBase::Environment::get().getStateManager()->getState() @@ -212,9 +212,7 @@ namespace MWGui void LoadingScreen::draw() { - const float loadingScreenFps = 120.f; - - if (mTimer.time_m() > mLastRenderTime + (1.f/loadingScreenFps) * 1000.f) + if (mTimer.time_m() > mLastRenderTime + (1.0/mTargetFrameRate) * 1000.0) { bool showWallpaper = (MWBase::Environment::get().getStateManager()->getState() == MWBase::StateManager::State_NoGame); @@ -233,7 +231,12 @@ namespace MWGui MWBase::Environment::get().getInputManager()->update(0, true, true); + //osg::Timer timer; mViewer->frame(); + //std::cout << "frame took " << timer.time_m() << std::endl; + + //if (mViewer->getIncrementalCompileOperation()) + //std::cout << "num to compile " << mViewer->getIncrementalCompileOperation()->getToCompile().size() << std::endl; // resume 3d rendering mViewer->getUpdateVisitor()->setTraversalMask(oldUpdateMask); @@ -242,4 +245,5 @@ namespace MWGui mLastRenderTime = mTimer.time_m(); } } + } diff --git a/apps/openmw/mwgui/loadingscreen.hpp b/apps/openmw/mwgui/loadingscreen.hpp index 7c49df027..a1e6e4d21 100644 --- a/apps/openmw/mwgui/loadingscreen.hpp +++ b/apps/openmw/mwgui/loadingscreen.hpp @@ -50,6 +50,8 @@ namespace MWGui const VFS::Manager* mVFS; osg::ref_ptr mViewer; + double mTargetFrameRate; + double mLastWallpaperChangeTime; double mLastRenderTime; osg::Timer mTimer;