mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 08:23:51 +00:00
LoadingScreen update
This commit is contained in:
parent
af7cbb2e3b
commit
52a4456cf7
2 changed files with 16 additions and 10 deletions
|
@ -30,6 +30,7 @@ namespace MWGui
|
||||||
: WindowBase("openmw_loading_screen.layout")
|
: WindowBase("openmw_loading_screen.layout")
|
||||||
, mVFS(vfs)
|
, mVFS(vfs)
|
||||||
, mViewer(viewer)
|
, mViewer(viewer)
|
||||||
|
, mTargetFrameRate(120.0)
|
||||||
, mLastWallpaperChangeTime(0.0)
|
, mLastWallpaperChangeTime(0.0)
|
||||||
, mLastRenderTime(0.0)
|
, mLastRenderTime(0.0)
|
||||||
, mLoadingOnTime(0.0)
|
, mLoadingOnTime(0.0)
|
||||||
|
@ -52,6 +53,10 @@ namespace MWGui
|
||||||
findSplashScreens();
|
findSplashScreens();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LoadingScreen::~LoadingScreen()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void LoadingScreen::findSplashScreens()
|
void LoadingScreen::findSplashScreens()
|
||||||
{
|
{
|
||||||
const std::map<std::string, VFS::File*>& index = mVFS->getIndex();
|
const std::map<std::string, VFS::File*>& index = mVFS->getIndex();
|
||||||
|
@ -86,10 +91,6 @@ namespace MWGui
|
||||||
mLoadingBox->setPosition(mMainWidget->getWidth()/2 - mLoadingBox->getWidth()/2, mLoadingBox->getTop());
|
mLoadingBox->setPosition(mMainWidget->getWidth()/2 - mLoadingBox->getWidth()/2, mLoadingBox->getTop());
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadingScreen::~LoadingScreen()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void LoadingScreen::setVisible(bool visible)
|
void LoadingScreen::setVisible(bool visible)
|
||||||
{
|
{
|
||||||
WindowBase::setVisible(visible);
|
WindowBase::setVisible(visible);
|
||||||
|
@ -105,9 +106,8 @@ namespace MWGui
|
||||||
|
|
||||||
if (mViewer->getIncrementalCompileOperation())
|
if (mViewer->getIncrementalCompileOperation())
|
||||||
{
|
{
|
||||||
mViewer->getIncrementalCompileOperation()->setMaximumNumOfObjectsToCompilePerFrame(200);
|
mViewer->getIncrementalCompileOperation()->setMaximumNumOfObjectsToCompilePerFrame(100);
|
||||||
// keep this in sync with loadingScreenFps
|
mViewer->getIncrementalCompileOperation()->setTargetFrameRate(mTargetFrameRate);
|
||||||
mViewer->getIncrementalCompileOperation()->setTargetFrameRate(1.0/120.0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool showWallpaper = (MWBase::Environment::get().getStateManager()->getState()
|
bool showWallpaper = (MWBase::Environment::get().getStateManager()->getState()
|
||||||
|
@ -212,9 +212,7 @@ namespace MWGui
|
||||||
|
|
||||||
void LoadingScreen::draw()
|
void LoadingScreen::draw()
|
||||||
{
|
{
|
||||||
const float loadingScreenFps = 120.f;
|
if (mTimer.time_m() > mLastRenderTime + (1.0/mTargetFrameRate) * 1000.0)
|
||||||
|
|
||||||
if (mTimer.time_m() > mLastRenderTime + (1.f/loadingScreenFps) * 1000.f)
|
|
||||||
{
|
{
|
||||||
bool showWallpaper = (MWBase::Environment::get().getStateManager()->getState()
|
bool showWallpaper = (MWBase::Environment::get().getStateManager()->getState()
|
||||||
== MWBase::StateManager::State_NoGame);
|
== MWBase::StateManager::State_NoGame);
|
||||||
|
@ -233,7 +231,12 @@ namespace MWGui
|
||||||
|
|
||||||
MWBase::Environment::get().getInputManager()->update(0, true, true);
|
MWBase::Environment::get().getInputManager()->update(0, true, true);
|
||||||
|
|
||||||
|
//osg::Timer timer;
|
||||||
mViewer->frame();
|
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
|
// resume 3d rendering
|
||||||
mViewer->getUpdateVisitor()->setTraversalMask(oldUpdateMask);
|
mViewer->getUpdateVisitor()->setTraversalMask(oldUpdateMask);
|
||||||
|
@ -242,4 +245,5 @@ namespace MWGui
|
||||||
mLastRenderTime = mTimer.time_m();
|
mLastRenderTime = mTimer.time_m();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,8 @@ namespace MWGui
|
||||||
const VFS::Manager* mVFS;
|
const VFS::Manager* mVFS;
|
||||||
osg::ref_ptr<osgViewer::Viewer> mViewer;
|
osg::ref_ptr<osgViewer::Viewer> mViewer;
|
||||||
|
|
||||||
|
double mTargetFrameRate;
|
||||||
|
|
||||||
double mLastWallpaperChangeTime;
|
double mLastWallpaperChangeTime;
|
||||||
double mLastRenderTime;
|
double mLastRenderTime;
|
||||||
osg::Timer mTimer;
|
osg::Timer mTimer;
|
||||||
|
|
Loading…
Reference in a new issue