1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-03 21:49:41 +00:00

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)); mWaterNode->setPosition(getSceneNodeCoordinates(store->getCell()->mData.mX, store->getCell()->mData.mY));
else else
mWaterNode->setPosition(osg::Vec3f(0,0,mTop)); 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) void Water::setHeight(const float height)

View file

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