fixed the disappearing

This commit is contained in:
scrawl 2012-09-13 12:33:09 +02:00
parent 2f0b47fc38
commit 7ad80e306b
3 changed files with 40 additions and 24 deletions

View file

@ -162,6 +162,10 @@ void OMW::Engine::loadBSA()
dataDirectory = iter->string(); dataDirectory = iter->string();
std::cout << "Data dir " << dataDirectory << std::endl; std::cout << "Data dir " << dataDirectory << std::endl;
Bsa::addDir(dataDirectory, mFSStrict); Bsa::addDir(dataDirectory, mFSStrict);
// Workaround: Mygui does not find textures in non-BSA subfolders, _unless_ they are explicitely added like this
// For splash screens, this is OK to do, but eventually we will need an investigation why this is necessary
Bsa::addDir(dataDirectory + "/Splash", mFSStrict);
} }
} }

View file

@ -22,6 +22,7 @@ namespace MWGui
, WindowBase("openmw_loading_screen.layout", parWindowManager) , WindowBase("openmw_loading_screen.layout", parWindowManager)
, mLoadingOn(false) , mLoadingOn(false)
, mLastRenderTime(0.f) , mLastRenderTime(0.f)
, mLastWallpaperChangeTime(0.f)
, mFirstLoad(true) , mFirstLoad(true)
{ {
getWidget(mLoadingText, "LoadingText"); getWidget(mLoadingText, "LoadingText");
@ -107,6 +108,11 @@ namespace MWGui
{ {
mLastRenderTime = mTimer.getMilliseconds (); mLastRenderTime = mTimer.getMilliseconds ();
if (mFirstLoad && mTimer.getMilliseconds () > mLastWallpaperChangeTime + 3000*1)
{
mLastWallpaperChangeTime = mTimer.getMilliseconds ();
changeWallpaper();
}
// Turn off rendering except the GUI // Turn off rendering except the GUI
mSceneMgr->clearSpecialCaseRenderQueues(); mSceneMgr->clearSpecialCaseRenderQueues();
@ -129,13 +135,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()); mBackgroundMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName(chain->getCompositor ("gbufferFinalizer")->getTextureInstance ("no_mrt_output", 0)->getName());
mRectangle->setVisible(true);
} }
for (unsigned int i = 0; i<chain->getNumCompositors(); ++i) for (unsigned int i = 0; i<chain->getNumCompositors(); ++i)
@ -144,9 +151,6 @@ 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)
@ -174,44 +178,49 @@ namespace MWGui
void LoadingScreen::loadingOn() void LoadingScreen::loadingOn()
{ {
std::cout << "loading on " <<std::endl;
setVisible(true); setVisible(true);
mLoadingOn = true; mLoadingOn = true;
if (mFirstLoad) if (mFirstLoad)
{ {
/// \todo use a directory listing here changeWallpaper();
std::vector<std::string> splash;
splash.push_back ("Splash/Splash_Bonelord.tga");
splash.push_back ("Splash/Splash_ClannDaddy.tga");
splash.push_back ("Splash/Splash_ClannFear.tga");
splash.push_back ("Splash/Splash_Daedroth.tga");
splash.push_back ("Splash/Splash_Hunger.tga");
splash.push_back ("Splash/Splash_KwamaWarrior.tga");
splash.push_back ("Splash/Splash_Netch.tga");
splash.push_back ("Splash/Splash_NixHound.tga");
splash.push_back ("Splash/Splash_Siltstriker.tga");
splash.push_back ("Splash/Splash_Skeleton.tga");
splash.push_back ("Splash/Splash_SphereCenturion.tga");
mBackgroundMaterial->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setTextureName(splash[rand() % splash.size()]);
mRectangle->setVisible(true);
mWindowManager.pushGuiMode(GM_LoadingWallpaper); mWindowManager.pushGuiMode(GM_LoadingWallpaper);
} }
else else
{
mBackgroundImage->setImageTexture("");
mWindowManager.pushGuiMode(GM_Loading); mWindowManager.pushGuiMode(GM_Loading);
}
} }
void LoadingScreen::loadingOff() void LoadingScreen::loadingOff()
{ {
std::cout << "loading off " << std::endl;
setVisible(false); setVisible(false);
mLoadingOn = false; mLoadingOn = false;
//mFirstLoad = false; mFirstLoad = false;
mWindowManager.removeGuiMode(GM_Loading); mWindowManager.removeGuiMode(GM_Loading);
mWindowManager.removeGuiMode(GM_LoadingWallpaper); mWindowManager.removeGuiMode(GM_LoadingWallpaper);
} }
void LoadingScreen::changeWallpaper ()
{
/// \todo use a directory listing here
std::vector<std::string> splash;
splash.push_back ("Splash_Bonelord.tga");
splash.push_back ("Splash_ClannDaddy.tga");
splash.push_back ("Splash_Clannfear.tga");
splash.push_back ("Splash_Daedroth.tga");
splash.push_back ("Splash_Hunger.tga");
splash.push_back ("Splash_KwamaWarrior.tga");
splash.push_back ("Splash_Netch.tga");
splash.push_back ("Splash_NixHound.tga");
splash.push_back ("Splash_Siltstriker.tga");
splash.push_back ("Splash_Skeleton.tga");
splash.push_back ("Splash_SphereCenturion.tga");
mBackgroundImage->setImageTexture (splash[rand() % splash.size()]);
}
} }

View file

@ -25,6 +25,7 @@ namespace MWGui
Ogre::SceneManager* mSceneMgr; Ogre::SceneManager* mSceneMgr;
Ogre::RenderWindow* mWindow; Ogre::RenderWindow* mWindow;
unsigned long mLastWallpaperChangeTime;
unsigned long mLastRenderTime; unsigned long mLastRenderTime;
Ogre::Timer mTimer; Ogre::Timer mTimer;
@ -46,6 +47,8 @@ namespace MWGui
void loadingOn(); void loadingOn();
void loadingOff(); void loadingOff();
void changeWallpaper();
}; };
} }