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

#include <Viewport.h>

Inheritance diagram for render::Viewport:
engine::Object

List of all members.

Public Member Functions

void clearUpdatedFlag ()
void getActualDimensions (s32 &left, s32 &top, s32 &width, s32 &height)
 Access to actual dimensions (based on target size).
s32 getActualHeight ()
 Gets one of the actual dimensions of the viewport, a value in pixels.
s32 getActualLeft ()
 Gets one of the actual dimensions of the viewport, a value in pixels.
s32 getActualTop ()
 Gets one of the actual dimensions of the viewport, a value in pixels.
s32 getActualWidth ()
 Gets one of the actual dimensions of the viewport, a value in pixels.
Color getBackgroundColor ()
 Gets the background color.
CameragetCamera ()
 Retrieves a pointer to the camera for this viewport.
bool getClearEveryFrame ()
 Determines if the viewport is cleared before every frame.
f32 getHeight ()
 Gets one of the relative dimensions of the viewport, a value between 0.0 and 1.0.
f32 getLeft ()
 Gets one of the relative dimensions of the viewport, a value between 0.0 and 1.0.
u32 getNumRenderedFaces () const
 Gets the number of rendered faces in the last update.
bool getShowOverlays ()
RenderTargetgetTarget ()
 Retrieves a pointer to the render target for this viewport.
f32 getTop ()
 Gets one of the relative dimensions of the viewport, a value between 0.0 and 1.0.
f32 getWidth ()
 Gets one of the relative dimensions of the viewport, a value between 0.0 and 1.0.
bool isUpdated ()
bool isVisible ()
void notifyRenderedFaces (u32 numfaces)
 Internal method to notify camera of the visible faces in the last render.
void setBackgroundColor (Color &color)
 Sets the initial background color of the viewport (before rendering).
void setClearEveryFrame (bool clear)
void setDimensions (f32 left, f32 top, f32 width, f32 height)
 Sets the dimensions (after creation).
void setShowOverlays (bool enabled)
void setVisible (bool enabled)
void updateDimensions ()
 Viewport (Camera *camera, RenderTarget *target, f32 left, f32 top, f32 width, f32 height)
 Viewport (const std::string &name, Camera *camera, RenderTarget *target, f32 left, f32 top, f32 width, f32 height)
 ~Viewport ()

Protected Member Functions

void initProperties ()
void updateImpl (f32 elapsedTime)

Protected Attributes

s32 mActHeight
s32 mActLeft
s32 mActTop
s32 mActWidth
Color mBackColor
CameramCamera
bool mClearEveryFrame
bool mIsVisible
f32 mRelHeight
f32 mRelLeft
f32 mRelTop
f32 mRelWidth
u32 mRenderedFaces
bool mShowOverlays
RenderTargetmTarget
bool mUpdated

Static Protected Attributes

static u32 msNextGeneratedViewportIndex = 0

Detailed Description

An abstraction of a viewport, i.e. a rendering region on a render target.

A viewport is the meeting of a camera and a rendering surface - the camera renders the scene from a viewpoint, and places it's results into some subset of a rendering target, which may be the whole surface or just a part of the surface. Each viewport has a single camera as source and a single target as destination. A camera only has 1 viewport, but a render target may have several. A viewport also has a Z-order, i.e. if there is more than one viewport on a single render target and they overlap, one must obscure the other in some predetermined way.


Constructor & Destructor Documentation

render::Viewport::Viewport ( Camera camera,
RenderTarget target,
f32  left,
f32  top,
f32  width,
f32  height 
)

The standard constructor.

Parameters:
camera,:Pointer to a camera to be the source for the image.
target,:Pointer to the render target to be the destination for the rendering.
left/top/width/height,:Dimensions of the viewport, expressed as decimals between 0 and 1. This allows the dimensions to apply irrespective of changes in the target's size: e.g. to fill the whole area, values of 0,0,1,1 are appropriate.

References initProperties(), mCamera, engine::Object::mObjectType, mRelHeight, mRelLeft, mRelTop, mRelWidth, mTarget, engine::OT_VIEWPORT, and updateDimensions().

render::Viewport::Viewport ( const std::string &  name,
Camera camera,
RenderTarget target,
f32  left,
f32  top,
f32  width,
f32  height 
)
render::Viewport::~Viewport ( )

Member Function Documentation

void render::Viewport::clearUpdatedFlag ( )
void render::Viewport::getActualDimensions ( s32 left,
s32 top,
s32 width,
s32 height 
)

Access to actual dimensions (based on target size).

References mActHeight, mActLeft, mActTop, and mActWidth.

s32 render::Viewport::getActualHeight ( )

Gets one of the actual dimensions of the viewport, a value in pixels.

References mActHeight.

Referenced by render::RenderManager::render(), render::RenderManager::renderSingleOverlay(), and render::RenderManager::renderVisibleOverlays().

s32 render::Viewport::getActualLeft ( )

Gets one of the actual dimensions of the viewport, a value in pixels.

References mActLeft.

s32 render::Viewport::getActualTop ( )

Gets one of the actual dimensions of the viewport, a value in pixels.

References mActTop.

s32 render::Viewport::getActualWidth ( )

Gets one of the actual dimensions of the viewport, a value in pixels.

References mActWidth.

Referenced by render::RenderManager::render(), render::RenderManager::renderSingleOverlay(), and render::RenderManager::renderVisibleOverlays().

Color render::Viewport::getBackgroundColor ( )

Gets the background color.

References mBackColor.

Camera * render::Viewport::getCamera ( )

Retrieves a pointer to the camera for this viewport.

References mCamera.

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

bool render::Viewport::getClearEveryFrame ( )

Determines if the viewport is cleared before every frame.

References mClearEveryFrame.

f32 render::Viewport::getHeight ( )

Gets one of the relative dimensions of the viewport, a value between 0.0 and 1.0.

References mRelHeight.

f32 render::Viewport::getLeft ( )

Gets one of the relative dimensions of the viewport, a value between 0.0 and 1.0.

References mRelLeft.

u32 render::Viewport::getNumRenderedFaces ( ) const

Gets the number of rendered faces in the last update.

References mRenderedFaces.

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

bool render::Viewport::getShowOverlays ( )
RenderTarget * render::Viewport::getTarget ( )

Retrieves a pointer to the render target for this viewport.

References mTarget.

f32 render::Viewport::getTop ( )

Gets one of the relative dimensions of the viewport, a value between 0.0 and 1.0.

References mRelTop.

f32 render::Viewport::getWidth ( )

Gets one of the relative dimensions of the viewport, a value between 0.0 and 1.0.

References mRelWidth.

void render::Viewport::initProperties ( ) [protected]
bool render::Viewport::isUpdated ( )
bool render::Viewport::isVisible ( )
void render::Viewport::notifyRenderedFaces ( u32  numfaces)

Internal method to notify camera of the visible faces in the last render.

References mRenderedFaces.

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

void render::Viewport::setBackgroundColor ( Color color)

Sets the initial background color of the viewport (before rendering).

References mBackColor.

void render::Viewport::setClearEveryFrame ( bool  clear)

Determines whether to clear the viewport before rendering.

If you expecting every pixel on the viewport to be redrawn every frame, you can save a little time by not clearing the viewport before every frame. Do so by passing 'false' to this method (the default is to clear every frame).

References mClearEveryFrame.

void render::Viewport::setDimensions ( f32  left,
f32  top,
f32  width,
f32  height 
)

Sets the dimensions (after creation).

Parameters:
left/top/width/height,:Dimensions relative to the size of the target, represented as real values between 0 and 1. E.g. the full target area is 0,0,1,1.

References mRelHeight, mRelLeft, mRelTop, mRelWidth, and updateDimensions().

void render::Viewport::setShowOverlays ( bool  enabled)

References mShowOverlays.

void render::Viewport::setVisible ( bool  enabled)

References mIsVisible.

void render::Viewport::updateDimensions ( )

Notifies the viewport of a possible change in dimensions. Used by the target to update the viewport's dimensions (usually the result of a change in target size). Internal use by Ogre only.

References render::RenderTarget::getHeight(), render::RenderTarget::getWidth(), mActHeight, mActLeft, mActTop, mActWidth, mCamera, mRelHeight, mRelLeft, mRelTop, mRelWidth, mTarget, mUpdated, and render::Camera::setAspectRatio().

Referenced by setDimensions(), and Viewport().

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

Reimplemented from engine::Object.


Member Data Documentation

bool render::Viewport::mIsVisible [protected]
bool render::Viewport::mUpdated [protected]

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)