OGRE  1.7
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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-2011 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 
36 namespace Ogre {
57  {
58  public:
81  Viewport(
82  Camera* camera,
83  RenderTarget* target,
84  Real left, Real top,
85  Real width, Real height,
86  int ZOrder);
87 
90  virtual ~Viewport();
91 
99  void _updateDimensions(void);
100 
103  void update(void);
104 
117  void clear(unsigned int buffers = FBT_COLOUR | FBT_DEPTH,
118  const ColourValue& colour = ColourValue::Black,
119  Real depth = 1.0f, unsigned short stencil = 0);
120 
123  RenderTarget* getTarget(void) const;
124 
127  Camera* getCamera(void) const;
128 
130  void setCamera(Camera* cam);
131 
133  int getZOrder(void) const;
137  Real getLeft(void) const;
138 
142  Real getTop(void) const;
143 
148  Real getWidth(void) const;
153  Real getHeight(void) const;
158  int getActualLeft(void) const;
163  int getActualTop(void) const;
167  int getActualWidth(void) const;
172  int getActualHeight(void) const;
173 
186  void setDimensions(Real left, Real top, Real width, Real height);
187 
190  void setOrientationMode(OrientationMode orientationMode, bool setDefault = true);
191 
194  OrientationMode getOrientationMode() const;
195 
198  static void setDefaultOrientationMode(OrientationMode orientationMode);
199 
202  static OrientationMode getDefaultOrientationMode();
203 
207  void setBackgroundColour(const ColourValue& colour);
208 
211  const ColourValue& getBackgroundColour(void) const;
212 
222  void setClearEveryFrame(bool clear, unsigned int buffers = FBT_COLOUR | FBT_DEPTH);
223 
226  bool getClearEveryFrame(void) const;
227 
229  unsigned int getClearBuffers(void) const;
230 
242  void setAutoUpdated(bool autoupdate);
246  bool isAutoUpdated() const;
247 
255  void setMaterialScheme(const String& schemeName)
256  { mMaterialSchemeName = schemeName; }
257 
260  const String& getMaterialScheme(void) const
261  { return mMaterialSchemeName; }
262 
265  void getActualDimensions(
266  int &left, int &top, int &width, int &height ) const;
267 
268  bool _isUpdated(void) const;
269  void _clearUpdatedFlag(void);
270 
273  unsigned int _getNumRenderedFaces(void) const;
274 
277  unsigned int _getNumRenderedBatches(void) const;
278 
289  void setOverlaysEnabled(bool enabled);
290 
293  bool getOverlaysEnabled(void) const;
294 
305  void setSkiesEnabled(bool enabled);
306 
309  bool getSkiesEnabled(void) const;
310 
319  void setShadowsEnabled(bool enabled);
320 
323  bool getShadowsEnabled(void) const;
324 
325 
334  void setVisibilityMask(uint32 mask) { mVisibilityMask = mask; }
335 
339  uint getVisibilityMask(void) const { return mVisibilityMask; }
340 
353  virtual void setRenderQueueInvocationSequenceName(const String& sequenceName);
355  virtual const String& getRenderQueueInvocationSequenceName(void) const;
357  RenderQueueInvocationSequence* _getRenderQueueInvocationSequence(void);
358 
360  void pointOrientedToScreen(const Vector2 &v, int orientationMode, Vector2 &outv);
361  void pointOrientedToScreen(Real orientedX, Real orientedY, int orientationMode,
362  Real &screenX, Real &screenY);
363 
364  protected:
367  // Relative dimensions, irrespective of target dimensions (0..1)
368  float mRelLeft, mRelTop, mRelWidth, mRelHeight;
369  // Actual dimensions, based on target dimensions
370  int mActLeft, mActTop, mActWidth, mActHeight;
372  int mZOrder;
376  unsigned int mClearBuffers;
377  bool mUpdated;
382  // Render queue invocation sequence name
390 
393  };
397 }
398 
399 #endif
A 'canvas' which can receive the results of a rendering operation.
A viewpoint from which the scene will be rendered.
Definition: OgreCamera.h:85
String mRQSequenceName
Definition: OgreViewport.h:383
float Real
Software floating point type.
unsigned int uint32
Definition: OgrePlatform.h:246
#define _OgreExport
Definition: OgrePlatform.h:203
void setMaterialScheme(const String &schemeName)
Set the material scheme which the viewport should use.
Definition: OgreViewport.h:255
unsigned int mClearBuffers
Definition: OgreViewport.h:376
Class representing colour.
ColourValue mBackColour
Background options.
Definition: OgreViewport.h:374
RenderTarget * mTarget
Definition: OgreViewport.h:366
bool mIsAutoUpdated
Automatic rendering on/off.
Definition: OgreViewport.h:392
Class to hold a linear sequence of RenderQueueInvocation objects.
OrientationMode
Specifies orientation mode.
Definition: OgreFrustum.h:48
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Standard 2-dimensional vector.
Definition: OgreVector2.h:51
uint getVisibilityMask(void) const
Gets a per-viewport visibility mask.
Definition: OgreViewport.h:339
An abstraction of a viewport, i.e.
Definition: OgreViewport.h:56
String mMaterialSchemeName
Material scheme.
Definition: OgreViewport.h:386
const String & getMaterialScheme(void) const
Get the material scheme which the viewport should use.
Definition: OgreViewport.h:260
static const ColourValue Black
_StringBase String
static OrientationMode mDefaultOrientationMode
Definition: OgreViewport.h:389
void setVisibilityMask(uint32 mask)
Sets a per-viewport visibility mask.
Definition: OgreViewport.h:334
RenderQueueInvocationSequence * mRQSequence
Definition: OgreViewport.h:384
OrientationMode mOrientationMode
Viewport orientation mode.
Definition: OgreViewport.h:388
int mZOrder
ZOrder.
Definition: OgreViewport.h:372
Camera * mCamera
Definition: OgreViewport.h:365
unsigned int uint
uint32 mVisibilityMask
Definition: OgreViewport.h:381