mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-05 15:55:45 +00:00
unloadUnreferencedMaterials: Properly unload materials instead of removing techniques
This commit is contained in:
parent
83037a1a91
commit
7b2070de5a
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)
|
||||
{
|
||||
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 bool isUnreferenced() = 0;
|
||||
virtual void unreferenceTextures() = 0;
|
||||
virtual void ensureLoaded() = 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);
|
||||
}
|
||||
|
||||
void OgreMaterial::unreferenceTextures()
|
||||
{
|
||||
mMaterial->unload();
|
||||
}
|
||||
|
||||
OgreMaterial::~OgreMaterial()
|
||||
{
|
||||
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 isUnreferenced();
|
||||
virtual void unreferenceTextures();
|
||||
virtual void ensureLoaded();
|
||||
|
||||
virtual void removeAll ();
|
||||
|
Loading…
Reference in New Issue
Block a user