mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
Fix mesh artifacts on vanilla/TBC M2 models when using expansion overlays
Vanilla (v256) and TBC (v263) M2 files embed skin data directly, parsed during M2Loader::load(). The code unconditionally loaded external .skin files afterwards, which resolved to WotLK-format .skin files (48-byte submeshes) from the base manifest — overwriting the correctly parsed embedded skin (32-byte submeshes) and causing mesh corruption on all character models. Guard all 13 loadSkin() call sites with version >= 264 so external .skin files are only loaded for WotLK M2s that need them.
This commit is contained in:
parent
a67dca5787
commit
ca3150e43d
3 changed files with 19 additions and 19 deletions
|
|
@ -303,12 +303,12 @@ std::shared_ptr<PendingTile> TerrainManager::prepareTile(int x, int y) {
|
|||
if (!m2Data.empty()) {
|
||||
pipeline::M2Model m2Model = pipeline::M2Loader::load(m2Data);
|
||||
|
||||
// Try to load skin file
|
||||
// Try to load skin file (only for WotLK M2s - vanilla has embedded skin)
|
||||
std::string skinPath = m2Path.substr(0, m2Path.size() - 3) + "00.skin";
|
||||
std::vector<uint8_t> skinData = assetManager->readFile(skinPath);
|
||||
if (!skinData.empty()) {
|
||||
if (!skinData.empty() && m2Model.version >= 264) {
|
||||
pipeline::M2Loader::loadSkin(skinData, m2Model);
|
||||
} else {
|
||||
} else if (skinData.empty() && m2Model.version >= 264) {
|
||||
skippedSkinNotFound++;
|
||||
LOG_WARNING("M2 skin not found: ", skinPath);
|
||||
}
|
||||
|
|
@ -447,7 +447,7 @@ std::shared_ptr<PendingTile> TerrainManager::prepareTile(int x, int y) {
|
|||
pipeline::M2Model m2Model = pipeline::M2Loader::load(m2Data);
|
||||
std::string skinPath = m2Path.substr(0, m2Path.size() - 3) + "00.skin";
|
||||
std::vector<uint8_t> skinData = assetManager->readFile(skinPath);
|
||||
if (!skinData.empty()) {
|
||||
if (!skinData.empty() && m2Model.version >= 264) {
|
||||
pipeline::M2Loader::loadSkin(skinData, m2Model);
|
||||
}
|
||||
if (!m2Model.isValid()) continue;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue