Initial commit
This commit is contained in:
150
Include/ZRenderer/ZFrameBufferRenderTargetBase.hpp
Normal file
150
Include/ZRenderer/ZFrameBufferRenderTargetBase.hpp
Normal file
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
ZFramebufferRenderTargetBase.hpp
|
||||
Author: James Russell <jcrussell@762studios.com>
|
||||
Created: 08/07/2011
|
||||
|
||||
Purpose:
|
||||
|
||||
Base class implementation of the ZFramebufferRenderTarget interface.
|
||||
|
||||
License:
|
||||
|
||||
TODO
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef _ZFRAMEBUFFERRENDERTARGETBASE_HPP
|
||||
#define _ZFRAMEBUFFERRENDERTARGETBASE_HPP
|
||||
|
||||
#include <ZRenderer/ZFramebufferRenderTarget.hpp>
|
||||
#include <ZRenderer/ZTexture.hpp>
|
||||
#include <ZRenderer/ZRenderBuffer.hpp>
|
||||
|
||||
//Buffer Data Struct, used to indicate buffer state
|
||||
struct ZFramebufferRenderTargetBufferState
|
||||
{
|
||||
//Our set of attached Color Buffers
|
||||
ZPtr<ZTexture> ColorBuffers[ZFBRT_MAX_COLOR_BUFFERS];
|
||||
|
||||
//Our attached depth texture
|
||||
ZPtr<ZTexture> DepthTexture;
|
||||
|
||||
//Our attached depth buffer
|
||||
ZPtr<ZRenderBuffer> DepthBuffer;
|
||||
|
||||
//Our attached stencil buffer
|
||||
ZPtr<ZRenderBuffer> 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<ZTexture> _texture, size_t _index);
|
||||
|
||||
//Subclass Implementation
|
||||
virtual bool AttachDepthTexture(ZPtr<ZTexture> _texture);
|
||||
|
||||
//Subclass Implementation
|
||||
virtual bool AttachRenderBuffer(ZPtr<ZRenderBuffer> _buffer);
|
||||
|
||||
//Subclass Implementation
|
||||
virtual bool IsComplete();
|
||||
|
||||
//Subclass Implementation
|
||||
virtual bool RemoveColorBuffers();
|
||||
|
||||
//Subclass Implementation
|
||||
virtual bool RemoveDepthBuffer();
|
||||
|
||||
//Subclass Implementation
|
||||
virtual bool RemoveStencilBuffer();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user