diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp index f2e78053a..a9216a1a3 100644 --- a/apps/openmw/mwrender/sky.cpp +++ b/apps/openmw/mwrender/sky.cpp @@ -535,23 +535,25 @@ int SkyManager::getSecundaPhase() const } void SkyManager::update(float duration) -{ +{ + if (!mEnabled) return; + // UV Scroll the clouds mCloudMaterial->getTechnique(0)->getPass(0)->getFragmentProgramParameters()->setNamedConstantFromTime("time", 1); mMasser->setPhase( static_cast( (int) ((mDay % 32)/4.f)) ); mSecunda->setPhase ( static_cast( (int) ((mDay % 32)/4.f)) ); + + mSunGlare->setVisible(mGlareEnabled && mSunEnabled); + mSun->setVisible(mSunEnabled); + mMasser->setVisible(mMasserEnabled); + mSecunda->setVisible(mSecundaEnabled); } void SkyManager::enable() { mRootNode->setVisible(true); mEnabled = true; - - mSunGlare->setVisible(mGlareEnabled && mSunEnabled); - mSun->setVisible(mSunEnabled); - mMasser->setVisible(mMasserEnabled); - mSecunda->setVisible(mSecundaEnabled); } void SkyManager::disable() diff --git a/apps/openmw/mwworld/weather.cpp b/apps/openmw/mwworld/weather.cpp index 8acbbb460..c88dad0f2 100644 --- a/apps/openmw/mwworld/weather.cpp +++ b/apps/openmw/mwworld/weather.cpp @@ -710,7 +710,6 @@ void WeatherManager::update(float duration) mRendering->sunEnable(); mRendering->setSunColour(result.mSunColor); - mRendering->skyEnable(); mRendering->getSkyManager()->setWeather(result); } else diff --git a/apps/openmw/mwworld/world.cpp b/apps/openmw/mwworld/world.cpp index ead8847cf..1a69f4d7b 100644 --- a/apps/openmw/mwworld/world.cpp +++ b/apps/openmw/mwworld/world.cpp @@ -140,12 +140,16 @@ namespace MWWorld void World::adjustSky() { - if (mSky) + if (mSky && (isCellExterior() || isCellQuasiExterior())) { mRendering->skySetHour (mGlobalVariables->getFloat ("gamehour")); mRendering->skySetDate (mGlobalVariables->getInt ("day"), mGlobalVariables->getInt ("month")); + + mRendering->getSkyManager()->enable(); } + else + mRendering->getSkyManager()->disable(); } World::World (OEngine::Render::OgreRenderer& renderer, @@ -153,7 +157,7 @@ namespace MWWorld const std::string& master, const boost::filesystem::path& resDir, bool newGame, Environment& environment, const std::string& encoding) : mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0), - mSky (false), mEnvironment (environment), mNextDynamicRecord (0), mCells (mStore, mEsm, *this) + mSky (true), mEnvironment (environment), mNextDynamicRecord (0), mCells (mStore, mEsm, *this) { mPhysics = new PhysicsSystem(renderer); mPhysEngine = mPhysics->getEngine();