Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

# Keos::IRenderTarget Class Reference

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

`#include <KeosRenderTarget.h>`

Inheritance diagram for Keos::IRenderTarget:

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 String & | GetName (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 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.
IRenderApp * | m_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.
CTimer * | m_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

Enumeration values:

  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 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(), m_pRenderApp, m_strName, and Keos::IRenderApp::Release().

## Member Function Documentation

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 277 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 283 of file KeosRenderTarget.h. References Keos::IRenderTarget::FrameStats::bestFPS, and m_Stats.

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

| Individual stats access - gets the best frame time. Definition at line 301 of file KeosRenderTarget.h. References Keos::IRenderTarget::FrameStats::bestFrameTime, and m_Stats.

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

| Definition at line 230 of file KeosRenderTarget.h. References m_nColourDepth.

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

| Definition at line 224 of file KeosRenderTarget.h. References m_nHeight.

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 271 of file KeosRenderTarget.h. References Keos::IRenderTarget::FrameStats::lastFPS, and m_Stats.

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 55 of file KeosRenderTarget.cpp.

References m_nColourDepth, m_nHeight, and m_nWidth.

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

| Retrieve target's name.

Returns:
  The target's name.

Definition at line 212 of file KeosRenderTarget.h.

References m_strName.

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 260 of file KeosRenderTarget.h.

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

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

| Gets the number of triangles rendered in the last Update() call. Definition at line 295 of file KeosRenderTarget.h. References m_Stats, size_t, and Keos::IRenderTarget::FrameStats::triangleCount.

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

| Definition at line 218 of file KeosRenderTarget.h. References m_nWidth.

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 289 of file KeosRenderTarget.h. References m_Stats, and Keos::IRenderTarget::FrameStats::worstFPS.

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

| Individual stats access - gets the worst frame time. Definition at line 307 of file KeosRenderTarget.h. References m_Stats, and Keos::IRenderTarget::FrameStats::worstFrameTime.

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

| Initialise the target. Definition at line 63 of file KeosRenderTarget.cpp. References Keos::IRenderApp::Init(), m_pRenderApp, m_strName, and Keos::IRenderApp::SetInit(). Referenced by Keos::IRenderSystem::InitAllRenderTargets().

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

| Used to retrieve the active state of the render target. Definition at line 236 of file KeosRenderTarget.h. References m_bActive. Referenced by Keos::IRenderSystem::UpdateAllRenderTargets().

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 254 of file KeosRenderTarget.h. References m_bAutoUpdate. Referenced by Keos::IRenderSystem::UpdateAllRenderTargets().

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

| Resets saved frame-rate statistices. Definition at line 83 of file KeosRenderTarget.cpp. References Keos::IRenderTarget::FrameStats::avgFPS, Keos::IRenderTarget::FrameStats::bestFPS, Keos::IRenderTarget::FrameStats::bestFrameTime, Keos::CTimer::GetMilliseconds(), Keos::IRenderTarget::FrameStats::lastFPS, 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 Keos::IRenderSystem::InitAllRenderTargets(), and IRenderTarget().

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 242 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 248 of file KeosRenderTarget.h.

References m_bAutoUpdate.

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 165 of file KeosRenderTarget.h.

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

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

| Tells the target to update it's contents. Reimplemented in Keos::CD3D9Window. Definition at line 71 of file KeosRenderTarget.cpp. References m_pRenderApp, m_Stats, Keos::IRenderApp::Render(), Keos::IRenderTarget::FrameStats::triangleCount, Keos::IRenderApp::Update(), and UpdateStats().

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

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

| Update stats. Definition at line 99 of file KeosRenderTarget.cpp. References Keos::IRenderTarget::FrameStats::avgFPS, Keos::IRenderTarget::FrameStats::bestFPS, Keos::IRenderTarget::FrameStats::bestFrameTime, Keos::CTimer::GetMilliseconds(), Keos::IRenderTarget::FrameStats::lastFPS, 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

bool Keos::IRenderTarget::m_bActive`[protected]`

| The active state of the render target. Definition at line 200 of file KeosRenderTarget.h. Referenced by IRenderTarget(), IsActive(), SetActive(), Keos::CWin32Window::WndProc(), and Keos::CD3D9Window::WndProc().

bool Keos::IRenderTarget::m_bAutoUpdate`[protected]`

| See SetAutoUpdated() function. Definition at line 202 of file KeosRenderTarget.h. Referenced by IRenderTarget(), IsAutoUpdated(), and SetAutoUpdated().

bool Keos::IRenderTarget::m_bIsDepthBuffered`[protected]`

| Definition at line 204 of file KeosRenderTarget.h.

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

| Target's colour depth. Definition at line 186 of file KeosRenderTarget.h. Referenced by GetColourDepth(), and GetMetrics().

size_t Keos::IRenderTarget::m_nFrameCount`[protected]`

| Definition at line 197 of file KeosRenderTarget.h. Referenced by ResetStatistics(), and UpdateStats().

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

| Target's height. Definition at line 183 of file KeosRenderTarget.h. Referenced by GetHeight(), and GetMetrics().

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

| Definition at line 195 of file KeosRenderTarget.h. Referenced by ResetStatistics(), and UpdateStats().

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

| Definition at line 196 of file KeosRenderTarget.h. Referenced by ResetStatistics(), and UpdateStats().

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

| Target's width. Definition at line 180 of file KeosRenderTarget.h. Referenced by GetMetrics(), and GetWidth().

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

| Interface for render of the target. Definition at line 177 of file KeosRenderTarget.h. Referenced by Init(), IRenderTarget(), Update(), and ~IRenderTarget().

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

| Timer for stats calculation. Definition at line 192 of file KeosRenderTarget.h. Referenced by IRenderTarget(), ResetStatistics(), and UpdateStats().

FrameStats Keos::IRenderTarget::m_Stats`[protected]`

| Stats. Definition at line 189 of file KeosRenderTarget.h. Referenced by GetAverageFPS(), GetBestFPS(), GetBestFrameTime(), GetLastFPS(), GetStatistics(), GetTriangleCount(), GetWorstFPS(), GetWorstFrameTime(), ResetStatistics(), Update(), and UpdateStats().

String Keos::IRenderTarget::m_strName`[protected]`

| The name of this target. Definition at line 174 of file KeosRenderTarget.h. Referenced by GetName(), Init(), and ~IRenderTarget().

The documentation for this class was generated from the following files:

- KeosEngine/KeosRenderTarget.h
- KeosEngine/KeosRenderTarget.cpp