Merge remote branch 'scrawl/water'

actorid
Marc Zinnschlag 13 years ago
commit e17a09e710

@ -10,7 +10,7 @@ namespace MWRender
Water::Water (Ogre::Camera *camera, SkyManager* sky, const ESM::Cell* cell) :
mCamera (camera), mViewport (camera->getViewport()), mSceneManager (camera->getSceneManager()),
mIsUnderwater(false), mReflectDistance(0), mVisibilityFlags(0), mOldCameraFarClip(0),
mIsUnderwater(false), mVisibilityFlags(0),
mReflectionTarget(0), mActive(1)
{
mSky = sky;
@ -38,7 +38,6 @@ Water::Water (Ogre::Camera *camera, SkyManager* sky, const ESM::Cell* cell) :
+ RV_Actors * Settings::Manager::getBool("reflect actors", "Water")
+ RV_Misc * Settings::Manager::getBool("reflect misc", "Water")
+ RV_Sky;
mReflectDistance = Settings::Manager::getInt("reflect distance", "Water");
mWaterNode = mSceneManager->getRootSceneNode()->createChildSceneNode();
mWaterNode->setPosition(0, mTop, 0);
@ -73,6 +72,8 @@ Water::Water (Ogre::Camera *camera, SkyManager* sky, const ESM::Cell* cell) :
createMaterial();
mWater->setMaterial(mMaterial);
mUnderwaterEffect = Settings::Manager::getBool("underwater effect", "Water");
}
void Water::setActive(bool active)
@ -120,9 +121,7 @@ void Water::checkUnderwater(float y)
if (!mActive) return;
if ((mIsUnderwater && y > mTop) || !mWater->isVisible() || mCamera->getPolygonMode() != Ogre::PM_SOLID)
{
try {
CompositorManager::getSingleton().setCompositorEnabled(mViewport, mCompositorName, false);
} catch(...) {}
CompositorManager::getSingleton().setCompositorEnabled(mViewport, mCompositorName, false);
// tell the shader we are not underwater
Ogre::Pass* pass = mMaterial->getTechnique(0)->getPass(0);
@ -139,9 +138,8 @@ void Water::checkUnderwater(float y)
if (!mIsUnderwater && y < mTop && mWater->isVisible() && mCamera->getPolygonMode() == Ogre::PM_SOLID)
{
try {
if (mUnderwaterEffect)
CompositorManager::getSingleton().setCompositorEnabled(mViewport, mCompositorName, true);
} catch(...) {}
// tell the shader we are underwater
Ogre::Pass* pass = mMaterial->getTechnique(0)->getPass(0);
@ -164,10 +162,6 @@ Vector3 Water::getSceneNodeCoordinates(int gridX, int gridY)
void Water::preRenderTargetUpdate(const RenderTargetEvent& evt)
{
//mOldCameraFarClip = mCamera->getFarClipDistance();
//if (mReflectDistance != 0)
// mCamera->setFarClipDistance(mReflectDistance);
if (evt.source == mReflectionTarget)
{
mWater->setVisible(false);
@ -189,8 +183,6 @@ void Water::postRenderTargetUpdate(const RenderTargetEvent& evt)
{
mWater->setVisible(true);
//mCamera->setFarClipDistance(mOldCameraFarClip);
if (evt.source == mReflectionTarget)
{
mSky->resetSkyPosition();

@ -41,9 +41,8 @@ namespace MWRender {
Ogre::RenderTarget* mReflectionTarget;
bool mUnderwaterEffect;
int mVisibilityFlags;
int mReflectDistance;
int mOldCameraFarClip;
public:
Water (Ogre::Camera *camera, SkyManager* sky, const ESM::Cell* cell);

@ -11,8 +11,11 @@ compositor gbuffer
input none
pass clear
{
// make sure to set this to the viewport background color from outside
colour_value 0 0 0 1
clear
{
// make sure to set this to the viewport background color from outside
colour_value 0 0 0 1
}
}
pass render_scene
{
@ -56,8 +59,11 @@ compositor gbufferFinalizer
shadows off
pass clear
{
buffers colour
colour_value 0 0 0 0
clear
{
buffers colour
colour_value 0 0 0 0
}
}
pass render_quad
{
@ -75,6 +81,9 @@ compositor gbufferFinalizer
input none
pass clear
{
clear
{
}
}
pass render_quad
{

@ -71,6 +71,9 @@ reflect actors = true
reflect misc = false
# Enable underwater effect. It is not resource intensive, so only disable it if you have problems.
underwater effect = true
[Sound]
# Device name. Blank means default
device =

@ -116,6 +116,6 @@ void main_fp
oColor.xyz = lerp(oColor.xyz, float3(0, 0.65, 0.65), saturate(isUnderwater * (iDepth / 2000.f))); // underwater fog
// add fog
float fogValue = saturate((iDepth - fogParams.y) * fogParams.w);
oColor.xyz = lerp(oColor.xyz, fogColour, fogValue);
//float fogValue = saturate((iDepth - fogParams.y) * fogParams.w);
//oColor.xyz = lerp(oColor.xyz, fogColour, fogValue);
}

@ -59,8 +59,8 @@ material Water
fragment_program_ref Water_FP
{
param_named_auto time time 0.1
param_named_auto fogColour fog_colour
param_named_auto fogParams fog_params
//param_named_auto fogColour fog_colour
//param_named_auto fogParams fog_params
param_named_auto renderTargetFlipping render_target_flipping
param_named_auto far far_clip_distance
param_named_auto lightPosObjSpace0 light_position_object_space 0

Loading…
Cancel
Save