refactor(wom): extract WOM->M2 conversion to shared helper

Adds WoweeModelLoader::toM2() and tryLoadByGamePath() to deduplicate the
identical conversion code that lived in editor_viewport for both objects
and NPCs. Cuts ~70 lines of duplicated logic and makes WOM->M2 reusable
across the codebase.
This commit is contained in:
Kelsi 2026-05-06 01:02:56 -07:00
parent eb8f5a09b1
commit 03a863abe1
3 changed files with 80 additions and 81 deletions

View file

@ -9,6 +9,8 @@
namespace wowee {
namespace pipeline {
struct M2Model;
// Wowee Open Model format (.wom) — novel format, no Blizzard IP
// WOM1: static geometry | WOM2: + bones + animations
struct WoweeModel {
@ -68,6 +70,14 @@ public:
// Check if a .wom exists
static bool exists(const std::string& basePath);
// Convert WoweeModel to an in-memory M2Model so the M2Renderer can consume it.
// Single batch, single material — sufficient for static and simple animated meshes.
static M2Model toM2(const WoweeModel& wom);
// Convenience: try loading <path-without-ext>.wom from the standard editor
// search paths (custom_zones/models/, output/models/). Returns valid model on hit.
static WoweeModel tryLoadByGamePath(const std::string& gamePath);
};
} // namespace pipeline