X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Frendertarget.h;h=2138d9ce31b202a7a0f896ebf7d0cb6b08d35d6f;hp=0181365e0c0b8ea4b916ef7255aa0ad3f171c5ac;hb=HEAD;hpb=5f7d0a31de9ffe891af6eb43aeb6d37372b8ade7 diff --git a/source/rendertarget.h b/source/rendertarget.h deleted file mode 100644 index 0181365e..00000000 --- a/source/rendertarget.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef RENDERTARGET_H_ -#define RENDERTARGET_H_ - -#include "framebuffer.h" -#include "texture2d.h" - -namespace Msp { -namespace GL { - -enum RenderOutput -{ - RENDER_COLOR = 0|3, - RENDER_DEPTH = 192|12 -}; - -class RenderTargetFormat -{ -private: - enum { MAX_OUTPUTS = 7 }; - - unsigned char count; - unsigned char outputs[MAX_OUTPUTS]; - -public: - RenderTargetFormat(); - RenderTargetFormat(RenderOutput); - - RenderTargetFormat operator,(RenderOutput) const; - RenderTargetFormat operator,(PixelFormat) const; - - bool empty() const { return !count; } - const unsigned char *begin() const { return outputs; } - const unsigned char *end() const { return outputs+count; } - int index(RenderOutput) const; -}; - -inline RenderTargetFormat operator,(RenderOutput o1, RenderOutput o2) -{ return (RenderTargetFormat(o1), o2); } - -inline RenderTargetFormat operator,(RenderOutput o, PixelFormat f) -{ return (RenderTargetFormat(o), f); } - -inline unsigned get_output_type(unsigned char o) -{ return o>>4; } - -PixelFormat get_output_pixelformat(unsigned char); - - -class RenderTarget -{ -private: - union TargetBuffer - { - Texture2D *texture; - Renderbuffer *buffer; - }; - - unsigned width; - unsigned height; - unsigned samples; - RenderTargetFormat format; - std::vector buffers; - Framebuffer fbo; - -public: - RenderTarget(unsigned, unsigned, const RenderTargetFormat & = (RENDER_COLOR, RENDER_DEPTH)); - RenderTarget(unsigned, unsigned, unsigned, const RenderTargetFormat & = (RENDER_COLOR, RENDER_DEPTH)); -private: - RenderTarget(const RenderTarget &); - RenderTarget &operator=(const RenderTarget &); - void init(unsigned, unsigned, unsigned, const RenderTargetFormat &); -public: - ~RenderTarget(); - - const RenderTargetFormat &get_format() const { return format; } - Framebuffer &get_framebuffer() { return fbo; } - const Texture2D &get_target_texture(unsigned) const; - const Texture2D &get_target_texture(RenderOutput) const; - void blit_from(const RenderTarget &); -}; - -} // namespace GL -} // namespace Msp - -#endif