Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 18, 2006, 4:36:03 PM (17 years ago)
Author:
bknecht
Message:

a few more steps fusing TrackElement and TrackManager to Track.. not very far, can't really work during the afternoon. Will have some time this evening

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/playability/src/util/track/track.cc

    r10088 r10091  
    2626#include "track/track.h"
    2727
    28 #include "track/track_manager.h"
    2928#include "p_node.h"
    3029
     
    5958void Track::init()
    6059{
    61   // resetting all elements
    62   this->firstTrackElem = NULL;
    63 
    64 
    65   // make a debug track
    66   this->firstTrackElem = new TrackElement();
    67   this->firstTrackElem->ID = 1;
    68   this->firstTrackElem->setName("root");
    69 
    70   this->currentTrackElem = firstTrackElem;
    71 
    7260  this->curveType = CURVE_BEZIER;
    73   this->trackElemCount = 1;
    74 
     61  this->startingTime = 0;
     62  this->duration = 10;
     63  this->endTime = 1;
     64  this->width = 10;
     65  this->curve = new BezierCurve();
    7566  this->trackNode = new PNode(PNode::getNullParent(), PNODE_ALL);
    7667}
     
    8172Track::~Track()
    8273{
    83   if( this->firstTrackElem)
    84     delete this->firstTrackElem;
     74
    8575}
    8676
     
    117107void Track::addPoint(Vector newPoint)
    118108{
    119 //   if (this->currentTrackElem->isFresh)
    120 //     {
    121 //       this->setCurveType(CURVE_BEZIER, this->currentTrackElem);
    122 //       this->currentTrackElem->isFresh = false;
    123 //     }
    124 //   trackElem->curve->addNode(newPoint);
    125 //   trackElem->nodeCount++;
     109   this->curve->addNode(newPoint);
     110   this->nodeCount++;
    126111}
    127112
     
    173158}
    174159
    175 Vector TrackManager::calcPos() const
    176 {
    177   return this->currentTrackElem->curve->calcPos((this->localTime-this->currentTrackElem->startingTime)/this->currentTrackElem->duration);
    178 }
    179 
    180 Vector TrackManager::calcDir() const
    181 {
    182   return this->currentTrackElem->curve->calcDir((this->localTime - this->currentTrackElem->startingTime)/this->currentTrackElem->duration);
     160Vector Track::calcPos() const
     161{
     162  return this->curve->calcPos((this->localTime-this->startingTime)/this->duration);
     163}
     164
     165Vector Track::calcDir() const
     166{
     167  return this->curve->calcDir((this->localTime - this->startingTime)/this->duration);
    183168}
    184169
     
    222207 * @returns the main TrackNode
    223208*/
    224 PNode* TrackManager::getTrackNode()
     209PNode* Track::getTrackNode()
    225210{
    226211  return this->trackNode;
Note: See TracChangeset for help on using the changeset viewer.