Water: fix world UV coords

This commit is contained in:
scrawl 2015-10-28 19:11:32 +01:00
parent 9f2f503d37
commit d485dd0782
2 changed files with 7 additions and 2 deletions

View file

@ -458,6 +458,11 @@ void Water::changeCell(const MWWorld::CellStore* store)
mWaterNode->setPosition(getSceneNodeCoordinates(store->getCell()->mData.mX, store->getCell()->mData.mY));
else
mWaterNode->setPosition(osg::Vec3f(0,0,mTop));
// create a new StateSet to prevent threading issues
osg::ref_ptr<osg::StateSet> nodeStateSet (new osg::StateSet);
nodeStateSet->addUniform(new osg::Uniform("nodePosition", osg::Vec3f(mWaterNode->getPosition())));
mWaterNode->setStateSet(nodeStateSet);
}
void Water::setHeight(const float height)

View file

@ -70,11 +70,11 @@ uniform float osg_SimulationTime;
uniform float near;
uniform float far;
uniform vec3 nodePosition;
void main(void)
{
// FIXME
vec3 worldPos = position.xyz; // ((wMat) * ( position)).xyz;
vec3 worldPos = position.xyz + nodePosition.xyz;
vec2 UV = worldPos.xy / (8192.0*5.0) * 3.0;
UV.y *= -1.0;