1 #ifndef RENDERTARGET_H_
2 #define RENDERTARGET_H_
4 #include "framebuffer.h"
18 class RenderTargetFormat
21 enum { MAX_OUTPUTS = 7 };
24 unsigned char outputs[MAX_OUTPUTS];
28 RenderTargetFormat(RenderOutput);
30 RenderTargetFormat operator,(RenderOutput) const;
31 RenderTargetFormat operator,(PixelFormat) const;
33 bool empty() const { return !count; }
34 const unsigned char *begin() const { return outputs; }
35 const unsigned char *end() const { return outputs+count; }
36 int index(RenderOutput) const;
39 inline RenderTargetFormat operator,(RenderOutput o1, RenderOutput o2)
40 { return (RenderTargetFormat(o1), o2); }
42 inline RenderTargetFormat operator,(RenderOutput o, PixelFormat f)
43 { return (RenderTargetFormat(o), f); }
45 inline unsigned get_output_type(unsigned char o)
48 PixelFormat get_output_pixelformat(unsigned char);
57 RenderTargetFormat format;
58 std::vector<Texture *> textures;
62 RenderTarget(unsigned, unsigned, RenderOutput);
63 RenderTarget(unsigned, unsigned, const RenderTargetFormat & = (RENDER_COLOR, RENDER_DEPTH));
64 RenderTarget(unsigned, unsigned, unsigned, const RenderTargetFormat & = (RENDER_COLOR, RENDER_DEPTH));
66 RenderTarget(const RenderTarget &);
67 RenderTarget &operator=(const RenderTarget &);
68 void init(unsigned, unsigned, unsigned, const RenderTargetFormat &);
72 unsigned get_width() const { return width; }
73 unsigned get_height() const { return height; }
74 const RenderTargetFormat &get_format() const { return format; }
75 Framebuffer &get_framebuffer() { return fbo; }
76 const Texture2D &get_target_texture(unsigned) const;
77 const Texture2D &get_target_texture(RenderOutput) const;
79 void set_debug_name(const std::string &);