X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Frender%2Fview.h;h=b8a116a65e3b80435a4aa4cdae39020dffad6252;hp=155a6fa995d91bab92f90d7090b6da9f8496f113;hb=HEAD;hpb=5bb193f930fb8738d099d630c4d625d82c1215b5 diff --git a/source/render/view.h b/source/render/view.h index 155a6fa9..b8a116a6 100644 --- a/source/render/view.h +++ b/source/render/view.h @@ -1,7 +1,7 @@ #ifndef MSP_GL_VIEW_H_ #define MSP_GL_VIEW_H_ -#include +#include #include "framebuffer.h" namespace Msp { @@ -12,29 +12,38 @@ class Renderable; class Renderer; /** -Manages the presentation of rendering results on the screen. +An ultimate render target, which is typically visible to the user of the +application in some way. + +The content renderable's render() function is called with an empty tag. A +Sequence can be used to specify other tags and add post-processing. */ -class View: public sigc::trackable +class View: public NonCopyable { protected: - Framebuffer ⌖ - Camera *camera; - Renderable *content; - Renderer *internal_renderer; + Camera *camera = 0; + Renderable *content = 0; + Renderer *internal_renderer = 0; - View(Framebuffer &); + View() = default; public: + View(View &&); virtual ~View(); - virtual unsigned get_width() const { return target.get_width(); } - virtual unsigned get_height() const { return target.get_height(); } + virtual unsigned get_width() const { return get_target().get_width(); } + virtual unsigned get_height() const { return get_target().get_height(); } float get_aspect_ratio() const { return static_cast(get_width())/get_height(); } + /** Sets the camera to render with. The camera's aspect ratio is set to + match that of the view. */ void set_camera(Camera *); + void set_content(Renderable *); virtual void render(); virtual void render(Renderer &); +protected: + virtual const Framebuffer &get_target() const = 0; }; } // namespace GL