]> git.tdb.fi Git - libs/gl.git/blob - source/render/rendertarget.h
Check the flat qualifier from the correct member
[libs/gl.git] / source / render / rendertarget.h
1 #ifndef RENDERTARGET_H_
2 #define RENDERTARGET_H_
3
4 #include <msp/core/noncopyable.h>
5 #include "framebuffer.h"
6
7 namespace Msp {
8 namespace GL {
9
10 class Texture;
11 class Texture2D;
12
13 /**
14 Wraps a Framebuffer and its attachments for easier management.
15
16 All attachments will be created as 2D or 2D multisample textures, depending on
17 the sample count of the format.
18 */
19 class RenderTarget: public NonCopyable
20 {
21 private:
22         unsigned width;
23         unsigned height;
24         std::vector<Texture *> textures;
25         Framebuffer fbo;
26
27 public:
28         RenderTarget(unsigned, unsigned, const FrameFormat & = (COLOR_ATTACHMENT, DEPTH_ATTACHMENT));
29         RenderTarget(RenderTarget &&) = default;
30         ~RenderTarget();
31
32         unsigned get_width() const { return width; }
33         unsigned get_height() const { return height; }
34         const FrameFormat &get_format() const { return fbo.get_format(); }
35         Framebuffer &get_framebuffer() { return fbo; }
36         const Texture2D &get_target_texture(unsigned) const;
37         const Texture2D &get_target_texture(FrameAttachment) const;
38
39         void set_debug_name(const std::string &);
40 };
41
42 } // namespace GL
43 } // namespace Msp
44
45 #endif