Skip to content

Commit b555c98

Browse files
committed
Merge branch 'deepasapuddle' into 'master'
Change the default depth test mode from less-than to less-than-or-equal-to (#7040) Closes #7040 See merge request OpenMW/openmw!4464
2 parents 9351a0e + 5433ecf commit b555c98

File tree

7 files changed

+11
-8
lines changed

7 files changed

+11
-8
lines changed

CHANGELOG.md

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

apps/components_tests/nifosg/testnifloader.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ osg::Group {
221221
AttributeList 1 {
222222
osg::Depth {
223223
UniqueID 10
224+
Function LEQUAL
224225
}
225226
Value OFF
226227
}

apps/openmw/mwrender/skyutil.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -885,12 +885,11 @@ namespace MWRender
885885
osg::StateSet* queryStateSet = new osg::StateSet;
886886
if (queryVisible)
887887
{
888-
osg::ref_ptr<osg::Depth> depth = new SceneUtil::AutoDepth(osg::Depth::LEQUAL);
888+
osg::ref_ptr<osg::Depth> depth = new SceneUtil::AutoDepth;
889889
// This is a trick to make fragments written by the query always use the maximum depth value,
890890
// without having to retrieve the current far clipping distance.
891891
// We want the sun glare to be "infinitely" far away.
892892
double far = SceneUtil::AutoDepth::isReversed() ? 0.0 : 1.0;
893-
depth->setFunction(osg::Depth::LEQUAL);
894893
depth->setZNear(far);
895894
depth->setZFar(far);
896895
depth->setWriteMask(false);

components/nifosg/nifloader.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333

3434
#include <osg/AlphaFunc>
3535
#include <osg/BlendFunc>
36-
#include <osg/Depth>
3736
#include <osg/FrontFace>
3837
#include <osg/Material>
3938
#include <osg/PolygonMode>
@@ -2011,7 +2010,7 @@ namespace NifOsg
20112010
stateset->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
20122011
return;
20132012
}
2014-
osg::ref_ptr<osg::Depth> depth = new osg::Depth;
2013+
osg::ref_ptr<osg::Depth> depth = new SceneUtil::AutoDepth;
20152014
depth->setWriteMask(depthWrite);
20162015
if (!depthTest)
20172016
depth->setFunction(osg::Depth::ALWAYS);

components/resource/scenemanager.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -275,14 +275,14 @@ namespace Resource
275275
{
276276
if (stateset->getRenderingHint() == osg::StateSet::TRANSPARENT_BIN)
277277
{
278-
osg::ref_ptr<osg::Depth> depth = new osg::Depth;
278+
osg::ref_ptr<osg::Depth> depth = new SceneUtil::AutoDepth;
279279
depth->setWriteMask(false);
280280

281281
stateset->setAttributeAndModes(depth, osg::StateAttribute::ON);
282282
}
283283
else if (stateset->getRenderingHint() == osg::StateSet::OPAQUE_BIN)
284284
{
285-
osg::ref_ptr<osg::Depth> depth = new osg::Depth;
285+
osg::ref_ptr<osg::Depth> depth = new SceneUtil::AutoDepth;
286286
depth->setWriteMask(true);
287287

288288
stateset->setAttributeAndModes(depth, osg::StateAttribute::ON);

components/sceneutil/depth.hpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ namespace SceneUtil
6464
{
6565
public:
6666
AutoDepth(
67-
osg::Depth::Function func = osg::Depth::LESS, double zNear = 0.0, double zFar = 1.0, bool writeMask = true)
67+
// NB: OSG uses LESS test function by default, Morrowind uses LEQUAL
68+
osg::Depth::Function func = osg::Depth::LEQUAL, double zNear = 0.0, double zFar = 1.0,
69+
bool writeMask = true)
6870
{
6971
setFunction(func);
7072
setZNear(zNear);

components/sceneutil/extradata.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ namespace SceneUtil
1818
{
1919
void setupSoftEffect(osg::Node& node, float size, bool falloff, float falloffDepth)
2020
{
21-
static const osg::ref_ptr<SceneUtil::AutoDepth> depth = new SceneUtil::AutoDepth(osg::Depth::LESS, 0, 1, false);
21+
static const osg::ref_ptr<SceneUtil::AutoDepth> depth
22+
= new SceneUtil::AutoDepth(osg::Depth::LEQUAL, 0, 1, false);
2223

2324
osg::StateSet* stateset = node.getOrCreateStateSet();
2425

0 commit comments

Comments
 (0)