Kelsidavis-WoWee/include/rendering/overlay_system.hpp
Paul 34c0e3ca28 chore(refactor): god-object decomposition and mega-file splits
Split all mega-files by single-responsibility concern and
partially extracting AudioCoordinator and
OverlaySystem from the Renderer facade. No behavioral changes.

Splits:
- game_handler.cpp (5,247 LOC) → core + callbacks + packets (3 files)
- world_packets.cpp (4,453 LOC) → economy/entity/social/world (4 files)
- game_screen.cpp  (5,786 LOC) → core + frames + hud + minimap (4 files)
- m2_renderer.cpp  (3,343 LOC) → core + instance + particles + render (4 files)
- chat_panel.cpp   (3,140 LOC) → core + commands + utils (3 files)
- entity_spawner.cpp (2,750 LOC) → core + player + processing (3 files)

Extractions:
- AudioCoordinator: include/audio/ + src/audio/ (owned by Renderer)
- OverlaySystem: include/rendering/ + src/rendering/overlay_system.*

CMakeLists.txt: registered all 17 new translation units.
Related handler/callback files: minor include fixups post-split.
2026-04-05 19:30:44 +03:00

73 lines
2.4 KiB
C++

#pragma once
#include <glm/vec3.hpp>
#include <glm/vec4.hpp>
#include <glm/mat4x4.hpp>
#include <vulkan/vulkan.h>
#include <vk_mem_alloc.h>
#include <functional>
#include <optional>
namespace wowee {
namespace rendering {
class VkContext;
/// Manages selection circle and fullscreen overlay Vulkan pipelines.
/// Extracted from Renderer to isolate overlay rendering resources.
class OverlaySystem {
public:
/// Height query callable: returns floor height at (x, y) or (x, y, probeZ).
using HeightQuery2D = std::function<std::optional<float>(float x, float y)>;
using HeightQuery3D = std::function<std::optional<float>(float x, float y, float probeZ)>;
explicit OverlaySystem(VkContext* ctx);
~OverlaySystem();
OverlaySystem(const OverlaySystem&) = delete;
OverlaySystem& operator=(const OverlaySystem&) = delete;
// Selection circle
void setSelectionCircle(const glm::vec3& pos, float radius, const glm::vec3& color);
void clearSelectionCircle();
void renderSelectionCircle(const glm::mat4& view, const glm::mat4& projection,
VkCommandBuffer cmd,
HeightQuery2D terrainHeight,
HeightQuery3D wmoHeight,
HeightQuery3D m2Height);
// Fullscreen color overlay (underwater tint, etc.)
void renderOverlay(const glm::vec4& color, VkCommandBuffer cmd);
/// Destroy all Vulkan resources (called before VkContext teardown).
void cleanup();
/// Recreate pipelines after swapchain resize / MSAA change.
void recreatePipelines();
private:
void initSelectionCircle();
void initOverlayPipeline();
VkContext* vkCtx_ = nullptr;
// Selection circle resources
VkPipeline selCirclePipeline_ = VK_NULL_HANDLE;
VkPipelineLayout selCirclePipelineLayout_ = VK_NULL_HANDLE;
::VkBuffer selCircleVertBuf_ = VK_NULL_HANDLE;
VmaAllocation selCircleVertAlloc_ = VK_NULL_HANDLE;
::VkBuffer selCircleIdxBuf_ = VK_NULL_HANDLE;
VmaAllocation selCircleIdxAlloc_ = VK_NULL_HANDLE;
int selCircleVertCount_ = 0;
glm::vec3 selCirclePos_{0.0f};
glm::vec3 selCircleColor_{1.0f, 0.0f, 0.0f};
float selCircleRadius_ = 1.5f;
bool selCircleVisible_ = false;
// Fullscreen overlay resources
VkPipeline overlayPipeline_ = VK_NULL_HANDLE;
VkPipelineLayout overlayPipelineLayout_ = VK_NULL_HANDLE;
};
} // namespace rendering
} // namespace wowee