OgreViewport.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4  (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2013 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 #ifndef __Viewport_H__
29 #define __Viewport_H__
30 
31 #include "OgrePrerequisites.h"
32 #include "OgreCommon.h"
33 #include "OgreColourValue.h"
34 #include "OgreFrustum.h"
35 #include "OgreHeaderPrefix.h"
36 
37 namespace Ogre {
58  {
59  public:
62  {
63  public:
64  virtual ~Listener() {}
65 
67  virtual void viewportCameraChanged(Viewport* viewport) {}
68 
70  virtual void viewportDimensionsChanged(Viewport* viewport) {}
71 
73  virtual void viewportDestroyed(Viewport* viewport) {}
74  };
75 
92  Camera* camera,
93  RenderTarget* target,
94  Real left, Real top,
95  Real width, Real height,
96  int ZOrder);
97 
100  virtual ~Viewport();
101 
109  void _updateDimensions(void);
110 
113  void update(void);
114 
127  void clear(unsigned int buffers = FBT_COLOUR | FBT_DEPTH,
128  const ColourValue& colour = ColourValue::Black,
129  Real depth = 1.0f, unsigned short stencil = 0);
130 
133  RenderTarget* getTarget(void) const;
134 
137  Camera* getCamera(void) const;
138 
140  void setCamera(Camera* cam);
141 
143  int getZOrder(void) const;
147  Real getLeft(void) const;
148 
152  Real getTop(void) const;
153 
158  Real getWidth(void) const;
163  Real getHeight(void) const;
168  int getActualLeft(void) const;
173  int getActualTop(void) const;
177  int getActualWidth(void) const;
182  int getActualHeight(void) const;
183 
197  void setDimensions(Real left, Real top, Real width, Real height);
198 
201  void setOrientationMode(OrientationMode orientationMode, bool setDefault = true);
202 
206 
209  static void setDefaultOrientationMode(OrientationMode orientationMode);
210 
214 
218  void setBackgroundColour(const ColourValue& colour);
219 
222  const ColourValue& getBackgroundColour(void) const;
223 
227  void setDepthClear( Real depth );
228 
231  Real getDepthClear(void) const;
232 
242  void setClearEveryFrame(bool clear, unsigned int buffers = FBT_COLOUR | FBT_DEPTH);
243 
246  bool getClearEveryFrame(void) const;
247 
249  unsigned int getClearBuffers(void) const;
250 
262  void setAutoUpdated(bool autoupdate);
266  bool isAutoUpdated() const;
267 
275  void setMaterialScheme(const String& schemeName)
276  { mMaterialSchemeName = schemeName; }
277 
280  const String& getMaterialScheme(void) const
281  { return mMaterialSchemeName; }
282 
286  int &left, int &top, int &width, int &height ) const;
287 
288  bool _isUpdated(void) const;
289  void _clearUpdatedFlag(void);
290 
293  unsigned int _getNumRenderedFaces(void) const;
294 
297  unsigned int _getNumRenderedBatches(void) const;
298 
309  void setOverlaysEnabled(bool enabled);
310 
313  bool getOverlaysEnabled(void) const;
314 
325  void setSkiesEnabled(bool enabled);
326 
329  bool getSkiesEnabled(void) const;
330 
339  void setShadowsEnabled(bool enabled);
340 
343  bool getShadowsEnabled(void) const;
344 
345 
354  void setVisibilityMask(uint32 mask) { mVisibilityMask = mask; }
355 
359  uint getVisibilityMask(void) const { return mVisibilityMask; }
360 
373  virtual void setRenderQueueInvocationSequenceName(const String& sequenceName);
375  virtual const String& getRenderQueueInvocationSequenceName(void) const;
378 
380  void pointOrientedToScreen(const Vector2 &v, int orientationMode, Vector2 &outv);
381  void pointOrientedToScreen(Real orientedX, Real orientedY, int orientationMode,
382  Real &screenX, Real &screenY);
383 
388 
389  protected:
393  float mRelLeft, mRelTop, mRelWidth, mRelHeight;
395  int mActLeft, mActTop, mActWidth, mActHeight;
397  int mZOrder;
402  unsigned int mClearBuffers;
403  bool mUpdated;
408  // Render queue invocation sequence name
416 
419 
422  };
426 }
427 
428 #include "OgreHeaderSuffix.h"
429 
430 #endif
OgreHeaderSuffix.h
Ogre::Viewport::mListeners
ListenerList mListeners
Definition: OgreViewport.h:421
Ogre::Viewport::getMaterialScheme
const String & getMaterialScheme(void) const
Get the material scheme which the viewport should use.
Definition: OgreViewport.h:280
Ogre::Viewport::getOverlaysEnabled
bool getOverlaysEnabled(void) const
Returns whether or not Overlay objects (created in the SceneManager) are displayed in this viewport.
Ogre::Viewport::setBackgroundColour
void setBackgroundColour(const ColourValue &colour)
Sets the initial background colour of the viewport (before rendering).
Ogre::Viewport::mOrientationMode
OrientationMode mOrientationMode
Viewport orientation mode.
Definition: OgreViewport.h:414
Ogre::AllocatedObject
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Definition: OgreMemoryAllocatedObject.h:59
Ogre
Definition: OgreAndroidLogListener.h:35
Ogre::Viewport::ListenerList
vector< Listener * >::type ListenerList
Definition: OgreViewport.h:420
Ogre::Viewport::_getNumRenderedFaces
unsigned int _getNumRenderedFaces(void) const
Gets the number of rendered faces in the last update.
Ogre::Viewport::removeListener
void removeListener(Listener *l)
Remove a listener to this camera.
Ogre::Camera
A viewpoint from which the scene will be rendered.
Definition: OgreCamera.h:87
Ogre::Viewport::getDepthClear
Real getDepthClear(void) const
Gets the default depth buffer value to which the viewport is cleared.
Ogre::Viewport::_updateDimensions
void _updateDimensions(void)
Notifies the viewport of a possible change in dimensions.
Ogre::Viewport::mIsAutoUpdated
bool mIsAutoUpdated
Automatic rendering on/off.
Definition: OgreViewport.h:418
Ogre::Viewport::mDepthClearValue
Real mDepthClearValue
Definition: OgreViewport.h:400
Ogre::Viewport::mBackColour
ColourValue mBackColour
Background options.
Definition: OgreViewport.h:399
Ogre::Viewport::mCamera
Camera * mCamera
Definition: OgreViewport.h:390
Ogre::Viewport::getBackgroundColour
const ColourValue & getBackgroundColour(void) const
Gets the background colour.
Ogre::Viewport::mDefaultOrientationMode
static OrientationMode mDefaultOrientationMode
Definition: OgreViewport.h:415
Ogre::FBT_DEPTH
@ FBT_DEPTH
Definition: OgreCommon.h:297
Ogre::Viewport::update
void update(void)
Instructs the viewport to updates its contents.
Ogre::Viewport::mClearBuffers
unsigned int mClearBuffers
Definition: OgreViewport.h:402
Ogre::Viewport::setOverlaysEnabled
void setOverlaysEnabled(bool enabled)
Tells this viewport whether it should display Overlay objects.
Ogre::Viewport::Listener
Listener interface so you can be notified of Viewport changes.
Definition: OgreViewport.h:62
Ogre::Viewport::mClearEveryFrame
bool mClearEveryFrame
Definition: OgreViewport.h:401
Ogre::Viewport::setDefaultOrientationMode
static void setDefaultOrientationMode(OrientationMode orientationMode)
Set the initial orientation mode of viewports.
Ogre::uint32
unsigned int uint32
Definition: OgrePlatform.h:359
Ogre::Viewport::mRelWidth
float mRelWidth
Definition: OgreViewport.h:393
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::Viewport::getSkiesEnabled
bool getSkiesEnabled(void) const
Returns whether or not skies (created in the SceneManager) are displayed in this viewport.
Ogre::Viewport::setDimensions
void setDimensions(Real left, Real top, Real width, Real height)
Sets the dimensions (after creation).
Ogre::Viewport::setVisibilityMask
void setVisibilityMask(uint32 mask)
Sets a per-viewport visibility mask.
Definition: OgreViewport.h:354
Ogre::Viewport::_getNumRenderedBatches
unsigned int _getNumRenderedBatches(void) const
Gets the number of rendered batches in the last update.
Ogre::Viewport::getWidth
Real getWidth(void) const
Gets one of the relative dimensions of the viewport, a value between 0.0 and 1.0.
Ogre::Viewport::getTarget
RenderTarget * getTarget(void) const
Retrieves a pointer to the render target for this viewport.
Ogre::OrientationMode
OrientationMode
Specifies orientation mode.
Definition: OgreFrustum.h:50
Ogre::Viewport::Listener::~Listener
virtual ~Listener()
Definition: OgreViewport.h:64
Ogre::Viewport::mRQSequence
RenderQueueInvocationSequence * mRQSequence
Definition: OgreViewport.h:410
Ogre::Viewport::clear
void clear(unsigned int buffers=FBT_COLOUR|FBT_DEPTH, const ColourValue &colour=ColourValue::Black, Real depth=1.0f, unsigned short stencil=0)
Instructs the viewport to clear itself, without performing an update.
OgreHeaderPrefix.h
Ogre::RenderTarget
A 'canvas' which can receive the results of a rendering operation.
Definition: OgreRenderTarget.h:66
Ogre::Viewport::mMaterialSchemeName
String mMaterialSchemeName
Material scheme.
Definition: OgreViewport.h:412
Ogre::Viewport::mUpdated
bool mUpdated
Definition: OgreViewport.h:403
Ogre::Viewport::Listener::viewportDimensionsChanged
virtual void viewportDimensionsChanged(Viewport *viewport)
Notification of when target listening Viewport's dimensions changed.
Definition: OgreViewport.h:70
Ogre::RenderQueueInvocationSequence
Class to hold a linear sequence of RenderQueueInvocation objects.
Definition: OgreRenderQueueInvocation.h:174
Ogre::Viewport
An abstraction of a viewport, i.e.
Definition: OgreViewport.h:58
OgrePrerequisites.h
Ogre::Viewport::setRenderQueueInvocationSequenceName
virtual void setRenderQueueInvocationSequenceName(const String &sequenceName)
Sets the use of a custom RenderQueueInvocationSequence for rendering this target.
Ogre::Viewport::getActualDimensions
void getActualDimensions(int &left, int &top, int &width, int &height) const
Access to actual dimensions (based on target size).
Ogre::Viewport::getRenderQueueInvocationSequenceName
virtual const String & getRenderQueueInvocationSequenceName(void) const
Gets the name of the render queue invocation sequence for this target.
Ogre::Viewport::getClearBuffers
unsigned int getClearBuffers(void) const
Gets which buffers are to be cleared each frame.
Ogre::Viewport::getActualWidth
int getActualWidth(void) const
Gets one of the actual dimensions of the viewport, a value in pixels.
Ogre::Viewport::setCamera
void setCamera(Camera *cam)
Sets the camera to use for rendering to this viewport.
Ogre::Viewport::getActualLeft
int getActualLeft(void) const
Gets one of the actual dimensions of the viewport, a value in pixels.
Ogre::Viewport::mShowShadows
bool mShowShadows
Definition: OgreViewport.h:406
Ogre::Viewport::getVisibilityMask
uint getVisibilityMask(void) const
Gets a per-viewport visibility mask.
Definition: OgreViewport.h:359
Ogre::Viewport::mShowSkies
bool mShowSkies
Definition: OgreViewport.h:405
Ogre::Viewport::mActWidth
int mActWidth
Definition: OgreViewport.h:395
Ogre::Viewport::mVisibilityMask
uint32 mVisibilityMask
Definition: OgreViewport.h:407
Ogre::Viewport::addListener
void addListener(Listener *l)
Add a listener to this camera.
Ogre::Viewport::_getRenderQueueInvocationSequence
RenderQueueInvocationSequence * _getRenderQueueInvocationSequence(void)
Get the invocation sequence - will return null if using standard.
Ogre::Viewport::getHeight
Real getHeight(void) const
Gets one of the relative dimensions of the viewport, a value between 0.0 and 1.0.
_OgreExport
#define _OgreExport
Definition: OgrePlatform.h:257
Ogre::Viewport::getActualHeight
int getActualHeight(void) const
Gets one of the actual dimensions of the viewport, a value in pixels.
OgreCommon.h
Ogre::Viewport::setSkiesEnabled
void setSkiesEnabled(bool enabled)
Tells this viewport whether it should display skies.
Ogre::Viewport::getClearEveryFrame
bool getClearEveryFrame(void) const
Determines if the viewport is cleared before every frame.
Ogre::Viewport::getOrientationMode
OrientationMode getOrientationMode() const
Get the orientation mode of the viewport.
Ogre::Viewport::Viewport
Viewport(Camera *camera, RenderTarget *target, Real left, Real top, Real width, Real height, int ZOrder)
The usual constructor.
Ogre::Viewport::getDefaultOrientationMode
static OrientationMode getDefaultOrientationMode()
Get the initial orientation mode of viewports.
Ogre::Viewport::getActualTop
int getActualTop(void) const
Gets one of the actual dimensions of the viewport, a value in pixels.
Ogre::Viewport::pointOrientedToScreen
void pointOrientedToScreen(const Vector2 &v, int orientationMode, Vector2 &outv)
Convert oriented input point coordinates to screen coordinates.
Ogre::Viewport::~Viewport
virtual ~Viewport()
Default destructor.
Ogre::Viewport::setMaterialScheme
void setMaterialScheme(const String &schemeName)
Set the material scheme which the viewport should use.
Definition: OgreViewport.h:275
Ogre::Viewport::setClearEveryFrame
void setClearEveryFrame(bool clear, unsigned int buffers=FBT_COLOUR|FBT_DEPTH)
Determines whether to clear the viewport before rendering.
Ogre::Viewport::getZOrder
int getZOrder(void) const
Gets the Z-Order of this viewport.
OgreColourValue.h
Ogre::ColourValue
Class representing colour.
Definition: OgreColourValue.h:58
Ogre::uint
unsigned int uint
Definition: OgrePrerequisites.h:114
Ogre::Viewport::isAutoUpdated
bool isAutoUpdated() const
Gets whether this viewport is automatically updated if Ogre's rendering loop or RenderTarget::update ...
Ogre::Viewport::setAutoUpdated
void setAutoUpdated(bool autoupdate)
Sets whether this viewport should be automatically updated if Ogre's rendering loop or RenderTarget::...
Ogre::Vector2
Standard 2-dimensional vector.
Definition: OgreVector2.h:52
Ogre::Viewport::mTarget
RenderTarget * mTarget
Definition: OgreViewport.h:391
Ogre::ColourValue::Black
static const ColourValue Black
Definition: OgreColourValue.h:61
Ogre::Viewport::setDepthClear
void setDepthClear(Real depth)
Sets the initial depth buffer value of the viewport (before rendering).
Ogre::Viewport::Listener::viewportCameraChanged
virtual void viewportCameraChanged(Viewport *viewport)
Notification of when a new camera is set to target listening Viewport.
Definition: OgreViewport.h:67
Ogre::FBT_COLOUR
@ FBT_COLOUR
Definition: OgreCommon.h:296
Ogre::Real
float Real
Software floating point type.
Definition: OgrePrerequisites.h:70
Ogre::Viewport::mShowOverlays
bool mShowOverlays
Definition: OgreViewport.h:404
Ogre::Viewport::getTop
Real getTop(void) const
Gets one of the relative dimensions of the viewport, a value between 0.0 and 1.0.
Ogre::Viewport::pointOrientedToScreen
void pointOrientedToScreen(Real orientedX, Real orientedY, int orientationMode, Real &screenX, Real &screenY)
Ogre::Viewport::Listener::viewportDestroyed
virtual void viewportDestroyed(Viewport *viewport)
Notification of when target listening Viewport's is destroyed.
Definition: OgreViewport.h:73
Ogre::Viewport::setShadowsEnabled
void setShadowsEnabled(bool enabled)
Tells this viewport whether it should display shadows.
Ogre::Viewport::getShadowsEnabled
bool getShadowsEnabled(void) const
Returns whether or not shadows (defined in the SceneManager) are displayed in this viewport.
Ogre::vector
Definition: OgrePrerequisites.h:492
Ogre::Viewport::mRQSequenceName
String mRQSequenceName
Definition: OgreViewport.h:409
Ogre::Viewport::_clearUpdatedFlag
void _clearUpdatedFlag(void)
Ogre::Viewport::_isUpdated
bool _isUpdated(void) const
OgreFrustum.h
Ogre::Viewport::setOrientationMode
void setOrientationMode(OrientationMode orientationMode, bool setDefault=true)
Set the orientation mode of the viewport.
Ogre::Viewport::getLeft
Real getLeft(void) const
Gets one of the relative dimensions of the viewport, a value between 0.0 and 1.0.
Ogre::Viewport::getCamera
Camera * getCamera(void) const
Retrieves a pointer to the camera for this viewport.
Ogre::Viewport::mZOrder
int mZOrder
Z-order.
Definition: OgreViewport.h:397

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.