Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4489 in orxonox.OLD for orxonox/trunk/src/util/track/track_manager.h


Ignore:
Timestamp:
Jun 3, 2005, 1:21:05 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: track: doxy-tags, redesign, and minor speed-update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/util/track/track_manager.h

    r4381 r4489  
    1616
    1717#ifndef NULL
    18 #define NULL 0
     18#define NULL   0  //!< NULL
    1919#endif
    2020
     
    2828// Static Definitions
    2929
    30 //! The Default Curve-Type to set for the whole path (if not chosen otherwise).
    31 #define TMAN_DEFAULT_CURVETYPE CURVE_BEZIER
    32 #define TMAN_DEFAULT_DURATION 10
    33 #define TMAN_DEFAULT_WIDTH    10
     30//! The default Curve-Type to set for the whole path (if not chosen otherwise).
     31#define TMAN_DEFAULT_CURVETYPE    CURVE_BEZIER
     32//! A default value for the duration for each TrackElement
     33#define TMAN_DEFAULT_DURATION     10
     34//! A default width for the width of a TrackElement
     35#define TMAN_DEFAULT_WIDTH        10
    3436
    3537//! A Graph-Element, that holds the curve-structure of a Level.
     
    5052  TrackElement* getChild(int childNumber) const;
    5153  void setName(const char* name);
    52   const char* getName(void) const;
     54  /** \returns the Name of this TrackElement */
     55  inline const char* getName(void) const { return this->name; };
     56
    5357
    5458  // atributes
    55   bool isFresh;              //!< If no Points where added until now
    56   bool isHotPoint;           //!< If the first node is a specialPoint;
    57   bool isSavePoint;          //!< If the first node is a savePoint
    58   bool isFork;               //!< If the first node is a Fork
    59   bool isJoined;             //!< If the End of the Curve is joined.
    60   bool mainJoin;             //!< If the End of the Curve is joined, and this is the one Curve the others join to.
    61   int ID;                    //!< The ID of this TrackElement
    62   float startingTime;        //!< The time at which this Track begins.
    63   float duration;            //!< The time used to cross this TrackElement (curve).
    64   float endTime;             //!< The time at which this Track ends.
    65   float jumpTime;            //!< The Time this Track has to jump to its preceding Track (only >0 if Track isJoined==true)
    66   float width;               //!< Th width of the Path. This tells the Player(s), how far he(they) can go to the left/right.
    67   int nodeCount;             //!< The count of points this TrackElement has.
    68   Curve* curve;              //!< The Curve of this TrackElement
    69   int childCount;            //!< The number of Children This TrackElement has.
    70   tList<TrackElement>* children;   //!< A TrackElement can have a Tree of following TrackElements.
     59  bool                  isFresh;              //!< If no Points where added until now
     60  bool                  isHotPoint;           //!< If the first node is a specialPoint;
     61  bool                  isSavePoint;          //!< If the first node is a savePoint
     62  bool                  isFork;               //!< If the first node is a Fork
     63  bool                  isJoined;             //!< If the End of the Curve is joined.
     64  bool                  mainJoin;             //!< If the End of the Curve is joined, and this is the one Curve the others join to.
     65  int                   ID;                   //!< The ID of this TrackElement
     66  float                 startingTime;         //!< The time at which this Track begins.
     67  float                 duration;             //!< The time used to cross this TrackElement (curve).
     68  float                 endTime;              //!< The time at which this Track ends.
     69  float                 jumpTime;             //!< The Time this Track has to jump to its preceding Track (only >0 if Track isJoined==true)
     70  float                 width;                //!< Th width of the Path. This tells the Player(s), how far he(they) can go to the left/right.
     71  int                   nodeCount;            //!< The count of points this TrackElement has.
     72  Curve*                curve;                //!< The Curve of this TrackElement
     73  int                   childCount;           //!< The number of Children This TrackElement has.
     74  tList<TrackElement>*  children;             //!< A TrackElement can have a Tree of following TrackElements.
    7175
    7276
     
    133137class TrackManager : public BaseObject
    134138{
    135  private:
    136   TrackManager(void);
    137 
    138   static TrackManager* singletonRef;  //!< There may only be one TrackManager.
    139 
    140   TrackElement* firstTrackElem;       //!< The first TrackElement that exists.
    141   TrackElement* currentTrackElem;     //!< The TrackElement we are working on.
    142   CurveType curveType;                //!< The CurveType the entire TrackSystem will have.
    143   float localTime;                    //!< The time that has been passed since the traveling the Track.
    144   float maxTime;                      //!< The maximal time the track has.
    145   int trackElemCount;                 //!< The count of TrackElements that exist.
    146 
    147   // external
    148   PNode* bindSlave;                   //!< The node that is slave to the TrackManager. This node will be moved while update the TrackManager, and must NOT move itself.
    149   PNode* trackNode;                   //!< The main TrackNode of this Track.
    150   Text* trackText;                    //!< The text to display when switching between Worlds.
    151   tAnimation<Text>* textAnimation;    //!< An Animation for the Text.
    152  
    153   void initChildren(unsigned int childCount, TrackElement* trackElem = NULL);
    154 
    155139 public:
    156140  virtual ~TrackManager(void);
    157 
    158   static TrackManager* getInstance(void);
    159 
    160   bool load(TiXmlElement* root);
     141  /** \returns a Pointer to the only object of this Class */
     142  inline static TrackManager* getInstance(void) { if (!singletonRef) singletonRef = new TrackManager();  return singletonRef; };
     143
     144  bool loadParams(TiXmlElement* root);
    161145
    162146  // Methods to change the Path (initialisation)
     
    197181  void drawGraph(float dt) const;
    198182  void debug(unsigned int level) const;
     183
     184 private:
     185  TrackManager(void);
     186  void initChildren(unsigned int childCount, TrackElement* trackElem = NULL);
     187
     188 private:
     189  static TrackManager* singletonRef;           //!< There may only be one TrackManager.
     190
     191  TrackElement*        firstTrackElem;         //!< The first TrackElement that exists.
     192  TrackElement*        currentTrackElem;       //!< The TrackElement we are working on.
     193  CurveType            curveType;              //!< The CurveType the entire TrackSystem will have.
     194  float                localTime;              //!< The time that has been passed since the traveling the Track.
     195  float                maxTime;                //!< The maximal time the track has.
     196  int                  trackElemCount;         //!< The count of TrackElements that exist.
     197
     198  // external
     199  PNode*               bindSlave;              //!< The node that is slave to the TrackManager. This node will be moved while update the TrackManager, and must NOT move itself.
     200  PNode*               trackNode;              //!< The main TrackNode of this Track.
     201  Text*                trackText;              //!< The text to display when switching between Worlds.
     202  tAnimation<Text>*    textAnimation;          //!< An Animation for the Text. (for fading it out on trackName-change)
    199203};
    200204
Note: See TracChangeset for help on using the changeset viewer.