mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 06:53:53 +00:00
Merge remote-tracking branch 'filkry/bug640_luminescent_water'
This commit is contained in:
commit
2683aa9503
8 changed files with 17 additions and 14 deletions
|
@ -35,7 +35,7 @@ namespace MWRender
|
|||
vp->setShadowsEnabled(false);
|
||||
vp->setVisibilityMask(RV_Actors + RV_Misc + RV_Statics + RV_StaticsSmall + RV_Terrain + RV_Sky + RV_FirstPerson);
|
||||
vp->setMaterialScheme("water_refraction");
|
||||
vp->setBackgroundColour (Ogre::ColourValue(0.18039, 0.23137, 0.25490));
|
||||
vp->setBackgroundColour (Ogre::ColourValue(0.090195, 0.115685, 0.12745));
|
||||
mRenderTarget->setAutoUpdated(true);
|
||||
mRenderTarget->addListener(this);
|
||||
}
|
||||
|
|
|
@ -522,9 +522,10 @@ void RenderingManager::applyFog (bool underwater)
|
|||
}
|
||||
else
|
||||
{
|
||||
mRendering.getScene()->setFog (FOG_LINEAR, Ogre::ColourValue(0.18039, 0.23137, 0.25490), 0, 0, 1000);
|
||||
mRendering.getViewport()->setBackgroundColour (Ogre::ColourValue(0.18039, 0.23137, 0.25490));
|
||||
mWater->setViewportBackground (Ogre::ColourValue(0.18039, 0.23137, 0.25490));
|
||||
Ogre::ColourValue clv(0.090195, 0.115685, 0.12745);
|
||||
mRendering.getScene()->setFog (FOG_LINEAR, Ogre::ColourValue(clv), 0, 0, 1000);
|
||||
mRendering.getViewport()->setBackgroundColour (Ogre::ColourValue(clv));
|
||||
mWater->setViewportBackground (Ogre::ColourValue(clv));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -631,12 +632,12 @@ void RenderingManager::sunDisable(bool real)
|
|||
}
|
||||
}
|
||||
|
||||
void RenderingManager::setSunDirection(const Ogre::Vector3& direction)
|
||||
void RenderingManager::setSunDirection(const Ogre::Vector3& direction, bool is_moon)
|
||||
{
|
||||
// direction * -1 (because 'direction' is camera to sun vector and not sun to camera),
|
||||
if (mSun) mSun->setDirection(Vector3(-direction.x, -direction.y, -direction.z));
|
||||
|
||||
mSkyManager->setSunDirection(direction);
|
||||
mSkyManager->setSunDirection(direction, is_moon);
|
||||
}
|
||||
|
||||
void RenderingManager::setGlare(bool glare)
|
||||
|
|
|
@ -145,7 +145,7 @@ public:
|
|||
|
||||
void setAmbientColour(const Ogre::ColourValue& colour);
|
||||
void setSunColour(const Ogre::ColourValue& colour);
|
||||
void setSunDirection(const Ogre::Vector3& direction);
|
||||
void setSunDirection(const Ogre::Vector3& direction, bool is_moon);
|
||||
void sunEnable(bool real); ///< @param real whether or not to really disable the sunlight (otherwise just set diffuse to 0)
|
||||
void sunDisable(bool real);
|
||||
|
||||
|
|
|
@ -546,14 +546,14 @@ void SkyManager::sunDisable()
|
|||
mSunEnabled = false;
|
||||
}
|
||||
|
||||
void SkyManager::setSunDirection(const Vector3& direction)
|
||||
void SkyManager::setSunDirection(const Vector3& direction, bool is_moon)
|
||||
{
|
||||
if (!mCreated) return;
|
||||
mSun->setPosition(direction);
|
||||
mSunGlare->setPosition(direction);
|
||||
|
||||
float height = direction.z;
|
||||
float fade = ( height > 0.5) ? 1.0 : height * 2;
|
||||
float fade = is_moon ? 0.0 : (( height > 0.5) ? 1.0 : height * 2);
|
||||
sh::Factory::getInstance ().setSharedParameter ("waterSunFade_sunHeight", sh::makeProperty<sh::Vector2>(new sh::Vector2(fade, height)));
|
||||
}
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ namespace MWRender
|
|||
|
||||
void sunDisable();
|
||||
|
||||
void setSunDirection(const Ogre::Vector3& direction);
|
||||
void setSunDirection(const Ogre::Vector3& direction, bool is_moon);
|
||||
|
||||
void setMasserDirection(const Ogre::Vector3& direction);
|
||||
|
||||
|
|
|
@ -378,11 +378,13 @@ void WeatherManager::update(float duration)
|
|||
|
||||
int facing = (mHour > 13.f) ? 1 : -1;
|
||||
|
||||
bool sun_is_moon = mHour >= mNightStart || mHour <= mSunriseTime;
|
||||
|
||||
Vector3 final(
|
||||
(height - 1) * facing,
|
||||
(height - 1) * facing,
|
||||
height);
|
||||
mRendering->setSunDirection(final);
|
||||
mRendering->setSunDirection(final, sun_is_moon);
|
||||
|
||||
/*
|
||||
* TODO: import separated fadeInStart/Finish, fadeOutStart/Finish
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#define UNDERWATER_COLOUR float3(0.18039, 0.23137, 0.25490)
|
||||
#define UNDERWATER_COLOUR float3(0.090195, 0.115685, 0.12745)
|
||||
|
||||
#define VISIBILITY 1000.0 // how far you can look through water
|
||||
|
||||
|
|
|
@ -351,7 +351,7 @@
|
|||
#if REFRACTION
|
||||
shOutputColour(0).xyz = shLerp( shLerp(refraction, scatterColour, lightScatter), reflection, fresnel) + specular * sunSpecular.xyz;
|
||||
#else
|
||||
shOutputColour(0).xyz = shLerp(reflection, float3(0.18039, 0.23137, 0.25490), (1.0-fresnel)*0.5) + specular * sunSpecular.xyz;
|
||||
shOutputColour(0).xyz = shLerp(reflection, float3(0.090195, 0.115685, 0.12745), (1.0-fresnel)*0.5) + specular * sunSpecular.xyz;
|
||||
#endif
|
||||
// fog
|
||||
float fogValue = shSaturate((depthPassthrough - fogParams.y) * fogParams.w);
|
||||
|
|
Loading…
Reference in a new issue