From d394b0793f8b9918d2b5f0a74533877229f3b7fb Mon Sep 17 00:00:00 2001 From: scrawl Date: Wed, 28 Oct 2015 23:31:59 +0100 Subject: [PATCH] waterLevel fix --- apps/openmw/mwrender/water.cpp | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/apps/openmw/mwrender/water.cpp b/apps/openmw/mwrender/water.cpp index 8ab29c3a72..f1ec66f4ba 100644 --- a/apps/openmw/mwrender/water.cpp +++ b/apps/openmw/mwrender/water.cpp @@ -423,22 +423,6 @@ Water::Water(osg::Group *parent, osg::Group* sceneRoot, Resource::ResourceSystem setHeight(mTop); - const float waterLevel = -1; - - // refraction - mRefraction = new Refraction(); - mRefraction->setWaterLevel(waterLevel); - mRefraction->setScene(mSceneRoot); - mParent->addChild(mRefraction); - - // reflection - mReflection = new Reflection(); - mReflection->setWaterLevel(waterLevel); - mReflection->setScene(mSceneRoot); - mParent->addChild(mReflection); - - createShaderWaterStateSet(mWaterGeode, mReflection, mRefraction); - updateWaterMaterial(); } @@ -605,6 +589,11 @@ void Water::setHeight(const float height) osg::Vec3f pos = mWaterNode->getPosition(); pos.z() = height; mWaterNode->setPosition(pos); + + if (mReflection) + mReflection->setWaterLevel(mTop); + if (mRefraction) + mRefraction->setWaterLevel(mTop); } void Water::update(float dt)