mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-03 16:03:52 +00:00
Retry one-time WMO reload when textures resolve to white
This commit is contained in:
parent
253153d7cc
commit
a3e88394ce
1 changed files with 26 additions and 2 deletions
|
|
@ -262,9 +262,33 @@ bool WMORenderer::loadModel(const pipeline::WMOModel& model, uint32_t id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if already loaded
|
// Check if already loaded
|
||||||
if (loadedModels.find(id) != loadedModels.end()) {
|
auto existingIt = loadedModels.find(id);
|
||||||
|
if (existingIt != loadedModels.end()) {
|
||||||
|
// If a model was first loaded while texture resolution failed (or before
|
||||||
|
// assets were fully available), it can remain permanently white because
|
||||||
|
// merged batches cache texture IDs at load time. Do a one-time reload for
|
||||||
|
// models that have texture paths but no resolved non-white textures.
|
||||||
|
if (assetManager && !model.textures.empty()) {
|
||||||
|
bool hasResolvedTexture = false;
|
||||||
|
for (GLuint texId : existingIt->second.textures) {
|
||||||
|
if (texId != 0 && texId != whiteTexture) {
|
||||||
|
hasResolvedTexture = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static std::unordered_set<uint32_t> retryReloadedModels;
|
||||||
|
if (!hasResolvedTexture && retryReloadedModels.insert(id).second) {
|
||||||
|
core::Logger::getInstance().warning(
|
||||||
|
"WMO model ", id,
|
||||||
|
" has only fallback textures; forcing one-time reload");
|
||||||
|
unloadModel(id);
|
||||||
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
core::Logger::getInstance().debug("Loading WMO model ", id, " with ", model.groups.size(), " groups, ",
|
core::Logger::getInstance().debug("Loading WMO model ", id, " with ", model.groups.size(), " groups, ",
|
||||||
model.textures.size(), " textures...");
|
model.textures.size(), " textures...");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue