CImage.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #pragma once
  2. #include "WallpaperEngine/Core/Objects/CImage.h"
  3. #include "WallpaperEngine/Render/Objects/Effects/CMaterial.h"
  4. #include "WallpaperEngine/Render/Objects/CEffect.h"
  5. #include "WallpaperEngine/Render/CObject.h"
  6. #include "WallpaperEngine/Render/CScene.h"
  7. #include "WallpaperEngine/Render/Shaders/Compiler.h"
  8. #include "WallpaperEngine/Assets/ITexture.h"
  9. #include <glm/vec3.hpp>
  10. using namespace WallpaperEngine;
  11. using namespace WallpaperEngine::Assets;
  12. namespace WallpaperEngine::Render::Objects::Effects
  13. {
  14. class CMaterial;
  15. }
  16. namespace WallpaperEngine::Render::Objects
  17. {
  18. class CEffect;
  19. class CImage : public CObject
  20. {
  21. public:
  22. CImage (CScene* scene, Core::Objects::CImage* image);
  23. void render () override;
  24. const Core::Objects::CImage* getImage () const;
  25. const std::vector<CEffect*>& getEffects () const;
  26. const GLfloat* getVertex () const;
  27. const GLuint* getVertexBuffer () const;
  28. const GLuint* getPassVertexBuffer () const;
  29. const GLuint* getTexCoordBuffer () const;
  30. const GLuint* getPassTexCoordBuffer () const;
  31. const ITexture* getTexture () const;
  32. /**
  33. * Performs a ping-pong on the available framebuffers to be able to continue rendering things to them
  34. *
  35. * @param drawTo The framebuffer to use
  36. * @param asInput The last texture used as output (if needed)
  37. */
  38. void pinpongFramebuffer (GLuint* drawTo, GLuint* inputTexture);
  39. protected:
  40. static const std::string Type;
  41. private:
  42. const ITexture* m_texture;
  43. GLfloat m_vertexList [6 * 3];
  44. GLfloat m_passesVertexList [6 * 3];
  45. GLfloat m_texCoordList [6 * 2];
  46. GLfloat m_passTexCoordList [6 * 2];
  47. GLuint m_vertexBuffer;
  48. GLuint m_passesVertexBuffer;
  49. GLuint m_texCoordBuffer;
  50. GLuint m_passTexCoordBuffer;
  51. uint16_t m_vertexIndices [6];
  52. CFBO* m_mainFBO;
  53. CFBO* m_subFBO;
  54. Core::Objects::CImage* m_image;
  55. std::vector<CEffect*> m_effects;
  56. Effects::CMaterial* m_material;
  57. };
  58. }