Added OPTIMIZER_TEXTURE_SETTINGS pass to Optimizer, which enables

unref image data after apply, client storage hint.
This commit is contained in:
Robert Osfield
2004-07-12 13:20:18 +00:00
parent 3e5c491f54
commit 6fd4677868
3 changed files with 146 additions and 16 deletions

View File

@@ -242,21 +242,14 @@ public:
{
// search for the existance of any texture object attributes
bool foundTextureState = false;
osg::StateSet::TextureAttributeList& tal = stateset->getTextureAttributeList();
for(osg::StateSet::TextureAttributeList::iterator itr=tal.begin();
itr!=tal.end() && !foundTextureState;
++itr)
for(unsigned int i=0;i<stateset->getTextureAttributeList().size();++i)
{
osg::StateSet::AttributeList& al = *itr;
if (al.count(osg::StateAttribute::TEXTURE)==1)
osg::Texture* texture = dynamic_cast<osg::Texture*>(stateset->getTextureAttribute(i,osg::StateAttribute::TEXTURE));
if (texture)
{
texture->setUnRefImageDataAfterApply(_unrefImageOnApply);
texture->setClientStorageHint(_clientStorageHint);
foundTextureState = true;
osg::Texture* texture = dynamic_cast<osg::Texture*>(al[osg::StateAttribute::TEXTURE].first.get());
if (texture)
{
texture->setUnRefImageDataAfterApply(_unrefImageOnApply);
texture->setClientStorageHint(_clientStorageHint);
}
}
}