]> git.tdb.fi Git - libs/gl.git/blobdiff - source/view.h
Support rendering View with an externally provided Renderer
[libs/gl.git] / source / view.h
index f7f47fc7b48fd7d37f349f73823fee017a3d5ad5..b34ae5c75abf070ecd1f9100548744d773b9b7d2 100644 (file)
@@ -2,49 +2,37 @@
 #define MSP_GL_VIEW_H_
 
 #include <list>
-#include <sigc++/trackable.h>
-#include <msp/graphics/glcontext.h>
-#include <msp/graphics/window.h>
+#include "framebuffer.h"
 
 namespace Msp {
 namespace GL {
 
 class Camera;
-class Framebuffer;
 class Renderable;
+class Renderer;
 
 /**
 Manages the presentation of rendering results on the screen.
 */
 class View: public sigc::trackable
 {
-private:
-       Graphics::Window &window;
-       Graphics::GLContext &context;
+protected:
        Framebuffer &target;
        Camera *camera;
        Renderable *content;
-       std::list<Camera *> synced_cameras;
 
-public:
-       View(Graphics::Window &, Graphics::GLContext &);
+       View(Framebuffer &);
 
-       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(); }
-       float get_aspect() const { return static_cast<float>(get_width())/get_height(); }
+public:
+       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<float>(get_width())/get_height(); }
 
        void set_camera(Camera *);
        void set_content(Renderable *);
 
-       // Deprecated
-       void synchronize_camera_aspect(Camera &);
-
-       void render();
-
-private:
-       void window_resized(unsigned, unsigned);
+       virtual void render();
+       virtual void render(Renderer &);
 };
 
 } // namespace GL