]> git.tdb.fi Git - libs/gl.git/blob - source/render/view.h
Remove deprecated functions from Renderer
[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         Camera *camera = 0;
24         Renderable *content = 0;
25         Renderer *internal_renderer = 0;
26
27         View() = default;
28 public:
29         virtual ~View();
30
31         virtual unsigned get_width() const { return get_target().get_width(); }
32         virtual unsigned get_height() const { return get_target().get_height(); }
33         float get_aspect_ratio() const { return static_cast<float>(get_width())/get_height(); }
34
35         /** Sets the camera to render with.  The camera's aspect ratio is set to
36         match that of the view. */
37         void set_camera(Camera *);
38
39         void set_content(Renderable *);
40
41         virtual void render();
42         virtual void render(Renderer &);
43 protected:
44         virtual const Framebuffer &get_target() const = 0;
45 };
46
47 } // namespace GL
48 } // namespace Msp
49
50 #endif