]> git.tdb.fi Git - libs/gl.git/blob - source/view.h
Support rendering View with an externally provided Renderer
[libs/gl.git] / source / view.h
1 #ifndef MSP_GL_VIEW_H_
2 #define MSP_GL_VIEW_H_
3
4 #include <list>
5 #include "framebuffer.h"
6
7 namespace Msp {
8 namespace GL {
9
10 class Camera;
11 class Renderable;
12 class Renderer;
13
14 /**
15 Manages the presentation of rendering results on the screen.
16 */
17 class View: public sigc::trackable
18 {
19 protected:
20         Framebuffer &target;
21         Camera *camera;
22         Renderable *content;
23
24         View(Framebuffer &);
25
26 public:
27         virtual unsigned get_width() const { return target.get_width(); }
28         virtual unsigned get_height() const { return target.get_height(); }
29         float get_aspect_ratio() const { return static_cast<float>(get_width())/get_height(); }
30
31         void set_camera(Camera *);
32         void set_content(Renderable *);
33
34         virtual void render();
35         virtual void render(Renderer &);
36 };
37
38 } // namespace GL
39 } // namespace Msp
40
41 #endif