#pragma once #include #include #include "../core/LockSurface.hpp" #include "Shader.hpp" #include "../helpers/Box.hpp" #include "../helpers/Color.hpp" #include "AsyncResourceGatherer.hpp" #include "widgets/IWidget.hpp" #include "Framebuffer.hpp" typedef std::unordered_map>> widgetMap_t; class CRenderer { public: CRenderer(); struct SRenderFeedback { bool needsFrame = false; }; struct SBlurParams { int size = 0, passes = 0; float noise = 0, contrast = 0, brightness = 0, vibrancy = 0, vibrancy_darkness = 0; }; SRenderFeedback renderLock(const CSessionLockSurface& surface); void renderRect(const CBox& box, const CColor& col, int rounding = 0); void renderTexture(const CBox& box, const CTexture& tex, float a = 1.0, int rounding = 0, bool noTransform = false); void blurFB(const CFramebuffer& outfb, SBlurParams params); std::unique_ptr asyncResourceGatherer; std::chrono::system_clock::time_point gatheredAt; private: widgetMap_t widgets; std::vector>* getOrCreateWidgetsFor(const CSessionLockSurface* surf); CShader rectShader; CShader texShader; CShader blurShader1; CShader blurShader2; CShader blurPrepareShader; CShader blurFinishShader; std::array projMatrix; std::array projection; }; inline std::unique_ptr g_pRenderer;