unloadUnreferencedMaterials: Properly unload materials instead of removing techniques

deque
scrawl 11 years ago
parent 83037a1a91
commit 7b2070de5a

@ -803,7 +803,7 @@ namespace sh
for (MaterialMap::iterator it = mMaterials.begin(); it != mMaterials.end(); ++it)
{
if (it->second.getMaterial()->isUnreferenced())
it->second.destroyAll();
it->second.getMaterial()->unreferenceTextures();
}
}

@ -69,6 +69,7 @@ namespace sh
virtual void removeAll () = 0; ///< remove all configurations
virtual bool isUnreferenced() = 0;
virtual void unreferenceTextures() = 0;
virtual void ensureLoaded() = 0;
virtual void setLodLevels (const std::string& lodLevels) = 0;

@ -35,6 +35,11 @@ namespace sh
return (!mMaterial.isNull() && mMaterial.useCount() <= Ogre::ResourceGroupManager::RESOURCE_SYSTEM_NUM_REFERENCE_COUNTS+1);
}
void OgreMaterial::unreferenceTextures()
{
mMaterial->unload();
}
OgreMaterial::~OgreMaterial()
{
if (!mMaterial.isNull())

@ -19,6 +19,7 @@ namespace sh
virtual bool createConfiguration (const std::string& name, unsigned short lodIndex);
virtual bool isUnreferenced();
virtual void unreferenceTextures();
virtual void ensureLoaded();
virtual void removeAll ();

Loading…
Cancel
Save