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-2013 Torus Knot Software Ltd 00008 00009 Permission is hereby granted, free of charge, to any person obtaining a copy 00010 of this software and associated documentation files (the "Software"), to deal 00011 in the Software without restriction, including without limitation the rights 00012 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00013 copies of the Software, and to permit persons to whom the Software is 00014 furnished to do so, subject to the following conditions: 00015 00016 The above copyright notice and this permission notice shall be included in 00017 all copies or substantial portions of the Software. 00018 00019 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00020 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00021 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00022 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00023 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00024 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00025 THE SOFTWARE. 00026 ----------------------------------------------------------------------------- 00027 */ 00028 00029 #ifndef __RibbonTrail_H__ 00030 #define __RibbonTrail_H__ 00031 00032 #include "OgrePrerequisites.h" 00033 00034 #include "OgreBillboardChain.h" 00035 #include "OgreNode.h" 00036 #include "OgreIteratorWrappers.h" 00037 #include "OgreFrameListener.h" 00038 #include "OgreControllerManager.h" 00039 #include "OgreHeaderPrefix.h" 00040 00041 namespace Ogre { 00042 00071 class _OgreExport RibbonTrail : public BillboardChain, public Node::Listener 00072 { 00073 public: 00083 RibbonTrail(const String& name, size_t maxElements = 20, size_t numberOfChains = 1, 00084 bool useTextureCoords = true, bool useVertexColours = true); 00086 virtual ~RibbonTrail(); 00087 00088 typedef vector<Node*>::type NodeList; 00089 typedef ConstVectorIterator<NodeList> NodeIterator; 00090 00094 virtual void addNode(Node* n); 00096 virtual void removeNode(Node* n); 00098 virtual NodeIterator getNodeIterator(void) const; 00100 virtual size_t getChainIndexForNode(const Node* n); 00101 00108 virtual void setTrailLength(Real len); 00110 virtual Real getTrailLength(void) const { return mTrailLength; } 00111 00113 void setMaxChainElements(size_t maxElements); 00115 void setNumberOfChains(size_t numChains); 00117 void clearChain(size_t chainIndex); 00118 00125 virtual void setInitialColour(size_t chainIndex, const ColourValue& col); 00132 virtual void setInitialColour(size_t chainIndex, Real r, Real g, Real b, Real a = 1.0); 00134 virtual const ColourValue& getInitialColour(size_t chainIndex) const; 00135 00140 virtual void setColourChange(size_t chainIndex, const ColourValue& valuePerSecond); 00141 00146 virtual void setInitialWidth(size_t chainIndex, Real width); 00148 virtual Real getInitialWidth(size_t chainIndex) const; 00149 00154 virtual void setWidthChange(size_t chainIndex, Real widthDeltaPerSecond); 00156 virtual Real getWidthChange(size_t chainIndex) const; 00157 00162 virtual void setColourChange(size_t chainIndex, Real r, Real g, Real b, Real a); 00163 00165 virtual const ColourValue& getColourChange(size_t chainIndex) const; 00166 00168 void nodeUpdated(const Node* node); 00170 void nodeDestroyed(const Node* node); 00171 00173 virtual void _timeUpdate(Real time); 00174 00176 const String& getMovableType(void) const; 00177 00178 protected: 00180 NodeList mNodeList; 00182 typedef vector<size_t>::type IndexVector; 00184 IndexVector mNodeToChainSegment; 00185 // chains not in use 00186 IndexVector mFreeChains; 00187 00188 // fast lookup node->chain index 00189 // we use positional map too because that can be useful 00190 typedef map<const Node*, size_t>::type NodeToChainSegmentMap; 00191 NodeToChainSegmentMap mNodeToSegMap; 00192 00194 Real mTrailLength; 00196 Real mElemLength; 00198 Real mSquaredElemLength; 00199 typedef vector<ColourValue>::type ColourValueList; 00200 typedef vector<Real>::type RealList; 00202 ColourValueList mInitialColour; 00204 ColourValueList mDeltaColour; 00206 RealList mInitialWidth; 00208 RealList mDeltaWidth; 00210 Controller<Real>* mFadeController; 00212 ControllerValueRealPtr mTimeControllerValue; 00213 00215 virtual void manageController(void); 00217 virtual void updateTrail(size_t index, const Node* node); 00219 virtual void resetTrail(size_t index, const Node* node); 00221 virtual void resetAllTrails(void); 00222 00223 }; 00224 00225 00227 class _OgreExport RibbonTrailFactory : public MovableObjectFactory 00228 { 00229 protected: 00230 MovableObject* createInstanceImpl( const String& name, const NameValuePairList* params); 00231 public: 00232 RibbonTrailFactory() {} 00233 ~RibbonTrailFactory() {} 00234 00235 static String FACTORY_TYPE_NAME; 00236 00237 const String& getType(void) const; 00238 void destroyInstance( MovableObject* obj); 00239 00240 }; 00244 } 00245 00246 #include "OgreHeaderSuffix.h" 00247 00248 #endif
Copyright © 2012 Torus Knot Software Ltd

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Mon Jul 27 2020 13:40:45