OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgreRibbonTrail.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4 (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2014 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 
29 #ifndef __RibbonTrail_H__
30 #define __RibbonTrail_H__
31 
32 #include "OgrePrerequisites.h"
33 
34 #include "OgreBillboardChain.h"
35 #include "OgreNode.h"
36 #include "OgreControllerManager.h"
37 #include "OgreHeaderPrefix.h"
38 
39 namespace Ogre {
40 
70  {
71  public:
81  RibbonTrail( IdType id, ObjectMemoryManager *objectMemoryManager, size_t maxElements = 20,
82  size_t numberOfChains = 1, bool useTextureCoords = true,
83  bool useVertexColours = true );
85  virtual ~RibbonTrail();
86 
89 
93  virtual void addNode(Node* n);
95  virtual void removeNode(Node* n);
97  virtual NodeIterator getNodeIterator(void) const;
99  virtual size_t getChainIndexForNode(const Node* n);
100 
107  virtual void setTrailLength(Real len);
109  virtual Real getTrailLength(void) const { return mTrailLength; }
110 
112  void setMaxChainElements(size_t maxElements);
114  void setNumberOfChains(size_t numChains);
116  void clearChain(size_t chainIndex);
117 
124  virtual void setInitialColour(size_t chainIndex, const ColourValue& col);
131  virtual void setInitialColour(size_t chainIndex, Real r, Real g, Real b, Real a = 1.0);
133  virtual const ColourValue& getInitialColour(size_t chainIndex) const;
134 
139  virtual void setColourChange(size_t chainIndex, const ColourValue& valuePerSecond);
140 
145  virtual void setInitialWidth(size_t chainIndex, Real width);
147  virtual Real getInitialWidth(size_t chainIndex) const;
148 
153  virtual void setWidthChange(size_t chainIndex, Real widthDeltaPerSecond);
155  virtual Real getWidthChange(size_t chainIndex) const;
156 
161  virtual void setColourChange(size_t chainIndex, Real r, Real g, Real b, Real a);
162 
164  virtual const ColourValue& getColourChange(size_t chainIndex) const;
165 
167  void nodeUpdated(const Node* node);
169  void nodeDestroyed(const Node* node);
170 
172  virtual void _timeUpdate(Real time);
173 
175  const String& getMovableType(void) const;
176 
177  protected:
184  // chains not in use
186 
187  // fast lookup node->chain index
188  // we use positional map too because that can be useful
191 
212 
214  virtual void manageController(void);
216  virtual void updateTrail(size_t index, const Node* node);
218  virtual void resetTrail(size_t index, Node* node);
220  virtual void resetAllTrails(void);
221 
222  };
223 
224 
227  {
228  protected:
229  virtual MovableObject* createInstanceImpl( IdType id, ObjectMemoryManager *objectMemoryManager,
230  const NameValuePairList* params = 0 );
231  public:
234 
236 
237  const String& getType(void) const;
238  void destroyInstance( MovableObject* obj);
239 
240  };
244 }
245 
246 #include "OgreHeaderSuffix.h"
247 
248 #endif
Factory object for creating RibbonTrail instances.
float Real
Software floating point type.
#define _OgreExport
Definition: OgrePlatform.h:255
map< String, String >::type NameValuePairList
Name / value parameter pair (first = name, second = value)
Definition: OgreCommon.h:580
IndexVector mFreeChains
ColourValueList mDeltaColour
fade amount per second
Class representing colour.
RealList mInitialWidth
Initial width of the ribbon.
Real mSquaredElemLength
Squared length of each element.
Controller< Real > * mFadeController
controller used to hook up frame time to fader
virtual Real getTrailLength(void) const
Get the length of the trail.
Interface definition for a factory class which produces a certain kind of MovableObject, and can be registered with Root in order to allow all clients to produce new instances of this object, integrated with the standard Ogre processing.
Wrap-around class that contains multiple ArrayMemoryManager, one per render queue.
Abstract class defining a movable object in a scene.
Allows the rendering of a chain of connected billboards.
vector< ColourValue >::type ColourValueList
NodeList mNodeList
List of nodes being trailed.
Ogre::uint32 IdType
Big projects with lots, lots of units for very long periods of time (MMORPGs?) may want to define thi...
Definition: OgreId.h:36
vector< size_t >::type IndexVector
Mapping of nodes to chain segments.
Concrete IteratorWrapper for const access to the underlying container.
Subclass of BillboardChain which automatically leaves a trail behind one or more Node instances...
Real mElemLength
length of each element
vector< Node * >::type NodeList
static String FACTORY_TYPE_NAME
map< const Node *, size_t >::type NodeToChainSegmentMap
ColourValueList mInitialColour
Initial colour of the ribbon.
RealList mDeltaWidth
Delta width of the ribbon.
_StringBase String
Definition: OgreCommon.h:53
NodeToChainSegmentMap mNodeToSegMap
vector< Real >::type RealList
IndexVector mNodeToChainSegment
Ordered like mNodeList, contains chain index.
Real mTrailLength
Total length of trail in world units.
Class representing a general-purpose node an articulated scene graph.
Definition: OgreNode.h:58
ControllerValueRealPtr mTimeControllerValue
controller value for hooking up frame time to fader
Listener which gets called back on Node events.
Definition: OgreNode.h:78
ConstVectorIterator< NodeList > NodeIterator