1 #pragma once 2 #include "common/common.hpp" 3 #include "util/uuid.hpp" 4 #include "color_palette.hpp" 5 #include "util/gl_inc.h" 6 #include <memory> 7 #include "util/picture_data.hpp" 8 9 namespace horizon { 10 11 class PictureRenderer { 12 friend class CanvasGL; 13 14 public: 15 PictureRenderer(const class CanvasGL &c); 16 void realize(); 17 void render(bool on_top); 18 void push(); 19 20 private: 21 const CanvasGL &ca; 22 23 GLuint program; 24 GLuint vao; 25 GLuint vbo; 26 27 GLuint screenmat_loc; 28 GLuint viewmat_loc; 29 GLuint scale_loc; 30 GLuint size_loc; 31 GLuint shift_loc; 32 GLuint angle_loc; 33 GLuint tex_loc; 34 GLuint opacity_loc; 35 36 std::map<UUID, std::pair<std::shared_ptr<const PictureData>, GLuint>> textures; 37 void cache_picture(std::shared_ptr<const PictureData> d); 38 void uncache_picture(const UUID &uu); 39 }; 40 } // namespace horizon 41