diff --git a/src/client/client.cpp b/src/client/client.cpp index 48097be2e..15979df02 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -1983,7 +1983,7 @@ scene::IAnimatedMesh* Client::getMesh(const std::string &filename, bool cache) return nullptr; mesh->grab(); if (!cache) - m_rendering_engine->get_mesh_cache()->removeMesh(mesh); + m_rendering_engine->removeMesh(mesh); return mesh; } diff --git a/src/client/game.cpp b/src/client/game.cpp index 612072136..8400d7639 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -652,8 +652,6 @@ public: protected: - void extendedResourceCleanup(); - // Basic initialisation bool init(const std::string &map_dir, const std::string &address, u16 port, const SubgameSpec &gamespec); @@ -968,7 +966,7 @@ Game::~Game() delete itemdef_manager; delete draw_control; - extendedResourceCleanup(); + clearTextureNameCache(); g_settings->deregisterChangedCallback("doubletap_jump", &settingChangedCallback, this); @@ -4063,27 +4061,6 @@ void Game::readSettings() ****************************************************************************/ /****************************************************************************/ -void Game::extendedResourceCleanup() -{ - // Extended resource accounting - infostream << "Irrlicht resources after cleanup:" << std::endl; - infostream << "\tRemaining meshes : " - << RenderingEngine::get_mesh_cache()->getMeshCount() << std::endl; - infostream << "\tRemaining textures : " - << driver->getTextureCount() << std::endl; - - for (unsigned int i = 0; i < driver->getTextureCount(); i++) { - irr::video::ITexture *texture = driver->getTextureByIndex(i); - infostream << "\t\t" << i << ":" << texture->getName().getPath().c_str() - << std::endl; - } - - clearTextureNameCache(); - infostream << "\tRemaining materials: " - << driver-> getMaterialRendererCount() - << " (note: irrlicht doesn't support removing renderers)" << std::endl; -} - void Game::showDeathFormspec() { static std::string formspec_str = diff --git a/src/client/renderingengine.cpp b/src/client/renderingengine.cpp index 970bcf95b..da9022477 100644 --- a/src/client/renderingengine.cpp +++ b/src/client/renderingengine.cpp @@ -225,12 +225,17 @@ bool RenderingEngine::print_video_modes() return videomode_list != NULL; } +void RenderingEngine::removeMesh(const irr::scene::IMesh* mesh) +{ + m_device->getSceneManager()->getMeshCache()->removeMesh(mesh); +} + void RenderingEngine::cleanupMeshCache() { auto mesh_cache = m_device->getSceneManager()->getMeshCache(); while (mesh_cache->getMeshCount() != 0) { if (scene::IAnimatedMesh *mesh = mesh_cache->getMeshByIndex(0)) - m_rendering_engine->get_mesh_cache()->removeMesh(mesh); + mesh_cache->removeMesh(mesh); } } diff --git a/src/client/renderingengine.h b/src/client/renderingengine.h index fae431f1f..73b55229e 100644 --- a/src/client/renderingengine.h +++ b/src/client/renderingengine.h @@ -26,6 +26,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "irrlichttypes_extrabloated.h" #include "debug.h" +namespace irr { namespace scene { +class IMesh; +}} class ITextureSource; class Camera; class Client; @@ -58,6 +61,8 @@ public: static bool print_video_modes(); void cleanupMeshCache(); + void removeMesh(const irr::scene::IMesh* mesh); + static RenderingEngine *get_instance() { return s_singleton; } io::IFileSystem *get_filesystem() @@ -71,12 +76,6 @@ public: return s_singleton->m_device->getVideoDriver(); } - static scene::IMeshCache *get_mesh_cache() - { - sanity_check(s_singleton && s_singleton->m_device); - return s_singleton->m_device->getSceneManager()->getMeshCache(); - } - static scene::ISceneManager *get_scene_manager() { sanity_check(s_singleton && s_singleton->m_device);