Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3330 in orxonox.OLD for orxonox


Ignore:
Timestamp:
Jan 4, 2005, 5:44:21 AM (20 years ago)
Author:
bensch
Message:

orxonox/branches/parenting: written the Headers for the class TrackManager: this will be a lot of work.

Location:
orxonox/branches/parenting/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/parenting/src/curve.cc

    r3328 r3330  
    2727#include <math.h>
    2828#include <stdio.h>
    29 
    3029
    3130/**
  • orxonox/branches/parenting/src/curve.h

    r3327 r3330  
    1111
    1212#include "vector.h"
     13
     14//! An Enumerator that defines what sort of Curves are availible
     15enum CurveType {BEZIER, UPOINT};
    1316
    1417
  • orxonox/branches/parenting/src/track_manager.cc

    r3311 r3330  
    3939   \todo this deconstructor is not jet implemented - do it
    4040*/
    41 TrackManager::~TrackManager () {}
    42 
     41TrackManager::~TrackManager ()
     42{
     43
     44}
     45
     46/**
     47   \brief Searches for a given trackID.
     48   \param trackID the trackID to search for.
     49   \returns The TrackElement #trackID if found, NULL otherways.
     50*/
     51TrackElement TrackManager::findTrackElementByID(int trackID)
     52{
     53
     54}
     55
     56// INITIALIZE //
     57
     58/**
     59   \brief Sets the trackID we are working on.
     60   \param trackID the trackID we are working on
     61*/
     62void TrackManager::workOn(int trackID)
     63{
     64
     65}
     66
     67/**
     68   \brief Sets the Type of the Curve
     69   \brief curveType The Type to set
     70*/
     71void TrackManager::setType(CurveType curveType)
     72{
     73
     74}
     75
     76/**
     77   \brief Sets the length of the current path in seconds.
     78   \param time The length in seconds.
     79*/
     80
     81void TrackManager::setLength(float time)
     82{
     83
     84}
     85
     86/**
     87   \brief adds a point to the current TrackElement
     88   \param newPoint The point to add.
     89*/
     90void TrackManager::addPoint(Vector newPoint)
     91{
     92
     93}
     94
     95/**
     96   \brief adds save/splitpoint.
     97   \param newPoint The point to add.
     98*/
     99void TrackManager::addHotPoint(Vector newPoint)
     100{
     101
     102}
     103
     104/**
     105   \brief Sets the last HotPoint into a savePoint.
     106   
     107   If no HotPoint was defined the last added Point will be rendered into a savePoint. \n
     108   If the HotPoint was defined as a fork the Point will \b not be set into a savePoint.
     109*/
     110void TrackManager::setSavePoint(void)
     111{
     112 
     113}
     114
     115/**
     116   \brief adds some interessting non-linear movments through the level.
     117   \param count The Count of childrens the current HotPoint will have.
     118
     119   If no HotPoint was defined the last added Point will be rendered into a fork. \n
     120   If the HotPoint was defined as a savePoint the Point will \b not be set into a fork.
     121*/
     122void TrackManager::fork(int count, ...)
     123{
     124
     125}
     126
     127/**
     128   \brief adds some interessting non-linear movments through the level.
     129   \param count The Count of childrens the current HotPoint will have.
     130   \param trackIDs A Pointer to an Array of ints which will hold the trackID's (the user will have to reserve space for this).
     131
     132   \see void TrackManager::fork(int count, ...)
     133*/
     134void TrackManager::forkV(int count, int* trackIDs)
     135{
     136
     137}
     138
     139/**
     140   \brief decides under what condition a certain Path will be chosen.
     141   \param groupID the ID on which to choose the preceding move
     142   \param cond \todo think about this
     143*/
     144void TrackManager::condition(int groupID, PathCondition cond)
     145{
     146
     147}
     148
     149/**
     150   \brief joins some tracks together again.
     151   \param count The count of Paths to join.
     152
     153   Join will set the localTime to the longest time a Path has to get to this Point. \n
     154   Join will join all curves to the first curve.
     155*/
     156void TrackManager::join(int count, ...)
     157{
     158
     159}
     160
     161/**
     162   \brief joins some tracks together again.
     163   \param count The count of Paths to join.
     164   \param trackIDs an Array with the trackID's to join
     165
     166   \see void TrackManager::join(int count, ...)
     167*/
     168void TrackManager::joinV(int count, int* trackIDs)
     169{
     170
     171}
     172
     173// RUNTIME //
     174
     175/**
     176   \brief calculates the Position for the localTime of the Track.
     177   \returns the calculated Position
     178*/
     179Vector TrackManager::calcPos()
     180{
     181
     182}
     183
     184/**
     185   \brief calculates the Rotation for the localTime of the Track.
     186   \returns the calculated Rotation
     187*/
     188Vector TrackManager::calcDir()
     189{
     190
     191}
     192
     193/**
     194   \brief Advances the local-time of the Track around dt
     195   \param dt The time about which to advance.
     196*/
     197void TrackManager::tick(float dt)
     198{
     199
     200}
     201
     202/**
     203   \brief a Function that decides which Path we should follow.
     204   \param graphID The Path to choose.
     205   
     206*/
     207void TrackManager::choosePath(int graphID)
     208{
     209
     210}
     211
  • orxonox/branches/parenting/src/track_manager.h

    r3311 r3330  
    1515
    1616
     17//! The TrackManager handles the flow of the Players through the game.
     18/**
     19   \todo write the methodes
     20
     21   <b>The TrackManager works as followed:</b> \n
     22     \n
     23   <b>1. Initialize it, by setting up the Graph. You can do this by using the following Commands.</b>
     24    \li workOn(): changes the ID that will be altered through the changes.
     25    \li setType: lets you set the CurveType of the Curve we are Working on. (default is BezierCurve, set this as early as possible, for this uses resources).
     26    \li setLength(): sets the length of the current path in seconds.
     27    \li addPoint(): adds a point to the Curve.
     28    \li addHotPoint(): adds save/splitpoint.\n
     29    \li fork(): adds some interessting non-linear movments through the level (fork will force addHotPoint if not done then).
     30    \li condition(): decides under what condition a certain Path will be chosen.
     31    \li join(): joins some tracks together again. Join will set the localTime to the longest time a Path has to get to this Point)
     32    \li setSavePoint(): Sets a HotPoint into a savePoint. A Savepoint can be used as a rollbackpoint if a Player gets shot.
     33
     34
     35    look out: <b>SAVEPOINTS CAN NOT BE FORKS</b> (but joins), because the condition is really hard to guess if you do not give some impuls. \n
     36\n
     37   <b> 2. Runtime knows the following: </b>
     38    \li calcPos(): returns the current position on the track
     39    \li calcDir(): returns the current Direction the track is flying on.
     40    \li tick(): makes a Step on the Path. increases localTime by dt.
     41    \li choosePath(): a Function that decides which Path we should follow.
     42   
     43   TrackManager can be handled as a StateMachine.
     44*/
    1745class TrackManager : public BaseObject {
     46 private:
     47  //! condition for choosing a certain Path. \todo implement a useful way.
     48  struct PathCondition
     49  {
     50   
     51  };
     52 
     53  //! A Graph, that holds the curve-structure of a Level.
     54  /**
     55     A CurveGraph is used, to Define the structure of the Track itself.
     56     It is a graph and not a tree, because paths can fork and join again.
     57  */
     58  struct TrackElement
     59  {
     60    bool isSavePoint;          //!< If the first node is a savePoint
     61    bool isFork;               //!< If the first node is a Fork
     62    bool isJoined;             //!< If the End of the Curve is joined.
     63    PathCondition cond;        //!< The Split Condition;
     64    int ID;                    //!< The ID of this TrackElement
     65    float length;              //!< The time usedto cross this TrackElement (curve).
     66    CurveType curveType;       //!< The CurveType this will have.
     67    int nodeCount;             //!< The count of points this TrackElement has.
     68    Curve* curve;              //!< The Curve of this TrackElement
     69    TrackElement** children;   //!< A TrackElement can have a Tree of following TrackElements.
     70  };
     71
     72
     73  TrackElement* firstGraph;    //!< The first Graph-element we are on.
     74  TrackElement* currentGraph;  //!< The Graph-element we are working on.
     75  float localTime;             //!< The time that has been passed since the traveling the Track.
     76  int trackElementCount;       //!< The count of TrackElements that exist.
     77 
     78  TrackElement findTrackElementByID(int trackID);
    1879
    1980 public:
     
    2182  ~TrackManager ();
    2283
     84  // Methods to change the Path (initialisation)
     85  void workOn(int trackID);
     86  void setType(CurveType curveType);
     87  void setLength(float time);
     88  void addPoint(Vector newPoint);
     89  void addHotPoint(Vector newPoint);
     90  void setSavePoint(void);
     91  void fork(int count, ...);
     92  void forkV(int count, int* trackIDs);
     93  void condition(int groupID, PathCondition cond); //!< \todo really do this!!
     94  void join(int count, ...);
     95  void joinV(int count, int* trackIDs);
    2396
     97  // Methods to calculate the position on the Path (runtime)
     98  Vector calcPos();
     99  Vector calcDir();
     100  void tick(float dt);
     101  void choosePath(int graphID);
    24102
    25103};
Note: See TracChangeset for help on using the changeset viewer.