OGRE 14.3
Object-Oriented Graphics Rendering Engine
|
An abstraction of a viewport, i.e., a rendering region on a render target. More...
#include <OgreViewport.h>
Classes | |
class | Listener |
Listener interface so you can be notified of Viewport changes. More... | |
Public Member Functions | |
Viewport (Camera *camera, RenderTarget *target, float left, float top, float width, float height, int ZOrder) | |
The usual constructor. | |
virtual | ~Viewport () |
Default destructor. | |
void | _clearUpdatedFlag (void) |
unsigned int | _getNumRenderedBatches (void) const |
Gets the number of rendered batches in the last update. | |
unsigned int | _getNumRenderedFaces (void) const |
Gets the number of rendered faces in the last update. | |
bool | _isUpdated (void) const |
void | _updateDimensions (void) |
Notifies the viewport of a possible change in dimensions. | |
void | addListener (Listener *l) |
Add a listener to this viewport. | |
void | clear (uint32 buffers=FBT_COLOUR|FBT_DEPTH, const ColourValue &colour=ColourValue::Black, float depth=1.0f, uint16 stencil=0) |
Instructs the viewport to clear itself, without performing an update. | |
Rect | getActualDimensions () const |
Access to actual dimensions (based on target size). | |
void | getActualDimensions (int &left, int &top, int &width, int &height) const |
int | getActualHeight (void) const |
Gets one of the actual dimensions of the viewport, a value in pixels. | |
int | getActualLeft (void) const |
Gets one of the actual dimensions of the viewport, a value in pixels. | |
int | getActualTop (void) const |
Gets one of the actual dimensions of the viewport, a value in pixels. | |
int | getActualWidth (void) const |
Gets one of the actual dimensions of the viewport, a value in pixels. | |
const ColourValue & | getBackgroundColour (void) const |
Gets the background colour. | |
Camera * | getCamera (void) const |
Retrieves a pointer to the camera for this viewport. | |
unsigned int | getClearBuffers (void) const |
Gets which buffers are to be cleared each frame. | |
bool | getClearEveryFrame (void) const |
Determines if the viewport is cleared before every frame. | |
float | getDepthClear (void) const |
Gets the default depth buffer value to which the viewport is cleared. | |
ColourBufferType | getDrawBuffer () const |
Returns the current colour buffer type for this viewport. | |
float | getHeight (void) const |
Gets one of the relative dimensions of the viewport, a value between 0.0 and 1.0. | |
float | getLeft (void) const |
Gets one of the relative dimensions of the viewport, a value between 0.0 and 1.0. | |
const String & | getMaterialScheme (void) const |
Get the material scheme which the viewport should use. | |
bool | getOverlaysEnabled (void) const |
Returns whether or not Overlay objects (created with the OverlayManager) are displayed in this viewport. | |
bool | getShadowsEnabled (void) const |
Returns whether or not shadows (defined in the SceneManager) are displayed in this viewport. | |
bool | getSkiesEnabled (void) const |
Returns whether or not skies (created in the SceneManager) are displayed in this viewport. | |
RenderTarget * | getTarget (void) const |
Retrieves a pointer to the render target for this viewport. | |
float | getTop (void) const |
Gets one of the relative dimensions of the viewport, a value between 0.0 and 1.0. | |
uint | getVisibilityMask (void) const |
Gets a per-viewport visibility mask. | |
float | getWidth (void) const |
Gets one of the relative dimensions of the viewport, a value between 0.0 and 1.0. | |
int | getZOrder (void) const |
Gets the Z-Order of this viewport. | |
bool | isAutoUpdated () const |
Gets whether this viewport is automatically updated if Ogre's rendering loop or RenderTarget::update is being used. | |
void | removeListener (Listener *l) |
Remove a listener to this viewport. | |
void | setAutoUpdated (bool autoupdate) |
Sets whether this viewport should be automatically updated if Ogre's rendering loop or RenderTarget::update is being used. | |
void | setBackgroundColour (const ColourValue &colour) |
Sets the initial background colour of the viewport (before rendering). | |
void | setCamera (Camera *cam) |
Sets the camera to use for rendering to this viewport. | |
void | setClearEveryFrame (bool clear, unsigned int buffers=FBT_COLOUR|FBT_DEPTH) |
Determines whether to clear the viewport before rendering. | |
void | setDepthClear (float depth) |
Sets the initial depth buffer value of the viewport (before rendering). | |
void | setDimensions (float left, float top, float width, float height) |
Sets the dimensions (after creation). | |
void | setDrawBuffer (ColourBufferType colourBuffer) |
Sets the draw buffer type for the next frame. | |
void | setMaterialScheme (const String &schemeName) |
Set the material scheme which the viewport should use. | |
void | setOverlaysEnabled (bool enabled) |
Tells this viewport whether it should display Overlay objects. | |
void | setShadowsEnabled (bool enabled) |
Tells this viewport whether it should display shadows. | |
void | setSkiesEnabled (bool enabled) |
Tells this viewport whether it should display skies. | |
void | setVisibilityMask (uint32 mask) |
Sets a per-viewport visibility mask. | |
void | update (void) |
Instructs the viewport to updates its contents. | |
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 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.
Ogre::Viewport::Viewport | ( | Camera * | camera, |
RenderTarget * | target, | ||
float | left, | ||
float | top, | ||
float | width, | ||
float | height, | ||
int | ZOrder | ||
) |
The usual 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 a value 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. |
ZOrder | Relative Z-order on the target. Lower = further to the front. |
|
virtual |
Default destructor.
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).
void Ogre::Viewport::clear | ( | uint32 | buffers = FBT_COLOUR|FBT_DEPTH , |
const ColourValue & | colour = ColourValue::Black , |
||
float | depth = 1.0f , |
||
uint16 | stencil = 0 |
||
) |
Instructs the viewport to clear itself, without performing an update.
You would not normally call this method when updating the viewport, since the viewport usually clears itself when updating anyway. However, if you wish you have the option of manually clearing the frame buffer (or elements of it) using this method.
buffers | Bitmask identifying which buffer elements to clear |
colour | The colour value to clear to, if FBT_COLOUR is included |
depth | The depth value to clear to, if FBT_DEPTH is included |
stencil | The stencil value to clear to, if FBT_STENCIL is included |
|
inline |
Retrieves a pointer to the render target for this viewport.
Retrieves a pointer to the camera for this viewport.
Sets the camera to use for rendering to this viewport.
Gets one of the relative dimensions of the viewport, a value between 0.0 and 1.0.
Gets one of the relative dimensions of the viewport, a value between 0.0 and 1.0.
Gets one of the relative dimensions of the viewport, a value between 0.0 and 1.0.
Gets one of the relative dimensions of the viewport, a value between 0.0 and 1.0.
Gets one of the actual dimensions of the viewport, a value in pixels.
Gets one of the actual dimensions of the viewport, a value in pixels.
Gets one of the actual dimensions of the viewport, a value in pixels.
Gets one of the actual dimensions of the viewport, a value in pixels.
Sets the dimensions (after creation).
left | Left point of viewport. |
top | Top point of the viewport. |
width | Width of the viewport. |
height | Height of the viewport. |
|
inline |
Sets the initial background colour of the viewport (before rendering).
|
inline |
Gets the background colour.
Sets the initial depth buffer value of the viewport (before rendering).
Default is 1
Gets the default depth buffer value to which the viewport is cleared.
Determines whether to clear the viewport before rendering.
You can use this method to set which buffers are cleared (if any) before rendering every frame.
clear | Whether or not to clear any buffers |
buffers | One or more values from FrameBufferType denoting which buffers to clear, if clear is set to true. Note you should not clear the stencil buffer here unless you know what you're doing. |
Determines if the viewport is cleared before every frame.
Gets which buffers are to be cleared each frame.
Sets whether this viewport should be automatically updated if Ogre's rendering loop or RenderTarget::update is being used.
By default, if you use Ogre's own rendering loop (Root::startRendering) or call RenderTarget::update, all viewports are updated automatically. This method allows you to control that behaviour, if for example you have a viewport which you only want to update periodically.
autoupdate | If true, the viewport is updated during the automatic render loop or when RenderTarget::update() is called. If false, the viewport is only updated when its update() method is called explicitly. |
|
inline |
Gets whether this viewport is automatically updated if Ogre's rendering loop or RenderTarget::update is being used.
Set the material scheme which the viewport should use.
This allows you to tell the system to use a particular material scheme when rendering this viewport, which can involve using different techniques to render your materials.
Get the material scheme which the viewport should use.
|
inline |
Access to actual dimensions (based on target size).
Gets the number of rendered faces in the last update.
Gets the number of rendered batches in the last update.
Tells this viewport whether it should display Overlay objects.
Overlay objects are layers which appear on top of the scene. They are created via OverlayManager::create 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.
enabled | If true, any overlays are displayed, if false they are not. |
Returns whether or not Overlay objects (created with the OverlayManager) are displayed in this viewport.
Tells this viewport whether it should display skies.
Skies are layers which appear on background of the scene. They are created via SceneManager::setSkyBox, SceneManager::setSkyPlane and SceneManager::setSkyDome 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 skies of it's own. In this case you can turn off skies on this viewport by calling this method.
enabled | If true, any skies are displayed, if false they are not. |
Returns whether or not skies (created in the SceneManager) are displayed in this viewport.
Tells this viewport whether it should display shadows.
This setting enables you to disable shadow rendering for a given viewport. The global shadow technique set on SceneManager still controls the type and nature of shadows, but this flag can override the setting so that no shadows are rendered for a given viewport to save processing time where they are not required.
enabled | If true, any shadows are displayed, if false they are not. |
Returns whether or not shadows (defined in the SceneManager) are displayed in this viewport.
Sets a per-viewport visibility mask.
The visibility mask is a way to exclude objects from rendering for a given viewport. For each object in the frustum, a check is made between this mask and the objects visibility flags, and if a binary 'and' returns zero, the object will not be rendered.
Gets a per-viewport visibility mask.
|
inline |
Sets the draw buffer type for the next frame.
Specifies the particular buffer that will be targeted by the render target. Should be used if the render target supports quad buffer stereo. If the render target does not support stereo (ie. left and right), then only back and front will be used.
colourBuffer | Specifies the particular buffer that will be targeted by the render target. |
|
inline |
Returns the current colour buffer type for this viewport.