module; #include #include export module VulkanRender; import Render; import views; import vulkan_render; import std; namespace ee_vulkan { template using lazy = std::optional; constexpr std::uint64_t TIMEOUT = std::numeric_limits::max(); struct DrawConfig { static constexpr vk::ClearValue CLEAR_COLOR = {.color = {std::array{1.0f, 1.0f, 1.0f, 1.0f}}}; static constexpr vk::ClearValue CLEAR_DEPTH = {.depthStencil = {1.0f, 0}}; }; struct ProvinceMesh { lazy> vertices; lazy> indices; lazy> storage; lazy> indirectCommands; }; } export namespace ee_vulkan { class VulkanRenderer final : public ee_engine::IRenderer { public: explicit VulkanRenderer(GLFWwindow *window); ~VulkanRenderer() override; void Init() override; void Shutdown() override; protected: void Clear() override; void DrawMap() override; void DrawUI() override; void ResizeWindow(int width, int height) override; void ApplyCamera() override; void UpdateProvinces(std::size_t offset, const std::vector& data) override; private: const std::uint32_t MAX_FRAMES_IN_FLIGHT = 3; bool isDrawing = false; lazy context; vulkan_render::Surface surface; lazy swapchain; lazy renderCommands; lazy provincesPipeline; lazy syncManager; lazy> depth; lazy> viewProjectionUniform; ProvinceMesh provinces; std::size_t currentFrame = 0; void RecreateSwapchain(); void LoadProvincesMaterial(); void LoadProvinces(); void UpdateData(std::uint32_t frame); }; }