X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fview.h;h=24188de44564f02d6a66e4b6feb7e43a5cf2bbb4;hp=0dd638959693f6c052494892a09a723b273a95a5;hb=a4549c55a6d47129bd9e42c6a49a671b759ce6d9;hpb=1bd2a77b4999d240a27e13a9069e8fca3410d363 diff --git a/source/view.h b/source/view.h index 0dd63895..24188de4 100644 --- a/source/view.h +++ b/source/view.h @@ -2,43 +2,40 @@ #define MSP_GL_VIEW_H_ #include -#include -#include +#include "framebuffer.h" namespace Msp { namespace GL { class Camera; -class Framebuffer; class Renderable; /** Manages the presentation of rendering results on the screen. */ -class View +class View: public sigc::trackable { -private: - Graphics::Window &window; - Graphics::GLContext &context; +protected: Framebuffer ⌖ - const Renderable *content; + Camera *camera; + Renderable *content; std::list synced_cameras; + View(Framebuffer &); + public: - View(Graphics::Window &, Graphics::GLContext &); + virtual unsigned get_width() const { return target.get_width(); } + virtual unsigned get_height() const { return target.get_height(); } + float get_aspect_ratio() const { return static_cast(get_width())/get_height(); } - Graphics::Window &get_window() { return window; } - Graphics::GLContext &get_context() { return context; } - unsigned get_width() const { return window.get_width(); } - unsigned get_height() const { return window.get_height(); } + void set_camera(Camera *); + void set_content(Renderable *); - void set_content(const Renderable *); + // Deprecated + float get_aspect() const { return get_aspect_ratio(); } void synchronize_camera_aspect(Camera &); - void render(); - -private: - void window_resized(unsigned, unsigned); + virtual void render(); }; } // namespace GL