]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/framebuffer.h
Adapt to changes in mspmath
[libs/gl.git] / source / core / framebuffer.h
index d2029022d94b6fee2d0380d43a18dbff90338a63..5476596317000dbecd53eca3146adce3dcc4407c 100644 (file)
@@ -5,6 +5,7 @@
 #include "color.h"
 #include "framebuffer_backend.h"
 #include "frameformat.h"
+#include "rect.h"
 #include "texturecube.h"
 
 namespace Msp {
@@ -34,7 +35,7 @@ class Framebuffer: public FramebufferBackend
 {
        friend FramebufferBackend;
 
-private:
+protected:
        struct Attachment
        {
                Texture *tex = 0;
@@ -47,9 +48,10 @@ private:
 
        FrameFormat format;
        std::vector<Attachment> attachments;
-       unsigned width;
-       unsigned height;
-       mutable unsigned dirty;
+       unsigned width = 0;
+       unsigned height = 0;
+       unsigned layers = 0;
+       mutable unsigned dirty = 0;
 
        Framebuffer(bool);
 public:
@@ -71,8 +73,10 @@ public:
 
        unsigned get_width() const { return width; }
        unsigned get_height() const { return height; }
+       Rect get_rect() const { return Rect(0, 0, width, height); }
+       unsigned get_layers() const { return layers; }
 
-private:
+protected:
        void update() const;
        void check_size();
        void set_attachment(FrameAttachment, Texture &, unsigned, int, unsigned);
@@ -99,7 +103,8 @@ public:
        void attach_layered(FrameAttachment attch, TextureCube &, unsigned level = 0);
        void detach(FrameAttachment attch);
 
-       void resize(const WindowView &);
+       const Texture *get_attachment(FrameAttachment) const;
+       const Texture *get_attachment(unsigned) const;
 
        /** Ensures that the framebuffer is complete, throwing an exception if it
        isn't. */
@@ -108,8 +113,6 @@ public:
        void refresh() const { if(dirty) update(); }
 
        using FramebufferBackend::set_debug_name;
-
-       static Framebuffer &system();
 };