Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes
render::RenderTarget Class Reference

#include <RenderTarget.h>

Inheritance diagram for render::RenderTarget:
engine::Object render::RenderWindow

List of all members.

Classes

struct  FrameStats

Public Member Functions

void addRenderTargetEventReceiver (RenderTargetEventReceiver *newEventReceiver)
virtual ViewportcreateViewport (Camera *cam, f32 left=0.0f, f32 top=0.0f, f32 width=1.0f, f32 height=1.0f)
virtual f32 getAverageFPS () const
 Individual stats access - gets the average frames per second (FPS) since call to RenderSystem::startRendering.
virtual f32 getBestFPS () const
 Individual stats access - gets the best frames per second (FPS) since call to RenderSystem::startRendering.
virtual f32 getBestFrameTime () const
 Individual stats access - gets the best frame time.
virtual u32 getColorDepth () const
virtual u32 getHeight () const
virtual f32 getLastFPS () const
 Individual stats access - gets the number of frames per second (FPS) based on the last frame rendered.
virtual u32 getPriority () const
 Gets the priority of a render target.
virtual const FrameStatsgetStatistics () const
virtual s32 getTriangleCount () const
 Gets the number of triangles rendered in the last update() call.
virtual ViewportgetViewport (const u32 &id)
 Retrieves a pointer to a viewport by id.
std::map< u32, Viewport * > & getViewports ()
virtual u32 getWidth () const
 Retrieve information about the render target.
virtual f32 getWorstFPS () const
 Individual stats access - gets the worst frames per second (FPS) since call to RenderSystem::startRendering.
virtual f32 getWorstFrameTime () const
 Individual stats access - gets the worst frame time.
virtual bool isActive () const
 Used to retrieve or set the active state of the render target.
virtual void removeAllViewports ()
 Removes all viewports on this target.
void removeRenderTargetEventReceiver (RenderTargetEventReceiver *oldEventReceiver)
virtual void removeViewport (Viewport *vp)
 Removes a viewport from the rendering target.
virtual void removeViewport (const u32 &id)
 Removes a viewport from the rendering target.
 RenderTarget ()
 RenderTarget (const std::string &name)
virtual void resetStatistics ()
 Resets saved frame-rate statistices.
virtual void setActive (bool state)
 Used to set the active state of the render target.
virtual void setPriority (u32 priority)
virtual ~RenderTarget ()

Protected Member Functions

virtual void firePostUpdate ()
 internal method for firing events.
virtual void firePreUpdate ()
 internal method for firing events.
void initProperties ()
virtual void updateImpl (f32 elapsedTime)
void updateStats ()

Protected Attributes

bool mActive
bool mAutoUpdate
u32 mColorDepth
s32 mFrameCount
u32 mHeight
bool mIsDepthBuffered
u32 mLastSecond
u32 mLastTime
u32 mPriority
RenderTargetEventmRenderTargetEvent
std::list
< RenderTargetEventReceiver * > 
mRenderTargetEventReceivers
FrameStats mStats
platform::TimermTimer
std::map< u32, Viewport * > mViewports
 Central list of viewports - for easy memory management and lookup.
u32 mWidth

Static Protected Attributes

static u32 msNextGeneratedRenderTargetIndex = 0

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 off screen surface like a texture or bump map etc.


Constructor & Destructor Documentation

render::RenderTarget::RenderTarget ( )
render::RenderTarget::RenderTarget ( const std::string &  name)
render::RenderTarget::~RenderTarget ( ) [virtual]

Member Function Documentation

void render::RenderTarget::addRenderTargetEventReceiver ( RenderTargetEventReceiver newEventReceiver)
Viewport * render::RenderTarget::createViewport ( Camera cam,
f32  left = 0.0f,
f32  top = 0.0f,
f32  width = 1.0f,
f32  height = 1.0f 
) [virtual]

Create a viewport to the rendering target.

A viewport is the rectangle into which redering output is sent. This method adds a viewport to the render target, rendering from the supplied camera. The rest of the parameters are only required if you wish to add more than one viewport to a single rendering target. Note that size information passed to this method is passed as a parametric, i.e. it is relative rather than absolute. This is to allow viewports to automatically resize along with the target.

Parameters:
cam,:The camera from which the viewport contents will be rendered (mandatory) viewports i.e. picture-in-picture). Higher ZOrders are on top of lower ones. The actual number is irrelevant, only the relative ZOrder matters (you can leave gaps in the numbering)
left,:The relative position of the left of the viewport on the target, as a value between 0 and 1.
top,:The relative position of the top of the viewport on the target, as a value between 0 and 1.
width,:The relative width of the viewport on the target, as a value between 0 and 1.
height,:The relative height of the viewport on the target, as a value between 0 and 1.

References engine::Object::getID(), and mViewports.

void render::RenderTarget::firePostUpdate ( ) [protected, virtual]

internal method for firing events.

References mRenderTargetEvent, mRenderTargetEventReceivers, and render::RenderTargetEvent::source.

Referenced by updateImpl().

void render::RenderTarget::firePreUpdate ( ) [protected, virtual]

internal method for firing events.

References mRenderTargetEvent, mRenderTargetEventReceivers, and render::RenderTargetEvent::source.

Referenced by updateImpl().

f32 render::RenderTarget::getAverageFPS ( ) const [virtual]

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

References render::RenderTarget::FrameStats::avgFPS, and mStats.

f32 render::RenderTarget::getBestFPS ( ) const [virtual]

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

References render::RenderTarget::FrameStats::bestFPS, and mStats.

f32 render::RenderTarget::getBestFrameTime ( ) const [virtual]

Individual stats access - gets the best frame time.

References render::RenderTarget::FrameStats::bestFrameTime, and mStats.

u32 render::RenderTarget::getColorDepth ( ) const [virtual]

References mColorDepth.

u32 render::RenderTarget::getHeight ( ) const [virtual]

References mHeight.

Referenced by render::Viewport::updateDimensions().

f32 render::RenderTarget::getLastFPS ( ) const [virtual]

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

References render::RenderTarget::FrameStats::lastFPS, and mStats.

u32 render::RenderTarget::getPriority ( ) const [virtual]

Gets the priority of a render target.

References mPriority.

const RenderTarget::FrameStats & render::RenderTarget::getStatistics ( ) const [virtual]

References mStats.

s32 render::RenderTarget::getTriangleCount ( ) const [virtual]

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

References mStats, and render::RenderTarget::FrameStats::triangleCount.

Viewport * render::RenderTarget::getViewport ( const u32 id) [virtual]

Retrieves a pointer to a viewport by id.

References mViewports.

std::map< u32, Viewport * > & render::RenderTarget::getViewports ( )

References mViewports.

Referenced by render::RenderManager::updateImpl().

u32 render::RenderTarget::getWidth ( ) const [virtual]

Retrieve information about the render target.

References mWidth.

Referenced by render::Viewport::updateDimensions().

f32 render::RenderTarget::getWorstFPS ( ) const [virtual]

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

References mStats, and render::RenderTarget::FrameStats::worstFPS.

f32 render::RenderTarget::getWorstFrameTime ( ) const [virtual]

Individual stats access - gets the worst frame time.

References mStats, and render::RenderTarget::FrameStats::worstFrameTime.

void render::RenderTarget::initProperties ( ) [protected]
bool render::RenderTarget::isActive ( ) const [virtual]

Used to retrieve or set the active state of the render target.

Reimplemented in render::RenderWindow.

References mActive.

void render::RenderTarget::removeAllViewports ( ) [virtual]

Removes all viewports on this target.

References mViewports.

Referenced by ~RenderTarget().

void render::RenderTarget::removeRenderTargetEventReceiver ( RenderTargetEventReceiver oldEventReceiver)
void render::RenderTarget::removeViewport ( Viewport vp) [virtual]

Removes a viewport from the rendering target.

References engine::Object::getID(), and mViewports.

void render::RenderTarget::removeViewport ( const u32 id) [virtual]

Removes a viewport from the rendering target.

References mViewports.

void render::RenderTarget::resetStatistics ( ) [virtual]
void render::RenderTarget::setActive ( bool  state) [virtual]

Used to set the active state of the render target.

References mActive.

void render::RenderTarget::setPriority ( u32  priority) [virtual]

Sets the priority of this render target in relation to the others.

This can be used in order to schedule render target updates. Lower priorities will be rendered first. Note that the priority must be set at the time the render target is attached to the render system, changes afterwards will not affect the ordering.

References mPriority.

void render::RenderTarget::updateImpl ( f32  elapsedTime) [protected, virtual]
void render::RenderTarget::updateStats ( ) [protected]

Member Data Documentation

Referenced by resetStatistics(), and updateStats().

Referenced by resetStatistics(), and updateStats().

Referenced by resetStatistics(), and updateStats().

Referenced by getPriority(), and setPriority().

Central list of viewports - for easy memory management and lookup.

Referenced by createViewport(), getViewport(), getViewports(), removeAllViewports(), removeViewport(), and updateImpl().


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

The KG Game Engine
The KG Game Engine Documentation © 2006-2011 by Kat'Oun. Generated on Sat Jul 2 2011 00:50:09 by Doxygen (1.7.4)