Kelsidavis-WoWee/include/rendering/world_map/layers/zone_highlight_layer.hpp

56 lines
1.8 KiB
C++
Raw Normal View History

refactor: decompose world map into modular component architecture 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>
2026-04-12 09:52:51 +03:00
// zone_highlight_layer.hpp — Continent view zone rectangles + hover effects.
#pragma once
#include "rendering/world_map/overlay_renderer.hpp"
#include "rendering/world_map/zone_metadata.hpp"
#include "rendering/vk_texture.hpp"
#include <vulkan/vulkan.h>
#include <unordered_map>
#include <memory>
namespace wowee {
namespace rendering {
class VkContext;
}
namespace pipeline { class AssetManager; }
namespace rendering {
namespace world_map {
class ZoneHighlightLayer : public IOverlayLayer {
public:
~ZoneHighlightLayer() override;
void setMetadata(const ZoneMetadata* metadata) { metadata_ = metadata; }
void initialize(VkContext* ctx, pipeline::AssetManager* am);
void clearTextures();
void render(const LayerContext& ctx) override;
int hoveredZone() const { return hoveredZone_; }
/// Get the ImGui texture ID for a highlight BLP, loading lazily.
/// key is used as cache key; customPath overrides the default path if non-empty.
ImTextureID getHighlightTexture(const std::string& key,
const std::string& customPath = "");
private:
/// Load the highlight BLP and register it with ImGui.
void ensureHighlight(const std::string& key, const std::string& customPath);
const ZoneMetadata* metadata_ = nullptr;
VkContext* vkCtx_ = nullptr;
pipeline::AssetManager* assetManager_ = nullptr;
struct HighlightEntry {
std::unique_ptr<VkTexture> texture;
VkDescriptorSet imguiDS = VK_NULL_HANDLE; // ImGui texture ID
};
std::unordered_map<std::string, HighlightEntry> highlights_;
std::unordered_set<std::string> missingHighlights_; // areas with no highlight file
int hoveredZone_ = -1;
int prevHoveredZone_ = -1;
float hoverHighlightAlpha_ = 0.0f;
};
} // namespace world_map
} // namespace rendering
} // namespace wowee