Working on loading
This commit is contained in:
1 parent
d38a75ea72
commit
9b71ee447a
11 files changed
+268
-55
No files matched your search
@@ -553,4 +553,26 @@ namespace FRG
|
||||
textureMap.clear();
|
||||
}
|
||||
|
||||
void TextureManager::MarkAllResident()
|
||||
{
|
||||
for (const auto& [key, tex] : textureMap) residentKeys.insert(key);
|
||||
}
|
||||
|
||||
void TextureManager::UnloadNonResident(const std::string& residentPrefix)
|
||||
{
|
||||
size_t unloaded = 0;
|
||||
for (auto it = textureMap.begin(); it != textureMap.end(); ) {
|
||||
const bool keep = residentKeys.count(it->first)
|
||||
|| (!residentPrefix.empty() && it->first.compare(0, residentPrefix.size(), residentPrefix) == 0);
|
||||
if (keep) {
|
||||
++it;
|
||||
}
|
||||
else {
|
||||
it = textureMap.erase(it);
|
||||
++unloaded;
|
||||
}
|
||||
}
|
||||
logger() << "Unloaded " << unloaded << " non-resident textures" << std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user