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-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);
00105         void clearChain(size_t chainIndex);
00106 
00113         virtual void setInitialColour(size_t chainIndex, const ColourValue& col);
00120         virtual void setInitialColour(size_t chainIndex, Real r, Real g, Real b, Real a = 1.0);
00122         virtual const ColourValue& getInitialColour(size_t chainIndex) const;
00123 
00128         virtual void setColourChange(size_t chainIndex, const ColourValue& valuePerSecond);
00129 
00134         virtual void setInitialWidth(size_t chainIndex, Real width);
00136         virtual Real getInitialWidth(size_t chainIndex) const;
00137         
00142         virtual void setWidthChange(size_t chainIndex, Real widthDeltaPerSecond);
00144         virtual Real getWidthChange(size_t chainIndex) const;
00145 
00150         virtual void setColourChange(size_t chainIndex, Real r, Real g, Real b, Real a);
00151 
00153         virtual const ColourValue& getColourChange(size_t chainIndex) const;
00154 
00156         void nodeUpdated(const Node* node);
00158         void nodeDestroyed(const Node* node);
00159 
00161         virtual void _timeUpdate(Real time);
00162 
00164         const String& getMovableType(void) const;
00165 
00166     protected:
00168         NodeList mNodeList;
00170         Real mTrailLength;
00172         Real mElemLength;
00174         Real mSquaredElemLength;
00175         typedef std::vector<ColourValue> ColourValueList;
00176         typedef std::vector<Real> RealList;
00178         ColourValueList mInitialColour;
00180         ColourValueList mDeltaColour;
00182         RealList mInitialWidth;
00184         RealList mDeltaWidth;
00186         Controller<Real>* mFadeController;
00188         ControllerValueRealPtr mTimeControllerValue;
00189 
00191         virtual void manageController(void);
00193         virtual void updateTrail(size_t index, const Node* node);
00195         virtual void resetTrail(size_t index, const Node* node);
00197         virtual void resetAllTrails(void);
00198 
00199     };
00200 
00201 
00203     class _OgreExport RibbonTrailFactory : public MovableObjectFactory
00204     {
00205     protected:
00206         MovableObject* createInstanceImpl( const String& name, const NameValuePairList* params);
00207     public:
00208         RibbonTrailFactory() {}
00209         ~RibbonTrailFactory() {}
00210 
00211         static String FACTORY_TYPE_NAME;
00212 
00213         const String& getType(void) const;
00214         void destroyInstance( MovableObject* obj);  
00215 
00216     };
00217 
00218 }
00219 
00220 #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 Nov 12 10:50:13 2006