mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-24 21:11:34 +00:00
Revert "avoids creating empty statesets on drawables (#3132)"
This reverts commit 957c25a491
.
This commit is contained in:
parent
b7c1d9edb0
commit
e109d86489
2 changed files with 11 additions and 10 deletions
|
@ -486,7 +486,6 @@ namespace MWRender
|
||||||
defaultMat->setDiffuse(osg::Material::FRONT_AND_BACK, osg::Vec4f(1,1,1,1));
|
defaultMat->setDiffuse(osg::Material::FRONT_AND_BACK, osg::Vec4f(1,1,1,1));
|
||||||
defaultMat->setSpecular(osg::Material::FRONT_AND_BACK, osg::Vec4f(0.f, 0.f, 0.f, 0.f));
|
defaultMat->setSpecular(osg::Material::FRONT_AND_BACK, osg::Vec4f(0.f, 0.f, 0.f, 0.f));
|
||||||
sceneRoot->getOrCreateStateSet()->setAttribute(defaultMat);
|
sceneRoot->getOrCreateStateSet()->setAttribute(defaultMat);
|
||||||
sceneRoot->getOrCreateStateSet()->addUniform(new osg::Uniform("emissiveMult", 1.f));
|
|
||||||
|
|
||||||
mFog.reset(new FogManager());
|
mFog.reset(new FogManager());
|
||||||
|
|
||||||
|
|
|
@ -1134,6 +1134,8 @@ namespace NifOsg
|
||||||
trans->addChild(toAttach);
|
trans->addChild(toAttach);
|
||||||
parentNode->addChild(trans);
|
parentNode->addChild(trans);
|
||||||
}
|
}
|
||||||
|
// create partsys stateset in order to pass in ShaderVisitor like all other Drawables
|
||||||
|
partsys->getOrCreateStateSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleNiGeometryData(osg::Geometry *geometry, const Nif::NiGeometryData* data, const std::vector<unsigned int>& boundTextures, const std::string& name)
|
void handleNiGeometryData(osg::Geometry *geometry, const Nif::NiGeometryData* data, const std::vector<unsigned int>& boundTextures, const std::string& name)
|
||||||
|
@ -1921,6 +1923,8 @@ namespace NifOsg
|
||||||
void applyDrawableProperties(osg::Node* node, const std::vector<const Nif::Property*>& properties, SceneUtil::CompositeStateSetUpdater* composite,
|
void applyDrawableProperties(osg::Node* node, const std::vector<const Nif::Property*>& properties, SceneUtil::CompositeStateSetUpdater* composite,
|
||||||
bool hasVertexColors, int animflags)
|
bool hasVertexColors, int animflags)
|
||||||
{
|
{
|
||||||
|
osg::StateSet* stateset = node->getOrCreateStateSet();
|
||||||
|
|
||||||
// Specular lighting is enabled by default, but there's a quirk...
|
// Specular lighting is enabled by default, but there's a quirk...
|
||||||
bool specEnabled = true;
|
bool specEnabled = true;
|
||||||
osg::ref_ptr<osg::Material> mat (new osg::Material);
|
osg::ref_ptr<osg::Material> mat (new osg::Material);
|
||||||
|
@ -2002,15 +2006,15 @@ namespace NifOsg
|
||||||
if (blendFunc->getDestination() == GL_DST_ALPHA)
|
if (blendFunc->getDestination() == GL_DST_ALPHA)
|
||||||
blendFunc->setDestination(GL_ONE);
|
blendFunc->setDestination(GL_ONE);
|
||||||
blendFunc = shareAttribute(blendFunc);
|
blendFunc = shareAttribute(blendFunc);
|
||||||
node->getOrCreateStateSet()->setAttributeAndModes(blendFunc, osg::StateAttribute::ON);
|
stateset->setAttributeAndModes(blendFunc, osg::StateAttribute::ON);
|
||||||
|
|
||||||
bool noSort = (alphaprop->flags>>13)&1;
|
bool noSort = (alphaprop->flags>>13)&1;
|
||||||
if (!noSort)
|
if (!noSort)
|
||||||
node->getOrCreateStateSet()->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
|
stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
|
||||||
else
|
else
|
||||||
node->getOrCreateStateSet()->setRenderBinToInherit();
|
stateset->setRenderBinToInherit();
|
||||||
}
|
}
|
||||||
else if (osg::StateSet* stateset = node->getStateSet())
|
else
|
||||||
{
|
{
|
||||||
stateset->removeAttribute(osg::StateAttribute::BLENDFUNC);
|
stateset->removeAttribute(osg::StateAttribute::BLENDFUNC);
|
||||||
stateset->removeMode(GL_BLEND);
|
stateset->removeMode(GL_BLEND);
|
||||||
|
@ -2021,9 +2025,9 @@ namespace NifOsg
|
||||||
{
|
{
|
||||||
osg::ref_ptr<osg::AlphaFunc> alphaFunc (new osg::AlphaFunc(getTestMode((alphaprop->flags>>10)&0x7), alphaprop->data.threshold/255.f));
|
osg::ref_ptr<osg::AlphaFunc> alphaFunc (new osg::AlphaFunc(getTestMode((alphaprop->flags>>10)&0x7), alphaprop->data.threshold/255.f));
|
||||||
alphaFunc = shareAttribute(alphaFunc);
|
alphaFunc = shareAttribute(alphaFunc);
|
||||||
node->getOrCreateStateSet()->setAttributeAndModes(alphaFunc, osg::StateAttribute::ON);
|
stateset->setAttributeAndModes(alphaFunc, osg::StateAttribute::ON);
|
||||||
}
|
}
|
||||||
else if (osg::StateSet* stateset = node->getStateSet())
|
else
|
||||||
{
|
{
|
||||||
stateset->removeAttribute(osg::StateAttribute::ALPHAFUNC);
|
stateset->removeAttribute(osg::StateAttribute::ALPHAFUNC);
|
||||||
stateset->removeMode(GL_ALPHA_TEST);
|
stateset->removeMode(GL_ALPHA_TEST);
|
||||||
|
@ -2079,10 +2083,8 @@ namespace NifOsg
|
||||||
|
|
||||||
mat = shareAttribute(mat);
|
mat = shareAttribute(mat);
|
||||||
|
|
||||||
osg::StateSet* stateset = node->getStateSet();
|
|
||||||
stateset->setAttributeAndModes(mat, osg::StateAttribute::ON);
|
stateset->setAttributeAndModes(mat, osg::StateAttribute::ON);
|
||||||
if (emissiveMult != 1.f)
|
stateset->addUniform(new osg::Uniform("emissiveMult", emissiveMult));
|
||||||
stateset->addUniform(new osg::Uniform("emissiveMult", emissiveMult));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue