1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-04 10:45:34 +00:00

scene does not disappear anymore during load

This commit is contained in:
scrawl 2012-09-11 17:36:20 +02:00
parent 369db182de
commit d5a08e31e7
3 changed files with 20 additions and 4 deletions

View file

@ -29,15 +29,17 @@ namespace MWGui
if (!mLoadingOn) if (!mLoadingOn)
loadingOn(); loadingOn();
const int numRefLists = 20;
if (depth == 0) if (depth == 0)
{ {
mCurrentCellLoading = current; mCurrentCellLoading = current;
mTotalCellsLoading = total; mTotalCellsLoading = total;
mCurrentRefLoading = 0; mCurrentRefLoading = 0;
mCurrentRefList = 0;
} }
if (depth == 1) else if (depth == 1)
{ {
mCurrentRefLoading = current; mCurrentRefLoading = current;
mTotalRefsLoading = total; mTotalRefsLoading = total;
@ -54,7 +56,14 @@ namespace MWGui
refProgress = 1; refProgress = 1;
else else
refProgress = float(mCurrentRefLoading) / float(mTotalRefsLoading-1); refProgress = float(mCurrentRefLoading) / float(mTotalRefsLoading-1);
std::cout << refProgress << " (" << mCurrentRefLoading << ", " << mTotalRefsLoading-1 << std::endl; refProgress += mCurrentRefList;
refProgress /= numRefLists;
assert(refProgress <= 1 && refProgress >= 0);
if (depth == 1 && mCurrentRefLoading == mTotalRefsLoading-1)
++mCurrentRefList;
float progress = (float(mCurrentCellLoading)+refProgress) / float(mTotalCellsLoading); float progress = (float(mCurrentCellLoading)+refProgress) / float(mTotalCellsLoading);
assert(progress <= 1 && progress >= 0); assert(progress <= 1 && progress >= 0);
if (progress >= 1) if (progress >= 1)
@ -78,7 +87,7 @@ std::cout << refProgress << " (" << mCurrentRefLoading << ", " << mTotalRefsLoa
// SCRQM_INCLUDE with RENDER_QUEUE_OVERLAY does not work. // SCRQM_INCLUDE with RENDER_QUEUE_OVERLAY does not work.
for (int i = 0; i < Ogre::RENDER_QUEUE_MAX; ++i) for (int i = 0; i < Ogre::RENDER_QUEUE_MAX; ++i)
{ {
if (i > 10 && i < 90) if (i > 0 && i < 90)
mSceneMgr->addSpecialCaseRenderQueue(i); mSceneMgr->addSpecialCaseRenderQueue(i);
} }
mSceneMgr->setSpecialCaseRenderQueueMode(Ogre::SceneManager::SCRQM_EXCLUDE); mSceneMgr->setSpecialCaseRenderQueueMode(Ogre::SceneManager::SCRQM_EXCLUDE);
@ -87,7 +96,9 @@ std::cout << refProgress << " (" << mCurrentRefLoading << ", " << mTotalRefsLoa
// (e.g. when using "coc" console command, it would enter an infinite loop and crash due to overflow) // (e.g. when using "coc" console command, it would enter an infinite loop and crash due to overflow)
MWBase::Environment::get().getInputManager()->update(0, true); MWBase::Environment::get().getInputManager()->update(0, true);
mWindow->getViewport(0)->setClearEveryFrame(false);
mWindow->update(); mWindow->update();
mWindow->getViewport(0)->setClearEveryFrame(true);
// resume 3d rendering // resume 3d rendering
mSceneMgr->clearSpecialCaseRenderQueues(); mSceneMgr->clearSpecialCaseRenderQueues();

View file

@ -31,6 +31,7 @@ namespace MWGui
int mTotalCellsLoading; int mTotalCellsLoading;
int mCurrentRefLoading; int mCurrentRefLoading;
int mTotalRefsLoading; int mTotalRefsLoading;
int mCurrentRefList;
bool mLoadingOn; bool mLoadingOn;

View file

@ -50,6 +50,10 @@ namespace
} }
} }
} }
else
{
MWBase::Environment::get().getWindowManager ()->setLoadingProgress ("Loading cells", 1, 0, 1);
}
} }
} }