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
2026-05-05 03:47:03 -07:00
|
|
|
#include "editor_camera.hpp"
|
|
|
|
|
#include <glm/gtc/constants.hpp>
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
|
|
namespace wowee {
|
|
|
|
|
namespace editor {
|
|
|
|
|
|
|
|
|
|
EditorCamera::EditorCamera() {
|
|
|
|
|
camera_.setPosition(glm::vec3(0.0f, 0.0f, 200.0f));
|
|
|
|
|
camera_.setFov(60.0f);
|
|
|
|
|
camera_.setRotation(0.0f, -30.0f);
|
|
|
|
|
yaw_ = 0.0f;
|
|
|
|
|
pitch_ = -30.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void EditorCamera::update(float deltaTime) {
|
|
|
|
|
float moveSpeed = speed_ * deltaTime;
|
|
|
|
|
if (keyShift_) moveSpeed *= 3.0f;
|
|
|
|
|
|
|
|
|
|
glm::vec3 forward = camera_.getForward();
|
|
|
|
|
glm::vec3 right = camera_.getRight();
|
|
|
|
|
glm::vec3 up(0.0f, 0.0f, 1.0f); // Z-up (WoW render coords)
|
|
|
|
|
|
|
|
|
|
glm::vec3 pos = camera_.getPosition();
|
|
|
|
|
if (keyW_) pos += forward * moveSpeed;
|
|
|
|
|
if (keyS_) pos -= forward * moveSpeed;
|
|
|
|
|
if (keyD_) pos += right * moveSpeed;
|
|
|
|
|
if (keyA_) pos -= right * moveSpeed;
|
|
|
|
|
if (keyE_) pos += up * moveSpeed;
|
|
|
|
|
if (keyQ_) pos -= up * moveSpeed;
|
|
|
|
|
|
|
|
|
|
camera_.setPosition(pos);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void EditorCamera::processMouseMotion(int dx, int dy) {
|
|
|
|
|
if (!rightMouseDown_) return;
|
|
|
|
|
|
|
|
|
|
constexpr float sensitivity = 0.15f; // degrees per pixel
|
|
|
|
|
yaw_ += static_cast<float>(dx) * sensitivity;
|
|
|
|
|
pitch_ -= static_cast<float>(dy) * sensitivity;
|
|
|
|
|
pitch_ = std::clamp(pitch_, -89.0f, 89.0f);
|
|
|
|
|
|
|
|
|
|
camera_.setRotation(yaw_, pitch_);
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-05 05:44:24 -07:00
|
|
|
void EditorCamera::processMouseWheel(float delta, bool shiftHeld) {
|
|
|
|
|
if (shiftHeld) {
|
|
|
|
|
speed_ = std::clamp(speed_ + delta * 20.0f, 10.0f, 2000.0f);
|
|
|
|
|
} else {
|
|
|
|
|
glm::vec3 pos = camera_.getPosition();
|
|
|
|
|
pos += camera_.getForward() * delta * speed_ * 0.3f;
|
|
|
|
|
camera_.setPosition(pos);
|
|
|
|
|
}
|
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
2026-05-05 03:47:03 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void EditorCamera::processKeyEvent(const SDL_KeyboardEvent& event) {
|
|
|
|
|
bool pressed = (event.type == SDL_KEYDOWN);
|
|
|
|
|
switch (event.keysym.scancode) {
|
|
|
|
|
case SDL_SCANCODE_W: keyW_ = pressed; break;
|
|
|
|
|
case SDL_SCANCODE_A: keyA_ = pressed; break;
|
|
|
|
|
case SDL_SCANCODE_S: keyS_ = pressed; break;
|
|
|
|
|
case SDL_SCANCODE_D: keyD_ = pressed; break;
|
|
|
|
|
case SDL_SCANCODE_Q: keyQ_ = pressed; break;
|
|
|
|
|
case SDL_SCANCODE_E: keyE_ = pressed; break;
|
|
|
|
|
case SDL_SCANCODE_LSHIFT:
|
|
|
|
|
case SDL_SCANCODE_RSHIFT: keyShift_ = pressed; break;
|
|
|
|
|
default: break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void EditorCamera::processMouseButton(const SDL_MouseButtonEvent& event) {
|
|
|
|
|
if (event.button == SDL_BUTTON_RIGHT)
|
|
|
|
|
rightMouseDown_ = (event.type == SDL_MOUSEBUTTONDOWN);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void EditorCamera::setPosition(const glm::vec3& pos) {
|
|
|
|
|
camera_.setPosition(pos);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void EditorCamera::setYawPitch(float yaw, float pitch) {
|
|
|
|
|
yaw_ = yaw;
|
|
|
|
|
pitch_ = pitch;
|
|
|
|
|
camera_.setRotation(yaw_, pitch_);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace editor
|
|
|
|
|
} // namespace wowee
|