diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 1e2a8383a..da50af3e4 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -20,7 +20,7 @@ using namespace Ogre; namespace MWRender { RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const boost::filesystem::path& resDir, OEngine::Physic::PhysicEngine* engine, MWWorld::Environment& environment) -:mRendering(_rend), mObjects(mRendering), mActors(mRendering, environment), mDebugging(engine) +:mRendering(_rend), mObjects(mRendering), mActors(mRendering, environment), mAmbientMode(0), mDebugging(engine) { mRendering.createScene("PlayerCam", 55, 5); @@ -280,4 +280,22 @@ void RenderingManager::skipAnimation (const MWWorld::Ptr& ptr) mActors.skipAnimation(ptr); } +void RenderingManager::setSunColour(const Ogre::ColourValue& colour) +{ + mSun->setDiffuseColour(colour); +} +void RenderingManager::sunEnable() +{ + /// \todo +} +void RenderingManager::sunDisable() +{ + /// \todo } + +void RenderingManager::setSunDirection(const Ogre::Vector3& direction) +{ + /// \todo +} + +} // namespace diff --git a/apps/openmw/mwrender/renderingmanager.hpp b/apps/openmw/mwrender/renderingmanager.hpp index 3ca677eac..1b5e23964 100644 --- a/apps/openmw/mwrender/renderingmanager.hpp +++ b/apps/openmw/mwrender/renderingmanager.hpp @@ -86,7 +86,12 @@ class RenderingManager: private RenderingInterface { void moveObjectToCell (const MWWorld::Ptr& ptr, const Ogre::Vector3& position, MWWorld::Ptr::CellStore *store); void update (float duration); - + + void setSunColour(const Ogre::ColourValue& colour); + void setSunDirection(const Ogre::Vector3& direction); + void sunEnable(); + void sunDisable(); + void skyEnable (); void skyDisable (); void skySetHour (double hour); diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp index 74375c21d..5f24cc584 100644 --- a/apps/openmw/mwrender/sky.cpp +++ b/apps/openmw/mwrender/sky.cpp @@ -14,7 +14,7 @@ using namespace MWRender; using namespace Ogre; // the speed at which the clouds are animated -#define CLOUD_SPEED 0.0025 +#define CLOUD_SPEED 0.001 // this distance has to be set accordingly so that the // celestial bodies are behind the clouds, but in front of the atmosphere @@ -371,11 +371,12 @@ SkyManager::SkyManager (SceneNode* pMwRoot, Camera* pCamera) " uniform sampler2D secondTexture : TEXUNIT1, \n" " uniform float transitionFactor, \n" " uniform float time, \n" + " uniform float speed, \n" " uniform float opacity, \n" " uniform float4 emissive \n" ") \n" "{ \n" - " uv += float2(1,1) * time * "<getTechnique(0)->getPass(0)->setSelfIllumination(weather.mSkyColor); mSkyColour = weather.mSkyColor; } + + if (mCloudSpeed != weather.mCloudSpeed) + { + mCloudMaterial->getTechnique(0)->getPass(0)->getFragmentProgramParameters()->setNamedConstant("speed", Real(weather.mCloudSpeed)); + mCloudSpeed = weather.mCloudSpeed; + } mViewport->setBackgroundColour(weather.mFogColor); + + /// \todo + // only set ambient light if we're in an exterior cell + // (interior cell lights are not managed by SkyManager) + mSceneMgr->setAmbientLight(weather.mAmbientColor); } diff --git a/apps/openmw/mwrender/sky.hpp b/apps/openmw/mwrender/sky.hpp index 149fa3d83..1d50067d5 100644 --- a/apps/openmw/mwrender/sky.hpp +++ b/apps/openmw/mwrender/sky.hpp @@ -144,10 +144,11 @@ namespace MWRender Ogre::String mNextClouds; float mCloudBlendFactor; float mCloudOpacity; + float mCloudSpeed; Ogre::ColourValue mCloudColour; Ogre::ColourValue mSkyColour; - + float mRemainingTransitionTime; void ModVertexAlpha(Ogre::Entity* ent, unsigned int meshType); diff --git a/apps/openmw/mwworld/weather.cpp b/apps/openmw/mwworld/weather.cpp index facdbf7e9..57b12c0c5 100644 --- a/apps/openmw/mwworld/weather.cpp +++ b/apps/openmw/mwworld/weather.cpp @@ -113,11 +113,6 @@ WeatherResult WeatherManager::getResult(const String& weather) result.mGlareView = current.mGlareView; result.mAmbientLoopSoundID = current.mAmbientLoopSoundID; - const float dayTime = 13.f; - const float nightTime = 1.f; - - float factor; - /// \todo interpolation // night @@ -215,6 +210,8 @@ void WeatherManager::update(float duration) result = getResult(mCurrentWeather); mRendering->getSkyManager()->setWeather(result); + + mRendering->setSunColour(result.mSunColor); } void WeatherManager::setHour(const float hour) @@ -227,7 +224,7 @@ void WeatherManager::setHour(const float hour) #include std::cout << "hour " << mHour << std::endl; - /**/ + */ mHour = hour; }