Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | 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-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 __RibbonTrail_H__
00027 #define __RibbonTrail_H__
00028 
00029 #include "OgrePrerequisites.h"
00030 
00031 #include "OgreBillboardChain.h"
00032 #include "OgreNode.h"
00033 #include "OgreIteratorWrappers.h"
00034 #include "OgreFrameListener.h"
00035 #include "OgreControllerManager.h"
00036 
00037 namespace Ogre {
00038 
00061     class _OgreExport RibbonTrail : public BillboardChain, public Node::Listener
00062     {
00063     public:
00073         RibbonTrail(const String& name, size_t maxElements = 20, size_t numberOfChains = 1, 
00074             bool useTextureCoords = true, bool useColours = true);
00076         virtual ~RibbonTrail();
00077 
00078         typedef std::vector<Node*> NodeList;
00079         typedef ConstVectorIterator<NodeList> NodeIterator;
00080 
00084         virtual void addNode(Node* n);
00086         virtual void removeNode(Node* n);
00088         virtual NodeIterator getNodeIterator(void) const;
00089 
00096         virtual void setTrailLength(Real len);
00098         virtual Real getTrailLength(void) const { return mTrailLength; }
00099 
00101         void setMaxChainElements(size_t maxElements);
00103         void setNumberOfChains(size_t numChains);
00104 
00111         virtual void setInitialColour(size_t chainIndex, const ColourValue& col);
00118         virtual void setInitialColour(size_t chainIndex, Real r, Real g, Real b, Real a = 1.0);
00120         virtual const ColourValue& getInitialColour(size_t chainIndex) const;
00121 
00126         virtual void setColourChange(size_t chainIndex, const ColourValue& valuePerSecond);
00127 
00132         virtual void setInitialWidth(size_t chainIndex, Real width);
00134         virtual Real getInitialWidth(size_t chainIndex) const;
00135         
00140         virtual void setWidthChange(size_t chainIndex, Real widthDeltaPerSecond);
00142         virtual Real getWidthChange(size_t chainIndex) const;
00143 
00148         virtual void setColourChange(size_t chainIndex, Real r, Real g, Real b, Real a);
00149 
00151         virtual const ColourValue& getColourChange(size_t chainIndex) const;
00152 
00154         void nodeUpdated(const Node* node);
00156         void nodeDestroyed(const Node* node);
00157 
00159         virtual void _timeUpdate(Real time);
00160 
00161     protected:
00163         NodeList mNodeList;
00165         Real mTrailLength;
00167         Real mElemLength;
00169         Real mSquaredElemLength;
00170         typedef std::vector<ColourValue> ColourValueList;
00171         typedef std::vector<Real> RealList;
00173         ColourValueList mInitialColour;
00175         ColourValueList mDeltaColour;
00177         RealList mInitialWidth;
00179         RealList mDeltaWidth;
00181         Controller<Real>* mFadeController;
00183         ControllerValueRealPtr mTimeControllerValue;
00184 
00186         virtual void manageController(void);
00188         virtual void updateTrail(size_t index, const Node* node);
00189 
00190 
00191     };
00192 
00193 
00195     class _OgreExport RibbonTrailFactory : public MovableObjectFactory
00196     {
00197     protected:
00198         MovableObject* createInstanceImpl( const String& name, const NameValuePairList* params);
00199     public:
00200         RibbonTrailFactory() {}
00201         ~RibbonTrailFactory() {}
00202 
00203         static String FACTORY_TYPE_NAME;
00204 
00205         const String& getType(void) const;
00206         void destroyInstance( MovableObject* obj);  
00207 
00208     };
00209 
00210 }
00211 
00212 #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 Mar 12 14:37:48 2006