Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

OgreOverlay.h

Go to the documentation of this file.
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 
00175         void add3D(SceneNode* node);
00176 
00178         void remove3D(SceneNode* node);
00179 
00181         void clear();
00182 
00192         void setScroll(Real x, Real y);
00193 
00195         Real getScrollX(void) const;
00196 
00198         Real getScrollY(void) const;
00199 
00206         void scroll(Real xoff, Real yoff);
00207 
00209         void setRotate(const Radian& angle);
00210 #ifndef OGRE_FORCE_ANGLE_TYPES
00211         inline void setRotate(Real degrees) {
00212             setRotate ( Angle(degrees) );
00213         }
00214 #endif//OGRE_FORCE_ANGLE_TYPES
00215 
00217         Radian getRotate(void) const { return mRotate; }
00218 
00220         void rotate(const Radian& angle);
00221 #ifndef OGRE_FORCE_ANGLE_TYPES
00222         inline void rotate(Real degrees) {
00223             rotate ( Angle(degrees) );
00224         }
00225 #endif//OGRE_FORCE_ANGLE_TYPES
00226 
00234         void setScale(Real x, Real y);
00235 
00237         Real getScaleX(void) const;
00238 
00240         Real getScaleY(void) const;
00241 
00243         void _getWorldTransforms(Matrix4* xform) const;
00245         const Quaternion& getWorldOrientation(void) const;
00247         const Vector3& getWorldPosition(void) const;
00248 
00250         void _findVisibleObjects(Camera* cam, RenderQueue* queue);
00251 
00253         virtual OverlayElement* findElementAt(Real x, Real y);
00254 
00259         typedef VectorIterator<OverlayContainerList> Overlay2DElementsIterator ;
00260         Overlay2DElementsIterator get2DElementsIterator ()
00261         {
00262             return Overlay2DElementsIterator (m2DElements.begin(), m2DElements.end());
00263         }
00270         const String& getOrigin(void) const { return mOrigin; }
00272         void _notifyOrigin(const String& origin) { mOrigin = origin; }
00273 
00274 
00275     };
00276 
00277 }
00278 
00279 
00280 #endif
00281 

Copyright © 2000-2005 by The OGRE Team
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Feb 12 12:59:48 2006