mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-23 16:09:45 +00:00
Add removeTexture method
This commit is contained in:
parent
4b9aff7a03
commit
67f31d948e
1 changed files with 15 additions and 5 deletions
|
@ -269,10 +269,7 @@ namespace MWRender
|
||||||
virtual void setDefaults(osg::StateSet *stateset)
|
virtual void setDefaults(osg::StateSet *stateset)
|
||||||
{
|
{
|
||||||
if (mDone)
|
if (mDone)
|
||||||
{
|
removeTexture(stateset);
|
||||||
stateset->removeTextureAttribute(mTexUnit, osg::StateAttribute::TEXTURE);
|
|
||||||
stateset->removeTextureAttribute(mTexUnit, osg::StateAttribute::TEXGEN);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stateset->setTextureMode(mTexUnit, GL_TEXTURE_2D, osg::StateAttribute::ON);
|
stateset->setTextureMode(mTexUnit, GL_TEXTURE_2D, osg::StateAttribute::ON);
|
||||||
|
@ -293,6 +290,19 @@ namespace MWRender
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void removeTexture(osg::StateSet* stateset)
|
||||||
|
{
|
||||||
|
stateset->removeTextureAttribute(mTexUnit, osg::StateAttribute::TEXTURE);
|
||||||
|
stateset->removeTextureAttribute(mTexUnit, osg::StateAttribute::TEXGEN);
|
||||||
|
stateset->removeTextureAttribute(mTexUnit, osg::StateAttribute::TEXENV);
|
||||||
|
stateset->removeTextureMode(mTexUnit, GL_TEXTURE_2D);
|
||||||
|
stateset->removeUniform("envMapColor");
|
||||||
|
|
||||||
|
osg::StateSet::TextureAttributeList& list = stateset->getTextureAttributeList();
|
||||||
|
while (list.size() && list.rbegin()->empty())
|
||||||
|
list.pop_back();
|
||||||
|
}
|
||||||
|
|
||||||
virtual void apply(osg::StateSet *stateset, osg::NodeVisitor *nv)
|
virtual void apply(osg::StateSet *stateset, osg::NodeVisitor *nv)
|
||||||
{
|
{
|
||||||
if (mColorChanged){
|
if (mColorChanged){
|
||||||
|
@ -315,7 +325,7 @@ namespace MWRender
|
||||||
{
|
{
|
||||||
if (mOriginalDuration >= 0) // if this glowupdater was a temporary glow since its creation
|
if (mOriginalDuration >= 0) // if this glowupdater was a temporary glow since its creation
|
||||||
{
|
{
|
||||||
stateset->removeTextureAttribute(mTexUnit, osg::StateAttribute::TEXTURE);
|
removeTexture(stateset);
|
||||||
this->reset();
|
this->reset();
|
||||||
mDone = true;
|
mDone = true;
|
||||||
mResourceSystem->getSceneManager()->recreateShaders(mNode);
|
mResourceSystem->getSceneManager()->recreateShaders(mNode);
|
||||||
|
|
Loading…
Reference in a new issue