Allow reload texture with threads

This commit is contained in:
Benau 2017-03-10 15:40:58 +08:00
parent ed9b16fe7b
commit 6b3441d2a0
2 changed files with 14 additions and 1 deletions

View File

@ -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!";

View File

@ -25,7 +25,6 @@
#include <vector>
class STKTexture;
class STKTexManager;
class ThreadedTexLoader : public NoCopy
{