Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3352 in orxonox.OLD for orxonox/branches


Ignore:
Timestamp:
Jan 6, 2005, 5:38:49 AM (20 years ago)
Author:
bensch
Message:

orxonox/branches/parenting: :TrackManager: Joining works too. (grafically)

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

Legend:

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

    r3351 r3352  
    221221bool TrackManager::addPoint(Vector newPoint)
    222222{
    223   if (this->currentTrackElem->isFresh)
     223  return this->addPoint(newPoint, this->currentTrackElem);
     224}
     225
     226/**
     227   \brief adds a point to trackElem
     228   \param newPoint The point to add.
     229   \param trackElem The TrackElement to add the Point to
     230*/
     231bool TrackManager::addPoint(Vector newPoint, TrackElement* trackElem)
     232{
     233  if (trackElem->isFresh)
    224234    {
    225235      this->setCurveType(BEZIERCURVE);
    226       this->currentTrackElem->isFresh = false;
    227       if(this->currentTrackElem != this->firstTrackElem)
     236      trackElem->isFresh = false;
     237      if(trackElem != this->firstTrackElem)
    228238        {
    229           this->addPoint(this->currentTrackElem->startPoint);
    230           this->addPoint(this->currentTrackElem->startTangentPoint);
     239          this->addPoint(trackElem->startPoint);
     240          this->addPoint(trackElem->startTangentPoint);
    231241        }
    232242    }
    233   this->currentTrackElem->curve->addNode(newPoint);
    234   this->currentTrackElem->nodeCount++;
     243  trackElem->curve->addNode(newPoint);
     244  trackElem->nodeCount++;
    235245}
    236246
     
    325335
    326336   Join will set the localTime to the longest time a Path has to get to this Point. \n
    327    Join will join all curves to the first curve.
     337   Join will join all curves to the curve we are working on, meaning that all the tangents will be matched.
    328338*/
    329339void TrackManager::join(unsigned int count, ...)
     
    350360void TrackManager::joinV(unsigned int count, int* trackIDs)
    351361{
    352   //! \todo this
     362  Vector tmpEndPoint = this->currentTrackElem->curve->getNode(this->currentTrackElem->curve->getNodeCount());
     363  Vector tmpTangentPoint = this->currentTrackElem->curve->getNode(this->currentTrackElem->curve->getNodeCount()-1);
     364 
     365  for (int i = 0; i < count; i++)
     366    {
     367      TrackElement* tmpJoinElem = this->findTrackElementByID(trackIDs[i]);
     368      this->addPoint(tmpTangentPoint, tmpJoinElem);
     369      this->addPoint(tmpEndPoint, tmpJoinElem);
     370      tmpJoinElem->isJoined = true;
     371    }
     372  this->currentTrackElem->isJoined = true;
     373
    353374}
    354375
     
    426447void TrackManager::drawGraph(float dt) const
    427448{
    428   glBegin(GL_LINES);
     449
    429450  for (int i = 1; i <= trackElemCount; i++)
    430451    {
     452      glBegin(GL_LINE_STRIP);
    431453      TrackElement* tmpElem = this->findTrackElementByID(i);
    432       printf("Element: %i\n", tmpElem->ID);
    433454      if (tmpElem->curve)
    434455        for(float f = 0.0; f < 1.0; f+=dt)
     
    438459            glVertex3f(tmpVector.x, tmpVector.y, tmpVector.z);
    439460          }
    440     }
    441461  glEnd();
    442  
    443  
     462    }
    444463}
    445464
  • orxonox/branches/parenting/src/track_manager.h

    r3350 r3352  
    116116  void setDuration(float time);
    117117  bool addPoint(Vector newPoint);
     118  bool addPoint(Vector newPoint, TrackElement* trackElem);
    118119  int addHotPoint(Vector newPoint);
    119120  int setSavePoint(void);
  • orxonox/branches/parenting/src/world.cc

    r3351 r3352  
    253253      trackManager->addPoint(Vector(170, 0, 10));
    254254      trackManager->addPoint(Vector(180, 0, 10));
     255      trackManager->addPoint(Vector(190,2,5));
     256      trackManager->addPoint(Vector(200,2,5));
     257      trackManager->join(2, fork11, fork12);
    255258     
    256259      /*
Note: See TracChangeset for help on using the changeset viewer.