initial reverse-z depth implementation

This commit is contained in:
glassmancody.info 2021-06-01 12:15:25 -07:00
parent 10d100f205
commit 70fac33940
46 changed files with 614 additions and 92 deletions

View file

@ -5,6 +5,8 @@
#include <osg/Material>
#include <osg/StateSet>
#include "util.hpp"
namespace SceneUtil
{
// disable nonsense test against a worldsize bb what will always pass
@ -62,7 +64,7 @@ namespace SceneUtil
return waterGeom;
}
osg::ref_ptr<osg::StateSet> createSimpleWaterStateSet(float alpha, int renderBin)
osg::ref_ptr<osg::StateSet> createSimpleWaterStateSet(float alpha, int renderBin, bool reverseZ)
{
osg::ref_ptr<osg::StateSet> stateset (new osg::StateSet);
@ -76,7 +78,7 @@ namespace SceneUtil
stateset->setMode(GL_BLEND, osg::StateAttribute::ON);
stateset->setMode(GL_CULL_FACE, osg::StateAttribute::OFF);
osg::ref_ptr<osg::Depth> depth (new osg::Depth);
auto depth = createDepth(reverseZ);
depth->setWriteMask(false);
stateset->setAttributeAndModes(depth, osg::StateAttribute::ON);