mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-14 00:23:50 +00:00
Break the monolithic 1360-line world_map.cpp into 16 focused modules under src/rendering/world_map/: Architecture: - world_map_facade: public API composing all components (PIMPL) - world_map_types: Vulkan-free domain types (Zone, ViewLevel, etc.) - data_repository: DBC zone loading, ZMP pixel map, POI/overlay storage - coordinate_projection: UV projection, zone/continent lookups - composite_renderer: Vulkan tile pipeline + off-screen compositing - exploration_state: server mask + local exploration tracking - view_state_machine: COSMIC→WORLD→CONTINENT→ZONE navigation - input_handler: keyboard/mouse input → InputAction mapping - overlay_renderer: layer-based ImGui overlay system (OCP) - map_resolver: cross-map navigation (Outland, Northrend, etc.) - zone_metadata: level ranges and faction data Overlay layers (each an IOverlayLayer): - player_marker, party_dot, taxi_node, poi_marker, quest_poi, corpse_marker, zone_highlight, coordinate_display, subzone_tooltip Fixes: - Player marker no longer bleeds across continents (only shown when player is in a zone belonging to the displayed continent) - Zone hover uses DBC-projected AABB rectangles (restored from original working behavior) - Exploration overlay rendering for zone view subzones Tests: - 6 new test files covering coordinate projection, exploration state, map resolver, view state machine, zone metadata, and integration Signed-off-by: Pavel Okhlopkov <pavel.okhlopkov@flant.com>
71 lines
2.3 KiB
C++
71 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
|