Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Ogre::Viewport Class Reference

An abstraction of a viewport, i.e. More...

#include <OgreViewport.h>

List of all members.

Public Methods

 Viewport (Camera *camera, RenderTarget *target, float left, float top, float width, float height, int ZOrder)
 The usual constructor. More...

 ~Viewport ()
 Default destructor. More...

void _updateDimensions (void)
 Notifies the viewport of a possible change in dimensions. More...

void update (void)
 Instructs the viewport to updates its contents. More...

RenderTarget * getTarget (void) const
 Retrieves a pointer to the render target for this viewport. More...

Camera * getCamera (void) const
 Retrieves a pointer to the camera for this viewport. More...

void setCamera (Camera *cam)
 Sets the camera to use for rendering to this viewport. More...

float getLeft (void) const
 Gets one of the relative dimensions of the viewport, a value between 0.0 and 1.0. More...

float getTop (void) const
 Gets one of the relative dimensions of the viewport, a value between 0.0 and 1.0. More...

float getWidth (void) const
 Gets one of the relative dimensions of the viewport, a value between 0.0 and 1.0. More...

float getHeight (void) const
 Gets one of the relative dimensions of the viewport, a value between 0.0 and 1.0. More...

int getActualLeft (void) const
 Gets one of the actual dimensions of the viewport, a value in pixels. More...

int getActualTop (void) const
 Gets one of the actual dimensions of the viewport, a value in pixels. More...

int getActualWidth (void) const
 Gets one of the actual dimensions of the viewport, a value in pixels. More...

int getActualHeight (void) const
 Gets one of the actual dimensions of the viewport, a value in pixels. More...

void setDimensions (float left, float top, float width, float height)
 Sets the dimensions (after creation). More...

void setBackgroundColour (ColourValue colour)
 Sets the initial background colour of the viewport (before rendering). More...

const ColourValue & getBackgroundColour (void) const
 Gets the background colour. More...

void setClearEveryFrame (bool clear)
 Determines whether to clear the viewport before rendering. More...

bool getClearEveryFrame (void) const
 Determines if the viewport is cleared before every frame. More...

void getActualDimensions (int &left, int &top, int &width, int &height) const
 Access to actual dimensions (based on target size). More...

bool _isUpdated (void) const
void _clearUpdatedFlag (void)
unsigned int _getNumRenderedFaces (void) const
 Gets the number of rendered faces in the last update. More...

void setOverlaysEnabled (bool enabled)
 Tells this viewport whether it should display Overlay objects. More...

bool getOverlaysEnabled (void)
 Returns whether or not Overlay objects (created in the SceneManager) are displayed in this viewport. More...


Protected Attributes

Camera * mCamera
RenderTarget * mTarget
float mRelLeft
float mRelTop
float mRelWidth
float mRelHeight
int mActLeft
int mActTop
int mActWidth
int mActHeight
int mZOrder
 ZOrder. More...

ColourValue mBackColour
 Background options. More...

bool mClearEveryFrame
bool mUpdated
bool mShowOverlays


Detailed Description

An abstraction of a viewport, i.e.

a rendering region on a render target.

Remarks:
A viewport is the meeting of a camera and a rendering surface - the camera renders the scene from a viewpoint, and places its 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

Ogre::Viewport::Viewport (  Camera *    camera,
RenderTarget *    target,
float    left,
float    top,
float    width,
float    height,
int    ZOrder
) 
 

The usual constructor.

Parameters:
cam  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 a a pecentage between 0 and 100. 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,100,100 are appropriate.
ZOrder  Relative Z-order on the target. Lower = further to the front.

Ogre::Viewport::~Viewport (    ) 
 

Default destructor.


Member Function Documentation

void Ogre::Viewport::_clearUpdatedFlag (  void    ) 
 

unsigned int Ogre::Viewport::_getNumRenderedFaces (  void    )  const
 

Gets the number of rendered faces in the last update.

bool Ogre::Viewport::_isUpdated (  void    )  const
 

void Ogre::Viewport::_updateDimensions (  void    ) 
 

Notifies the viewport of a possible change in dimensions.

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

void Ogre::Viewport::getActualDimensions (  int &    left,
int &    top,
int &    width,
int &    height
)  const
 

Access to actual dimensions (based on target size).

int Ogre::Viewport::getActualHeight (  void    )  const
 

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

int Ogre::Viewport::getActualLeft (  void    )  const
 

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

int Ogre::Viewport::getActualTop (  void    )  const
 

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

int Ogre::Viewport::getActualWidth (  void    )  const
 

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

const ColourValue & Ogre::Viewport::getBackgroundColour (  void    )  const
 

Gets the background colour.

Camera * Ogre::Viewport::getCamera (  void    )  const
 

Retrieves a pointer to the camera for this viewport.

bool Ogre::Viewport::getClearEveryFrame (  void    )  const
 

Determines if the viewport is cleared before every frame.

Real Ogre::Viewport::getHeight (  void    )  const
 

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

Real Ogre::Viewport::getLeft (  void    )  const
 

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

bool Ogre::Viewport::getOverlaysEnabled (  void    ) 
 

Returns whether or not Overlay objects (created in the SceneManager) are displayed in this viewport.

RenderTarget * Ogre::Viewport::getTarget (  void    )  const
 

Retrieves a pointer to the render target for this viewport.

Real Ogre::Viewport::getTop (  void    )  const
 

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

Real Ogre::Viewport::getWidth (  void    )  const
 

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

void Ogre::Viewport::setBackgroundColour (  ColourValue    colour ) 
 

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

void Ogre::Viewport::setCamera (  Camera *    cam ) 
 

Sets the camera to use for rendering to this viewport.

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

Determines whether to clear the viewport before rendering.

Remarks:
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).

void Ogre::Viewport::setDimensions (  float    left,
float    top,
float    width,
float    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. i.e. the full target area is 0, 0, 1, 1.

void Ogre::Viewport::setOverlaysEnabled (  bool    enabled ) 
 

Tells this viewport whether it should display Overlay objects.

Remarks:
Overlay objects are layers which appear on top of the scene. They are created via SceneManager::createOverlay and every viewport displays these by default. However, you probably don't want this if you're using multiple viewports, because one of them is probably a picture-in-picture which is not supposed to have overlays of it's own. In this case you can turn off overlays on this viewport by calling this method.
Parameters:
enabled  If true, any overlays are displayed, if false they are not.

void Ogre::Viewport::update (  void    ) 
 

Instructs the viewport to updates its contents.


Member Data Documentation

int Ogre::Viewport::mActHeight [protected]
 

int Ogre::Viewport::mActLeft [protected]
 

int Ogre::Viewport::mActTop [protected]
 

int Ogre::Viewport::mActWidth [protected]
 

ColourValue Ogre::Viewport::mBackColour [protected]
 

Background options.

Camera* Ogre::Viewport::mCamera [protected]
 

bool Ogre::Viewport::mClearEveryFrame [protected]
 

float Ogre::Viewport::mRelHeight [protected]
 

float Ogre::Viewport::mRelLeft [protected]
 

float Ogre::Viewport::mRelTop [protected]
 

float Ogre::Viewport::mRelWidth [protected]
 

bool Ogre::Viewport::mShowOverlays [protected]
 

RenderTarget* Ogre::Viewport::mTarget [protected]
 

bool Ogre::Viewport::mUpdated [protected]
 

int Ogre::Viewport::mZOrder [protected]
 

ZOrder.

Copyright © 2002 by The OGRE Team