OGRE  1.7
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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-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 
29 #ifndef __Overlay_H__
30 #define __Overlay_H__
31 
32 #include "OgrePrerequisites.h"
33 #include "OgreSceneNode.h"
34 #include "OgreIteratorWrappers.h"
35 #include "OgreMatrix4.h"
36 
37 namespace Ogre {
38 
39 
71  {
72 
73  public:
75  protected:
79  // 2D elements
80  // OverlayContainers, linked list for easy sorting by zorder later
81  // Not a map because sort can be saved since changes infrequent (unlike render queue)
83 
84  // Degrees of rotation around center
86  // Scroll values, offsets
87  Real mScrollX, mScrollY;
88  // Scale values
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;
119  void setZOrder(ushort zorder);
121  ushort getZOrder(void) const;
122 
124  bool isVisible(void) const;
125 
127  bool isInitialised(void) const { return mInitialised; }
128 
130  void show(void);
131 
133  void hide(void);
134 
145  void add2D(OverlayContainer* cont);
146 
147 
152  void remove2D(OverlayContainer* cont);
153 
186  void add3D(SceneNode* node);
187 
189  void remove3D(SceneNode* node);
190 
192  void clear();
193 
203  void setScroll(Real x, Real y);
204 
206  Real getScrollX(void) const;
207 
209  Real getScrollY(void) const;
210 
217  void scroll(Real xoff, Real yoff);
218 
220  void setRotate(const Radian& angle);
221 
223  const Radian &getRotate(void) const { return mRotate; }
224 
226  void rotate(const Radian& angle);
227 
235  void setScale(Real x, Real y);
236 
238  Real getScaleX(void) const;
239 
241  Real getScaleY(void) const;
242 
244  void _getWorldTransforms(Matrix4* xform) const;
245 
247  void _findVisibleObjects(Camera* cam, RenderQueue* queue);
248 
250  virtual OverlayElement* findElementAt(Real x, Real y);
251 
258  {
259  return Overlay2DElementsIterator (m2DElements.begin(), m2DElements.end());
260  }
267  const String& getOrigin(void) const { return mOrigin; }
269  void _notifyOrigin(const String& origin) { mOrigin = origin; }
270 
271 
272  };
276 }
277 
278 
279 #endif
280 
A viewpoint from which the scene will be rendered.
Definition: OgreCamera.h:85
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: OgreMatrix4.h:78
float Real
Software floating point type.
Overlay2DElementsIterator get2DElementsIterator()
Definition: OgreOverlay.h:257
#define _OgreExport
Definition: OgrePlatform.h:203
unsigned long ulong
String mName
Definition: OgreOverlay.h:76
Radian mRotate
Definition: OgreOverlay.h:85
list< OverlayContainer * >::type OverlayContainerList
Definition: OgreOverlay.h:74
bool mInitialised
Definition: OgreOverlay.h:96
VectorIterator< OverlayContainerList > Overlay2DElementsIterator
Returns an iterator over all 2D elements in this manager.
Definition: OgreOverlay.h:256
A 2D element which contains other OverlayElement instances.
OverlayContainerList m2DElements
Definition: OgreOverlay.h:82
Class representing a node in the scene graph.
Definition: OgreSceneNode.h:57
void _notifyOrigin(const String &origin)
Notify this overlay of it's origin.
Definition: OgreOverlay.h:269
SceneNode * mRootNode
Internal root node, used as parent for 3D objects.
Definition: OgreOverlay.h:78
bool mTransformOutOfDate
Definition: OgreOverlay.h:92
bool mTransformUpdated
Definition: OgreOverlay.h:93
Matrix4 mTransform
Definition: OgreOverlay.h:91
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
const Radian & getRotate(void) const
Gets the rotation applied to this overlay, in degrees.
Definition: OgreOverlay.h:223
unsigned short ushort
Abstract definition of a 2D element to be displayed in an Overlay.
Wrapper class which indicates a given angle value is in Radians.
Definition: OgreMath.h:46
Class to manage the scene object rendering queue.
_StringBase String
bool isInitialised(void) const
Gets whether the overlay is initialised or not.
Definition: OgreOverlay.h:127
const String & getOrigin(void) const
Get the origin of this overlay, e.g.
Definition: OgreOverlay.h:267
Concrete IteratorWrapper for nonconst access to the underlying container.
Represents a layer which is rendered on top of the 'normal' scene contents.
Definition: OgreOverlay.h:70
String mOrigin
Definition: OgreOverlay.h:97