1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-05 17:45:34 +00:00

Put groundcover alphafunc where shader visitor can see it

I'd already made this change so don't know why it disappeared instead of
being included in b8ee32e3
This commit is contained in:
AnyOldName3 2021-03-12 17:21:36 +00:00
parent 46a1715d8a
commit f09b0fc1bd
2 changed files with 4 additions and 5 deletions

View file

@ -1,5 +1,6 @@
#include "groundcover.hpp" #include "groundcover.hpp"
#include <osg/AlphaFunc>
#include <osg/Geometry> #include <osg/Geometry>
#include <osg/VertexAttribDivisor> #include <osg/VertexAttribDivisor>
@ -265,6 +266,9 @@ namespace MWRender
group->addChild(node); group->addChild(node);
} }
// Force a unified alpha handling instead of data from meshes
osg::ref_ptr<osg::AlphaFunc> alpha = new osg::AlphaFunc(osg::AlphaFunc::GEQUAL, 128.f / 255.f);
group->getOrCreateStateSet()->setAttributeAndModes(alpha.get(), osg::StateAttribute::ON);
group->getBound(); group->getBound();
group->setNodeMask(Mask_Groundcover); group->setNodeMask(Mask_Groundcover);
mSceneManager->recreateShaders(group, "groundcover", false, true); mSceneManager->recreateShaders(group, "groundcover", false, true);

View file

@ -3,7 +3,6 @@
#include <limits> #include <limits>
#include <cstdlib> #include <cstdlib>
#include <osg/AlphaFunc>
#include <osg/Light> #include <osg/Light>
#include <osg/LightModel> #include <osg/LightModel>
#include <osg/Fog> #include <osg/Fog>
@ -312,10 +311,6 @@ namespace MWRender
groundcoverRoot->setName("Groundcover Root"); groundcoverRoot->setName("Groundcover Root");
sceneRoot->addChild(groundcoverRoot); sceneRoot->addChild(groundcoverRoot);
// Force a unified alpha handling instead of data from meshes
osg::ref_ptr<osg::AlphaFunc> alpha = new osg::AlphaFunc(osg::AlphaFunc::GEQUAL, 128.f/255.f);
groundcoverRoot->getOrCreateStateSet()->setAttributeAndModes(alpha.get(), osg::StateAttribute::ON);
mGroundcoverUpdater = new GroundcoverUpdater; mGroundcoverUpdater = new GroundcoverUpdater;
groundcoverRoot->addUpdateCallback(mGroundcoverUpdater); groundcoverRoot->addUpdateCallback(mGroundcoverUpdater);