From 6b3441d2a0d73c723ddfd90bd273b93e06d9d983 Mon Sep 17 00:00:00 2001 From: Benau Date: Fri, 10 Mar 2017 15:40:58 +0800 Subject: [PATCH] Allow reload texture with threads --- src/graphics/stk_tex_manager.cpp | 14 ++++++++++++++ src/graphics/threaded_tex_loader.hpp | 1 - 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/graphics/stk_tex_manager.cpp b/src/graphics/stk_tex_manager.cpp index 29949b0ed..ec0a10031 100644 --- a/src/graphics/stk_tex_manager.cpp +++ b/src/graphics/stk_tex_manager.cpp @@ -250,9 +250,16 @@ core::stringw STKTexManager::reloadTexture(const irr::core::stringw& name) if (p.second == NULL || !p.second->isMeshTexture()) continue; p.second->reload(); + if (p.second->useThreadedLoading()) + { + m_all_tex_loaders[m_tlt_added++ % m_thread_size] + ->addTexture(p.second); + uploadBatch(); + } Log::info("STKTexManager", "%s reloaded", p.second->getName().getPtr()); } + m_tlt_added = 0; return L"All textures reloaded."; } @@ -272,11 +279,18 @@ core::stringw STKTexManager::reloadTexture(const irr::core::stringw& name) if (fname == tex_name || fname == tex_path) { p.second->reload(); + if (p.second->useThreadedLoading()) + { + m_all_tex_loaders[m_tlt_added++ % m_thread_size] + ->addTexture(p.second); + uploadBatch(); + } result += tex_name.c_str(); result += L" "; break; } } + m_tlt_added = 0; } if (result.empty()) return L"Texture(s) not found!"; diff --git a/src/graphics/threaded_tex_loader.hpp b/src/graphics/threaded_tex_loader.hpp index 91c4225ac..ccd27d310 100644 --- a/src/graphics/threaded_tex_loader.hpp +++ b/src/graphics/threaded_tex_loader.hpp @@ -25,7 +25,6 @@ #include class STKTexture; -class STKTexManager; class ThreadedTexLoader : public NoCopy {