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