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
83
tools/editor/editor_history.cpp
Normal file
83
tools/editor/editor_history.cpp
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
#include "editor_history.hpp"
|
||||
|
||||
namespace wowee {
|
||||
namespace editor {
|
||||
|
||||
void EditorHistory::beginEdit(const pipeline::ADTTerrain& terrain,
|
||||
const std::vector<int>& affectedChunks) {
|
||||
pending_ = {};
|
||||
pending_.before.reserve(affectedChunks.size());
|
||||
for (int idx : affectedChunks) {
|
||||
ChunkSnapshot snap;
|
||||
snap.chunkIndex = idx;
|
||||
snap.heights = terrain.chunks[idx].heightMap.heights;
|
||||
pending_.before.push_back(snap);
|
||||
}
|
||||
}
|
||||
|
||||
void EditorHistory::endEdit(const pipeline::ADTTerrain& terrain) {
|
||||
pending_.after.reserve(pending_.before.size());
|
||||
lastAffected_.clear();
|
||||
for (const auto& snap : pending_.before) {
|
||||
ChunkSnapshot after;
|
||||
after.chunkIndex = snap.chunkIndex;
|
||||
after.heights = terrain.chunks[snap.chunkIndex].heightMap.heights;
|
||||
pending_.after.push_back(after);
|
||||
lastAffected_.push_back(snap.chunkIndex);
|
||||
}
|
||||
|
||||
// Only push if something actually changed
|
||||
bool changed = false;
|
||||
for (size_t i = 0; i < pending_.before.size(); i++) {
|
||||
if (pending_.before[i].heights != pending_.after[i].heights) {
|
||||
changed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!changed) return;
|
||||
|
||||
undoStack_.push_back(std::move(pending_));
|
||||
redoStack_.clear();
|
||||
|
||||
if (undoStack_.size() > MAX_UNDO)
|
||||
undoStack_.erase(undoStack_.begin());
|
||||
}
|
||||
|
||||
void EditorHistory::undo(pipeline::ADTTerrain& terrain) {
|
||||
if (undoStack_.empty()) return;
|
||||
|
||||
auto cmd = std::move(undoStack_.back());
|
||||
undoStack_.pop_back();
|
||||
|
||||
lastAffected_.clear();
|
||||
for (const auto& snap : cmd.before) {
|
||||
terrain.chunks[snap.chunkIndex].heightMap.heights = snap.heights;
|
||||
lastAffected_.push_back(snap.chunkIndex);
|
||||
}
|
||||
|
||||
redoStack_.push_back(std::move(cmd));
|
||||
}
|
||||
|
||||
void EditorHistory::redo(pipeline::ADTTerrain& terrain) {
|
||||
if (redoStack_.empty()) return;
|
||||
|
||||
auto cmd = std::move(redoStack_.back());
|
||||
redoStack_.pop_back();
|
||||
|
||||
lastAffected_.clear();
|
||||
for (const auto& snap : cmd.after) {
|
||||
terrain.chunks[snap.chunkIndex].heightMap.heights = snap.heights;
|
||||
lastAffected_.push_back(snap.chunkIndex);
|
||||
}
|
||||
|
||||
undoStack_.push_back(std::move(cmd));
|
||||
}
|
||||
|
||||
void EditorHistory::clear() {
|
||||
undoStack_.clear();
|
||||
redoStack_.clear();
|
||||
lastAffected_.clear();
|
||||
}
|
||||
|
||||
} // namespace editor
|
||||
} // namespace wowee
|
||||
Loading…
Add table
Add a link
Reference in a new issue