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 © 2000-2002 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 #include "OgreResource.h" 00034 00035 namespace Ogre { 00036 00037 00062 class _OgreExport Overlay : public Resource 00063 { 00064 00065 public: 00066 typedef std::list<GuiContainer*> GuiContainerList; 00067 protected: 00068 ushort mZOrder; 00069 bool mVisible; 00071 SceneNode* mRootNode; 00072 // 2D elements 00073 // GuiContainers, linked list for easy sorting by zorder later 00074 // Not a map because sort can be saved since changes infrequent (unlike render queue) 00075 GuiContainerList m2DElements; 00076 00077 // Degrees of rotation around center 00078 Real mRotate; 00079 // Scroll values, offsets 00080 Real mScrollX, mScrollY; 00081 // Scale values 00082 Real mScaleX, mScaleY; 00083 00084 mutable Matrix4 mTransform; 00085 mutable bool mTransformOutOfDate; 00086 bool mTransformUpdated; 00088 void updateTransform(void) const; 00089 00090 public: 00092 Overlay(const String& name); 00093 virtual ~Overlay(); 00094 00096 virtual void load(void); 00098 virtual void unload(void); 00099 00100 GuiContainer* 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 void show(void); 00117 00119 void hide(void); 00120 00131 void add2D(GuiContainer* cont); 00132 00133 00138 void remove2D(GuiContainer* cont); 00139 00168 void add3D(SceneNode* node); 00169 00171 void remove3D(SceneNode* node); 00172 00174 void clear(); 00175 00185 void setScroll(Real x, Real y); 00186 00188 Real getScrollX(void) const; 00189 00191 Real getScrollY(void) const; 00192 00199 void scroll(Real xoff, Real yoff); 00200 00202 void setRotate(Real degrees); 00203 00205 Real getRotate(void) const; 00206 00208 void rotate(Real degrees); 00209 00210 00218 void setScale(Real x, Real y); 00219 00221 Real getScaleX(void) const; 00222 00224 Real getScaleY(void) const; 00225 00227 void _getWorldTransforms(Matrix4* xform) const; 00229 const Quaternion& getWorldOrientation(void) const; 00231 const Vector3& getWorldPosition(void) const; 00232 00234 void _findVisibleObjects(Camera* cam, RenderQueue* queue); 00235 00237 virtual GuiElement* findElementAt(Real x, Real y); 00238 00243 typedef VectorIterator<GuiContainerList> Overlay2DElementsIterator ; 00244 Overlay2DElementsIterator get2DElementsIterator () 00245 { 00246 return Overlay2DElementsIterator (m2DElements.begin(), m2DElements.end()); 00247 } 00248 00249 }; 00250 00251 00252 00253 } 00254 00255 00256 #endif 00257
Copyright © 2002-2003 by The OGRE Team
Last modified Fri May 14 23:22:29 2004