115 lines
2.5 KiB
C++
115 lines
2.5 KiB
C++
/*
|
|
ZRenderTarget.hpp
|
|
Author: James Russell <jcrussell@762studios.com>
|
|
Created: 03/20/2011
|
|
|
|
Purpose:
|
|
|
|
Defines an interface for a rendering surface.
|
|
|
|
License:
|
|
|
|
TODO
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#ifndef _ZRENDERTARGET_HPP
|
|
#define _ZRENDERTARGET_HPP
|
|
|
|
#include <ZRenderer/ZRendererBuild.hpp>
|
|
#include <ZRenderer/ZRendererResource.hpp>
|
|
|
|
//Enumeration of possible render target types
|
|
enum ZRenderTargetType
|
|
{
|
|
ZRTT_WINDOW, //Used for window render targets
|
|
ZRTT_FRAMEBUFFER, //Used for frame buffer render targets
|
|
ZRTT_SIZE
|
|
};
|
|
|
|
//Used to flag which buffers should be cleared, and to what value
|
|
struct ZRenderTargetClearFlags
|
|
{
|
|
bool AutoClear; //Indicates that the renderer should 'clear' the toggled buffers before rendering to this target
|
|
|
|
bool ClearColorBuffer; //Indicates we should clear the color buffer
|
|
bool ClearDepthBuffer; //Indicates we should clear the depth buffer
|
|
bool ClearStencilBuffer; //Indicates we should clear the stencil buffer
|
|
|
|
float ClearColor[4]; //RGBA clear color to use
|
|
|
|
//Default Constructor
|
|
ZRenderTargetClearFlags()
|
|
: AutoClear(true), ClearColorBuffer(true), ClearDepthBuffer(true), ClearStencilBuffer(false)
|
|
{
|
|
ClearColor[0] = 0.0f;
|
|
ClearColor[1] = 0.0f;
|
|
ClearColor[2] = 0.0f;
|
|
ClearColor[3] = 1.0f;
|
|
}
|
|
};
|
|
|
|
/*
|
|
RenderTarget Interface.
|
|
*/
|
|
class ZRenderTarget : public ZRendererResource
|
|
{
|
|
public:
|
|
//Virtual Destructor
|
|
virtual ~ZRenderTarget() { }
|
|
|
|
/*
|
|
public ZRenderTarget::GetClearFlags
|
|
|
|
Gets the current set of clear flags for this render target.
|
|
|
|
@return (const ZRenderTargetClearFlags&) - clearing flags for this render target
|
|
@context (all)
|
|
*/
|
|
virtual const ZRenderTargetClearFlags& GetClearFlags() = 0;
|
|
|
|
/*
|
|
public ZRenderTarget::GetHeight
|
|
|
|
Gets the height value for the render target (in pixels).
|
|
|
|
@return (size_t)
|
|
@context (all)
|
|
*/
|
|
virtual size_t GetHeight() = 0;
|
|
|
|
/*
|
|
public ZRenderTarget::GetType
|
|
|
|
Gets the type of render target.
|
|
|
|
@return (ZRenderTargetType) - the type of render target
|
|
@context (all)
|
|
*/
|
|
virtual ZRenderTargetType GetType() = 0;
|
|
|
|
/*
|
|
public ZRenderTarget::GetWidth
|
|
|
|
Gets the width value for the render target (in pixels).
|
|
|
|
@return (size_t)
|
|
@context (all)
|
|
*/
|
|
virtual size_t GetWidth() = 0;
|
|
|
|
/*
|
|
public ZRenderTarget::SetClearFlags
|
|
|
|
Sets the clear flags for this render target.
|
|
|
|
@param _flags - flags structure which has our clear settings
|
|
@return (bool) - true if able to set flags, false if resource contended
|
|
@context (all)
|
|
*/
|
|
virtual bool SetClearFlags(const ZRenderTargetClearFlags& _flags) = 0;
|
|
};
|
|
|
|
#endif
|