Keos::IRenderTarget Class Reference

A 'canvas' which can receive the results of a rendering operation. More...

#include <KeosRenderTarget.h>

Inheritance diagram for Keos::IRenderTarget:

Inheritance graph
[legend]
List of all members.

Public Types

enum  StatFlags {
  SF_NONE = 0, SF_FPS = 1, SF_AVG_FPS = 2, SF_BEST_FPS = 4,
  SF_WORST_FPS = 8, SF_TRIANGLE_COUNT = 16, SF_ALL = 0xFFFF
}

Public Member Functions

 IRenderTarget ()
 Default constructor.
virtual ~IRenderTarget ()
 Destructor.
virtual const StringGetName (void) const
 Retrieve target's name.
virtual void GetMetrics (uint &nWidth, uint &nHeight, uint &nColourDepth)
 Retrieve information about the render target.
virtual unsigned int GetWidth (void) const
virtual unsigned int GetHeight (void) const
virtual unsigned int GetColourDepth (void) const
virtual void Init (void)
 Initialise the target.
virtual void Update (void)
 Tells the target to update it's contents.
virtual void GetStatistics (float &lastFPS, float &avgFPS, float &bestFPS, float &worstFPS) const
 Retieves details of current rendering performance.
virtual float GetLastFPS () const
 Individual stats access - gets the number of frames per second (FPS) based on the last frame rendered.
virtual float GetAverageFPS () const
 Individual stats access - gets the average frames per second (FPS) since call to Root::startRendering.
virtual float GetBestFPS () const
 Individual stats access - gets the best frames per second (FPS) since call to Root::startRendering.
virtual float GetWorstFPS () const
 Individual stats access - gets the worst frames per second (FPS) since call to Root::startRendering.
virtual float GetBestFrameTime () const
 Individual stats access - gets the best frame time.
virtual float GetWorstFrameTime () const
 Individual stats access - gets the worst frame time.
virtual float GetLastFrameTime () const
 Individual stats access - gets the last frame time.
virtual void ResetStatistics (void)
 Resets saved frame-rate statistices.
virtual bool IsActive () const
 Used to retrieve the active state of the render target.
virtual void SetActive (bool bState)
 Used to set the active state of the render target.
virtual void SetAutoUpdated (bool bAutoUpdate)
 Sets whether this target should be automatically updated if Keos's rendering loop or Keos::KeosRenderSystem::UpdateAllRenderTargets is being used.
virtual bool IsAutoUpdated (void) const
 Gets whether this target should be automatically updated if Keos's rendering loop or Keos::KeosRenderSystem::UpdateAllRenderTargets is being used.
virtual size_t GetTriangleCount (void) const
 Gets the number of triangles rendered in the last Update() call.
void SetRenderApp (IRenderApp *pRenderApp)
 Attaches a IRenderApp interface to render target.

Protected Member Functions

void UpdateStats (void)
 Update stats.

Protected Attributes

String m_strName
 The name of this target.
IRenderAppm_pRenderApp
 Interface for render of the target.
unsigned int m_nWidth
 Target's width.
unsigned int m_nHeight
 Target's height.
unsigned int m_nColourDepth
 Target's colour depth.
FrameStats m_Stats
 Stats.
CTimerm_pTimer
 Timer for stats calculation.
unsigned long m_nLastSecond
unsigned long m_nLastTime
size_t m_nFrameCount
bool m_bActive
 The active state of the render target.
bool m_bAutoUpdate
 See SetAutoUpdated() function.
bool m_bIsDepthBuffered

Classes

struct  FrameStats

Detailed Description

A 'canvas' which can receive the results of a rendering operation.

This abstract class defines a common root to all targets of rendering operations. A render target could be a window on a screen, or another offscreen surface like a texture or bump map etc.

Definition at line 36 of file KeosRenderTarget.h.


Member Enumeration Documentation

enum Keos::IRenderTarget::StatFlags

Enumerator:
SF_NONE 
SF_FPS 
SF_AVG_FPS 
SF_BEST_FPS 
SF_WORST_FPS 
SF_TRIANGLE_COUNT 
SF_ALL 

Definition at line 39 of file KeosRenderTarget.h.


Constructor & Destructor Documentation

Keos::IRenderTarget::IRenderTarget (  ) 

Default constructor.

Definition at line 33 of file KeosRenderTarget.cpp.

References Keos::CSingleton< T >::Instance(), m_bActive, m_bAutoUpdate, m_pRenderApp, m_pTimer, and ResetStatistics().

Keos::IRenderTarget::~IRenderTarget (  )  [virtual]

Destructor.

Definition at line 46 of file KeosRenderTarget.cpp.

References Keos::IRenderApp::IsInit(), Keos::ILogger::Log(), m_pRenderApp, m_strName, and Keos::IRenderApp::Release().


Member Function Documentation

const String & Keos::IRenderTarget::GetName ( void   )  const [inline, virtual]

Retrieve target's name.

Returns:
The target's name.

Definition at line 221 of file KeosRenderTarget.h.

References m_strName.

Referenced by Keos::IRenderSystem::AttachRenderTarget().

void Keos::IRenderTarget::GetMetrics ( uint nWidth,
uint nHeight,
uint nColourDepth 
) [virtual]

Retrieve information about the render target.

Parameters:
nWidth Target's width.
nHeight Target's height.
nColourDepth Target's colour depth.

Definition at line 56 of file KeosRenderTarget.cpp.

References m_nColourDepth, m_nHeight, and m_nWidth.

uint Keos::IRenderTarget::GetWidth ( void   )  const [inline, virtual]

Definition at line 227 of file KeosRenderTarget.h.

References m_nWidth.

uint Keos::IRenderTarget::GetHeight ( void   )  const [inline, virtual]

Definition at line 233 of file KeosRenderTarget.h.

References m_nHeight.

uint Keos::IRenderTarget::GetColourDepth ( void   )  const [inline, virtual]

Definition at line 239 of file KeosRenderTarget.h.

References m_nColourDepth.

void Keos::IRenderTarget::Init ( void   )  [virtual]

Initialise the target.

Definition at line 64 of file KeosRenderTarget.cpp.

References Keos::IRenderApp::Init(), Keos::ILogger::Log(), m_pRenderApp, m_strName, and Keos::IRenderApp::SetInit().

void Keos::IRenderTarget::Update ( void   )  [virtual]

Tells the target to update it's contents.

Reimplemented in Keos::CD3D9Window.

Definition at line 72 of file KeosRenderTarget.cpp.

References m_pRenderApp, m_Stats, Keos::IRenderApp::Render(), Keos::IRenderTarget::FrameStats::triangleCount, Keos::IRenderApp::Update(), and UpdateStats().

Referenced by Keos::CD3D9Window::Update(), Keos::IRenderSystem::UpdateAllRenderTargets(), and Keos::CWin32Window::WndProc().

void Keos::IRenderTarget::GetStatistics ( float &  lastFPS,
float &  avgFPS,
float &  bestFPS,
float &  worstFPS 
) const [inline, virtual]

Retieves details of current rendering performance.

Parameters:
lastFPS Pointer to a float to receive the number of frames per second (FPS) based on the last frame rendered.
avgFPS Pointer to a float to receive the FPS rating based on an average of all the frames rendered since rendering began.
bestFPS Pointer to a float to receive the best FPS rating that has been achieved since rendering began.
worstFPS Pointer to a float to receive the worst FPS rating seen so far.

Definition at line 269 of file KeosRenderTarget.h.

References Keos::IRenderTarget::FrameStats::avgFPS, Keos::IRenderTarget::FrameStats::bestFPS, Keos::IRenderTarget::FrameStats::lastFPS, m_Stats, and Keos::IRenderTarget::FrameStats::worstFPS.

float Keos::IRenderTarget::GetLastFPS (  )  const [inline, virtual]

Individual stats access - gets the number of frames per second (FPS) based on the last frame rendered.

Definition at line 280 of file KeosRenderTarget.h.

References Keos::IRenderTarget::FrameStats::lastFPS, and m_Stats.

float Keos::IRenderTarget::GetAverageFPS (  )  const [inline, virtual]

Individual stats access - gets the average frames per second (FPS) since call to Root::startRendering.

Definition at line 286 of file KeosRenderTarget.h.

References Keos::IRenderTarget::FrameStats::avgFPS, and m_Stats.

float Keos::IRenderTarget::GetBestFPS (  )  const [inline, virtual]

Individual stats access - gets the best frames per second (FPS) since call to Root::startRendering.

Definition at line 292 of file KeosRenderTarget.h.

References Keos::IRenderTarget::FrameStats::bestFPS, and m_Stats.

float Keos::IRenderTarget::GetWorstFPS (  )  const [inline, virtual]

Individual stats access - gets the worst frames per second (FPS) since call to Root::startRendering.

Definition at line 298 of file KeosRenderTarget.h.

References m_Stats, and Keos::IRenderTarget::FrameStats::worstFPS.

float Keos::IRenderTarget::GetBestFrameTime (  )  const [inline, virtual]

Individual stats access - gets the best frame time.

Definition at line 310 of file KeosRenderTarget.h.

References Keos::IRenderTarget::FrameStats::bestFrameTime, and m_Stats.

float Keos::IRenderTarget::GetWorstFrameTime (  )  const [inline, virtual]

Individual stats access - gets the worst frame time.

Definition at line 316 of file KeosRenderTarget.h.

References m_Stats, and Keos::IRenderTarget::FrameStats::worstFrameTime.

float Keos::IRenderTarget::GetLastFrameTime (  )  const [inline, virtual]

Individual stats access - gets the last frame time.

Definition at line 322 of file KeosRenderTarget.h.

References Keos::IRenderTarget::FrameStats::lastFrameTime, and m_Stats.

void Keos::IRenderTarget::ResetStatistics ( void   )  [virtual]

Resets saved frame-rate statistices.

Definition at line 84 of file KeosRenderTarget.cpp.

References Keos::IRenderTarget::FrameStats::avgFPS, Keos::IRenderTarget::FrameStats::bestFPS, Keos::IRenderTarget::FrameStats::bestFrameTime, Keos::CTimer::GetMilliseconds(), Keos::IRenderTarget::FrameStats::lastFPS, Keos::IRenderTarget::FrameStats::lastFrameTime, m_nFrameCount, m_nLastSecond, m_nLastTime, m_pTimer, m_Stats, Keos::IRenderTarget::FrameStats::triangleCount, Keos::IRenderTarget::FrameStats::worstFPS, and Keos::IRenderTarget::FrameStats::worstFrameTime.

Referenced by IRenderTarget().

bool Keos::IRenderTarget::IsActive (  )  const [inline, virtual]

Used to retrieve the active state of the render target.

Definition at line 245 of file KeosRenderTarget.h.

References m_bActive.

Referenced by Keos::IRenderSystem::UpdateAllRenderTargets().

void Keos::IRenderTarget::SetActive ( bool  bState  )  [inline, virtual]

Used to set the active state of the render target.

Reimplemented in Keos::CD3D9Window, and Keos::CWin32Window.

Definition at line 251 of file KeosRenderTarget.h.

References m_bActive.

void Keos::IRenderTarget::SetAutoUpdated ( bool  bAutoUpdate  )  [inline, virtual]

Sets whether this target should be automatically updated if Keos's rendering loop or Keos::KeosRenderSystem::UpdateAllRenderTargets is being used.

Parameters:
bAutoUpdate If true, the render target is updated during the automatic render loop or when Keos::KeosRenderSystem::UpdateAllRenderTargets is called. If false, the target is only updated when its Update() method is called explicitly.

Definition at line 257 of file KeosRenderTarget.h.

References m_bAutoUpdate.

bool Keos::IRenderTarget::IsAutoUpdated ( void   )  const [inline, virtual]

Gets whether this target should be automatically updated if Keos's rendering loop or Keos::KeosRenderSystem::UpdateAllRenderTargets is being used.

Definition at line 263 of file KeosRenderTarget.h.

References m_bAutoUpdate.

Referenced by Keos::IRenderSystem::UpdateAllRenderTargets().

size_t Keos::IRenderTarget::GetTriangleCount ( void   )  const [inline, virtual]

Gets the number of triangles rendered in the last Update() call.

Definition at line 304 of file KeosRenderTarget.h.

References m_Stats, and Keos::IRenderTarget::FrameStats::triangleCount.

void Keos::IRenderTarget::SetRenderApp ( IRenderApp pRenderApp  )  [inline]

Attaches a IRenderApp interface to render target.

Parameters:
pRenderApp Interface for render of the target.

Definition at line 170 of file KeosRenderTarget.h.

References Keos::IRenderApp::m_pRenderTarget.

void Keos::IRenderTarget::UpdateStats ( void   )  [protected]

Update stats.

Definition at line 101 of file KeosRenderTarget.cpp.

References Keos::IRenderTarget::FrameStats::avgFPS, Keos::IRenderTarget::FrameStats::bestFPS, Keos::IRenderTarget::FrameStats::bestFrameTime, Keos::CTimer::GetMilliseconds(), Keos::IRenderTarget::FrameStats::lastFPS, Keos::IRenderTarget::FrameStats::lastFrameTime, m_nFrameCount, m_nLastSecond, m_nLastTime, m_pTimer, m_Stats, Keos::IRenderTarget::FrameStats::worstFPS, and Keos::IRenderTarget::FrameStats::worstFrameTime.

Referenced by Update().


Member Data Documentation

String Keos::IRenderTarget::m_strName [protected]

The name of this target.

Definition at line 183 of file KeosRenderTarget.h.

Referenced by Keos::CWin32Window::Create(), Keos::CD3D9Window::Create(), GetName(), Init(), and ~IRenderTarget().

IRenderApp* Keos::IRenderTarget::m_pRenderApp [protected]

Interface for render of the target.

Definition at line 186 of file KeosRenderTarget.h.

Referenced by Init(), IRenderTarget(), Update(), and ~IRenderTarget().

unsigned int Keos::IRenderTarget::m_nWidth [protected]

Target's width.

Definition at line 189 of file KeosRenderTarget.h.

Referenced by Keos::CWin32Window::Create(), Keos::CD3D9Window::Create(), Keos::CD3D9Window::CreateD3DResources(), Keos::IRenderWindow::GetMetrics(), GetMetrics(), GetWidth(), Keos::CWin32Window::Resize(), and Keos::CD3D9Window::Resize().

unsigned int Keos::IRenderTarget::m_nHeight [protected]

Target's height.

Definition at line 192 of file KeosRenderTarget.h.

Referenced by Keos::CWin32Window::Create(), Keos::CD3D9Window::Create(), Keos::CD3D9Window::CreateD3DResources(), GetHeight(), Keos::IRenderWindow::GetMetrics(), GetMetrics(), and Keos::CD3D9Window::Resize().

unsigned int Keos::IRenderTarget::m_nColourDepth [protected]

Target's colour depth.

Definition at line 195 of file KeosRenderTarget.h.

Referenced by Keos::CWin32Window::Create(), Keos::CD3D9Window::Create(), Keos::CD3D9Window::CreateD3DResources(), GetColourDepth(), Keos::IRenderWindow::GetMetrics(), and GetMetrics().

FrameStats Keos::IRenderTarget::m_Stats [protected]

Stats.

Definition at line 198 of file KeosRenderTarget.h.

Referenced by GetAverageFPS(), GetBestFPS(), GetBestFrameTime(), GetLastFPS(), GetLastFrameTime(), GetStatistics(), GetTriangleCount(), GetWorstFPS(), GetWorstFrameTime(), ResetStatistics(), Update(), and UpdateStats().

CTimer* Keos::IRenderTarget::m_pTimer [protected]

Timer for stats calculation.

Definition at line 201 of file KeosRenderTarget.h.

Referenced by IRenderTarget(), ResetStatistics(), and UpdateStats().

unsigned long Keos::IRenderTarget::m_nLastSecond [protected]

Definition at line 204 of file KeosRenderTarget.h.

Referenced by ResetStatistics(), and UpdateStats().

unsigned long Keos::IRenderTarget::m_nLastTime [protected]

Definition at line 205 of file KeosRenderTarget.h.

Referenced by ResetStatistics(), and UpdateStats().

size_t Keos::IRenderTarget::m_nFrameCount [protected]

Definition at line 206 of file KeosRenderTarget.h.

Referenced by ResetStatistics(), and UpdateStats().

bool Keos::IRenderTarget::m_bActive [protected]

The active state of the render target.

Definition at line 209 of file KeosRenderTarget.h.

Referenced by Keos::CD3D9Window::CD3D9Window(), Keos::CD3D9Window::Create(), Keos::CWin32Window::CWin32Window(), Keos::CWin32Window::Destroy(), Keos::CD3D9Window::Destroy(), IRenderTarget(), IsActive(), Keos::CWin32Window::SetActive(), Keos::CD3D9Window::SetActive(), SetActive(), Keos::CWin32Window::WndProc(), and Keos::CD3D9Window::WndProc().

bool Keos::IRenderTarget::m_bAutoUpdate [protected]

See SetAutoUpdated() function.

Definition at line 211 of file KeosRenderTarget.h.

Referenced by IRenderTarget(), IsAutoUpdated(), and SetAutoUpdated().

bool Keos::IRenderTarget::m_bIsDepthBuffered [protected]

Definition at line 213 of file KeosRenderTarget.h.

Referenced by Keos::CWin32Window::Create().


The documentation for this class was generated from the following files:
Generated on Fri Mar 9 14:29:27 2007 for Keos by  doxygen 1.5.1-p1