/* ZFramebufferRenderTargetBase.hpp Author: James Russell Created: 08/07/2011 Purpose: Base class implementation of the ZFramebufferRenderTarget interface. License: TODO */ #pragma once #ifndef _ZFRAMEBUFFERRENDERTARGETBASE_HPP #define _ZFRAMEBUFFERRENDERTARGETBASE_HPP #include #include #include //Buffer Data Struct, used to indicate buffer state struct ZFramebufferRenderTargetBufferState { //Our set of attached Color Buffers ZPtr ColorBuffers[ZFBRT_MAX_COLOR_BUFFERS]; //Our attached depth texture ZPtr DepthTexture; //Our attached depth buffer ZPtr DepthBuffer; //Our attached stencil buffer ZPtr StencilBuffer; //Indicates we are in a usable state bool bIsComplete; ZFramebufferRenderTargetBufferState() : bIsComplete(false) { } }; //Base class implementation of a frame buffer render target class ZFramebufferRenderTargetBase : public ZFramebufferRenderTarget { private: DISABLE_COPY_AND_ASSIGN(ZFramebufferRenderTargetBase); protected: //The 'clear' flags ZRenderTargetClearFlags Flags; //Width of the FBRT size_t Width; //Height of the FBRT size_t Height; //Flag indicating state has changed bool bIsDirty; //Buffer State for this frame buffer render target ZFramebufferRenderTargetBufferState BufferState; /* Constructor. @param _width - the width (in pixels / texels) of the FBRT @param _height - the height (in pixels / texels) of the FBRT */ ZFramebufferRenderTargetBase(size_t _width, size_t _height); public: //Virtual Destructor virtual ~ZFramebufferRenderTargetBase() { } /* public ZFramebufferRenderTargetBase::GetBufferState Gets the buffer state for this frame buffer render target. @return (ZFramebufferRenderTargetBufferState*) - the buffer state @context (all) */ ZFramebufferRenderTargetBufferState* GetBufferState(); /* public ZFramebufferRenderTargetBase::GetBufferStateResetDirty Gets the backing buffer state for this render target. This will return NULL if the buffer state has not been modified since the last call to this function, and in the case it has been modified, a call to this resets the 'dirty' flag for the render target. @return (ZFramebufferRenderTargetBufferState*) - buffer state, NULL if not modified @context (all) */ ZFramebufferRenderTargetBufferState* GetBufferStateResetDirty(); /*************************/ /* ZRenderTarget Methods */ /*************************/ //Subclass Implementation virtual const ZRenderTargetClearFlags& GetClearFlags(); //Subclass Implementation virtual size_t GetHeight(); //Subclass Implementation virtual ZRenderTargetType GetType(); //Subclass Implementation virtual size_t GetWidth(); //Subclass Implementation virtual bool SetClearFlags(const ZRenderTargetClearFlags& _flags); /************************************/ /* ZFramebufferRenderTarget Methods */ /************************************/ //Subclass Implementation virtual bool AttachColorTexture(ZPtr _texture, size_t _index); //Subclass Implementation virtual bool AttachDepthTexture(ZPtr _texture); //Subclass Implementation virtual bool AttachRenderBuffer(ZPtr _buffer); //Subclass Implementation virtual bool IsComplete(); //Subclass Implementation virtual bool RemoveColorBuffers(); //Subclass Implementation virtual bool RemoveDepthBuffer(); //Subclass Implementation virtual bool RemoveStencilBuffer(); }; #endif