]> git.tdb.fi Git - libs/gl.git/blobdiff - source/view.h
Refresh lighting and culling uniforms if the camera changes in pop_state
[libs/gl.git] / source / view.h
index 93eb49d7d64c82d8223a21c406bea9aaf49675f4..f7f47fc7b48fd7d37f349f73823fee017a3d5ad5 100644 (file)
@@ -2,6 +2,7 @@
 #define MSP_GL_VIEW_H_
 
 #include <list>
+#include <sigc++/trackable.h>
 #include <msp/graphics/glcontext.h>
 #include <msp/graphics/window.h>
 
@@ -15,19 +16,29 @@ 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;
        Framebuffer &target;
-       const Renderable *content;
+       Camera *camera;
+       Renderable *content;
        std::list<Camera *> synced_cameras;
 
 public:
        View(Graphics::Window &, Graphics::GLContext &);
 
-       void set_content(const Renderable *);
+       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(); }
+
+       void set_camera(Camera *);
+       void set_content(Renderable *);
+
+       // Deprecated
        void synchronize_camera_aspect(Camera &);
 
        void render();