Merge pull request #68 from OpenMW/master

Use a shader to render the simple water, ensuring that fog is applied…
This commit is contained in:
David Cernat 2016-09-29 03:12:57 +03:00 committed by GitHub
commit ae00f12c87

View file

@ -23,6 +23,7 @@
#include <components/resource/resourcesystem.hpp>
#include <components/resource/imagemanager.hpp>
#include <components/resource/scenemanager.hpp>
#include <components/sceneutil/waterutil.hpp>
@ -507,6 +508,14 @@ void Water::createSimpleWaterStateSet(osg::Node* node, float alpha)
node->setUpdateCallback(controller);
stateset->setTextureAttributeAndModes(0, textures[0], osg::StateAttribute::ON);
// use a shader to render the simple water, ensuring that fog is applied per pixel as required.
// this could be removed if a more detailed water mesh, using some sort of paging solution, is implemented.
Resource::SceneManager* sceneManager = mResourceSystem->getSceneManager();
bool oldValue = sceneManager->getForceShaders();
sceneManager->setForceShaders(true);
sceneManager->recreateShaders(node);
sceneManager->setForceShaders(oldValue);
}
void Water::createShaderWaterStateSet(osg::Node* node, Reflection* reflection, Refraction* refraction)