diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 5cbcaab83b..478cadb74f 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -219,6 +219,26 @@ namespace MWRender updateAmbient(); } + void RenderingManager::skySetDate(int day, int month) + { + mSky->setDate(day, month); + } + + int RenderingManager::skyGetMasserPhase() const + { + return mSky->getMasserPhase(); + } + + int RenderingManager::skyGetSecundaPhase() const + { + return mSky->getSecundaPhase(); + } + + void RenderingManager::skySetMoonColour(bool red) + { + mSky->setMoonColour(red); + } + void RenderingManager::configureAmbient(const ESM::Cell *cell) { setAmbientColour(SceneUtil::colourFromRGB(cell->mAmbi.mAmbient)); @@ -593,6 +613,8 @@ namespace MWRender void RenderingManager::clear() { + mSky->setMoonColour(false); + notifyWorldSpaceChanged(); } diff --git a/apps/openmw/mwrender/renderingmanager.hpp b/apps/openmw/mwrender/renderingmanager.hpp index 302073e4dc..fc2f5a4f38 100644 --- a/apps/openmw/mwrender/renderingmanager.hpp +++ b/apps/openmw/mwrender/renderingmanager.hpp @@ -68,6 +68,11 @@ namespace MWRender void setAmbientColour(const osg::Vec4f& colour); + void skySetDate(int day, int month); + int skyGetMasserPhase() const; + int skyGetSecundaPhase() const; + void skySetMoonColour(bool red); + void setSunDirection(const osg::Vec3f& direction); void setSunColour(const osg::Vec4f& colour); diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp index 07e4332085..4b70c81ab6 100644 --- a/apps/openmw/mwrender/sky.cpp +++ b/apps/openmw/mwrender/sky.cpp @@ -473,7 +473,6 @@ SkyManager::SkyManager(osg::Group* parentNode, Resource::SceneManager* sceneMana , mCreated(false) , mMoonRed(false) , mIsStorm(false) - , mHour(0.0f) , mDay(0) , mMonth(0) , mCloudAnimationTimer(0.f) @@ -886,11 +885,6 @@ void SkyManager::setSecundaFade(const float fade) mSecunda->setAlpha(fade); } -void SkyManager::setHour(double hour) -{ - mHour = static_cast(hour); -} - void SkyManager::setDate(int day, int month) { mDay = day; diff --git a/apps/openmw/mwrender/sky.hpp b/apps/openmw/mwrender/sky.hpp index e11f20c181..f097029d1a 100644 --- a/apps/openmw/mwrender/sky.hpp +++ b/apps/openmw/mwrender/sky.hpp @@ -117,7 +117,6 @@ namespace MWRender bool mIsStorm; - float mHour; int mDay; int mMonth; diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 4743b3ad9d..0d6a8ef47c 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -134,9 +134,8 @@ namespace MWWorld { if (mSky && (isCellExterior() || isCellQuasiExterior())) { - //mRendering->skySetHour (mGlobalVariables["gamehour"].getFloat()); - //mRendering->skySetDate (mGlobalVariables["day"].getInteger(), - // mGlobalVariables["month"].getInteger()); + mRendering->skySetDate (mGlobalVariables["day"].getInteger(), + mGlobalVariables["month"].getInteger()); mRendering->setSkyEnabled(true); } @@ -812,8 +811,6 @@ namespace MWWorld mGlobalVariables["gamehour"].setFloat(static_cast(hour)); - //mRendering->skySetHour (hour); - mWeatherManager->setHour(static_cast(hour)); if (days>0) @@ -849,7 +846,7 @@ namespace MWWorld mGlobalVariables["day"].setInteger (day); mGlobalVariables["month"].setInteger (month); - //mRendering->skySetDate (day, month); + mRendering->skySetDate(day, month); } void World::setMonth (int month) @@ -870,7 +867,7 @@ namespace MWWorld if (years>0) mGlobalVariables["year"].setInteger (years+mGlobalVariables["year"].getInteger()); - //mRendering->skySetDate (mGlobalVariables["day"].getInteger(), month); + mRendering->skySetDate (mGlobalVariables["day"].getInteger(), month); } int World::getDay() const @@ -916,36 +913,24 @@ namespace MWWorld bool World::toggleSky() { -#if 0 - if (mSky) - { - mSky = false; - mRendering->skyDisable(); - return false; - } - else - { - mSky = true; - mRendering->skyEnable(); - return true; - } -#endif - return 0; + mSky = !mSky; + mRendering->setSkyEnabled(mSky); + return mSky; } int World::getMasserPhase() const { - return 0;//mRendering->skyGetMasserPhase(); + return mRendering->skyGetMasserPhase(); } int World::getSecundaPhase() const { - return 0;//mRendering->skyGetSecundaPhase(); + return mRendering->skyGetSecundaPhase(); } void World::setMoonColour (bool red) { - //mRendering->skySetMoonColour (red); + mRendering->skySetMoonColour (red); } float World::getTimeScaleFactor() const