# 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
    00162         const String& getMovableType(void) const;
    00163
    00164     protected:
    00166         NodeList mNodeList;
    00168         Real mTrailLength;
    00170         Real mElemLength;
    00172         Real mSquaredElemLength;
    00173         typedef std::vector<ColourValue> ColourValueList;
    00174         typedef std::vector<Real> RealList;
    00176         ColourValueList mInitialColour;
    00178         ColourValueList mDeltaColour;
    00180         RealList mInitialWidth;
    00182         RealList mDeltaWidth;
    00184         Controller<Real>* mFadeController;
    00186         ControllerValueRealPtr mTimeControllerValue;
    00187
    00189         virtual void manageController(void);
    00191         virtual void updateTrail(size_t index, const Node* node);
    00192
    00193
    00194     };
    00195
    00196
    00198     class _OgreExport RibbonTrailFactory : public MovableObjectFactory
    00199     {
    00200     protected:
    00201         MovableObject* createInstanceImpl( const String& name, const NameValuePairList* params);
    00202     public:
    00203         RibbonTrailFactory() {}
    00204         ~RibbonTrailFactory() {}
    00205
    00206         static String FACTORY_TYPE_NAME;
    00207
    00208         const String& getType(void) const;
    00209         void destroyInstance( MovableObject* obj);
    00210
    00211     };
    00212
    00213 }
    00214
    00215 #endif

Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Sep 17 15:39:11 2006