RenderContext.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #pragma once
  2. #include <glm/vec4.hpp>
  3. #include <memory>
  4. #include <vector>
  5. #include "TextureCache.h"
  6. #include "WallpaperEngine/Application/WallpaperApplication.h"
  7. #include "WallpaperEngine/Input/InputContext.h"
  8. #include "WallpaperEngine/Input/MouseInput.h"
  9. #include "WallpaperEngine/Render/Drivers/Output/Output.h"
  10. #include "WallpaperEngine/Render/Drivers/Output/OutputViewport.h"
  11. #include "WallpaperEngine/Render/Drivers/VideoDriver.h"
  12. namespace WallpaperEngine {
  13. namespace Application {
  14. class WallpaperApplication;
  15. }
  16. namespace Media {
  17. class MediaSource;
  18. }
  19. namespace Render {
  20. namespace Drivers {
  21. class VideoDriver;
  22. namespace Output {
  23. class Output;
  24. class OutputViewport;
  25. } // namespace Output
  26. } // namespace Drivers
  27. class CWallpaper;
  28. class TextureCache;
  29. class RenderContext {
  30. public:
  31. RenderContext (Drivers::VideoDriver& driver, WallpaperApplication& app, Media::MediaSource& mediaSource);
  32. void render (Drivers::Output::OutputViewport* viewport);
  33. void setWallpaper (const std::string& display, std::shared_ptr<CWallpaper> wallpaper);
  34. void setPause (bool newState) const;
  35. [[nodiscard]] Input::InputContext& getInputContext () const;
  36. [[nodiscard]] const WallpaperApplication& getApp () const;
  37. [[nodiscard]] const Drivers::VideoDriver& getDriver () const;
  38. [[nodiscard]] const Drivers::Output::Output& getOutput () const;
  39. [[nodiscard]] std::shared_ptr<const TextureProvider> resolveTexture (const std::string& name) const;
  40. [[nodiscard]] const std::map<std::string, std::shared_ptr<CWallpaper>>& getWallpapers () const;
  41. [[nodiscard]] Media::MediaSource& getMediaSource () const;
  42. private:
  43. /** Video driver in use */
  44. Drivers::VideoDriver& m_driver;
  45. /** Maps screen -> wallpaper list */
  46. std::map<std::string, std::shared_ptr<CWallpaper>> m_wallpapers = {};
  47. /** App that holds the render context */
  48. WallpaperApplication& m_app;
  49. /** Source for the media playback information */
  50. Media::MediaSource& m_mediaSource;
  51. /** Texture cache for the render */
  52. std::unique_ptr<TextureCache> m_textureCache = nullptr;
  53. };
  54. } // namespace Render
  55. } // namespace WallpaperEngine