#pragma once #include "../base/Types.h" #include "../plot/Plot_Core.h" #include #include #include #include namespace renderive { struct Performance_Log_Options { bool enabled{}; std::string directory; std::string session_name = "renderive"; }; struct Performance_Overlay_Style { Font font; int top_margin = 4; int left_margin = 6; int right_margin = 12; int bottom_margin = 6; Color background = Color::white(); Color section_color{64, 142, 255}; Color label_color{190, 190, 190}; Color value_color{235, 218, 130}; }; struct Performance_Overlay_Options { Performance_Overlay_Style style; Performance_Log_Options log; }; struct Performance_Display_Snapshot { Performance_Overlay_Style style; Size viewport_size; std::string plot_name; std::vector lines; std::uint64_t frame_count{}; }; class LIB_DECL Performance_Overlay { public: Performance_Overlay(); explicit Performance_Overlay(Performance_Overlay_Options options); ~Performance_Overlay(); [[nodiscard]] bool enabled() const noexcept; [[nodiscard]] std::shared_ptr display_snapshot() const; private: friend class Plot_Core; friend std::shared_ptr attach_performance_overlay(Plot_Core&); friend std::shared_ptr attach_performance_overlay( Plot_Core&, const Performance_Overlay_Options&); friend void set_performance_plot_name(Plot_Core&, std::string); friend void set_performance_overlay_enabled(Plot_Core&, bool); struct Impl; std::unique_ptr impl_; void set_enabled(bool enabled); void set_plot_name(std::string name); void set_options(Performance_Overlay_Options options); void record_frame(double render_duration_ms, const Low_Latency_Diagnostics& diagnostics, std::size_t renderable_count, Size viewport); }; LIB_DECL std::shared_ptr attach_performance_overlay(Plot_Core& plot); LIB_DECL std::shared_ptr attach_performance_overlay( Plot_Core& plot, const Performance_Overlay_Options& options); LIB_DECL void set_performance_plot_name(Plot_Core& plot, std::string name); LIB_DECL void set_performance_overlay_enabled(Plot_Core& plot, bool enabled); } // namespace renderive