forked from mirror/openmw-tes3mp
unloadUnreferencedMaterials: Properly unload materials instead of removing techniques
This commit is contained in:
parent
83037a1a91
commit
7b2070de5a
4 changed files with 8 additions and 1 deletions
2
extern/shiny/Main/Factory.cpp
vendored
2
extern/shiny/Main/Factory.cpp
vendored
|
@ -803,7 +803,7 @@ namespace sh
|
||||||
for (MaterialMap::iterator it = mMaterials.begin(); it != mMaterials.end(); ++it)
|
for (MaterialMap::iterator it = mMaterials.begin(); it != mMaterials.end(); ++it)
|
||||||
{
|
{
|
||||||
if (it->second.getMaterial()->isUnreferenced())
|
if (it->second.getMaterial()->isUnreferenced())
|
||||||
it->second.destroyAll();
|
it->second.getMaterial()->unreferenceTextures();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1
extern/shiny/Main/Platform.hpp
vendored
1
extern/shiny/Main/Platform.hpp
vendored
|
@ -69,6 +69,7 @@ namespace sh
|
||||||
virtual void removeAll () = 0; ///< remove all configurations
|
virtual void removeAll () = 0; ///< remove all configurations
|
||||||
|
|
||||||
virtual bool isUnreferenced() = 0;
|
virtual bool isUnreferenced() = 0;
|
||||||
|
virtual void unreferenceTextures() = 0;
|
||||||
virtual void ensureLoaded() = 0;
|
virtual void ensureLoaded() = 0;
|
||||||
|
|
||||||
virtual void setLodLevels (const std::string& lodLevels) = 0;
|
virtual void setLodLevels (const std::string& lodLevels) = 0;
|
||||||
|
|
5
extern/shiny/Platforms/Ogre/OgreMaterial.cpp
vendored
5
extern/shiny/Platforms/Ogre/OgreMaterial.cpp
vendored
|
@ -35,6 +35,11 @@ namespace sh
|
||||||
return (!mMaterial.isNull() && mMaterial.useCount() <= Ogre::ResourceGroupManager::RESOURCE_SYSTEM_NUM_REFERENCE_COUNTS+1);
|
return (!mMaterial.isNull() && mMaterial.useCount() <= Ogre::ResourceGroupManager::RESOURCE_SYSTEM_NUM_REFERENCE_COUNTS+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OgreMaterial::unreferenceTextures()
|
||||||
|
{
|
||||||
|
mMaterial->unload();
|
||||||
|
}
|
||||||
|
|
||||||
OgreMaterial::~OgreMaterial()
|
OgreMaterial::~OgreMaterial()
|
||||||
{
|
{
|
||||||
if (!mMaterial.isNull())
|
if (!mMaterial.isNull())
|
||||||
|
|
1
extern/shiny/Platforms/Ogre/OgreMaterial.hpp
vendored
1
extern/shiny/Platforms/Ogre/OgreMaterial.hpp
vendored
|
@ -19,6 +19,7 @@ namespace sh
|
||||||
virtual bool createConfiguration (const std::string& name, unsigned short lodIndex);
|
virtual bool createConfiguration (const std::string& name, unsigned short lodIndex);
|
||||||
|
|
||||||
virtual bool isUnreferenced();
|
virtual bool isUnreferenced();
|
||||||
|
virtual void unreferenceTextures();
|
||||||
virtual void ensureLoaded();
|
virtual void ensureLoaded();
|
||||||
|
|
||||||
virtual void removeAll ();
|
virtual void removeAll ();
|
||||||
|
|
Loading…
Reference in a new issue