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-2005 The OGRE Team 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 */ 00025 00026 #ifndef __Overlay_H__ 00027 #define __Overlay_H__ 00028 00029 #include "OgrePrerequisites.h" 00030 #include "OgreSceneNode.h" 00031 #include "OgreIteratorWrappers.h" 00032 #include "OgreMatrix4.h" 00033 00034 namespace Ogre { 00035 00036 00061 class _OgreExport Overlay 00062 { 00063 00064 public: 00065 typedef std::list<OverlayContainer*> OverlayContainerList; 00066 protected: 00067 String mName; 00069 SceneNode* mRootNode; 00070 // 2D elements 00071 // OverlayContainers, linked list for easy sorting by zorder later 00072 // Not a map because sort can be saved since changes infrequent (unlike render queue) 00073 OverlayContainerList m2DElements; 00074 00075 // Degrees of rotation around center 00076 Radian mRotate; 00077 // Scroll values, offsets 00078 Real mScrollX, mScrollY; 00079 // Scale values 00080 Real mScaleX, mScaleY; 00081 00082 mutable Matrix4 mTransform; 00083 mutable bool mTransformOutOfDate; 00084 bool mTransformUpdated; 00085 ulong mZOrder; 00086 bool mVisible; 00087 bool mInitialised; 00088 String mOrigin; 00090 void updateTransform(void) const; 00092 void initialise(void); 00093 00094 public: 00096 Overlay(const String& name); 00097 virtual ~Overlay(); 00098 00099 00100 OverlayContainer* getChild(const String& name); 00101 00103 const String& getName(void) const; 00108 void setZOrder(ushort zorder); 00110 ushort getZOrder(void) const; 00111 00113 bool isVisible(void) const; 00114 00116 bool isInitialised(void) const { return mInitialised; } 00117 00119 void show(void); 00120 00122 void hide(void); 00123 00134 void add2D(OverlayContainer* cont); 00135 00136 00141 void remove2D(OverlayContainer* cont); 00142 00171 void add3D(SceneNode* node); 00172 00174 void remove3D(SceneNode* node); 00175 00177 void clear(); 00178 00188 void setScroll(Real x, Real y); 00189 00191 Real getScrollX(void) const; 00192 00194 Real getScrollY(void) const; 00195 00202 void scroll(Real xoff, Real yoff); 00203 00205 void setRotate(const Radian& angle); 00206 #ifndef OGRE_FORCE_ANGLE_TYPES 00207 inline void setRotate(Real degrees) { 00208 setRotate ( Angle(degrees) ); 00209 } 00210 #endif//OGRE_FORCE_ANGLE_TYPES 00211 00213 Radian getRotate(void) const { return mRotate; } 00214 00216 void rotate(const Radian& angle); 00217 #ifndef OGRE_FORCE_ANGLE_TYPES 00218 inline void rotate(Real degrees) { 00219 rotate ( Angle(degrees) ); 00220 } 00221 #endif//OGRE_FORCE_ANGLE_TYPES 00222 00230 void setScale(Real x, Real y); 00231 00233 Real getScaleX(void) const; 00234 00236 Real getScaleY(void) const; 00237 00239 void _getWorldTransforms(Matrix4* xform) const; 00241 const Quaternion& getWorldOrientation(void) const; 00243 const Vector3& getWorldPosition(void) const; 00244 00246 void _findVisibleObjects(Camera* cam, RenderQueue* queue); 00247 00249 virtual OverlayElement* findElementAt(Real x, Real y); 00250 00255 typedef VectorIterator<OverlayContainerList> Overlay2DElementsIterator ; 00256 Overlay2DElementsIterator get2DElementsIterator () 00257 { 00258 return Overlay2DElementsIterator (m2DElements.begin(), m2DElements.end()); 00259 } 00266 const String& getOrigin(void) const { return mOrigin; } 00268 void _notifyOrigin(const String& origin) { mOrigin = origin; } 00269 00270 00271 }; 00272 00273 } 00274 00275 00276 #endif 00277
Copyright © 2000-2005 by The OGRE Team
Last modified Wed Feb 23 00:19:09 2005