Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jan 5, 2005, 12:53:42 AM (19 years ago)
Author:
bensch
Message:

orxonox/branches/parenting: :TrackManager: reimplemented some functions, and added some for the logic of it.

File:
1 edited

Legend:

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

    r3332 r3333  
    3434  this->cond; //!< todo think!!
    3535  this->ID = -1;
    36   this->length =0;
     36  this->startingTime = 0; //!< \todo eventually set this to the max time of TrackManager.
     37  this->duration =0;
    3738  this->curveType = BEZIERCURVE;
    3839  this->nodeCount = 0;
     
    5859        delete this->children[i];
    5960    }
     61  if (children)
     62    delete children;
     63}
     64
     65/**
     66   \brief reserves Space for childCount children
     67   \param childCount The Count of children to make space for.
     68*/
     69void TrackElement::initChildren(unsigned int childCount)
     70{
     71  this->childCount = childCount;
     72  this->children = new TrackElement*[childCount];
     73  for (int i=0; i<childCount; i++)
     74    this->children[i] = new TrackElement();
    6075}
    6176
     
    183198
    184199/**
    185    \brief Sets the length of the current path in seconds.
    186    \param time The length in seconds.
    187 */
    188 
    189 void TrackManager::setLength(float time)
    190 {
    191   this->currentTrackElem->length = time;
     200   \brief Sets the duration of the current path in seconds.
     201   \param time The duration in seconds.
     202*/
     203
     204void TrackManager::setDuration(float time)
     205{
     206  this->currentTrackElem->duration = time;
    192207}
    193208
     
    196211   \param newPoint The point to add.
    197212*/
    198 void TrackManager::addPoint(Vector newPoint)
     213bool TrackManager::addPoint(Vector newPoint)
    199214{
    200215  if (this->currentTrackElem->isFresh)
     
    209224   \brief adds save/splitpoint.
    210225   \param newPoint The point to add.
    211 */
    212 void TrackManager::addHotPoint(Vector newPoint)
     226   \returns A Pointer to a newly appended Curve
     227*/
     228int TrackManager::addHotPoint(Vector newPoint)
    213229{
    214230  if (this->currentTrackElem->isFresh)
     
    224240/**
    225241   \brief Sets the last HotPoint into a savePoint.
     242   \returns A Pointer to a newly appended Curve
    226243   
    227244   If no HotPoint was defined the last added Point will be rendered into a savePoint. \n
    228245   If the HotPoint was defined as a fork the Point will \b not be set into a savePoint.
    229246*/
    230 void TrackManager::setSavePoint(void)
     247int TrackManager::setSavePoint(void)
    231248{
    232249  if (this->currentTrackElem->isFork || this->currentTrackElem->isSavePoint)
    233     return;
     250    return this->currentTrackElem->children[1]->ID;
    234251  this->currentTrackElem->isSavePoint = true;
    235252
    236   this->currentTrackElem->children = new TrackElement*[1];
     253  this->currentTrackElem->initChildren(1);
    237254}
    238255
     
    273290  this->currentTrackElem->isFork = true;
    274291
    275   this->currentTrackElem->children = new TrackElement*[count];
     292  this->currentTrackElem->initChildren(count);
    276293}
    277294
     
    327344Vector TrackManager::calcPos() const
    328345{
    329  
     346  return this->currentTrackElem->curve->calcPos(this->localTime);
    330347}
    331348
     
    336353Vector TrackManager::calcDir() const
    337354{
    338 
     355  return this->currentTrackElem->curve->calcDir(this->localTime);
    339356}
    340357
     
    342359   \brief Advances the local-time of the Track around dt
    343360   \param dt The time about which to advance.
     361
     362   This function also checks, if the TrackElement has to be changed.
    344363*/
    345364void TrackManager::tick(float dt)
Note: See TracChangeset for help on using the changeset viewer.