mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-06 17:13:51 +00:00
feat: WOT doodad/WMO placements, WOB materials, deduplicate loader
Architecture fixes for open format data fidelity: - WOT now serializes full doodad/WMO placement arrays (positions, rotations, scale, flags, doodad sets) — was only storing counts, causing all placed objects to be lost on WOT round-trip - WOT loader parses placements back into ADTTerrain for client rendering - WOB Material struct added: preserves WMO material flags, shader type, and blend mode during WMO→WOB conversion (was geometry-only) - WOB doodad rotation: quaternion→euler conversion instead of hardcoded zero (placed doodads inside buildings now retain their orientation) - importOpen() deduplicated: delegates to pipeline::WoweeTerrainLoader instead of duplicating 100 lines of parsing code
This commit is contained in:
parent
d00ddd1c73
commit
ca15da5e9b
4 changed files with 100 additions and 110 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#include "pipeline/wowee_building.hpp"
|
||||
#include "pipeline/wmo_loader.hpp"
|
||||
#include "core/logger.hpp"
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
#include <fstream>
|
||||
#include <filesystem>
|
||||
#include <cstring>
|
||||
|
|
@ -226,13 +227,19 @@ WoweeBuilding WoweeBuildingLoader::fromWMO(const WMOModel& wmo, const std::strin
|
|||
wobGroup.indices.push_back(static_cast<uint32_t>(idx));
|
||||
|
||||
for (const auto& mat : wmo.materials) {
|
||||
WoweeBuilding::Material wobMat;
|
||||
wobMat.flags = mat.flags;
|
||||
wobMat.shader = mat.shader;
|
||||
wobMat.blendMode = mat.blendMode;
|
||||
if (mat.texture1 < wmo.textures.size()) {
|
||||
std::string texPath = wmo.textures[mat.texture1];
|
||||
auto dot = texPath.rfind('.');
|
||||
if (dot != std::string::npos)
|
||||
texPath = texPath.substr(0, dot) + ".png";
|
||||
wobMat.texturePath = texPath;
|
||||
wobGroup.texturePaths.push_back(texPath);
|
||||
}
|
||||
wobGroup.materials.push_back(wobMat);
|
||||
}
|
||||
|
||||
bld.groups.push_back(std::move(wobGroup));
|
||||
|
|
@ -250,7 +257,10 @@ WoweeBuilding WoweeBuildingLoader::fromWMO(const WMOModel& wmo, const std::strin
|
|||
if (dot != std::string::npos)
|
||||
dp.modelPath = dp.modelPath.substr(0, dot) + ".wom";
|
||||
dp.position = doodad.position;
|
||||
dp.rotation = glm::vec3(0.0f);
|
||||
// Convert quaternion rotation to euler angles
|
||||
glm::quat q(doodad.rotation.w, doodad.rotation.x,
|
||||
doodad.rotation.y, doodad.rotation.z);
|
||||
dp.rotation = glm::degrees(glm::eulerAngles(q));
|
||||
dp.scale = doodad.scale;
|
||||
bld.doodads.push_back(dp);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue