CImage.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. friend CObject;
  22. public:
  23. CImage (CScene* scene, Core::Objects::CImage* image);
  24. void setup ();
  25. void render () override;
  26. const Core::Objects::CImage* getImage () const;
  27. const std::vector<CEffect*>& getEffects () const;
  28. const glm::vec2 getSize() const;
  29. const GLfloat* getVertex () const;
  30. const GLuint* getSceneSpacePosition () const;
  31. const GLuint* getCopySpacePosition () const;
  32. const GLuint* getPassSpacePosition () const;
  33. const GLuint* getTexCoordCopy () const;
  34. const GLuint* getTexCoordPass () const;
  35. ITexture* getTexture () const;
  36. /**
  37. * Performs a ping-pong on the available framebuffers to be able to continue rendering things to them
  38. *
  39. * @param drawTo The framebuffer to use
  40. * @param asInput The last texture used as output (if needed)
  41. */
  42. void pinpongFramebuffer (CFBO** drawTo, ITexture** asInput);
  43. protected:
  44. static const std::string Type;
  45. void simpleRender ();
  46. void complexRender ();
  47. private:
  48. ITexture* m_texture;
  49. GLuint m_sceneSpacePosition;
  50. GLuint m_copySpacePosition;
  51. GLuint m_passSpacePosition;
  52. GLuint m_texcoordCopy;
  53. GLuint m_texcoordPass;
  54. glm::mat4 m_modelViewProjectionScreen;
  55. glm::mat4 m_modelViewProjectionPass;
  56. CFBO* m_mainFBO;
  57. CFBO* m_subFBO;
  58. CFBO* m_currentMainFBO;
  59. CFBO* m_currentSubFBO;
  60. Core::Objects::CImage* m_image;
  61. std::vector<CEffect*> m_effects;
  62. Effects::CMaterial* m_material;
  63. Effects::CMaterial* m_copyMaterial;
  64. };
  65. }