space-game001/src/LocationEditor.h
2026-06-02 12:11:37 +03:00

71 lines
2.0 KiB
C++

#pragma once
#include <vector>
#include <string>
#include "render/Renderer.h"
#include "navigation/PathFinder.h"
#include "items/GameObjectLoader.h"
#include <Eigen/Dense>
namespace ZL {
class Location; // forward declaration — LocationEditor.cpp includes Location.h
enum class EditorMode {
None,
Navigation,
InteractiveObjects
// GameObjects // future
};
class LocationEditor {
public:
explicit LocationEditor(Location& location);
// Navigation editor state
std::vector<Eigen::Vector3f> navigationEditorPoints;
VertexRenderStruct navigationEditorPointsMesh;
std::vector<VertexRenderStruct> navigationEditorNavMeshes;
int navigationEditorObstacleCounter = 0;
// Interactive object editor state
std::vector<VertexRenderStruct> interactiveObjectBoundsMeshes;
std::vector<VertexRenderStruct> interactionPositionMeshes;
int selectedInteractiveObjectIndex = 0;
int boundsClickCount = 0; // 0 = waiting for first corner, 1 = waiting for second
Eigen::Vector3f boundsClickA = Eigen::Vector3f::Zero();
// Game object editor state
std::vector<GameObjectData> editorPlacedObjects;
int editorPlacedObjectCounter = 0;
// Navigation editor methods
void buildNavMeshes();
void drawNavigation();
void rebuildPointsMesh();
void drawPoints();
void handleLeftClick(const Eigen::Vector3f& hit, bool ctrlHeld);
void handleRightClick();
void save();
void reload();
// Interactive object editor methods
void buildInteractiveObjectBoundsMeshes();
void drawInteractiveObjectBounds();
void selectInteractiveObject(int index);
void handleInteractiveObjectClick(const Eigen::Vector3f& worldHit, bool ctrlHeld);
void saveInteractiveObjects();
// Save all editor data at once (nav mesh + interactive objects)
void saveAll();
// Game object editor methods
void placeTree();
void saveObjects();
private:
Location& loc;
};
} // namespace ZL