1 #ifndef RENDERTARGET_H_
2 #define RENDERTARGET_H_
4 #include "framebuffer.h"
16 class RenderTargetFormat
19 enum { MAX_OUTPUTS = 7 };
22 unsigned char outputs[MAX_OUTPUTS];
26 RenderTargetFormat(RenderOutput);
28 RenderTargetFormat operator,(RenderOutput) const;
29 RenderTargetFormat operator,(PixelFormat) const;
31 bool empty() const { return !count; }
32 const unsigned char *begin() const { return outputs; }
33 const unsigned char *end() const { return outputs+count; }
34 int index(RenderOutput) const;
37 inline RenderTargetFormat operator,(RenderOutput o1, RenderOutput o2)
38 { return (RenderTargetFormat(o1), o2); }
40 inline RenderTargetFormat operator,(RenderOutput o, PixelFormat f)
41 { return (RenderTargetFormat(o), f); }
43 inline unsigned get_output_type(unsigned char o)
46 PixelFormat get_output_pixelformat(unsigned char);
61 RenderTargetFormat format;
62 std::vector<TargetBuffer> buffers;
66 RenderTarget(unsigned, unsigned, RenderOutput);
67 RenderTarget(unsigned, unsigned, const RenderTargetFormat & = (RENDER_COLOR, RENDER_DEPTH));
68 RenderTarget(unsigned, unsigned, unsigned, const RenderTargetFormat & = (RENDER_COLOR, RENDER_DEPTH));
70 RenderTarget(const RenderTarget &);
71 RenderTarget &operator=(const RenderTarget &);
72 void init(unsigned, unsigned, unsigned, const RenderTargetFormat &);
76 unsigned get_width() const { return width; }
77 unsigned get_height() const { return height; }
78 const RenderTargetFormat &get_format() const { return format; }
79 Framebuffer &get_framebuffer() { return fbo; }
80 void set_texture_filter(TextureFilter);
81 const Texture2D &get_target_texture(unsigned) const;
82 const Texture2D &get_target_texture(RenderOutput) const;
83 void blit_from(const RenderTarget &);