00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://www.ogre3d.org/ 00006 00007 Copyright (c) 2000-2012 Torus Knot Software Ltd 00008 00009 Permission is hereby granted, free of charge, to any person obtaining a copy 00010 of this software and associated documentation files (the "Software"), to deal 00011 in the Software without restriction, including without limitation the rights 00012 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00013 copies of the Software, and to permit persons to whom the Software is 00014 furnished to do so, subject to the following conditions: 00015 00016 The above copyright notice and this permission notice shall be included in 00017 all copies or substantial portions of the Software. 00018 00019 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00020 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00021 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00022 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00023 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00024 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00025 THE SOFTWARE. 00026 ----------------------------------------------------------------------------- 00027 */ 00028 00029 #ifndef __Overlay_H__ 00030 #define __Overlay_H__ 00031 00032 #include "OgrePrerequisites.h" 00033 #include "OgreSceneNode.h" 00034 #include "OgreIteratorWrappers.h" 00035 #include "OgreMatrix4.h" 00036 00037 namespace Ogre { 00038 00039 00070 class _OgreExport Overlay : public OverlayAlloc 00071 { 00072 00073 public: 00074 typedef list<OverlayContainer*>::type OverlayContainerList; 00075 protected: 00076 String mName; 00078 SceneNode* mRootNode; 00079 // 2D elements 00080 // OverlayContainers, linked list for easy sorting by zorder later 00081 // Not a map because sort can be saved since changes infrequent (unlike render queue) 00082 OverlayContainerList m2DElements; 00083 00084 // Degrees of rotation around center 00085 Radian mRotate; 00086 // Scroll values, offsets 00087 Real mScrollX, mScrollY; 00088 // Scale values 00089 Real mScaleX, mScaleY; 00090 00091 mutable Matrix4 mTransform; 00092 mutable bool mTransformOutOfDate; 00093 bool mTransformUpdated; 00094 ulong mZOrder; 00095 bool mVisible; 00096 bool mInitialised; 00097 String mOrigin; 00099 void updateTransform(void) const; 00101 void initialise(void); 00103 void assignZOrders(void); 00104 00105 public: 00107 Overlay(const String& name); 00108 virtual ~Overlay(); 00109 00110 00111 OverlayContainer* getChild(const String& name); 00112 00114 const String& getName(void) const; 00119 void setZOrder(ushort zorder); 00121 ushort getZOrder(void) const; 00122 00124 bool isVisible(void) const; 00125 00127 bool isInitialised(void) const { return mInitialised; } 00128 00130 void show(void); 00131 00133 void hide(void); 00134 00145 void add2D(OverlayContainer* cont); 00146 00147 00152 void remove2D(OverlayContainer* cont); 00153 00186 void add3D(SceneNode* node); 00187 00189 void remove3D(SceneNode* node); 00190 00192 void clear(); 00193 00203 void setScroll(Real x, Real y); 00204 00206 Real getScrollX(void) const; 00207 00209 Real getScrollY(void) const; 00210 00217 void scroll(Real xoff, Real yoff); 00218 00220 void setRotate(const Radian& angle); 00221 00223 const Radian &getRotate(void) const { return mRotate; } 00224 00226 void rotate(const Radian& angle); 00227 00235 void setScale(Real x, Real y); 00236 00238 Real getScaleX(void) const; 00239 00241 Real getScaleY(void) const; 00242 00244 void _getWorldTransforms(Matrix4* xform) const; 00245 00247 void _findVisibleObjects(Camera* cam, RenderQueue* queue); 00248 00250 virtual OverlayElement* findElementAt(Real x, Real y); 00251 00256 typedef VectorIterator<OverlayContainerList> Overlay2DElementsIterator ; 00257 Overlay2DElementsIterator get2DElementsIterator () 00258 { 00259 return Overlay2DElementsIterator (m2DElements.begin(), m2DElements.end()); 00260 } 00267 const String& getOrigin(void) const { return mOrigin; } 00269 void _notifyOrigin(const String& origin) { mOrigin = origin; } 00270 00271 00272 }; 00276 } 00277 00278 00279 #endif 00280
Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Fri May 25 23:36:25 2012