1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 06:35:30 +00:00

fix toggleSky

This commit is contained in:
scrawl 2012-02-26 18:21:11 +01:00
parent c1d39bb35f
commit 932983c2fa
3 changed files with 14 additions and 9 deletions

View File

@ -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<Moon::Phase>( (int) ((mDay % 32)/4.f)) );
mSecunda->setPhase ( static_cast<Moon::Phase>( (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()

View File

@ -710,7 +710,6 @@ void WeatherManager::update(float duration)
mRendering->sunEnable();
mRendering->setSunColour(result.mSunColor);
mRendering->skyEnable();
mRendering->getSkyManager()->setWeather(result);
}
else

View File

@ -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();