CImage.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #pragma once
  2. #include "WallpaperEngine/Core/Objects/CImage.h"
  3. #include "WallpaperEngine/Render/Objects/Effects/CMaterial.h"
  4. #include "WallpaperEngine/Render/Objects/Effects/CPass.h"
  5. #include "WallpaperEngine/Render/Objects/CEffect.h"
  6. #include "WallpaperEngine/Render/CObject.h"
  7. #include "WallpaperEngine/Render/CScene.h"
  8. #include "WallpaperEngine/Render/Shaders/Compiler.h"
  9. #include "WallpaperEngine/Assets/ITexture.h"
  10. #include <glm/vec3.hpp>
  11. using namespace WallpaperEngine;
  12. using namespace WallpaperEngine::Assets;
  13. namespace WallpaperEngine::Render::Objects::Effects
  14. {
  15. class CMaterial;
  16. class CPass;
  17. }
  18. namespace WallpaperEngine::Render::Objects
  19. {
  20. class CEffect;
  21. class CImage : public CObject
  22. {
  23. friend CObject;
  24. public:
  25. CImage (CScene* scene, Core::Objects::CImage* image);
  26. void setup ();
  27. void render () override;
  28. const Core::Objects::CImage* getImage () const;
  29. const std::vector<CEffect*>& getEffects () const;
  30. const glm::vec2 getSize() const;
  31. const GLfloat* getVertex () const;
  32. const GLuint* getSceneSpacePosition () const;
  33. const GLuint* getCopySpacePosition () const;
  34. const GLuint* getPassSpacePosition () const;
  35. const GLuint* getTexCoordCopy () const;
  36. const GLuint* getTexCoordPass () const;
  37. ITexture* getTexture () const;
  38. const double getAnimationTime () const;
  39. /**
  40. * Performs a ping-pong on the available framebuffers to be able to continue rendering things to them
  41. *
  42. * @param drawTo The framebuffer to use
  43. * @param asInput The last texture used as output (if needed)
  44. */
  45. void pinpongFramebuffer (CFBO** drawTo, ITexture** asInput);
  46. protected:
  47. static const std::string Type;
  48. private:
  49. ITexture* m_texture;
  50. GLuint m_sceneSpacePosition;
  51. GLuint m_copySpacePosition;
  52. GLuint m_passSpacePosition;
  53. GLuint m_texcoordCopy;
  54. GLuint m_texcoordPass;
  55. glm::mat4 m_modelViewProjectionScreen;
  56. glm::mat4 m_modelViewProjectionPass;
  57. CFBO* m_mainFBO;
  58. CFBO* m_subFBO;
  59. CFBO* m_currentMainFBO;
  60. CFBO* m_currentSubFBO;
  61. Core::Objects::CImage* m_image;
  62. std::vector<CEffect*> m_effects;
  63. Effects::CMaterial* m_material;
  64. Effects::CMaterial* m_colorBlendMaterial;
  65. std::vector <Effects::CPass*> m_passes;
  66. double m_animationTime;
  67. bool m_initialized;
  68. };
  69. }