some fixes

actorid
scrawl 12 years ago
parent d5a08e31e7
commit a8d9aa98b1

@ -2,6 +2,11 @@
#include <OgreRenderWindow.h>
#include <OgreRoot.h>
#include <OgreCompositorManager.h>
#include <OgreCompositorChain.h>
#include <OgreMaterial.h>
#include "../mwbase/environment.hpp"
#include "../mwbase/inputmanager.hpp"
@ -18,10 +23,37 @@ namespace MWGui
{
getWidget(mLoadingText, "LoadingText");
getWidget(mProgressBar, "ProgressBar");
getWidget(mBackgroundImage, "BackgroundImage");
mBackgroundMaterial = Ogre::MaterialManager::getSingleton().create("BackgroundMaterial", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
mBackgroundMaterial->getTechnique(0)->getPass(0)->setLightingEnabled(false);
mBackgroundMaterial->getTechnique(0)->getPass(0)->setDepthCheckEnabled(false);
mBackgroundMaterial->getTechnique(0)->getPass(0)->createTextureUnitState("");
mRectangle = new Ogre::Rectangle2D(true);
mRectangle->setCorners(-1.0, 1.0, 1.0, -1.0);
mRectangle->setMaterial("BackgroundMaterial");
// Render the background before everything else
mRectangle->setRenderQueueGroup(Ogre::RENDER_QUEUE_OVERLAY-1);
// Use infinite AAB to always stay visible
Ogre::AxisAlignedBox aabInf;
aabInf.setInfinite();
mRectangle->setBoundingBox(aabInf);
// Attach background to the scene
Ogre::SceneNode* node = mSceneMgr->getRootSceneNode()->createChildSceneNode();
node->attachObject(mRectangle);
mRectangle->setVisible(false);
}
LoadingScreen::~LoadingScreen()
{
delete mRectangle;
}
void LoadingScreen::onResChange(int w, int h)
{
setCoord(0,0,w,h);
}
void LoadingScreen::setLoadingProgress (const std::string& stage, int depth, int current, int total)
@ -87,7 +119,7 @@ namespace MWGui
// SCRQM_INCLUDE with RENDER_QUEUE_OVERLAY does not work.
for (int i = 0; i < Ogre::RENDER_QUEUE_MAX; ++i)
{
if (i > 0 && i < 90)
if (i > 0 && i < 96)
mSceneMgr->addSpecialCaseRenderQueue(i);
}
mSceneMgr->setSpecialCaseRenderQueueMode(Ogre::SceneManager::SCRQM_EXCLUDE);
@ -96,9 +128,38 @@ namespace MWGui
// (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);
Ogre::CompositorChain* chain = Ogre::CompositorManager::getSingleton().getCompositorChain(mWindow->getViewport(0));
bool hasCompositor = chain->getCompositor ("gbufferFinalizer");
if (!hasCompositor)
{
mWindow->getViewport(0)->setClearEveryFrame(false);
}
else
{
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)
{
Ogre::CompositorManager::getSingleton().setCompositorEnabled(mWindow->getViewport(0), chain->getCompositor(i)->getCompositor()->getName(), false);
}
}
mWindow->update();
if (!hasCompositor)
mWindow->getViewport(0)->setClearEveryFrame(true);
else
{
for (unsigned int i = 0; i<chain->getNumCompositors(); ++i)
{
Ogre::CompositorManager::getSingleton().setCompositorEnabled(mWindow->getViewport(0), chain->getCompositor(i)->getCompositor()->getName(), true);
}
mRectangle->setVisible(false);
}
// resume 3d rendering
mSceneMgr->clearSpecialCaseRenderQueues();

@ -8,7 +8,6 @@
namespace MWGui
{
class LoadingScreen : public WindowBase
{
public:
@ -17,6 +16,8 @@ namespace MWGui
void setLoadingProgress (const std::string& stage, int depth, int current, int total);
void onResChange(int w, int h);
private:
Ogre::SceneManager* mSceneMgr;
Ogre::RenderWindow* mWindow;
@ -26,6 +27,7 @@ namespace MWGui
MyGUI::TextBox* mLoadingText;
MyGUI::ProgressBar* mProgressBar;
MyGUI::ImageBox* mBackgroundImage;
int mCurrentCellLoading;
int mTotalCellsLoading;
@ -33,6 +35,9 @@ namespace MWGui
int mTotalRefsLoading;
int mCurrentRefList;
Ogre::Rectangle2D* mRectangle;
Ogre::MaterialPtr mBackgroundMaterial;
bool mLoadingOn;

@ -149,7 +149,7 @@ WindowManager::WindowManager(
mQuickKeysMenu = new QuickKeysMenu(*this);
mLoadingScreen = new LoadingScreen(mOgre->getScene (), mOgre->getWindow (), *this);
mLoadingScreen->setCoord (0,0,w,h);
mLoadingScreen->onResChange (w,h);
mInputBlocker = mGui->createWidget<MyGUI::Widget>("",0,0,w,h,MyGUI::Align::Default,"Windows","");
@ -684,7 +684,7 @@ void WindowManager::processChangedSettings(const Settings::CategorySettingVector
mBookWindow->center();
mQuickKeysMenu->center();
mSpellBuyingWindow->center();
mLoadingScreen->setCoord (0,0,x,y);
mLoadingScreen->onResChange (x,y);
mDragAndDrop->mDragAndDropWidget->setSize(MyGUI::IntSize(x, y));
mInputBlocker->setSize(MyGUI::IntSize(x,y));
}

@ -734,6 +734,7 @@ void RenderingManager::processChangedSettings(const Settings::CategorySettingVec
sh::Factory::getInstance ().setGlobalSetting ("mrt_output", useMRT() ? "true" : "false");
sh::Factory::getInstance ().setGlobalSetting ("simple_water", Settings::Manager::getBool("shader", "Water") ? "false" : "true");
mObjects.rebuildStaticGeometry ();
mRendering.getViewport ()->setClearEveryFrame (true);
}
else if (it->second == "underwater effect" && it->first == "Water")
{

@ -4,16 +4,20 @@
<!-- The entire screen -->
<Widget type="Widget" layer="LoadingScreen" position="0 0 300 300" name="_Main">
<Widget type="Widget" skin="HUD_Box" position="0 200 300 80" align="Bottom HCenter">
<Widget type="ImageBox" skin="ImageBox" position="0 0 300 300" align="Stretch" name="BackgroundImage">
<Widget type="AutoSizedTextBox" skin="SandText" position="30 20 240 24" name="LoadingText">
<Widget type="Widget" skin="HUD_Box" position="0 200 300 70" align="Bottom HCenter">
<Widget type="AutoSizedTextBox" skin="SandText" position="20 12 260 24" name="LoadingText">
</Widget>
<Widget type="ProgressBar" skin="MW_Progress_Blue" position="30 50 240 24" name="ProgressBar">
<Widget type="ProgressBar" skin="MW_Progress_Blue" position="20 38 260 24" name="ProgressBar">
<Property key="Range" value="1000"/>
</Widget>
</Widget>
</Widget>
</Widget>
</MyGUI>

Loading…
Cancel
Save