Remove some reference to STKTexture

This commit is contained in:
Benau
2021-04-17 13:26:37 +08:00
parent 2ef63f997e
commit f3497a9b3b
4 changed files with 9 additions and 12 deletions

View File

@@ -52,7 +52,6 @@
#include "graphics/sp/sp_texture_manager.hpp"
#include "graphics/stk_text_billboard.hpp"
#include "graphics/stk_tex_manager.hpp"
#include "graphics/stk_texture.hpp"
#include "graphics/sun.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/message_queue.hpp"
@@ -1535,12 +1534,8 @@ void IrrDriver::removeMeshFromCache(scene::IMesh *mesh)
*/
void IrrDriver::removeTexture(video::ITexture *t)
{
STKTexture* stkt = dynamic_cast<STKTexture*>(t);
if (stkt)
{
STKTexManager::getInstance()->removeTexture(stkt);
if (STKTexManager::getInstance()->removeTexture(t))
return;
}
m_video_driver->removeTexture(t);
} // removeTexture

View File

@@ -20,7 +20,6 @@
#include "graphics/skybox.hpp"
#include "graphics/central_settings.hpp"
#include "graphics/irr_driver.hpp"
#include "graphics/stk_texture.hpp"
#include "graphics/texture_shader.hpp"
#include <algorithm>

View File

@@ -19,9 +19,7 @@
#include "config/hardware_stats.hpp"
#include "config/user_config.hpp"
#include "graphics/central_settings.hpp"
#include "graphics/stk_texture.hpp"
#include "graphics/server_dummy_texture.hpp"
#include "graphics/stk_texture.hpp"
#include "guiengine/engine.hpp"
#include "io/file_manager.hpp"
#include "utils/string_utils.hpp"
@@ -129,8 +127,9 @@ video::ITexture* STKTexManager::addTexture(video::ITexture* texture)
} // addTexture
// ----------------------------------------------------------------------------
void STKTexManager::removeTexture(video::ITexture* texture, bool remove_all)
bool STKTexManager::removeTexture(video::ITexture* texture, bool remove_all)
{
bool ret = false;
#ifdef DEBUG
std::vector<std::string> undeleted_texture;
#endif
@@ -150,6 +149,7 @@ void STKTexManager::removeTexture(video::ITexture* texture, bool remove_all)
#endif
p->second->drop();
p = m_all_textures.erase(p);
ret = true;
}
else
{
@@ -157,12 +157,15 @@ void STKTexManager::removeTexture(video::ITexture* texture, bool remove_all)
}
}
#ifdef DEBUG
if (!remove_all) return;
if (!remove_all) return ret;
for (const std::string& s : undeleted_texture)
{
Log::error("STKTexManager", "%s undeleted!", s.c_str());
}
#endif
if (remove_all)
return true;
return ret;
} // removeTexture
// ----------------------------------------------------------------------------

View File

@@ -80,7 +80,7 @@ public:
// ------------------------------------------------------------------------
bool hasTexture(const std::string& path);
// ------------------------------------------------------------------------
void removeTexture(irr::video::ITexture* texture, bool remove_all = false);
bool removeTexture(irr::video::ITexture* texture, bool remove_all = false);
// ------------------------------------------------------------------------
int dumpTextureUsage();
// ------------------------------------------------------------------------