X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Frender%2Frendertarget.h;h=bad7845c4064d1bb1c7993a97565a8aa071db81c;hb=77a534371433054384d213922a2e8c55f8a69ad6;hp=f13d23d9683a12b2828272125a610570b52c28ca;hpb=cd5f37b066352119cf92d53d0001af7ff99be437;p=libs%2Fgl.git diff --git a/source/render/rendertarget.h b/source/render/rendertarget.h index f13d23d9..bad7845c 100644 --- a/source/render/rendertarget.h +++ b/source/render/rendertarget.h @@ -9,72 +9,28 @@ namespace GL { class Texture; class Texture2D; -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: unsigned width; unsigned height; - unsigned samples; - RenderTargetFormat format; std::vector textures; Framebuffer fbo; public: - RenderTarget(unsigned, unsigned, RenderOutput); - RenderTarget(unsigned, unsigned, const RenderTargetFormat & = (RENDER_COLOR, RENDER_DEPTH)); - RenderTarget(unsigned, unsigned, unsigned, const RenderTargetFormat & = (RENDER_COLOR, RENDER_DEPTH)); + RenderTarget(unsigned, unsigned, const FrameFormat & = (COLOR_ATTACHMENT, DEPTH_ATTACHMENT)); private: RenderTarget(const RenderTarget &); RenderTarget &operator=(const RenderTarget &); - void init(unsigned, unsigned, unsigned, const RenderTargetFormat &); public: ~RenderTarget(); unsigned get_width() const { return width; } unsigned get_height() const { return height; } - const RenderTargetFormat &get_format() const { return format; } + const FrameFormat &get_format() const { return fbo.get_format(); } Framebuffer &get_framebuffer() { return fbo; } const Texture2D &get_target_texture(unsigned) const; - const Texture2D &get_target_texture(RenderOutput) const; + const Texture2D &get_target_texture(FrameAttachment) const; void set_debug_name(const std::string &); };