diff --git a/apps/openmw/mwbase/inputmanager.hpp b/apps/openmw/mwbase/inputmanager.hpp index f69e1a152..8293cbfa7 100644 --- a/apps/openmw/mwbase/inputmanager.hpp +++ b/apps/openmw/mwbase/inputmanager.hpp @@ -39,9 +39,6 @@ namespace MWBase virtual int getNumActions() = 0; virtual void enableDetectingBindingMode (int action) = 0; virtual void resetToDefaultBindings() = 0; - - virtual void create () = 0; - virtual void destroy () = 0; }; } diff --git a/apps/openmw/mwgui/settingswindow.cpp b/apps/openmw/mwgui/settingswindow.cpp index eaea022c0..73f2f6c8a 100644 --- a/apps/openmw/mwgui/settingswindow.cpp +++ b/apps/openmw/mwgui/settingswindow.cpp @@ -370,6 +370,12 @@ namespace MWGui 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()); + } else { if (_sender == mVSyncButton) diff --git a/apps/openmw/mwinput/inputmanagerimp.cpp b/apps/openmw/mwinput/inputmanagerimp.cpp index 00849503c..0934d8763 100644 --- a/apps/openmw/mwinput/inputmanagerimp.cpp +++ b/apps/openmw/mwinput/inputmanagerimp.cpp @@ -53,14 +53,6 @@ namespace MWInput , mUIYMultiplier (Settings::Manager::getFloat("ui y multiplier", "Input")) , mPreviewPOVDelay(0.f) , mTimeIdle(0.f) - { - create(); - - changeInputMode(false); - } - - - void InputManager::create() { Ogre::RenderWindow* window = mOgre.getWindow (); size_t windowHnd; @@ -139,9 +131,11 @@ namespace MWInput mControlSwitch["playermagic"] = true; mControlSwitch["playerviewswitch"] = true; mControlSwitch["vanitymode"] = true; + + changeInputMode(false); } - void InputManager::destroy() + InputManager::~InputManager() { mInputCtrl->save (mUserFile); @@ -152,11 +146,6 @@ namespace MWInput OIS::InputManager::destroyInputSystem(mInputManager); } - InputManager::~InputManager() - { - destroy(); - } - void InputManager::channelChanged(ICS::Channel* channel, float currentValue, float previousValue) { if (mDragDrop) diff --git a/apps/openmw/mwinput/inputmanagerimp.hpp b/apps/openmw/mwinput/inputmanagerimp.hpp index 7be35ee0b..3be669621 100644 --- a/apps/openmw/mwinput/inputmanagerimp.hpp +++ b/apps/openmw/mwinput/inputmanagerimp.hpp @@ -153,10 +153,6 @@ namespace MWInput std::map mControlSwitch; - public: - virtual void create(); - virtual void destroy(); - private: void adjustMouseRegion(int width, int height); diff --git a/apps/openmw/mwrender/refraction.cpp b/apps/openmw/mwrender/refraction.cpp index 05229da1d..e6b6e3baa 100644 --- a/apps/openmw/mwrender/refraction.cpp +++ b/apps/openmw/mwrender/refraction.cpp @@ -31,6 +31,7 @@ namespace MWRender vp->setShadowsEnabled(false); vp->setVisibilityMask(RV_Actors + RV_Misc + RV_Statics + RV_StaticsSmall + RV_Terrain + RV_Sky); vp->setMaterialScheme("water_reflection"); + vp->setBackgroundColour (Ogre::ColourValue(0.0078, 0.0576, 0.150)); mRenderTarget->setAutoUpdated(true); mRenderTarget->addListener(this); } @@ -66,11 +67,6 @@ namespace MWRender 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) { // We don't want the sky to get clipped by custom near clip plane (the water plane) diff --git a/apps/openmw/mwrender/refraction.hpp b/apps/openmw/mwrender/refraction.hpp index 6b3c487c1..de47d6e43 100644 --- a/apps/openmw/mwrender/refraction.hpp +++ b/apps/openmw/mwrender/refraction.hpp @@ -24,7 +24,6 @@ namespace MWRender void setHeight (float height); void preRenderTargetUpdate(const Ogre::RenderTargetEvent& evt); void postRenderTargetUpdate(const Ogre::RenderTargetEvent& evt); - void setViewportBackground(Ogre::ColourValue colour); void setUnderwater(bool underwater) {mIsUnderwater = underwater;} void renderQueueStarted (Ogre::uint8 queueGroupId, const Ogre::String &invocation, bool &skipThisInvocation); diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index afbdbb06f..ce48284e0 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -46,8 +46,12 @@ namespace MWRender { RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const boost::filesystem::path& resDir, const boost::filesystem::path& cacheDir, OEngine::Physic::PhysicEngine* engine) - : mRendering(_rend), mObjects(mRendering), mActors(mRendering), mAmbientMode(0), mSunEnabled(0), mPhysicsEngine(engine), - mRecreateWindowInNextFrame(false) + : mRendering(_rend) + , mObjects(mRendering) + , mActors(mRendering) + , mAmbientMode(0) + , mSunEnabled(0) + , mPhysicsEngine(engine) { // select best shader mode 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) { - 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; mPlayer->setCameraDistance(); if (!mPlayer->getPosition(orig, dest)) { @@ -784,7 +761,6 @@ Compositors* RenderingManager::getCompositors() void RenderingManager::processChangedSettings(const Settings::CategorySettingVector& settings) { bool changeRes = false; - bool recreateWindow = false; bool rebuild = false; // rebuild static geometry (necessary after any material changes) for (Settings::CategorySettingVector::const_iterator it=settings.begin(); it != settings.end(); ++it) @@ -803,8 +779,6 @@ void RenderingManager::processChangedSettings(const Settings::CategorySettingVec || it->second == "resolution y" || it->second == "fullscreen")) changeRes = true; - else if (it->first == "Video" && it->second == "vsync") - recreateWindow = true; else if (it->second == "field of view" && it->first == "General") mRendering.setFov(Settings::Manager::getFloat("field of view", "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); } - 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) mWater->processChangedSettings(settings); diff --git a/apps/openmw/mwrender/renderingmanager.hpp b/apps/openmw/mwrender/renderingmanager.hpp index 670f3dc85..71ac742c2 100644 --- a/apps/openmw/mwrender/renderingmanager.hpp +++ b/apps/openmw/mwrender/renderingmanager.hpp @@ -260,8 +260,6 @@ class RenderingManager: private RenderingInterface, public Ogre::WindowEventList MWRender::Compositors* mCompositors; VideoPlayer* mVideoPlayer; - - bool mRecreateWindowInNextFrame; }; } diff --git a/apps/openmw/mwrender/water.cpp b/apps/openmw/mwrender/water.cpp index f31dca08c..3b8705ac5 100644 --- a/apps/openmw/mwrender/water.cpp +++ b/apps/openmw/mwrender/water.cpp @@ -380,8 +380,6 @@ void Water::setViewportBackground(const ColourValue& bg) { if (mReflection) mReflection->setViewportBackground(bg); - if (mRefraction) - mRefraction->setViewportBackground(bg); } void Water::updateVisible()