mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 23:53:52 +00:00
Set default state sensibly
This commit is contained in:
parent
ce2bcba5d4
commit
a080071588
3 changed files with 6 additions and 8 deletions
|
@ -32,6 +32,8 @@
|
||||||
#include <components/resource/imagemanager.hpp>
|
#include <components/resource/imagemanager.hpp>
|
||||||
#include <components/resource/scenemanager.hpp>
|
#include <components/resource/scenemanager.hpp>
|
||||||
#include <components/resource/keyframemanager.hpp>
|
#include <components/resource/keyframemanager.hpp>
|
||||||
|
|
||||||
|
#include <components/shader/removedalphafunc.hpp>
|
||||||
#include <components/shader/shadermanager.hpp>
|
#include <components/shader/shadermanager.hpp>
|
||||||
|
|
||||||
#include <components/settings/settings.hpp>
|
#include <components/settings/settings.hpp>
|
||||||
|
@ -376,6 +378,9 @@ namespace MWRender
|
||||||
mRootNode->getOrCreateStateSet()->addUniform(new osg::Uniform("far", mViewDistance));
|
mRootNode->getOrCreateStateSet()->addUniform(new osg::Uniform("far", mViewDistance));
|
||||||
mRootNode->getOrCreateStateSet()->addUniform(new osg::Uniform("simpleWater", false));
|
mRootNode->getOrCreateStateSet()->addUniform(new osg::Uniform("simpleWater", false));
|
||||||
|
|
||||||
|
// Hopefully, anything genuinely requiring the default alpha func of GL_ALWAYS explicitly sets it
|
||||||
|
mRootNode->getOrCreateStateSet()->setAttribute(Shader::RemovedAlphaFunc::getInstance(GL_GREATER));
|
||||||
|
|
||||||
mUniformNear = mRootNode->getOrCreateStateSet()->getUniform("near");
|
mUniformNear = mRootNode->getOrCreateStateSet()->getUniform("near");
|
||||||
mUniformFar = mRootNode->getOrCreateStateSet()->getUniform("far");
|
mUniformFar = mRootNode->getOrCreateStateSet()->getUniform("far");
|
||||||
updateProjectionMatrix();
|
updateProjectionMatrix();
|
||||||
|
|
|
@ -17,11 +17,4 @@ namespace Shader
|
||||||
sInstances[func - GL_NEVER] = new RemovedAlphaFunc(static_cast<osg::AlphaFunc::ComparisonFunction>(func), 1.0);
|
sInstances[func - GL_NEVER] = new RemovedAlphaFunc(static_cast<osg::AlphaFunc::ComparisonFunction>(func), 1.0);
|
||||||
return sInstances[func - GL_NEVER];
|
return sInstances[func - GL_NEVER];
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemovedAlphaFunc::apply(osg::State & state) const
|
|
||||||
{
|
|
||||||
// Hopefully, anything genuinely requiring the default alpha func of GL_ALWAYS explicitly sets it
|
|
||||||
if (!state.getGlobalDefaultAttribute(ALPHAFUNC)->getType() != getType())
|
|
||||||
state.setGlobalDefaultAttribute(static_cast<const osg::StateAttribute*>(cloneType()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace Shader
|
||||||
|
|
||||||
META_StateAttribute(Shader, RemovedAlphaFunc, ALPHAFUNC);
|
META_StateAttribute(Shader, RemovedAlphaFunc, ALPHAFUNC);
|
||||||
|
|
||||||
void apply(osg::State& state) const override;
|
void apply(osg::State& state) const override {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~RemovedAlphaFunc() = default;
|
virtual ~RemovedAlphaFunc() = default;
|
||||||
|
|
Loading…
Reference in a new issue