Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members |
#include <Viewport.h>
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. | |
Camera * | getCamera () |
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 () |
RenderTarget * | getTarget () |
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 |
Camera * | mCamera |
bool | mClearEveryFrame |
bool | mIsVisible |
f32 | mRelHeight |
f32 | mRelLeft |
f32 | mRelTop |
f32 | mRelWidth |
u32 | mRenderedFaces |
bool | mShowOverlays |
RenderTarget * | mTarget |
bool | mUpdated |
Static Protected Attributes | |
static u32 | msNextGeneratedViewportIndex = 0 |
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.
render::Viewport::Viewport | ( | Camera * | camera, |
RenderTarget * | target, | ||
f32 | left, | ||
f32 | top, | ||
f32 | width, | ||
f32 | height | ||
) |
The standard constructor.
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 | ||
) |
References initProperties(), mCamera, engine::Object::mObjectType, mRelHeight, mRelLeft, mRelTop, mRelWidth, mTarget, engine::OT_VIEWPORT, and updateDimensions().
render::Viewport::~Viewport | ( | ) |
void render::Viewport::clearUpdatedFlag | ( | ) |
References mUpdated.
Referenced by render::RenderManager::setCurrentViewport().
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 | ( | ) |
References mShowOverlays.
Referenced by render::RenderManager::renderVisibleOverlays().
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] |
References render::Color::Black, mBackColor, mClearEveryFrame, mIsVisible, mShowOverlays, and mUpdated.
Referenced by Viewport().
bool render::Viewport::isUpdated | ( | ) |
References mUpdated.
Referenced by render::RenderManager::setCurrentViewport().
bool render::Viewport::isVisible | ( | ) |
References mIsVisible.
Referenced by render::RenderTarget::updateImpl(), and render::RenderManager::updateImpl().
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.
Sets the dimensions (after creation).
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.
s32 render::Viewport::mActHeight [protected] |
Referenced by getActualDimensions(), getActualHeight(), and updateDimensions().
s32 render::Viewport::mActLeft [protected] |
Referenced by getActualDimensions(), getActualLeft(), and updateDimensions().
s32 render::Viewport::mActTop [protected] |
Referenced by getActualDimensions(), getActualTop(), and updateDimensions().
s32 render::Viewport::mActWidth [protected] |
Referenced by getActualDimensions(), getActualWidth(), and updateDimensions().
Color render::Viewport::mBackColor [protected] |
Referenced by getBackgroundColor(), initProperties(), and setBackgroundColor().
Camera* render::Viewport::mCamera [protected] |
Referenced by getCamera(), updateDimensions(), and Viewport().
bool render::Viewport::mClearEveryFrame [protected] |
Referenced by getClearEveryFrame(), initProperties(), and setClearEveryFrame().
bool render::Viewport::mIsVisible [protected] |
Referenced by initProperties(), isVisible(), and setVisible().
f32 render::Viewport::mRelHeight [protected] |
Referenced by getHeight(), setDimensions(), updateDimensions(), and Viewport().
f32 render::Viewport::mRelLeft [protected] |
Referenced by getLeft(), setDimensions(), updateDimensions(), and Viewport().
f32 render::Viewport::mRelTop [protected] |
Referenced by getTop(), setDimensions(), updateDimensions(), and Viewport().
f32 render::Viewport::mRelWidth [protected] |
Referenced by getWidth(), setDimensions(), updateDimensions(), and Viewport().
u32 render::Viewport::mRenderedFaces [protected] |
Referenced by getNumRenderedFaces(), and notifyRenderedFaces().
bool render::Viewport::mShowOverlays [protected] |
Referenced by getShowOverlays(), initProperties(), and setShowOverlays().
u32 render::Viewport::msNextGeneratedViewportIndex = 0 [static, protected] |
RenderTarget* render::Viewport::mTarget [protected] |
Referenced by getTarget(), updateDimensions(), and Viewport().
bool render::Viewport::mUpdated [protected] |
Referenced by clearUpdatedFlag(), initProperties(), isUpdated(), and updateDimensions().
The KG Game Engine
Documentation © 2006-2011 by Kat'Oun. Generated on Sat Jul 2 2011 00:50:09 by
Doxygen
(1.7.4)
|