forked from teamnwah/openmw-tes3coop
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)
|
||||
{
|
||||
if (mDone)
|
||||
{
|
||||
stateset->removeTextureAttribute(mTexUnit, osg::StateAttribute::TEXTURE);
|
||||
stateset->removeTextureAttribute(mTexUnit, osg::StateAttribute::TEXGEN);
|
||||
}
|
||||
removeTexture(stateset);
|
||||
else
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (mColorChanged){
|
||||
|
@ -315,7 +325,7 @@ namespace MWRender
|
|||
{
|
||||
if (mOriginalDuration >= 0) // if this glowupdater was a temporary glow since its creation
|
||||
{
|
||||
stateset->removeTextureAttribute(mTexUnit, osg::StateAttribute::TEXTURE);
|
||||
removeTexture(stateset);
|
||||
this->reset();
|
||||
mDone = true;
|
||||
mResourceSystem->getSceneManager()->recreateShaders(mNode);
|
||||
|
|
Loading…
Reference in a new issue