]> git.tdb.fi Git - libs/gl.git/blob - source/render/view.h
Update and improve documentation
[libs/gl.git] / source / render / view.h
1 #ifndef MSP_GL_VIEW_H_
2 #define MSP_GL_VIEW_H_
3
4 #include "framebuffer.h"
5
6 namespace Msp {
7 namespace GL {
8
9 class Camera;
10 class Renderable;
11 class Renderer;
12
13 /**
14 An ultimate render target, which is typically visible to the user of the
15 application in some way.
16
17 The content renderable's render() function is called with an empty tag.  A
18 Sequence can be used to specify other tags and add post-processing.
19 */
20 class View
21 {
22 protected:
23         Framebuffer ⌖
24         Camera *camera;
25         Renderable *content;
26         Renderer *internal_renderer;
27
28         View(Framebuffer &);
29 public:
30         virtual ~View();
31
32         virtual unsigned get_width() const { return target.get_width(); }
33         virtual unsigned get_height() const { return target.get_height(); }
34         float get_aspect_ratio() const { return static_cast<float>(get_width())/get_height(); }
35
36         /** Sets the camera to render with.  The camera's aspect ratio is set to
37         match that of the view. */
38         void set_camera(Camera *);
39
40         void set_content(Renderable *);
41
42         virtual void render();
43         virtual void render(Renderer &);
44 };
45
46 } // namespace GL
47 } // namespace Msp
48
49 #endif