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

OgreRibbonTrail.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-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 __RibbonTrail_H__
00031 #define __RibbonTrail_H__
00032 
00033 #include "OgrePrerequisites.h"
00034 
00035 #include "OgreBillboardChain.h"
00036 #include "OgreNode.h"
00037 #include "OgreIteratorWrappers.h"
00038 #include "OgreFrameListener.h"
00039 #include "OgreControllerManager.h"
00040 
00041 namespace Ogre {
00042 
00065     class _OgreExport RibbonTrail : public BillboardChain, public Node::Listener
00066     {
00067     public:
00077         RibbonTrail(const String& name, size_t maxElements = 20, size_t numberOfChains = 1, 
00078             bool useTextureCoords = true, bool useColours = true);
00080         virtual ~RibbonTrail();
00081 
00082         typedef std::vector<Node*> NodeList;
00083         typedef ConstVectorIterator<NodeList> NodeIterator;
00084 
00088         virtual void addNode(Node* n);
00090         virtual void removeNode(Node* n);
00092         virtual NodeIterator getNodeIterator(void) const;
00093 
00100         virtual void setTrailLength(Real len);
00102         virtual Real getTrailLength(void) const { return mTrailLength; }
00103 
00105         void setMaxChainElements(size_t maxElements);
00107         void setNumberOfChains(size_t numChains);
00109         void clearChain(size_t chainIndex);
00110 
00117         virtual void setInitialColour(size_t chainIndex, const ColourValue& col);
00124         virtual void setInitialColour(size_t chainIndex, Real r, Real g, Real b, Real a = 1.0);
00126         virtual const ColourValue& getInitialColour(size_t chainIndex) const;
00127 
00132         virtual void setColourChange(size_t chainIndex, const ColourValue& valuePerSecond);
00133 
00138         virtual void setInitialWidth(size_t chainIndex, Real width);
00140         virtual Real getInitialWidth(size_t chainIndex) const;
00141         
00146         virtual void setWidthChange(size_t chainIndex, Real widthDeltaPerSecond);
00148         virtual Real getWidthChange(size_t chainIndex) const;
00149 
00154         virtual void setColourChange(size_t chainIndex, Real r, Real g, Real b, Real a);
00155 
00157         virtual const ColourValue& getColourChange(size_t chainIndex) const;
00158 
00160         void nodeUpdated(const Node* node);
00162         void nodeDestroyed(const Node* node);
00163 
00165         virtual void _timeUpdate(Real time);
00166 
00168         const String& getMovableType(void) const;
00169 
00170     protected:
00172         NodeList mNodeList;
00174         Real mTrailLength;
00176         Real mElemLength;
00178         Real mSquaredElemLength;
00179         typedef std::vector<ColourValue> ColourValueList;
00180         typedef std::vector<Real> RealList;
00182         ColourValueList mInitialColour;
00184         ColourValueList mDeltaColour;
00186         RealList mInitialWidth;
00188         RealList mDeltaWidth;
00190         Controller<Real>* mFadeController;
00192         ControllerValueRealPtr mTimeControllerValue;
00193 
00195         virtual void manageController(void);
00197         virtual void updateTrail(size_t index, const Node* node);
00199         virtual void resetTrail(size_t index, const Node* node);
00201         virtual void resetAllTrails(void);
00202 
00203     };
00204 
00205 
00207     class _OgreExport RibbonTrailFactory : public MovableObjectFactory
00208     {
00209     protected:
00210         MovableObject* createInstanceImpl( const String& name, const NameValuePairList* params);
00211     public:
00212         RibbonTrailFactory() {}
00213         ~RibbonTrailFactory() {}
00214 
00215         static String FACTORY_TYPE_NAME;
00216 
00217         const String& getType(void) const;
00218         void destroyInstance( MovableObject* obj);  
00219 
00220     };
00221 
00222 }
00223 
00224 #endif

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 Sep 30 10:50:57 2007