Change default depth test mode to <= (#7040)

master
Alexei Kotov 1 month ago
parent cf3badb8a4
commit 5433ecf861

@ -69,6 +69,7 @@
Bug #6993: Shooting your last round of ammunition causes the attack animation to cancel
Bug #7009: Falling actors teleport to the ground without receiving any damage on cell loading
Bug #7034: Misc items defined in one content file are not treated as keys if another content file uses them as such
Bug #7040: Incorrect rendering order for Rebirth's Stormfang
Bug #7042: Weapon follow animations that immediately follow the hit animations cause multiple hits
Bug #7044: Changing a class' services does not affect autocalculated NPCs
Bug #7053: Running into objects doesn't trigger GetCollidingPC

@ -221,6 +221,7 @@ osg::Group {
AttributeList 1 {
osg::Depth {
UniqueID 10
Function LEQUAL
}
Value OFF
}

@ -885,12 +885,11 @@ namespace MWRender
osg::StateSet* queryStateSet = new osg::StateSet;
if (queryVisible)
{
osg::ref_ptr<osg::Depth> depth = new SceneUtil::AutoDepth(osg::Depth::LEQUAL);
osg::ref_ptr<osg::Depth> depth = new SceneUtil::AutoDepth;
// This is a trick to make fragments written by the query always use the maximum depth value,
// without having to retrieve the current far clipping distance.
// We want the sun glare to be "infinitely" far away.
double far = SceneUtil::AutoDepth::isReversed() ? 0.0 : 1.0;
depth->setFunction(osg::Depth::LEQUAL);
depth->setZNear(far);
depth->setZFar(far);
depth->setWriteMask(false);

@ -33,7 +33,6 @@
#include <osg/AlphaFunc>
#include <osg/BlendFunc>
#include <osg/Depth>
#include <osg/FrontFace>
#include <osg/Material>
#include <osg/PolygonMode>
@ -2011,7 +2010,7 @@ namespace NifOsg
stateset->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
return;
}
osg::ref_ptr<osg::Depth> depth = new osg::Depth;
osg::ref_ptr<osg::Depth> depth = new SceneUtil::AutoDepth;
depth->setWriteMask(depthWrite);
if (!depthTest)
depth->setFunction(osg::Depth::ALWAYS);

@ -275,14 +275,14 @@ namespace Resource
{
if (stateset->getRenderingHint() == osg::StateSet::TRANSPARENT_BIN)
{
osg::ref_ptr<osg::Depth> depth = new osg::Depth;
osg::ref_ptr<osg::Depth> depth = new SceneUtil::AutoDepth;
depth->setWriteMask(false);
stateset->setAttributeAndModes(depth, osg::StateAttribute::ON);
}
else if (stateset->getRenderingHint() == osg::StateSet::OPAQUE_BIN)
{
osg::ref_ptr<osg::Depth> depth = new osg::Depth;
osg::ref_ptr<osg::Depth> depth = new SceneUtil::AutoDepth;
depth->setWriteMask(true);
stateset->setAttributeAndModes(depth, osg::StateAttribute::ON);

@ -64,7 +64,9 @@ namespace SceneUtil
{
public:
AutoDepth(
osg::Depth::Function func = osg::Depth::LESS, double zNear = 0.0, double zFar = 1.0, bool writeMask = true)
// NB: OSG uses LESS test function by default, Morrowind uses LEQUAL
osg::Depth::Function func = osg::Depth::LEQUAL, double zNear = 0.0, double zFar = 1.0,
bool writeMask = true)
{
setFunction(func);
setZNear(zNear);

@ -18,7 +18,8 @@ namespace SceneUtil
{
void setupSoftEffect(osg::Node& node, float size, bool falloff, float falloffDepth)
{
static const osg::ref_ptr<SceneUtil::AutoDepth> depth = new SceneUtil::AutoDepth(osg::Depth::LESS, 0, 1, false);
static const osg::ref_ptr<SceneUtil::AutoDepth> depth
= new SceneUtil::AutoDepth(osg::Depth::LEQUAL, 0, 1, false);
osg::StateSet* stateset = node.getOrCreateStateSet();

Loading…
Cancel
Save