OgreOverlay.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 
29 #ifndef __Overlay_H__
30 #define __Overlay_H__
31 
33 #include "OgreSceneNode.h"
34 #include "OgreIteratorWrappers.h"
35 #include "OgreMatrix4.h"
36 
37 namespace Ogre {
38 
39 
71  {
72 
73  public:
75  protected:
82  OverlayContainerList m2DElements;
83 
87  Real mScrollX, mScrollY;
89  Real mScaleX, mScaleY;
90 
92  mutable bool mTransformOutOfDate;
95  bool mVisible;
99  void updateTransform(void) const;
101  void initialise(void);
103  void assignZOrders(void);
104 
105  public:
107  Overlay(const String& name);
108  virtual ~Overlay();
109 
110 
111  OverlayContainer* getChild(const String& name);
112 
114  const String& getName(void) const;
115 
120  void setZOrder(ushort zorder);
122  ushort getZOrder(void) const;
123 
125  bool isVisible(void) const;
126 
128  bool isInitialised(void) const { return mInitialised; }
129 
131  void show(void);
132 
134  void hide(void);
135 
146  void add2D(OverlayContainer* cont);
147 
148 
153  void remove2D(OverlayContainer* cont);
154 
187  void add3D(SceneNode* node);
188 
190  void remove3D(SceneNode* node);
191 
193  void clear();
194 
204  void setScroll(Real x, Real y);
205 
207  Real getScrollX(void) const;
208 
210  Real getScrollY(void) const;
211 
218  void scroll(Real xoff, Real yoff);
219 
221  void setRotate(const Radian& angle);
222 
224  const Radian &getRotate(void) const { return mRotate; }
225 
227  void rotate(const Radian& angle);
228 
236  void setScale(Real x, Real y);
237 
239  Real getScaleX(void) const;
240 
242  Real getScaleY(void) const;
243 
245  void _getWorldTransforms(Matrix4* xform) const;
246 
248  void _findVisibleObjects(Camera* cam, RenderQueue* queue);
249 
251  virtual OverlayElement* findElementAt(Real x, Real y);
252 
258  Overlay2DElementsIterator get2DElementsIterator ()
259  {
260  return Overlay2DElementsIterator (m2DElements.begin(), m2DElements.end());
261  }
268  const String& getOrigin(void) const { return mOrigin; }
270  void _notifyOrigin(const String& origin) { mOrigin = origin; }
271 
272 
273  };
277 }
278 
279 
280 #endif
281 
Concrete IteratorWrapper for nonconst access to the underlying container.
void _notifyOrigin(const String &origin)
Notify this overlay of it's origin.
Definition: OgreOverlay.h:270
float Real
Software floating point type.
Class to manage the scene object rendering queue.
const Radian & getRotate(void) const
Gets the rotation applied to this overlay, in degrees.
Definition: OgreOverlay.h:224
#define _OgreOverlayExport
bool mTransformUpdated
Definition: OgreOverlay.h:93
Class representing a node in the scene graph.
Definition: OgreSceneNode.h:58
bool mInitialised
Definition: OgreOverlay.h:96
const String & getOrigin(void) const
Get the origin of this overlay, e.g.
Definition: OgreOverlay.h:268
SceneNode * mRootNode
Internal root node, used as parent for 3D objects.
Definition: OgreOverlay.h:78
OverlayContainerList m2DElements
2D elements OverlayContainers, linked list for easy sorting by zorder later Not a map because sort ca...
Definition: OgreOverlay.h:82
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: OgreMatrix4.h:78
VectorIterator< OverlayContainerList > Overlay2DElementsIterator
Returns an iterator over all 2D elements in this manager.
Definition: OgreOverlay.h:257
Radian mRotate
Degrees of rotation around center.
Definition: OgreOverlay.h:85
_StringBase String
String mName
Definition: OgreOverlay.h:76
Matrix4 mTransform
Definition: OgreOverlay.h:91
A viewpoint from which the scene will be rendered.
Definition: OgreCamera.h:86
bool mTransformOutOfDate
Definition: OgreOverlay.h:92
bool isInitialised(void) const
Gets whether the overlay is initialised or not.
Definition: OgreOverlay.h:128
String mOrigin
Definition: OgreOverlay.h:97
unsigned long ulong
Abstract definition of a 2D element to be displayed in an Overlay.
list< OverlayContainer * >::type OverlayContainerList
Definition: OgreOverlay.h:74
unsigned short ushort
A 2D element which contains other OverlayElement instances.
Represents a layer which is rendered on top of the &#39;normal&#39; scene contents.
Definition: OgreOverlay.h:70
Overlay2DElementsIterator get2DElementsIterator()
Definition: OgreOverlay.h:258
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Wrapper class which indicates a given angle value is in Radians.
Definition: OgreMath.h:47

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 Mon Jan 2 2017 11:48:42