mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-06 00:53:52 +00:00
feat: complete client integration for all 6 open formats
- Wire WOB buildings into WMO render pipeline (loads→converts→renders) - Implement JSON DBC loading in DBCFile::loadJSON() with nlohmann/json - Wire JSON DBC override into AssetManager (custom_zones/output scan) - Add WMO→WOB conversion with full geometry (fromWMO) - Replace placeholder WOB export with real WMO→WOB conversion in editor - Add --convert-wmo CLI flag for batch WMO→WOB conversion - Store discovered custom zones on Renderer with getCustomZones() accessor - Add isCustomZone_ member to TerrainManager All 6 Blizzard format replacements now fully load in the client: ADT→WOT/WHM, WDT→zone.json, BLP→PNG, DBC→JSON, M2→WOM, WMO→WOB
This commit is contained in:
parent
d8f2388635
commit
4fc0361f7a
11 changed files with 271 additions and 47 deletions
|
|
@ -7,6 +7,7 @@
|
|||
#include "dbc_exporter.hpp"
|
||||
#include "pipeline/wowee_model.hpp"
|
||||
#include "pipeline/wowee_building.hpp"
|
||||
#include "pipeline/wmo_loader.hpp"
|
||||
#include "core/coordinates.hpp"
|
||||
#include "rendering/vk_context.hpp"
|
||||
#include "pipeline/adt_loader.hpp"
|
||||
|
|
@ -761,19 +762,36 @@ void EditorApp::exportZone(const std::string& outputDir) {
|
|||
std::unordered_set<std::string> convertedWMOs;
|
||||
for (const auto& obj : objectPlacer_.getObjects()) {
|
||||
if (obj.type == PlaceableType::WMO && !convertedWMOs.count(obj.path)) {
|
||||
// Create a placeholder WOB (full WMO→WOB conversion needs group loading)
|
||||
pipeline::WoweeBuilding bld;
|
||||
bld.name = obj.path;
|
||||
std::string wobPath = obj.path;
|
||||
std::replace(wobPath.begin(), wobPath.end(), '\\', '/');
|
||||
auto dot = wobPath.rfind('.');
|
||||
if (dot != std::string::npos) wobPath = wobPath.substr(0, dot);
|
||||
pipeline::WoweeBuildingLoader::save(bld, base + "/buildings/" + wobPath);
|
||||
|
||||
auto wmoData = assetManager_->readFile(obj.path);
|
||||
if (!wmoData.empty()) {
|
||||
auto wmoModel = pipeline::WMOLoader::load(wmoData);
|
||||
if (wmoModel.nGroups > 0) {
|
||||
std::string wmoBase = obj.path;
|
||||
if (wmoBase.size() > 4) wmoBase = wmoBase.substr(0, wmoBase.size() - 4);
|
||||
for (uint32_t gi = 0; gi < wmoModel.nGroups; gi++) {
|
||||
char suffix[16];
|
||||
snprintf(suffix, sizeof(suffix), "_%03u.wmo", gi);
|
||||
auto gd = assetManager_->readFile(wmoBase + suffix);
|
||||
if (!gd.empty()) pipeline::WMOLoader::loadGroup(gd, wmoModel, gi);
|
||||
}
|
||||
}
|
||||
auto bld = pipeline::WoweeBuildingLoader::fromWMO(wmoModel, obj.path);
|
||||
pipeline::WoweeBuildingLoader::save(bld, base + "/buildings/" + wobPath);
|
||||
} else {
|
||||
pipeline::WoweeBuilding bld;
|
||||
bld.name = obj.path;
|
||||
pipeline::WoweeBuildingLoader::save(bld, base + "/buildings/" + wobPath);
|
||||
}
|
||||
convertedWMOs.insert(obj.path);
|
||||
}
|
||||
}
|
||||
if (!convertedWMOs.empty())
|
||||
LOG_INFO("Created ", convertedWMOs.size(), " WOB building placeholders");
|
||||
LOG_INFO("Converted ", convertedWMOs.size(), " WMO buildings to WOB");
|
||||
}
|
||||
|
||||
// Export used textures as PNG (open format replacement for BLP)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#include "editor_app.hpp"
|
||||
#include "pipeline/wowee_model.hpp"
|
||||
#include "pipeline/wowee_building.hpp"
|
||||
#include "pipeline/wmo_loader.hpp"
|
||||
#include "pipeline/asset_manager.hpp"
|
||||
#include "pipeline/custom_zone_discovery.hpp"
|
||||
#include "core/logger.hpp"
|
||||
|
|
@ -13,6 +15,7 @@ static void printUsage(const char* argv0) {
|
|||
LOG_INFO(" --data <path> Path to extracted WoW data (manifest.json)");
|
||||
LOG_INFO(" --adt <map> <x> <y> Load an ADT tile on startup");
|
||||
LOG_INFO(" --convert-m2 <path> Convert M2 model to WOM open format (no GUI)");
|
||||
LOG_INFO(" --convert-wmo <path> Convert WMO building to WOB open format (no GUI)");
|
||||
LOG_INFO(" --list-zones List discovered custom zones and exit");
|
||||
LOG_INFO(" --version Show version and format info");
|
||||
LOG_INFO("");
|
||||
|
|
@ -81,6 +84,46 @@ int main(int argc, char* argv[]) {
|
|||
}
|
||||
}
|
||||
|
||||
// Batch convert mode: --convert-wmo converts WMO to WOB
|
||||
for (int i = 1; i < argc; i++) {
|
||||
if (std::strcmp(argv[i], "--convert-wmo") == 0 && i + 1 < argc) {
|
||||
std::string wmoPath = argv[++i];
|
||||
LOG_INFO("Batch convert mode: WMO→WOB for ", wmoPath);
|
||||
if (dataPath.empty()) dataPath = "Data";
|
||||
wowee::pipeline::AssetManager am;
|
||||
if (am.initialize(dataPath)) {
|
||||
auto wmoData = am.readFile(wmoPath);
|
||||
if (!wmoData.empty()) {
|
||||
auto wmoModel = wowee::pipeline::WMOLoader::load(wmoData);
|
||||
if (wmoModel.nGroups > 0) {
|
||||
std::string wmoBase = wmoPath;
|
||||
if (wmoBase.size() > 4) wmoBase = wmoBase.substr(0, wmoBase.size() - 4);
|
||||
for (uint32_t gi = 0; gi < wmoModel.nGroups; gi++) {
|
||||
char suffix[16];
|
||||
snprintf(suffix, sizeof(suffix), "_%03u.wmo", gi);
|
||||
auto gd = am.readFile(wmoBase + suffix);
|
||||
if (!gd.empty()) wowee::pipeline::WMOLoader::loadGroup(gd, wmoModel, gi);
|
||||
}
|
||||
}
|
||||
auto wob = wowee::pipeline::WoweeBuildingLoader::fromWMO(wmoModel, wmoPath);
|
||||
if (wob.isValid()) {
|
||||
std::string outPath = wmoPath;
|
||||
auto dot = outPath.rfind('.');
|
||||
if (dot != std::string::npos) outPath = outPath.substr(0, dot);
|
||||
wowee::pipeline::WoweeBuildingLoader::save(wob, "output/buildings/" + outPath);
|
||||
LOG_INFO("Converted: ", wmoPath, " → output/buildings/", outPath, ".wob");
|
||||
} else {
|
||||
LOG_ERROR("Failed to convert: ", wmoPath);
|
||||
}
|
||||
} else {
|
||||
LOG_ERROR("WMO file not found: ", wmoPath);
|
||||
}
|
||||
am.shutdown();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (dataPath.empty()) {
|
||||
dataPath = "Data";
|
||||
LOG_INFO("No --data path specified, using default: ", dataPath);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue