]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/framebuffer.cpp
Make framebuffer attachment accessors public
[libs/gl.git] / source / core / framebuffer.cpp
index 70c19859d128aeda40f1f9a1b34cb7cfd4774e06..8a1a52316f9fa6835e685570f6357d14955389d0 100644 (file)
@@ -16,15 +16,11 @@ framebuffer_incomplete::framebuffer_incomplete(const std::string &reason):
 
 
 Framebuffer::Framebuffer(bool s):
-       FramebufferBackend(s),
-       dirty(0)
+       FramebufferBackend(s)
 { }
 
 Framebuffer::Framebuffer():
-       FramebufferBackend(false),
-       width(0),
-       height(0),
-       dirty(0)
+       FramebufferBackend(false)
 { }
 
 Framebuffer::Framebuffer(FrameAttachment fa):
@@ -169,6 +165,20 @@ void Framebuffer::detach(FrameAttachment attch)
        }
 }
 
+const Texture *Framebuffer::get_attachment(FrameAttachment attch) const
+{
+       if(attachments.empty())
+               return 0;
+
+       int i = format.index(attch);
+       return (i>=0 ? attachments[i].tex : 0);
+}
+
+const Texture *Framebuffer::get_attachment(unsigned i) const
+{
+       return (i<attachments.size() ? attachments[i].tex : 0);
+}
+
 void Framebuffer::require_complete() const
 {
        bool layered = (!attachments.empty() && attachments.front().layer<0);