mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-31 07:06:45 +00:00
waterLevel fix
This commit is contained in:
parent
c9d7078b4b
commit
d394b0793f
1 changed files with 5 additions and 16 deletions
|
@ -423,22 +423,6 @@ Water::Water(osg::Group *parent, osg::Group* sceneRoot, Resource::ResourceSystem
|
||||||
|
|
||||||
setHeight(mTop);
|
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();
|
updateWaterMaterial();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -605,6 +589,11 @@ void Water::setHeight(const float height)
|
||||||
osg::Vec3f pos = mWaterNode->getPosition();
|
osg::Vec3f pos = mWaterNode->getPosition();
|
||||||
pos.z() = height;
|
pos.z() = height;
|
||||||
mWaterNode->setPosition(pos);
|
mWaterNode->setPosition(pos);
|
||||||
|
|
||||||
|
if (mReflection)
|
||||||
|
mReflection->setWaterLevel(mTop);
|
||||||
|
if (mRefraction)
|
||||||
|
mRefraction->setWaterLevel(mTop);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Water::update(float dt)
|
void Water::update(float dt)
|
||||||
|
|
Loading…
Reference in a new issue