X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Frender%2Fview.h;h=b7cb2256e937a6ef014415ae635c31d7d4e2b7fd;hb=9e63512930bc7dace6dc169c65161961e5dcfcf6;hp=9c756bbcdb453c62b1701a8421d3df075c6076f0;hpb=791f266553f0e6c6fc006d96eb9bc2967beb7012;p=libs%2Fgl.git diff --git a/source/render/view.h b/source/render/view.h index 9c756bbc..b7cb2256 100644 --- a/source/render/view.h +++ b/source/render/view.h @@ -11,29 +11,37 @@ 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 { protected: - Framebuffer ⌖ Camera *camera; Renderable *content; Renderer *internal_renderer; - View(Framebuffer &); + View(); public: 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