Cleaning out some old bits

This commit is contained in:
scrawl 2013-02-13 18:39:36 +01:00
parent de90b911c9
commit 6a49ea9b4f
9 changed files with 16 additions and 70 deletions

View file

@ -39,9 +39,6 @@ namespace MWBase
virtual int getNumActions() = 0; virtual int getNumActions() = 0;
virtual void enableDetectingBindingMode (int action) = 0; virtual void enableDetectingBindingMode (int action) = 0;
virtual void resetToDefaultBindings() = 0; virtual void resetToDefaultBindings() = 0;
virtual void create () = 0;
virtual void destroy () = 0;
}; };
} }

View file

@ -370,6 +370,12 @@ namespace MWGui
apply(); apply();
} }
} }
else if (_sender == mVSyncButton)
{
Settings::Manager::setBool("vsync", "Video", newState);
MWBase::Environment::get().getWindowManager()->
messageBox("VSync will be applied after a restart", std::vector<std::string>());
}
else else
{ {
if (_sender == mVSyncButton) if (_sender == mVSyncButton)

View file

@ -53,14 +53,6 @@ namespace MWInput
, mUIYMultiplier (Settings::Manager::getFloat("ui y multiplier", "Input")) , mUIYMultiplier (Settings::Manager::getFloat("ui y multiplier", "Input"))
, mPreviewPOVDelay(0.f) , mPreviewPOVDelay(0.f)
, mTimeIdle(0.f) , mTimeIdle(0.f)
{
create();
changeInputMode(false);
}
void InputManager::create()
{ {
Ogre::RenderWindow* window = mOgre.getWindow (); Ogre::RenderWindow* window = mOgre.getWindow ();
size_t windowHnd; size_t windowHnd;
@ -139,9 +131,11 @@ namespace MWInput
mControlSwitch["playermagic"] = true; mControlSwitch["playermagic"] = true;
mControlSwitch["playerviewswitch"] = true; mControlSwitch["playerviewswitch"] = true;
mControlSwitch["vanitymode"] = true; mControlSwitch["vanitymode"] = true;
changeInputMode(false);
} }
void InputManager::destroy() InputManager::~InputManager()
{ {
mInputCtrl->save (mUserFile); mInputCtrl->save (mUserFile);
@ -152,11 +146,6 @@ namespace MWInput
OIS::InputManager::destroyInputSystem(mInputManager); OIS::InputManager::destroyInputSystem(mInputManager);
} }
InputManager::~InputManager()
{
destroy();
}
void InputManager::channelChanged(ICS::Channel* channel, float currentValue, float previousValue) void InputManager::channelChanged(ICS::Channel* channel, float currentValue, float previousValue)
{ {
if (mDragDrop) if (mDragDrop)

View file

@ -153,10 +153,6 @@ namespace MWInput
std::map<std::string, bool> mControlSwitch; std::map<std::string, bool> mControlSwitch;
public:
virtual void create();
virtual void destroy();
private: private:
void adjustMouseRegion(int width, int height); void adjustMouseRegion(int width, int height);

View file

@ -31,6 +31,7 @@ namespace MWRender
vp->setShadowsEnabled(false); vp->setShadowsEnabled(false);
vp->setVisibilityMask(RV_Actors + RV_Misc + RV_Statics + RV_StaticsSmall + RV_Terrain + RV_Sky); vp->setVisibilityMask(RV_Actors + RV_Misc + RV_Statics + RV_StaticsSmall + RV_Terrain + RV_Sky);
vp->setMaterialScheme("water_reflection"); vp->setMaterialScheme("water_reflection");
vp->setBackgroundColour (Ogre::ColourValue(0.0078, 0.0576, 0.150));
mRenderTarget->setAutoUpdated(true); mRenderTarget->setAutoUpdated(true);
mRenderTarget->addListener(this); mRenderTarget->addListener(this);
} }
@ -66,11 +67,6 @@ namespace MWRender
mNearClipPlaneUnderwater = Ogre::Plane( Ogre::Vector3(0,1,0), height - 5); mNearClipPlaneUnderwater = Ogre::Plane( Ogre::Vector3(0,1,0), height - 5);
} }
void Refraction::setViewportBackground (Ogre::ColourValue colour)
{
mRenderTarget->getViewport (0)->setBackgroundColour (colour);
}
void Refraction::renderQueueStarted (Ogre::uint8 queueGroupId, const Ogre::String &invocation, bool &skipThisInvocation) void Refraction::renderQueueStarted (Ogre::uint8 queueGroupId, const Ogre::String &invocation, bool &skipThisInvocation)
{ {
// We don't want the sky to get clipped by custom near clip plane (the water plane) // We don't want the sky to get clipped by custom near clip plane (the water plane)

View file

@ -24,7 +24,6 @@ namespace MWRender
void setHeight (float height); void setHeight (float height);
void preRenderTargetUpdate(const Ogre::RenderTargetEvent& evt); void preRenderTargetUpdate(const Ogre::RenderTargetEvent& evt);
void postRenderTargetUpdate(const Ogre::RenderTargetEvent& evt); void postRenderTargetUpdate(const Ogre::RenderTargetEvent& evt);
void setViewportBackground(Ogre::ColourValue colour);
void setUnderwater(bool underwater) {mIsUnderwater = underwater;} void setUnderwater(bool underwater) {mIsUnderwater = underwater;}
void renderQueueStarted (Ogre::uint8 queueGroupId, const Ogre::String &invocation, bool &skipThisInvocation); void renderQueueStarted (Ogre::uint8 queueGroupId, const Ogre::String &invocation, bool &skipThisInvocation);

View file

@ -46,8 +46,12 @@ namespace MWRender {
RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const boost::filesystem::path& resDir, RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const boost::filesystem::path& resDir,
const boost::filesystem::path& cacheDir, OEngine::Physic::PhysicEngine* engine) const boost::filesystem::path& cacheDir, OEngine::Physic::PhysicEngine* engine)
: mRendering(_rend), mObjects(mRendering), mActors(mRendering), mAmbientMode(0), mSunEnabled(0), mPhysicsEngine(engine), : mRendering(_rend)
mRecreateWindowInNextFrame(false) , mObjects(mRendering)
, mActors(mRendering)
, mAmbientMode(0)
, mSunEnabled(0)
, mPhysicsEngine(engine)
{ {
// select best shader mode // select best shader mode
bool openGL = (Ogre::Root::getSingleton ().getRenderSystem ()->getName().find("OpenGL") != std::string::npos); bool openGL = (Ogre::Root::getSingleton ().getRenderSystem ()->getName().find("OpenGL") != std::string::npos);
@ -324,33 +328,6 @@ RenderingManager::moveObjectToCell(
void RenderingManager::update (float duration, bool paused) void RenderingManager::update (float duration, bool paused)
{ {
if (mRecreateWindowInNextFrame)
{
mRecreateWindowInNextFrame = false;
mRendering.removeWindowEventListener(this);
mRendering.getWindow()->removeListener(this);
MWBase::Environment::get().getInputManager()->destroy();
OEngine::Render::WindowSettings windowSettings;
windowSettings.fullscreen = Settings::Manager::getBool("fullscreen", "Video");
windowSettings.window_x = Settings::Manager::getInt("resolution x", "Video");
windowSettings.window_y = Settings::Manager::getInt("resolution y", "Video");
windowSettings.vsync = Settings::Manager::getBool("vsync", "Video");
std::string aa = Settings::Manager::getString("antialiasing", "Video");
windowSettings.fsaa = (aa.substr(0, 4) == "MSAA") ? aa.substr(5, aa.size()-5) : "0";
mRendering.recreateWindow("OpenMW", windowSettings);
MWBase::Environment::get().getInputManager()->create();
mRendering.setWindowEventListener (this);
mRendering.getWindow()->addListener(this);
// this is necessary, otherwise it would just endlessly wait for the last query and it would never return
delete mOcclusionQuery;
mOcclusionQuery = new OcclusionQuery(&mRendering, mSkyManager->getSunNode());
}
Ogre::Vector3 orig, dest; Ogre::Vector3 orig, dest;
mPlayer->setCameraDistance(); mPlayer->setCameraDistance();
if (!mPlayer->getPosition(orig, dest)) { if (!mPlayer->getPosition(orig, dest)) {
@ -784,7 +761,6 @@ Compositors* RenderingManager::getCompositors()
void RenderingManager::processChangedSettings(const Settings::CategorySettingVector& settings) void RenderingManager::processChangedSettings(const Settings::CategorySettingVector& settings)
{ {
bool changeRes = false; bool changeRes = false;
bool recreateWindow = false;
bool rebuild = false; // rebuild static geometry (necessary after any material changes) bool rebuild = false; // rebuild static geometry (necessary after any material changes)
for (Settings::CategorySettingVector::const_iterator it=settings.begin(); for (Settings::CategorySettingVector::const_iterator it=settings.begin();
it != settings.end(); ++it) it != settings.end(); ++it)
@ -803,8 +779,6 @@ void RenderingManager::processChangedSettings(const Settings::CategorySettingVec
|| it->second == "resolution y" || it->second == "resolution y"
|| it->second == "fullscreen")) || it->second == "fullscreen"))
changeRes = true; changeRes = true;
else if (it->first == "Video" && it->second == "vsync")
recreateWindow = true;
else if (it->second == "field of view" && it->first == "General") else if (it->second == "field of view" && it->first == "General")
mRendering.setFov(Settings::Manager::getFloat("field of view", "General")); mRendering.setFov(Settings::Manager::getFloat("field of view", "General"));
else if ((it->second == "texture filtering" && it->first == "General") else if ((it->second == "texture filtering" && it->first == "General")
@ -876,13 +850,6 @@ void RenderingManager::processChangedSettings(const Settings::CategorySettingVec
mRendering.getWindow()->setFullscreen(Settings::Manager::getBool("fullscreen", "Video"), x, y); mRendering.getWindow()->setFullscreen(Settings::Manager::getBool("fullscreen", "Video"), x, y);
} }
if (recreateWindow)
{
mRecreateWindowInNextFrame = true;
// We can not do this now, because this might get triggered from the input listener
// and destroying/recreating the input system at that point would cause a crash
}
if (mWater) if (mWater)
mWater->processChangedSettings(settings); mWater->processChangedSettings(settings);

View file

@ -260,8 +260,6 @@ class RenderingManager: private RenderingInterface, public Ogre::WindowEventList
MWRender::Compositors* mCompositors; MWRender::Compositors* mCompositors;
VideoPlayer* mVideoPlayer; VideoPlayer* mVideoPlayer;
bool mRecreateWindowInNextFrame;
}; };
} }

View file

@ -380,8 +380,6 @@ void Water::setViewportBackground(const ColourValue& bg)
{ {
if (mReflection) if (mReflection)
mReflection->setViewportBackground(bg); mReflection->setViewportBackground(bg);
if (mRefraction)
mRefraction->setViewportBackground(bg);
} }
void Water::updateVisible() void Water::updateVisible()