1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-28 08:37:12 +00:00

Use a shader to render the simple water, ensuring that fog is applied per pixel (Fixes #2716)

This commit is contained in:
scrawl 2016-09-28 21:10:44 +02:00
parent 0cf837aa20
commit 85c7d014d3

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)