mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-15 08:53:51 +00:00
72 lines
2.3 KiB
C++
72 lines
2.3 KiB
C++
|
|
// overlay_renderer.hpp — ImGui overlay layer system for the world map.
|
||
|
|
// Extracted from WorldMap::renderImGuiOverlay (Phase 8 of refactoring plan).
|
||
|
|
// OCP — new marker types are added by implementing IOverlayLayer.
|
||
|
|
#pragma once
|
||
|
|
|
||
|
|
#include "rendering/world_map/world_map_types.hpp"
|
||
|
|
#include <glm/glm.hpp>
|
||
|
|
#include <vector>
|
||
|
|
#include <memory>
|
||
|
|
#include <unordered_set>
|
||
|
|
#include <unordered_map>
|
||
|
|
#include <array>
|
||
|
|
#include <cstdint>
|
||
|
|
#include <functional>
|
||
|
|
#include <imgui.h>
|
||
|
|
|
||
|
|
struct ImDrawList;
|
||
|
|
|
||
|
|
namespace wowee {
|
||
|
|
namespace rendering {
|
||
|
|
namespace world_map {
|
||
|
|
|
||
|
|
/// Context passed to each overlay layer during rendering.
|
||
|
|
struct LayerContext {
|
||
|
|
ImDrawList* drawList = nullptr;
|
||
|
|
ImVec2 imgMin; // top-left of map image in screen space
|
||
|
|
float displayW = 0, displayH = 0;
|
||
|
|
glm::vec3 playerRenderPos;
|
||
|
|
float playerYawDeg = 0;
|
||
|
|
int currentZoneIdx = -1;
|
||
|
|
int continentIdx = -1;
|
||
|
|
int currentMapId = -1;
|
||
|
|
ViewLevel viewLevel = ViewLevel::ZONE;
|
||
|
|
const std::vector<Zone>* zones = nullptr;
|
||
|
|
const std::unordered_set<int>* exploredZones = nullptr;
|
||
|
|
const std::unordered_set<int>* exploredOverlays = nullptr;
|
||
|
|
const std::unordered_map<uint32_t, std::string>* areaNameByAreaId = nullptr;
|
||
|
|
// FBO dimensions for overlay coordinate math
|
||
|
|
int fboW = 1024;
|
||
|
|
int fboH = 768;
|
||
|
|
|
||
|
|
// ZMP pixel map for continent-view hover (128x128 grid of AreaTable IDs)
|
||
|
|
const std::array<uint32_t, 128 * 128>* zmpGrid = nullptr;
|
||
|
|
bool hasZmpData = false;
|
||
|
|
// Function to resolve AreaTable ID → zone index (from DataRepository)
|
||
|
|
int (*zmpResolveZoneIdx)(const void* repo, uint32_t areaId) = nullptr;
|
||
|
|
const void* zmpRepoPtr = nullptr; // opaque DataRepository pointer
|
||
|
|
// ZMP-derived zone bounding boxes (zone index → UV rect on display)
|
||
|
|
const std::unordered_map<int, ZmpRect>* zmpZoneBounds = nullptr;
|
||
|
|
};
|
||
|
|
|
||
|
|
/// Interface for an overlay layer rendered on top of the composite map.
|
||
|
|
class IOverlayLayer {
|
||
|
|
public:
|
||
|
|
virtual ~IOverlayLayer() = default;
|
||
|
|
virtual void render(const LayerContext& ctx) = 0;
|
||
|
|
};
|
||
|
|
|
||
|
|
/// Orchestrates rendering of all registered overlay layers.
|
||
|
|
class OverlayRenderer {
|
||
|
|
public:
|
||
|
|
void addLayer(std::unique_ptr<IOverlayLayer> layer);
|
||
|
|
void render(const LayerContext& ctx);
|
||
|
|
|
||
|
|
private:
|
||
|
|
std::vector<std::unique_ptr<IOverlayLayer>> layers_;
|
||
|
|
};
|
||
|
|
|
||
|
|
} // namespace world_map
|
||
|
|
} // namespace rendering
|
||
|
|
} // namespace wowee
|