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:
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 
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 
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 
249 
252 
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 
#define _OgreOverlayExport
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
A viewpoint from which the scene will be rendered.
Definition: OgreCamera.h:87
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: OgreMatrix4.h:79
A 2D element which contains other OverlayElement instances.
Abstract definition of a 2D element to be displayed in an Overlay.
Represents a layer which is rendered on top of the 'normal' scene contents.
Definition: OgreOverlay.h:71
SceneNode * mRootNode
Internal root node, used as parent for 3D objects.
Definition: OgreOverlay.h:78
void assignZOrders(void)
Internal method for updating container elements' Z-ordering.
ushort getZOrder(void) const
Gets the Z-order of this overlay.
void add3D(SceneNode *node)
Adds a node capable of holding 3D objects to the overlay.
Matrix4 mTransform
Definition: OgreOverlay.h:91
void remove3D(SceneNode *node)
Removes a 3D element from the overlay.
void _getWorldTransforms(Matrix4 *xform) const
Used to transform the overlay when scrolling, scaling etc.
Real getScrollY(void) const
Gets the current Y scroll value.
void show(void)
Shows the overlay if it was hidden.
bool isInitialised(void) const
Gets whether the overlay is initialised or not.
Definition: OgreOverlay.h:128
void updateTransform(void) const
Internal lazy update method.
Real getScaleY(void) const
Gets the current Y scale value.
list< OverlayContainer * >::type OverlayContainerList
Definition: OgreOverlay.h:74
virtual ~Overlay()
void remove2D(OverlayContainer *cont)
Removes a 2D container from the overlay.
OverlayContainer * getChild(const String &name)
void setZOrder(ushort zorder)
Alters the Z-order of this overlay.
const Radian & getRotate(void) const
Gets the rotation applied to this overlay, in degrees.
Definition: OgreOverlay.h:224
const String & getName(void) const
Gets the name of this overlay.
Overlay2DElementsIterator get2DElementsIterator()
Definition: OgreOverlay.h:258
bool isVisible(void) const
Gets whether the overlay is displayed or not.
bool mTransformUpdated
Definition: OgreOverlay.h:93
void setRotate(const Radian &angle)
Sets the rotation applied to this overlay.
void add2D(OverlayContainer *cont)
Adds a 2D 'container' to the overlay.
OverlayContainerList m2DElements
2D elements OverlayContainers, linked list for easy sorting by zorder later Not a map because sort ca...
Definition: OgreOverlay.h:82
Real mScrollX
Scroll values, offsets.
Definition: OgreOverlay.h:87
void clear()
Clears the overlay of all attached items.
void rotate(const Radian &angle)
Adds the passed in angle to the rotation applied to this overlay.
Real mScaleX
Scale values.
Definition: OgreOverlay.h:89
Overlay(const String &name)
Constructor: do not call direct, use OverlayManager::create.
VectorIterator< OverlayContainerList > Overlay2DElementsIterator
Returns an iterator over all 2D elements in this manager.
Definition: OgreOverlay.h:257
Real getScrollX(void) const
Gets the current X scroll value.
Real getScaleX(void) const
Gets the current X scale value.
virtual OverlayElement * findElementAt(Real x, Real y)
This returns a OverlayElement at position x,y.
void hide(void)
Hides the overlay if it was visible.
bool mTransformOutOfDate
Definition: OgreOverlay.h:92
String mOrigin
Definition: OgreOverlay.h:97
Radian mRotate
Degrees of rotation around center.
Definition: OgreOverlay.h:85
void setScale(Real x, Real y)
Sets the scaling factor of this overlay.
void scroll(Real xoff, Real yoff)
Scrolls the overlay by the offsets provided.
void setScroll(Real x, Real y)
Sets the scrolling factor of this overlay.
void initialise(void)
Internal method for initialising an overlay.
void _notifyOrigin(const String &origin)
Notify this overlay of it's origin.
Definition: OgreOverlay.h:270
void _findVisibleObjects(Camera *cam, RenderQueue *queue)
Internal method to put the overlay contents onto the render queue.
bool mInitialised
Definition: OgreOverlay.h:96
const String & getOrigin(void) const
Get the origin of this overlay, e.g.
Definition: OgreOverlay.h:268
String mName
Definition: OgreOverlay.h:76
Wrapper class which indicates a given angle value is in Radians.
Definition: OgreMath.h:48
Class to manage the scene object rendering queue.
Class representing a node in the scene graph.
Definition: OgreSceneNode.h:59
Concrete IteratorWrapper for nonconst access to the underlying container.
unsigned long ulong
float Real
Software floating point type.
_StringBase String
unsigned short ushort

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