mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-07 09:33:51 +00:00
fix(wob): convert .png texture paths back to .blp in toWMOModel
WMORenderer's PNG override system only triggers when the requested texture path ends in .blp — it strips the .blp and probes for .png. WoB stores .png paths (because fromWMO converts .blp->.png at conversion time), so passing them straight through to the WMOModel meant the override wasn't engaged and textures didn't load. Now converts back to .blp so the existing override pipeline picks up the PNG file.
This commit is contained in:
parent
9d200fbe7b
commit
aa6b692a58
1 changed files with 13 additions and 4 deletions
|
|
@ -206,12 +206,21 @@ bool WoweeBuildingLoader::toWMOModel(const WoweeBuilding& building, WMOModel& ou
|
|||
// Build a global texture index from per-material texturePath strings.
|
||||
// First-group materials become the WMO material list; each unique texture
|
||||
// gets one entry in outModel.textures.
|
||||
|
||||
// Reverse the .blp -> .png conversion that fromWMO did, since the WMO
|
||||
// renderer's PNG override system only triggers when the requested texture
|
||||
// path ends in .blp (it then probes for a .png next to the cache file).
|
||||
auto textureIndex = [&](const std::string& path) -> uint32_t {
|
||||
if (path.empty()) return 0;
|
||||
for (uint32_t i = 0; i < outModel.textures.size(); i++) {
|
||||
if (outModel.textures[i] == path) return i;
|
||||
std::string p = path;
|
||||
if (p.size() >= 4) {
|
||||
std::string ext = p.substr(p.size() - 4);
|
||||
if (ext == ".png" || ext == ".PNG") p = p.substr(0, p.size() - 4) + ".blp";
|
||||
}
|
||||
outModel.textures.push_back(path);
|
||||
if (p.empty()) return 0;
|
||||
for (uint32_t i = 0; i < outModel.textures.size(); i++) {
|
||||
if (outModel.textures[i] == p) return i;
|
||||
}
|
||||
outModel.textures.push_back(p);
|
||||
return static_cast<uint32_t>(outModel.textures.size() - 1);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue