1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-02 02:15:31 +00:00
This commit is contained in:
scrawl 2012-09-13 00:21:58 +02:00
parent a96ed6ac61
commit 2f0b47fc38
8 changed files with 30 additions and 21 deletions

View file

@ -218,6 +218,7 @@ namespace MWBase
virtual void executeInConsole (const std::string& path) = 0; virtual void executeInConsole (const std::string& path) = 0;
virtual void setLoadingProgress (const std::string& stage, int depth, int current, int total) = 0; virtual void setLoadingProgress (const std::string& stage, int depth, int current, int total) = 0;
virtual void loadingDone() = 0;
}; };
} }

View file

@ -80,11 +80,7 @@ namespace MWGui
mTotalRefsLoading = total; mTotalRefsLoading = total;
} }
if (mTotalCellsLoading == 0) assert (mTotalCellsLoading != 0);
{
loadingOff();
return;
}
float refProgress; float refProgress;
if (mTotalRefsLoading <= 1) if (mTotalRefsLoading <= 1)
@ -101,11 +97,6 @@ namespace MWGui
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)
{
loadingOff();
return;
}
mLoadingText->setCaption(stage + "... "); mLoadingText->setCaption(stage + "... ");
mProgressBar->setProgressPosition (static_cast<size_t>(progress * 1000)); mProgressBar->setProgressPosition (static_cast<size_t>(progress * 1000));
@ -138,13 +129,14 @@ namespace MWGui
if (!hasCompositor) if (!hasCompositor)
{ {
mWindow->getViewport(0)->setClearEveryFrame(false); //mWindow->getViewport(0)->setClearEveryFrame(false);
} }
else else
{ {
if (!mFirstLoad) if (!mFirstLoad)
mBackgroundMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName(chain->getCompositor ("gbufferFinalizer")->getTextureInstance ("no_mrt_output", 0)->getName()); {
mRectangle->setVisible(true); //mBackgroundMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName(chain->getCompositor ("gbufferFinalizer")->getTextureInstance ("no_mrt_output", 0)->getName());
}
for (unsigned int i = 0; i<chain->getNumCompositors(); ++i) for (unsigned int i = 0; i<chain->getNumCompositors(); ++i)
{ {
@ -152,6 +144,9 @@ namespace MWGui
} }
} }
mRectangle->setVisible(hasCompositor || mFirstLoad);
std::cout << "rect vis? " << mRectangle->getVisible () << " first load? " << mFirstLoad << std::endl;
mBackgroundMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName("Splash/Splash_Bonelord.tga");
mWindow->update(); mWindow->update();
if (!hasCompositor) if (!hasCompositor)
@ -162,17 +157,24 @@ namespace MWGui
{ {
Ogre::CompositorManager::getSingleton().setCompositorEnabled(mWindow->getViewport(0), chain->getCompositor(i)->getCompositor()->getName(), true); Ogre::CompositorManager::getSingleton().setCompositorEnabled(mWindow->getViewport(0), chain->getCompositor(i)->getCompositor()->getName(), true);
} }
mRectangle->setVisible(false);
} }
mRectangle->setVisible(false);
// resume 3d rendering // resume 3d rendering
mSceneMgr->clearSpecialCaseRenderQueues(); mSceneMgr->clearSpecialCaseRenderQueues();
mSceneMgr->setSpecialCaseRenderQueueMode(Ogre::SceneManager::SCRQM_EXCLUDE); mSceneMgr->setSpecialCaseRenderQueueMode(Ogre::SceneManager::SCRQM_EXCLUDE);
} }
} }
void LoadingScreen::loadingDone()
{
loadingOff();
}
void LoadingScreen::loadingOn() void LoadingScreen::loadingOn()
{ {
std::cout << "loading on " <<std::endl;
setVisible(true); setVisible(true);
mLoadingOn = true; mLoadingOn = true;
@ -204,10 +206,10 @@ namespace MWGui
void LoadingScreen::loadingOff() void LoadingScreen::loadingOff()
{ {
std::cout << "loading off " << std::endl;
setVisible(false); setVisible(false);
mLoadingOn = false; mLoadingOn = false;
mFirstLoad = false; //mFirstLoad = false;
mRectangle->setVisible(false);
mWindowManager.removeGuiMode(GM_Loading); mWindowManager.removeGuiMode(GM_Loading);
mWindowManager.removeGuiMode(GM_LoadingWallpaper); mWindowManager.removeGuiMode(GM_LoadingWallpaper);

View file

@ -15,6 +15,7 @@ namespace MWGui
virtual ~LoadingScreen(); virtual ~LoadingScreen();
void setLoadingProgress (const std::string& stage, int depth, int current, int total); void setLoadingProgress (const std::string& stage, int depth, int current, int total);
void loadingDone();
void onResChange(int w, int h); void onResChange(int w, int h);

View file

@ -918,3 +918,8 @@ void WindowManager::setLoadingProgress (const std::string& stage, int depth, int
{ {
mLoadingScreen->setLoadingProgress (stage, depth, current, total); mLoadingScreen->setLoadingProgress (stage, depth, current, total);
} }
void WindowManager::loadingDone ()
{
mLoadingScreen->loadingDone ();
}

View file

@ -197,6 +197,7 @@ namespace MWGui
virtual void executeInConsole (const std::string& path); virtual void executeInConsole (const std::string& path);
virtual void setLoadingProgress (const std::string& stage, int depth, int current, int total); virtual void setLoadingProgress (const std::string& stage, int depth, int current, int total);
virtual void loadingDone();
private: private:
OEngine::GUI::MyGUIManager *mGuiManager; OEngine::GUI::MyGUIManager *mGuiManager;

View file

@ -11,9 +11,6 @@
#include <OgreBillboardSet.h> #include <OgreBillboardSet.h>
#include <OgreEntity.h> #include <OgreEntity.h>
#include <OgreSubEntity.h> #include <OgreSubEntity.h>
#include <OgreOverlay.h>
#include <OgreOverlayManager.h>
#include <OgreOverlayContainer.h>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>

View file

@ -24,7 +24,6 @@ namespace Ogre
class Entity; class Entity;
class BillboardSet; class BillboardSet;
class TextureUnitState; class TextureUnitState;
class Overlay;
} }
namespace MWRender namespace MWRender

View file

@ -290,7 +290,6 @@ namespace MWWorld
mCurrentCell = *iter; mCurrentCell = *iter;
// adjust player // adjust player
playerCellChange (mCurrentCell, position, adjustPlayerPos); playerCellChange (mCurrentCell, position, adjustPlayerPos);
@ -300,6 +299,8 @@ namespace MWWorld
mRendering.switchToExterior(); mRendering.switchToExterior();
mCellChanged = true; mCellChanged = true;
MWBase::Environment::get().getWindowManager ()->loadingDone ();
} }
//We need the ogre renderer and a scene node. //We need the ogre renderer and a scene node.
@ -369,6 +370,8 @@ namespace MWWorld
MWBase::Environment::get().getWorld()->adjustSky(); MWBase::Environment::get().getWorld()->adjustSky();
mCellChanged = true; mCellChanged = true;
MWBase::Environment::get().getWindowManager ()->loadingDone ();
} }
void Scene::changeToExteriorCell (const ESM::Position& position) void Scene::changeToExteriorCell (const ESM::Position& position)