mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-06 00:53:52 +00:00
feat(editor): add standalone world editor (rough/WIP)
Standalone wowee_editor tool for creating custom WoW zones. This is a rough initial implementation — many features work but M2/WMO rendering still has issues (frame sync, texture layout transitions) and needs further polish. Terrain: - Create new blank terrain with 10 biome types (Grassland, Forest, Jungle, Desert, Barrens, Snow, Swamp, Rocky, Beach, Volcanic) - Load existing ADT tiles from extracted game data - Sculpt brushes: Raise, Lower, Smooth, Flatten, Level - Chunk edge stitching prevents seams between tiles - Undo/redo (100-deep stack, Ctrl+Z/Ctrl+Shift+Z) - Save to WoW ADT/WDT format Texture Painting: - Paint/Erase/Replace Base modes - Full tileset texture browser (1285 textures from manifest) - Per-zone directory filtering and search - Alpha map editing with 4-layer limit (auto-replaces weakest) Object Placement: - M2 and WMO model placement with full manifest browser (11k M2s, 2k WMOs) - M2Renderer + WMORenderer integrated (loads .skin files for WotLK) - Ghost preview follows cursor before placing - Ctrl+click selection, right-click context menu - Transform gizmo (Move/Rotate/Scale with axis constraints) - Position/rotation/scale editing in properties panel NPC/Monster System: - 631 creature presets scanned from manifest, categorized (Critters, Beasts, Humanoids, Undead, Demons, etc.) - Stats editor: level, health, mana, damage, armor, faction - Behavior: Stationary, Patrol, Wander, Scripted - Aggro/leash radius, respawn time, flags (hostile/vendor/etc.) - Save creature spawns to JSON Water: - Place water at configurable height per chunk - Liquid types: Water, Ocean, Magma, Slime - Rendered as translucent colored quads - Saved in ADT MH2O format Infrastructure: - Free-fly camera (WASD/QE, right-drag look, scroll speed) - 5-mode toolbar: Sculpt | Paint | Objects | Water | NPCs - Asset browser indexes full manifest on startup - Editor water/marker shaders (pos+color vertex format) - forceNoCull added to M2Renderer for editor use - AssetManifest::getEntries() and AssetManager::getManifest() exposed Known issues: - M2/WMO rendering may not display on first placement (frame index sync between update/render was misaligned — now fixed but untested end-to-end) - Validation layer errors on shutdown (resource cleanup ordering) - Object placement on steep terrain can miss raycast - No undo for texture painting or object placement yet
This commit is contained in:
parent
d138269a35
commit
2980ca83e7
42 changed files with 5647 additions and 3 deletions
98
tools/editor/asset_browser.cpp
Normal file
98
tools/editor/asset_browser.cpp
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
#include "asset_browser.hpp"
|
||||
#include "pipeline/asset_manager.hpp"
|
||||
#include "pipeline/asset_manifest.hpp"
|
||||
#include "core/logger.hpp"
|
||||
#include <algorithm>
|
||||
#include <set>
|
||||
|
||||
namespace wowee {
|
||||
namespace editor {
|
||||
|
||||
std::string AssetBrowser::extractFilename(const std::string& path) {
|
||||
auto pos = path.rfind('\\');
|
||||
return pos != std::string::npos ? path.substr(pos + 1) : path;
|
||||
}
|
||||
|
||||
std::string AssetBrowser::extractDirectory(const std::string& path) {
|
||||
auto pos = path.rfind('\\');
|
||||
return pos != std::string::npos ? path.substr(0, pos) : "";
|
||||
}
|
||||
|
||||
void AssetBrowser::initialize(pipeline::AssetManager* am) {
|
||||
if (initialized_ || !am) return;
|
||||
initialized_ = true;
|
||||
|
||||
const auto& entries = am->getManifest().getEntries();
|
||||
|
||||
std::set<std::string> texDirSet, m2DirSet, wmoDirSet;
|
||||
|
||||
for (const auto& [path, entry] : entries) {
|
||||
// Tileset textures
|
||||
if (path.starts_with("tileset\\") && path.ends_with(".blp")) {
|
||||
// Skip specular/normal maps
|
||||
if (path.ends_with("_s.blp") || path.ends_with("_h.blp") ||
|
||||
path.ends_with("_n.blp")) continue;
|
||||
|
||||
AssetEntry ae;
|
||||
ae.wowPath = path;
|
||||
ae.displayName = extractFilename(path);
|
||||
ae.directory = extractDirectory(path);
|
||||
textures_.push_back(ae);
|
||||
texDirSet.insert(ae.directory);
|
||||
}
|
||||
|
||||
// M2 models (world doodads)
|
||||
if (path.ends_with(".m2")) {
|
||||
// Focus on world assets, skip character/creature/item models
|
||||
if (path.starts_with("world\\") || path.starts_with("dungeons\\")) {
|
||||
AssetEntry ae;
|
||||
ae.wowPath = path;
|
||||
ae.displayName = extractFilename(path);
|
||||
ae.directory = extractDirectory(path);
|
||||
m2Models_.push_back(ae);
|
||||
m2DirSet.insert(ae.directory);
|
||||
}
|
||||
}
|
||||
|
||||
// WMOs
|
||||
if (path.ends_with(".wmo") && !path.ends_with("_lod.wmo")) {
|
||||
// Skip group files (_000.wmo, _001.wmo, etc.)
|
||||
bool isGroup = false;
|
||||
if (path.size() > 8) {
|
||||
auto base = path.substr(path.size() - 8);
|
||||
if (base[0] == '_' && std::isdigit(base[1]) && std::isdigit(base[2]) &&
|
||||
std::isdigit(base[3]))
|
||||
isGroup = true;
|
||||
}
|
||||
if (isGroup) continue;
|
||||
|
||||
AssetEntry ae;
|
||||
ae.wowPath = path;
|
||||
ae.displayName = extractFilename(path);
|
||||
ae.directory = extractDirectory(path);
|
||||
wmos_.push_back(ae);
|
||||
wmoDirSet.insert(ae.directory);
|
||||
}
|
||||
}
|
||||
|
||||
std::sort(textures_.begin(), textures_.end(),
|
||||
[](const AssetEntry& a, const AssetEntry& b) { return a.wowPath < b.wowPath; });
|
||||
std::sort(m2Models_.begin(), m2Models_.end(),
|
||||
[](const AssetEntry& a, const AssetEntry& b) { return a.wowPath < b.wowPath; });
|
||||
std::sort(wmos_.begin(), wmos_.end(),
|
||||
[](const AssetEntry& a, const AssetEntry& b) { return a.wowPath < b.wowPath; });
|
||||
|
||||
textureDirs_.assign(texDirSet.begin(), texDirSet.end());
|
||||
m2Dirs_.assign(m2DirSet.begin(), m2DirSet.end());
|
||||
wmoDirs_.assign(wmoDirSet.begin(), wmoDirSet.end());
|
||||
|
||||
std::sort(textureDirs_.begin(), textureDirs_.end());
|
||||
std::sort(m2Dirs_.begin(), m2Dirs_.end());
|
||||
std::sort(wmoDirs_.begin(), wmoDirs_.end());
|
||||
|
||||
LOG_INFO("Asset browser: ", textures_.size(), " textures, ",
|
||||
m2Models_.size(), " M2s, ", wmos_.size(), " WMOs indexed");
|
||||
}
|
||||
|
||||
} // namespace editor
|
||||
} // namespace wowee
|
||||
Loading…
Add table
Add a link
Reference in a new issue