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 
91  Viewport(
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 
196  void setDimensions(Real left, Real top, Real width, Real height);
197 
200  void setOrientationMode(OrientationMode orientationMode, bool setDefault = true);
201 
204  OrientationMode getOrientationMode() const;
205 
208  static void setDefaultOrientationMode(OrientationMode orientationMode);
209 
212  static OrientationMode getDefaultOrientationMode();
213 
217  void setBackgroundColour(const ColourValue& colour);
218 
221  const ColourValue& getBackgroundColour(void) const;
222 
226  void setDepthClear( Real depth );
227 
230  Real getDepthClear(void) const;
231 
241  void setClearEveryFrame(bool clear, unsigned int buffers = FBT_COLOUR | FBT_DEPTH);
242 
245  bool getClearEveryFrame(void) const;
246 
248  unsigned int getClearBuffers(void) const;
249 
261  void setAutoUpdated(bool autoupdate);
265  bool isAutoUpdated() const;
266 
274  void setMaterialScheme(const String& schemeName)
275  { mMaterialSchemeName = schemeName; }
276 
279  const String& getMaterialScheme(void) const
280  { return mMaterialSchemeName; }
281 
284  void getActualDimensions(
285  int &left, int &top, int &width, int &height ) const;
286 
287  bool _isUpdated(void) const;
288  void _clearUpdatedFlag(void);
289 
292  unsigned int _getNumRenderedFaces(void) const;
293 
296  unsigned int _getNumRenderedBatches(void) const;
297 
308  void setOverlaysEnabled(bool enabled);
309 
312  bool getOverlaysEnabled(void) const;
313 
324  void setSkiesEnabled(bool enabled);
325 
328  bool getSkiesEnabled(void) const;
329 
338  void setShadowsEnabled(bool enabled);
339 
342  bool getShadowsEnabled(void) const;
343 
344 
353  void setVisibilityMask(uint32 mask) { mVisibilityMask = mask; }
354 
358  uint getVisibilityMask(void) const { return mVisibilityMask; }
359 
372  virtual void setRenderQueueInvocationSequenceName(const String& sequenceName);
374  virtual const String& getRenderQueueInvocationSequenceName(void) const;
376  RenderQueueInvocationSequence* _getRenderQueueInvocationSequence(void);
377 
379  void pointOrientedToScreen(const Vector2 &v, int orientationMode, Vector2 &outv);
380  void pointOrientedToScreen(Real orientedX, Real orientedY, int orientationMode,
381  Real &screenX, Real &screenY);
382 
384  void addListener(Listener* l);
386  void removeListener(Listener* l);
387 
388  protected:
392  float mRelLeft, mRelTop, mRelWidth, mRelHeight;
394  int mActLeft, mActTop, mActWidth, mActHeight;
396  int mZOrder;
401  unsigned int mClearBuffers;
402  bool mUpdated;
407  // Render queue invocation sequence name
415 
418 
421  };
425 }
426 
427 #include "OgreHeaderSuffix.h"
428 
429 #endif

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Wed Oct 16 2013 14:35:46