mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-02 06:36:39 +00:00
More decal deduplication
This commit is contained in:
parent
32d24e73fe
commit
8325e100df
1 changed files with 7 additions and 9 deletions
|
@ -2209,8 +2209,11 @@ namespace NifOsg
|
||||||
handleDepthFlags(stateset, material->mDepthTest, material->mDepthWrite);
|
handleDepthFlags(stateset, material->mDepthTest, material->mDepthWrite);
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleDecal(bool hasSortAlpha, osg::ref_ptr<osg::StateSet> stateset)
|
void handleDecal(bool enabled, bool hasSortAlpha, osg::Node& node)
|
||||||
{
|
{
|
||||||
|
if (!enabled)
|
||||||
|
return;
|
||||||
|
osg::ref_ptr<osg::StateSet> stateset = node.getOrCreateStateSet();
|
||||||
osg::ref_ptr<osg::PolygonOffset> polygonOffset(new osg::PolygonOffset);
|
osg::ref_ptr<osg::PolygonOffset> polygonOffset(new osg::PolygonOffset);
|
||||||
polygonOffset->setUnits(SceneUtil::AutoDepth::isReversed() ? 1.f : -1.f);
|
polygonOffset->setUnits(SceneUtil::AutoDepth::isReversed() ? 1.f : -1.f);
|
||||||
polygonOffset->setFactor(SceneUtil::AutoDepth::isReversed() ? 0.65f : -0.65f);
|
polygonOffset->setFactor(SceneUtil::AutoDepth::isReversed() ? 0.65f : -0.65f);
|
||||||
|
@ -2279,10 +2282,7 @@ namespace NifOsg
|
||||||
handleAlphaTesting(shaderMat->mAlphaTest, osg::AlphaFunc::GREATER, shaderMat->mAlphaTestThreshold, node);
|
handleAlphaTesting(shaderMat->mAlphaTest, osg::AlphaFunc::GREATER, shaderMat->mAlphaTestThreshold, node);
|
||||||
handleAlphaBlending(shaderMat->mAlphaBlend, shaderMat->mSourceBlendMode, shaderMat->mDestinationBlendMode,
|
handleAlphaBlending(shaderMat->mAlphaBlend, shaderMat->mSourceBlendMode, shaderMat->mDestinationBlendMode,
|
||||||
true, hasSortAlpha, node);
|
true, hasSortAlpha, node);
|
||||||
if (shaderMat->mDecal)
|
handleDecal(shaderMat->mDecal, hasSortAlpha, node);
|
||||||
{
|
|
||||||
handleDecal(hasSortAlpha, node.getOrCreateStateSet());
|
|
||||||
}
|
|
||||||
if (shaderMat->mShaderType == Bgsm::ShaderType::Lighting)
|
if (shaderMat->mShaderType == Bgsm::ShaderType::Lighting)
|
||||||
{
|
{
|
||||||
auto bgsm = static_cast<const Bgsm::BGSMFile*>(shaderMat.get());
|
auto bgsm = static_cast<const Bgsm::BGSMFile*>(shaderMat.get());
|
||||||
|
@ -2794,8 +2794,7 @@ namespace NifOsg
|
||||||
emissiveMult = shaderprop->mEmissiveMult;
|
emissiveMult = shaderprop->mEmissiveMult;
|
||||||
specStrength = shaderprop->mSpecStrength;
|
specStrength = shaderprop->mSpecStrength;
|
||||||
specEnabled = shaderprop->specular();
|
specEnabled = shaderprop->specular();
|
||||||
if (shaderprop->decal())
|
handleDecal(shaderprop->decal(), hasSortAlpha, *node);
|
||||||
handleDecal(hasSortAlpha, node->getOrCreateStateSet());
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Nif::RC_BSEffectShaderProperty:
|
case Nif::RC_BSEffectShaderProperty:
|
||||||
|
@ -2806,8 +2805,7 @@ namespace NifOsg
|
||||||
handleShaderMaterialDrawableProperties(shaderMat, mat, *node, hasSortAlpha);
|
handleShaderMaterialDrawableProperties(shaderMat, mat, *node, hasSortAlpha);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (shaderprop->decal())
|
handleDecal(shaderprop->decal(), hasSortAlpha, *node);
|
||||||
handleDecal(hasSortAlpha, node->getOrCreateStateSet());
|
|
||||||
if (shaderprop->softEffect())
|
if (shaderprop->softEffect())
|
||||||
SceneUtil::setupSoftEffect(
|
SceneUtil::setupSoftEffect(
|
||||||
*node, shaderprop->mFalloffDepth, true, shaderprop->mFalloffDepth);
|
*node, shaderprop->mFalloffDepth, true, shaderprop->mFalloffDepth);
|
||||||
|
|
Loading…
Reference in a new issue