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-2006 Torus Knot Software Ltd 00008 Also see acknowledgements in Readme.html 00009 00010 This program is free software; you can redistribute it and/or modify it under 00011 the terms of the GNU Lesser General Public License as published by the Free Software 00012 Foundation; either version 2 of the License, or (at your option) any later 00013 version. 00014 00015 This program is distributed in the hope that it will be useful, but WITHOUT 00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License along with 00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to 00022 http://www.gnu.org/copyleft/lesser.txt. 00023 00024 You may alternatively use this source under the terms of a specific version of 00025 the OGRE Unrestricted License provided you have obtained such a license from 00026 Torus Knot Software Ltd. 00027 ----------------------------------------------------------------------------- 00028 */ 00029 00030 #ifndef __Overlay_H__ 00031 #define __Overlay_H__ 00032 00033 #include "OgrePrerequisites.h" 00034 #include "OgreSceneNode.h" 00035 #include "OgreIteratorWrappers.h" 00036 #include "OgreMatrix4.h" 00037 00038 namespace Ogre { 00039 00040 00065 class _OgreExport Overlay 00066 { 00067 00068 public: 00069 typedef std::list<OverlayContainer*> OverlayContainerList; 00070 protected: 00071 String mName; 00073 SceneNode* mRootNode; 00074 // 2D elements 00075 // OverlayContainers, linked list for easy sorting by zorder later 00076 // Not a map because sort can be saved since changes infrequent (unlike render queue) 00077 OverlayContainerList m2DElements; 00078 00079 // Degrees of rotation around center 00080 Radian mRotate; 00081 // Scroll values, offsets 00082 Real mScrollX, mScrollY; 00083 // Scale values 00084 Real mScaleX, mScaleY; 00085 00086 mutable Matrix4 mTransform; 00087 mutable bool mTransformOutOfDate; 00088 bool mTransformUpdated; 00089 ulong mZOrder; 00090 bool mVisible; 00091 bool mInitialised; 00092 String mOrigin; 00094 void updateTransform(void) const; 00096 void initialise(void); 00097 00098 public: 00100 Overlay(const String& name); 00101 virtual ~Overlay(); 00102 00103 00104 OverlayContainer* getChild(const String& name); 00105 00107 const String& getName(void) const; 00112 void setZOrder(ushort zorder); 00114 ushort getZOrder(void) const; 00115 00117 bool isVisible(void) const; 00118 00120 bool isInitialised(void) const { return mInitialised; } 00121 00123 void show(void); 00124 00126 void hide(void); 00127 00138 void add2D(OverlayContainer* cont); 00139 00140 00145 void remove2D(OverlayContainer* cont); 00146 00179 void add3D(SceneNode* node); 00180 00182 void remove3D(SceneNode* node); 00183 00185 void clear(); 00186 00196 void setScroll(Real x, Real y); 00197 00199 Real getScrollX(void) const; 00200 00202 Real getScrollY(void) const; 00203 00210 void scroll(Real xoff, Real yoff); 00211 00213 void setRotate(const Radian& angle); 00214 #ifndef OGRE_FORCE_ANGLE_TYPES 00215 inline void setRotate(Real degrees) { 00216 setRotate ( Angle(degrees) ); 00217 } 00218 #endif//OGRE_FORCE_ANGLE_TYPES 00219 00221 const Radian &getRotate(void) const { return mRotate; } 00222 00224 void rotate(const Radian& angle); 00225 #ifndef OGRE_FORCE_ANGLE_TYPES 00226 inline void rotate(Real degrees) { 00227 rotate ( Angle(degrees) ); 00228 } 00229 #endif//OGRE_FORCE_ANGLE_TYPES 00230 00238 void setScale(Real x, Real y); 00239 00241 Real getScaleX(void) const; 00242 00244 Real getScaleY(void) const; 00245 00247 void _getWorldTransforms(Matrix4* xform) const; 00249 const Quaternion& getWorldOrientation(void) const; 00251 const Vector3& getWorldPosition(void) const; 00252 00254 void _findVisibleObjects(Camera* cam, RenderQueue* queue); 00255 00257 virtual OverlayElement* findElementAt(Real x, Real y); 00258 00263 typedef VectorIterator<OverlayContainerList> Overlay2DElementsIterator ; 00264 Overlay2DElementsIterator get2DElementsIterator () 00265 { 00266 return Overlay2DElementsIterator (m2DElements.begin(), m2DElements.end()); 00267 } 00274 const String& getOrigin(void) const { return mOrigin; } 00276 void _notifyOrigin(const String& origin) { mOrigin = origin; } 00277 00278 00279 }; 00280 00281 } 00282 00283 00284 #endif 00285
Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Jul 8 15:20:08 2007