mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-31 04:06:40 +00:00
Handle DoubleSided and TreeAnim flags in BSLightingShaderProperty.
This commit is contained in:
parent
fd90a8c9b4
commit
788a4d32aa
4 changed files with 17 additions and 1 deletions
|
@ -172,6 +172,7 @@ namespace MWRender
|
|||
stateset->addUniform(new osg::Uniform("isReflection", false));
|
||||
stateset->addUniform(new osg::Uniform("windSpeed", 0.0f));
|
||||
stateset->addUniform(new osg::Uniform("playerPos", osg::Vec3f(0.f, 0.f, 0.f)));
|
||||
stateset->addUniform(new osg::Uniform("useTreeAnim", false));
|
||||
}
|
||||
|
||||
void apply(osg::StateSet* stateset, osg::NodeVisitor* nv) override
|
||||
|
|
|
@ -138,6 +138,9 @@ namespace Nif
|
|||
unsigned int type{ 0u }, flags1{ 0u }, flags2{ 0u };
|
||||
float envMapIntensity{ 0.f };
|
||||
void read(NIFStream* nif) override;
|
||||
|
||||
bool doubleSided() const { return (flags2 >> 4) & 1; }
|
||||
bool treeAnim() const { return (flags2 >> 29) & 1; }
|
||||
};
|
||||
|
||||
struct BSShaderLightingProperty : public BSShaderProperty
|
||||
|
|
|
@ -2150,6 +2150,8 @@ namespace NifOsg
|
|||
textureSet, texprop->clamp, node->getName(), stateset, imageManager, boundTextures);
|
||||
}
|
||||
handleTextureControllers(texprop, composite, imageManager, stateset, animflags);
|
||||
if (texprop->doubleSided())
|
||||
stateset->setMode(GL_CULL_FACE, osg::StateAttribute::OFF);
|
||||
break;
|
||||
}
|
||||
case Nif::RC_BSShaderNoLightingProperty:
|
||||
|
@ -2190,6 +2192,8 @@ namespace NifOsg
|
|||
stateset->addUniform(new osg::Uniform("useFalloff", false));
|
||||
}
|
||||
handleTextureControllers(texprop, composite, imageManager, stateset, animflags);
|
||||
if (texprop->doubleSided())
|
||||
stateset->setMode(GL_CULL_FACE, osg::StateAttribute::OFF);
|
||||
break;
|
||||
}
|
||||
case Nif::RC_BSLightingShaderProperty:
|
||||
|
@ -2203,6 +2207,10 @@ namespace NifOsg
|
|||
handleTextureSet(texprop->mTextureSet.getPtr(), texprop->mClamp, node->getName(), stateset,
|
||||
imageManager, boundTextures);
|
||||
handleTextureControllers(texprop, composite, imageManager, stateset, animflags);
|
||||
if (texprop->doubleSided())
|
||||
stateset->setMode(GL_CULL_FACE, osg::StateAttribute::OFF);
|
||||
if (texprop->treeAnim())
|
||||
stateset->addUniform(new osg::Uniform("useTreeAnim", true));
|
||||
break;
|
||||
}
|
||||
case Nif::RC_BSEffectShaderProperty:
|
||||
|
@ -2253,6 +2261,8 @@ namespace NifOsg
|
|||
stateset->addUniform(new osg::Uniform("useFalloff", false)); // Should use the shader flag
|
||||
stateset->addUniform(new osg::Uniform("falloffParams", texprop->mFalloffParams));
|
||||
handleTextureControllers(texprop, composite, imageManager, stateset, animflags);
|
||||
if (texprop->doubleSided())
|
||||
stateset->setMode(GL_CULL_FACE, osg::StateAttribute::OFF);
|
||||
break;
|
||||
}
|
||||
// unused by mw
|
||||
|
|
|
@ -38,6 +38,7 @@ uniform float far;
|
|||
uniform float alphaRef;
|
||||
uniform float emissiveMult;
|
||||
uniform float specStrength;
|
||||
uniform bool useTreeAnim;
|
||||
|
||||
#include "lib/light/lighting.glsl"
|
||||
#include "lib/material/alpha.glsl"
|
||||
|
@ -58,7 +59,8 @@ void main()
|
|||
#endif
|
||||
|
||||
vec4 diffuseColor = getDiffuseColor();
|
||||
gl_FragData[0].a *= diffuseColor.a;
|
||||
if (!useTreeAnim)
|
||||
gl_FragData[0].a *= diffuseColor.a;
|
||||
gl_FragData[0].a = alphaTest(gl_FragData[0].a, alphaRef);
|
||||
|
||||
#if @normalMap
|
||||
|
|
Loading…
Reference in a new issue