CFBO.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #pragma once
  2. #include <string>
  3. #include "TextureProvider.h"
  4. using namespace WallpaperEngine::Render;
  5. namespace WallpaperEngine::Render {
  6. class CFBO final : public TextureProvider {
  7. public:
  8. CFBO (
  9. std::string name, const TextureFormat format, const uint32_t flags, const float scale, uint32_t realWidth,
  10. uint32_t realHeight, uint32_t textureWidth, uint32_t textureHeight
  11. );
  12. ~CFBO () override;
  13. [[nodiscard]] const std::string& getName () const;
  14. [[nodiscard]] const float& getScale () const;
  15. [[nodiscard]] TextureFormat getFormat () const override;
  16. [[nodiscard]] uint32_t getFlags () const override;
  17. [[nodiscard]] GLuint getFramebuffer () const;
  18. [[nodiscard]] GLuint getDepthbuffer () const;
  19. [[nodiscard]] GLuint getTextureID (uint32_t imageIndex) const override;
  20. [[nodiscard]] uint32_t getTextureWidth (uint32_t imageIndex) const override;
  21. [[nodiscard]] uint32_t getTextureHeight (uint32_t imageIndex) const override;
  22. [[nodiscard]] uint32_t getRealWidth () const override;
  23. [[nodiscard]] uint32_t getRealHeight () const override;
  24. [[nodiscard]] const std::vector<FrameSharedPtr>& getFrames () const override;
  25. [[nodiscard]] const glm::vec4* getResolution () const override;
  26. [[nodiscard]] bool isAnimated () const override;
  27. [[nodiscard]] uint32_t getSpritesheetCols () const override;
  28. [[nodiscard]] uint32_t getSpritesheetRows () const override;
  29. [[nodiscard]] uint32_t getSpritesheetFrames () const override;
  30. [[nodiscard]] float getSpritesheetDuration () const override;
  31. void incrementUsageCount () const override;
  32. void decrementUsageCount () const override;
  33. void update () const override;
  34. bool isReady () const override;
  35. private:
  36. GLuint m_framebuffer = GL_NONE;
  37. GLuint m_depthbuffer = GL_NONE;
  38. GLuint m_texture = GL_NONE;
  39. glm::vec4 m_resolution = {};
  40. float m_scale = 0;
  41. std::string m_name = "";
  42. TextureFormat m_format = TextureFormat_UNKNOWN;
  43. uint32_t m_flags = TextureFlags_NoFlags;
  44. /** Placeholder for frames, FBOs only have ONE */
  45. std::vector<FrameSharedPtr> m_frames = {};
  46. };
  47. } // namespace WallpaperEngine::Render