Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4584 in orxonox.OLD for orxonox/trunk/src/util


Ignore:
Timestamp:
Jun 10, 2005, 3:50:11 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: TrackElement and Material are BaseObjects now

Location:
orxonox/trunk/src/util/track
Files:
2 edited

Legend:

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

    r4509 r4584  
    1 /* 
     1/*
    22   orxonox - the future of 3D-vertical-scrollers
    33
     
    5656  this->childCount = 0;
    5757  this->children = NULL;
    58   this->name = NULL;
    5958
    6059  this->history = NULL;
     
    6463}
    6564
    66 /** 
     65/**
    6766    \brief destroys all alocated memory)
    6867    \todo eventually when deleting a TrackElement you would not like to delete all its preceding TrackElements
     
    7069TrackElement::~TrackElement(void)
    7170{
    72   // deleting the Name
    73   delete []name;
    7471  // deleting the Curve
    7572  delete this->curve;
    7673
    7774  // deleting all the Children of this TrackNode.
    78   if ((!this->isJoined &&this->childCount > 0) 
     75  if ((!this->isJoined &&this->childCount > 0)
    7976      || (this->isJoined && this->mainJoin)) // only if this is the MainJoin.
    8077    {
     
    8279      TrackElement* enumElem = iterator->nextElement();
    8380      while (enumElem)
    84         {
    85           delete enumElem;
    86           enumElem = iterator->nextElement();
    87         }
     81        {
     82          delete enumElem;
     83          enumElem = iterator->nextElement();
     84        }
    8885      delete iterator;
    8986      delete this->children;
     
    108105      TrackElement* tmpElem;
    109106      while (enumElem)
    110         {
    111           if ((tmpElem = enumElem->findByID(trackID)))
    112             return tmpElem;
    113           enumElem = iterator->nextElement();
    114         }
     107        {
     108          if ((tmpElem = enumElem->findByID(trackID)))
     109            return tmpElem;
     110          enumElem = iterator->nextElement();
     111        }
    115112      delete iterator;
    116113    }
     
    128125{
    129126  // return if Found.
    130   if (this->name && !strcmp(this->name, trackName))
     127  if (this->getName() && !strcmp(this->getName(), trackName))
    131128    return this;
    132129  // search all children
     
    137134      TrackElement* tmpElem;
    138135      while (enumElem)
    139         {
    140           if ((tmpElem = enumElem->findByName(trackName)))
    141             return tmpElem;
    142           enumElem = iterator->nextElement();
    143         }
     136        {
     137          if ((tmpElem = enumElem->findByName(trackName)))
     138            return tmpElem;
     139          enumElem = iterator->nextElement();
     140        }
    144141      delete iterator;
    145142    }
     
    156153{
    157154  tList<const TrackElement>* trackList = new tList<const TrackElement>;
    158  
     155
    159156  this->backLoopCheckAtomic(trackList);
    160  
     157
    161158  delete trackList;
    162159  // only returns if everything worked out
     
    182179      TrackElement* enumElem = iterator->nextElement();
    183180      while (enumElem)
    184         {
    185           if (!enumElem->backLoopCheckAtomic(trackList))
    186             return false;
    187         }
     181        {
     182          if (!enumElem->backLoopCheckAtomic(trackList))
     183            return false;
     184        }
    188185      delete iterator;
    189186    }
     
    194191/**
    195192   \param childCount which child to return
    196    \returns the n-the children (starting at 0). 
     193   \returns the n-the children (starting at 0).
    197194   Be aware, that when the trackElement has no Children, NULL will be returned
    198195*/
     
    205202  if (childCount > this->childCount)
    206203    childCount = this->childCount;
    207  
     204
    208205  tIterator<TrackElement>* iterator = this->children->getIterator();
    209206  TrackElement* enumElem = iterator->nextElement();
     
    212209  delete iterator;
    213210  return enumElem;
    214 }
    215 
    216 /**
    217    \param name the Name to set.
    218 */
    219 void TrackElement::setName(const char* name)
    220 {
    221   //  delete the old name
    222   if (this->name)
    223     delete []this->name;
    224   // if a name was given.
    225   if (name)
    226     {
    227       this->name = new char[strlen(name)+1];
    228       strcpy(this->name, name);
    229     }
    230   else
    231     this->name = NULL;
    232211}
    233212
     
    255234      TrackElement* enumElem = iterator->nextElement();
    256235      while (enumElem)
    257         {
    258           PRINT(0)("=%d= ", enumElem->ID);
    259           enumElem = iterator->nextElement();
    260         }
     236        {
     237          PRINT(0)("=%d= ", enumElem->ID);
     238          enumElem = iterator->nextElement();
     239        }
    261240      delete iterator;
    262241      PRINT(0)("\n");
    263242    }
    264  
     243
    265244  if(this->isHotPoint)
    266245    PRINT(0)("   is a special Point:\n");
     
    273252  if(this->isJoined)
    274253    PRINT(0)("   is Joined at the End\n");
    275  
     254
    276255  if(!this->backLoopCheck()) /* this should not happen */
    277256    PRINT(2)(" THERE IS A BACKLOOP TO THIS ELEMENT\n");
     
    294273*/
    295274int TrackElement::highest(const void* nothing) const
    296 { 
     275{
    297276  return this->childCount-1;
    298277}
     
    308287  if (i >= this->childCount)
    309288    return this->childCount-1;
    310   else 
     289  else
    311290    return i;
    312291}
     
    324303  if (tmpNode->getRelCoor().z < 0)
    325304    return 0;
    326   else 
     305  else
    327306    return 1;
    328307}
     
    355334      float dist = (nodeRelCoord - enumElem->curve->getNode(4)).len();
    356335      if (dist < minDist)
    357         {
    358           minDist = dist;
    359           childNumber = i;
    360         }
     336        {
     337          minDist = dist;
     338          childNumber = i;
     339        }
    361340      i++;
    362341      enumElem = iterator->nextElement();
     
    379358{
    380359  this->setClassID(CL_TRACK_MANAGER, "TrackManager");
    381  
     360
    382361  TrackManager::singletonRef = this; // do this because otherwise the TrackNode cannot get The instance of the TrackManager
    383362
     
    417396  TiXmlNode* container;
    418397  double x, y, z, d;
    419        
     398
    420399  element = root->FirstChildElement();
    421400  while( element != NULL)
    422401    {
    423402      LoadParam<TrackManager>(element, "WorkOn", this, &TrackManager::workOnS, true)
    424         .describe("Selects a TrackElement (by name) to work on");
     403        .describe("Selects a TrackElement (by name) to work on");
    425404
    426405      LoadParam<TrackManager>(element, "Point", this, &TrackManager::addPoint, true)
    427         .describe("Adds a new Point to the currently selected TrackElement");
     406        .describe("Adds a new Point to the currently selected TrackElement");
    428407
    429408      LoadParam<TrackManager>(element, "Duration", this, &TrackManager::setDuration, true)
    430         .describe("Sets the Duration of the currently selected TrackElement");
     409        .describe("Sets the Duration of the currently selected TrackElement");
    431410
    432411      LoadParam<TrackManager>(element, "HotPoint", this, &TrackManager::addHotPoint, true)
    433         .describe("Sets a new Point that acts as a hot point. meaning, the curve will flow through this Point");
    434      
     412        .describe("Sets a new Point that acts as a hot point. meaning, the curve will flow through this Point");
     413
    435414      LoadParam<TrackManager>(element, "SavePoint", this, &TrackManager::setSavePointS, true)
    436         .describe("Sets the current selected Point to a Savepoint, meaning that the curve will be ended and a new one starts, and that one starts again from this point on");
     415        .describe("Sets the current selected Point to a Savepoint, meaning that the curve will be ended and a new one starts, and that one starts again from this point on");
    437416
    438417      LoadParam<TrackManager>(element, "Fork", this, &TrackManager::forkS, true)
    439         .describe("Forks the Path into multiple forked Path names seperated by ','");
     418        .describe("Forks the Path into multiple forked Path names seperated by ','");
    440419
    441420      LoadParam<TrackManager>(element, "Join", this, &TrackManager::joinS, true)
    442         .describe("Joins multiple joining Path names seperated by ','");
     421        .describe("Joins multiple joining Path names seperated by ','");
    443422
    444423      /*
    445         if( !strcmp( element->Value(), "Fork"))
    446         {
    447         container = element->FirstChild();
    448         if( container->ToText())
    449         {
    450         assert( container->Value() != NULL);
    451         PRINTF(4)("Loaded Fork: %s\n", container->Value());
    452         forkS(container->Value());
    453         }
    454         }
     424        if( !strcmp( element->Value(), "Fork"))
     425        {
     426        container = element->FirstChild();
     427        if( container->ToText())
     428        {
     429        assert( container->Value() != NULL);
     430        PRINTF(4)("Loaded Fork: %s\n", container->Value());
     431        forkS(container->Value());
     432        }
     433        }
    455434      */
    456435      /*
    457         if( !strcmp( element->Value(), "Join"))
    458         {
    459         container = element->FirstChild();
    460         if( container->ToText())
    461         {
    462         assert( container->Value() != NULL);
    463         PRINTF0("Loaded Join: %s\n", container->Value());
    464         joinS(container->Value());
    465         }
    466         }
    467       */       
     436        if( !strcmp( element->Value(), "Join"))
     437        {
     438        container = element->FirstChild();
     439        if( container->ToText())
     440        {
     441        assert( container->Value() != NULL);
     442        PRINTF0("Loaded Join: %s\n", container->Value());
     443        joinS(container->Value());
     444        }
     445        }
     446      */
    468447      element = element->NextSiblingElement();
    469448    }
     
    514493      // adds the conection Point
    515494      this->addPointV(trackElem->curve->getNode(trackElem->curve->getNodeCount()),
    516                      newElem);
     495                     newElem);
    517496      // add the new child to the childList.
    518497      trackElem->children->add(newElem);
     
    525504      for (int i = 0; i < trackElem->childCount; i++)
    526505      {
    527         char* childName = new char[strlen(trackElem->getName())+10];
    528         sprintf(childName, "%s_child%d", trackElem->getName(), i);
    529         trackElem->getChild(i)->setName(childName);
     506        char* childName = new char[strlen(trackElem->getName())+10];
     507        sprintf(childName, "%s_child%d", trackElem->getName(), i);
     508        trackElem->getChild(i)->setName(childName);
    530509      }
    531510    }
     
    727706      *va_arg (ID, int*) = trackIDs[i];
    728707    }
    729   va_end(ID); 
     708  va_end(ID);
    730709  delete []trackIDs;
    731710}
     
    748727      this->firstTrackElem->findByID(trackIDs[i])->setName(va_arg(name, const char*));
    749728    }
    750   va_end(name); 
     729  va_end(name);
    751730  delete []trackIDs;
    752731}
     
    765744    {
    766745      this->firstTrackElem->findByID(trackIDs[i])->setName(strings.getString(i));
    767     } 
     746    }
    768747  delete []trackIDs;
    769748}
     
    773752   \param count The Count of childrens the current HotPoint will have.
    774753   \param trackIDs A Pointer to an Array of ints which will hold the trackID's (the user will have to reserve space for this).
    775    \param trackNames the names for the tracks as a char-arrey-array 
     754   \param trackNames the names for the tracks as a char-arrey-array
    776755   \param trackElem The TrackElement to appy this to. (if NULL choose this->currentTrackElement)
    777756   \see TrackManager::fork(unsigned int count, ...)
     
    822801    {
    823802      switch (cond)
    824         {
    825         case LOWEST:
    826           trackElem->condFunc = &TrackElement::lowest;
    827           break;
    828         case HIGHEST:
    829           trackElem->condFunc = &TrackElement::highest;
    830           break;
    831         case RANDOM:
    832           trackElem->condFunc = &TrackElement::random;
    833           break;
    834         case LEFTRIGHT:
    835           trackElem->condFunc = &TrackElement::leftRight;
    836           break;
    837         case NEAREST:
    838           trackElem->condFunc = &TrackElement::nearest;
    839           break;
    840         case ENEMYKILLED:
    841           break;
    842         }
     803        {
     804        case LOWEST:
     805          trackElem->condFunc = &TrackElement::lowest;
     806          break;
     807        case HIGHEST:
     808          trackElem->condFunc = &TrackElement::highest;
     809          break;
     810        case RANDOM:
     811          trackElem->condFunc = &TrackElement::random;
     812          break;
     813        case LEFTRIGHT:
     814          trackElem->condFunc = &TrackElement::leftRight;
     815          break;
     816        case NEAREST:
     817          trackElem->condFunc = &TrackElement::nearest;
     818          break;
     819        case ENEMYKILLED:
     820          break;
     821        }
    843822      trackElem->subject=subject;
    844823    }
     
    846825
    847826/**
    848    \brief joins some tracks together again. 
     827   \brief joins some tracks together again.
    849828   \param count The count of Paths to join.
    850829
     
    884863      TrackElement* tmpElem = this->firstTrackElem->findByName(name);
    885864      if (tmpElem)
    886         trackIDs[i] = tmpElem->ID;
     865        trackIDs[i] = tmpElem->ID;
    887866      else
    888         PRINTF(1)("Trying to join a Track, of which the name does not exist: %s\n", name);
     867        PRINTF(1)("Trying to join a Track, of which the name does not exist: %s\n", name);
    889868    }
    890869  va_end(NAME);
     
    907886      TrackElement* tmpElem = this->firstTrackElem->findByName(strings.getString(i));
    908887      if (tmpElem)
    909         trackIDs[i] = tmpElem->ID;
     888        trackIDs[i] = tmpElem->ID;
    910889      else
    911         PRINTF(1)("Trying to join a Track, of which the name does not exist: %s\n", strings.getString(i));
     890        PRINTF(1)("Trying to join a Track, of which the name does not exist: %s\n", strings.getString(i));
    912891    }
    913892
     
    917896
    918897/**
    919    \brief joins some tracks together again. 
     898   \brief joins some tracks together again.
    920899   \param count The count of Paths to join.
    921900   \param trackIDs an Array with the trackID's to join
     
    930909    if (!this->firstTrackElem->findByID(trackIDs[i]))
    931910      {
    932         PRINTF(1)("Trying to Connect Paths that do not exist yet: %d\n Not Joining Anything\n", trackIDs[i]);
    933         return;
     911        PRINTF(1)("Trying to Connect Paths that do not exist yet: %d\n Not Joining Anything\n", trackIDs[i]);
     912        return;
    934913      }
    935                  
     914
    936915
    937916  PRINTF(3)("Joining %d tracks and merging to Track %d\n", count, trackIDs[0]);
     
    959938    {
    960939      if(tmpJoinElem = this->firstTrackElem->findByID(trackIDs[i]))
    961         {
    962           if (tmpJoinElem->childCount == 0
    963               && tmpJoinElem->endTime > tmpLatestTime)
    964             tmpLatestTime = tmpJoinElem->endTime;
    965         }
     940        {
     941          if (tmpJoinElem->childCount == 0
     942              && tmpJoinElem->endTime > tmpLatestTime)
     943            tmpLatestTime = tmpJoinElem->endTime;
     944        }
    966945    }
    967946  // time the main Join.
    968947  firstJoint->jumpTime = tmpLatestTime - firstJoint->endTime;
    969  
     948
    970949  // Joining:
    971950  for (int i = 1; i < count; i++)
    972951    {
    973952      if( tmpJoinElem = this->firstTrackElem->findByID(trackIDs[i]))
    974         {
    975           if (tmpJoinElem->childCount > 0)
    976             printf("!!This Curve has children, and as such will not be joined!!\n You can try joining other childless TrackElements to this one!");
    977           else
    978             {
    979               this->addPointV(tmpc2Point, tmpJoinElem);
    980               this->addPointV(tmpTangentPoint, tmpJoinElem);
    981               this->addPointV(tmpEndPoint, tmpJoinElem);
    982               // time all other Joins
    983               tmpJoinElem->jumpTime = tmpLatestTime - tmpJoinElem->endTime;
    984              
    985               //Copying Joint-Info
    986               tmpJoinElem->children = firstJoint->children;
    987               tmpJoinElem->childCount = firstJoint->childCount;
    988               tmpJoinElem->isSavePoint = firstJoint->isSavePoint;
    989               tmpJoinElem->isFork = firstJoint->isFork;
    990              
    991               tmpJoinElem->isJoined = true;
    992             }
    993         }
     953        {
     954          if (tmpJoinElem->childCount > 0)
     955            printf("!!This Curve has children, and as such will not be joined!!\n You can try joining other childless TrackElements to this one!");
     956          else
     957            {
     958              this->addPointV(tmpc2Point, tmpJoinElem);
     959              this->addPointV(tmpTangentPoint, tmpJoinElem);
     960              this->addPointV(tmpEndPoint, tmpJoinElem);
     961              // time all other Joins
     962              tmpJoinElem->jumpTime = tmpLatestTime - tmpJoinElem->endTime;
     963
     964              //Copying Joint-Info
     965              tmpJoinElem->children = firstJoint->children;
     966              tmpJoinElem->childCount = firstJoint->childCount;
     967              tmpJoinElem->isSavePoint = firstJoint->isSavePoint;
     968              tmpJoinElem->isFork = firstJoint->isFork;
     969
     970              tmpJoinElem->isJoined = true;
     971            }
     972        }
    994973    }
    995974  if(firstJoint->children)
     
    999978      TrackElement* enumElem = iterator->nextElement();
    1000979      while (enumElem)
    1001         {
    1002           PRINTF(5)("Setting startingTime of %d to %f.\n", enumElem->ID, tmpLatestTime);
    1003           enumElem->startingTime = tmpLatestTime;
    1004           enumElem->endTime = tmpLatestTime + enumElem->duration;
    1005          
    1006           enumElem = iterator->nextElement();
    1007         }
     980        {
     981          PRINTF(5)("Setting startingTime of %d to %f.\n", enumElem->ID, tmpLatestTime);
     982          enumElem->startingTime = tmpLatestTime;
     983          enumElem->endTime = tmpLatestTime + enumElem->duration;
     984
     985          enumElem = iterator->nextElement();
     986        }
    1008987      delete iterator;
    1009988    }
     
    10211000      TrackElement* tmpElem = this->firstTrackElem->findByID(i);
    10221001      if( tmpElem->childCount > 0 && tmpElem->mainJoin)
    1023         {
    1024           tIterator<TrackElement>* iterator = tmpElem->children->getIterator();
    1025           TrackElement* enumElem = iterator->nextElement();
    1026           //TrackElement* enumElem = tmpElem->children->enumerate();
    1027           while (enumElem)
    1028             {
    1029              
    1030               // c1-continuity
    1031               enumElem->curve->addNode(enumElem->curve->getNode(0) +
    1032                                                    ((enumElem->curve->getNode(0) -
    1033                                                     tmpElem->curve->getNode(tmpElem->curve->getNodeCount()-1))
    1034                                                     ),2);
    1035               enumElem->nodeCount++;
    1036               // c2-continuity
    1037               enumElem->curve->addNode((tmpElem->curve->getNode(tmpElem->curve->getNodeCount())-
    1038                                                     tmpElem->curve->getNode(tmpElem->curve->getNodeCount()-1)) * 4 +
    1039                                                    tmpElem->curve->getNode(tmpElem->curve->getNodeCount()-2), 3);
    1040               enumElem->nodeCount++;                                               
    1041               PRINTF(5)("accelerations: %d-in: count: %d, %f, %f, %f\n                  %d-out: count: %d %f, %f, %f\n",
    1042                      tmpElem->ID, tmpElem->nodeCount,
    1043                      tmpElem->curve->calcAcc(0.999).x, tmpElem->curve->calcAcc(0.999).y, tmpElem->curve->calcAcc(0.999).z,
    1044                      enumElem->ID, enumElem->nodeCount,
    1045                      enumElem->curve->calcAcc(0).x, enumElem->curve->calcAcc(0).y, enumElem->curve->calcAcc(0).z);
    1046              
    1047               enumElem = iterator->nextElement();
    1048             }
    1049           delete iterator;
    1050         }
     1002        {
     1003          tIterator<TrackElement>* iterator = tmpElem->children->getIterator();
     1004          TrackElement* enumElem = iterator->nextElement();
     1005          //TrackElement* enumElem = tmpElem->children->enumerate();
     1006          while (enumElem)
     1007            {
     1008
     1009              // c1-continuity
     1010              enumElem->curve->addNode(enumElem->curve->getNode(0) +
     1011                                                   ((enumElem->curve->getNode(0) -
     1012                                                    tmpElem->curve->getNode(tmpElem->curve->getNodeCount()-1))
     1013                                                    ),2);
     1014              enumElem->nodeCount++;
     1015              // c2-continuity
     1016              enumElem->curve->addNode((tmpElem->curve->getNode(tmpElem->curve->getNodeCount())-
     1017                                                    tmpElem->curve->getNode(tmpElem->curve->getNodeCount()-1)) * 4 +
     1018                                                   tmpElem->curve->getNode(tmpElem->curve->getNodeCount()-2), 3);
     1019              enumElem->nodeCount++;
     1020              PRINTF(5)("accelerations: %d-in: count: %d, %f, %f, %f\n                  %d-out: count: %d %f, %f, %f\n",
     1021                     tmpElem->ID, tmpElem->nodeCount,
     1022                     tmpElem->curve->calcAcc(0.999).x, tmpElem->curve->calcAcc(0.999).y, tmpElem->curve->calcAcc(0.999).z,
     1023                     enumElem->ID, enumElem->nodeCount,
     1024                     enumElem->curve->calcAcc(0).x, enumElem->curve->calcAcc(0).y, enumElem->curve->calcAcc(0).z);
     1025
     1026              enumElem = iterator->nextElement();
     1027            }
     1028          delete iterator;
     1029        }
    10511030    }
    10521031  for (int i = 1; i <= trackElemCount;i++)
     
    11021081    {
    11031082      if (this->currentTrackElem->jumpTime != 0.0)
    1104         this->jumpTo(this->localTime + this->currentTrackElem->jumpTime);
     1083        this->jumpTo(this->localTime + this->currentTrackElem->jumpTime);
    11051084      // jump to the next TrackElement and also set the history of the new Element to the old one.
    11061085      TrackElement* tmpHistoryElem = this->currentTrackElem;
     
    11081087      this->currentTrackElem->history = tmpHistoryElem;
    11091088      if (this->currentTrackElem->getName())
    1110         {
    1111           this->trackText->setText(this->currentTrackElem->getName());
    1112           this->textAnimation->replay();
    1113         }
     1089        {
     1090          this->trackText->setText(this->currentTrackElem->getName());
     1091          this->textAnimation->replay();
     1092        }
    11141093    }
    11151094  if (this->bindSlave)
    11161095    {
    11171096      Vector tmp = this->calcPos();
    1118       Quaternion quat = Quaternion(this->calcDir(), Vector(this->currentTrackElem->curve->calcAcc((localTime-this->currentTrackElem->startingTime)/this->currentTrackElem->duration).x,1,this->currentTrackElem->curve->calcAcc((localTime-this->currentTrackElem->startingTime)/this->currentTrackElem->duration).z)); 
     1097      Quaternion quat = Quaternion(this->calcDir(), Vector(this->currentTrackElem->curve->calcAcc((localTime-this->currentTrackElem->startingTime)/this->currentTrackElem->duration).x,1,this->currentTrackElem->curve->calcAcc((localTime-this->currentTrackElem->startingTime)/this->currentTrackElem->duration).z));
    11191098
    11201099      Vector v(0.0, 1.0, 0.0);
     
    11401119      this->currentTrackElem = this->firstTrackElem;
    11411120      if (this->currentTrackElem->getName())
    1142         {
    1143           this->trackText->setText(this->currentTrackElem->getName());
    1144           this->textAnimation->play();
    1145         }
     1121        {
     1122          this->trackText->setText(this->currentTrackElem->getName());
     1123          this->textAnimation->play();
     1124        }
    11461125    }
    11471126  this->localTime = time;
     
    11511130   \brief a Function that decides which Path we should follow.
    11521131   \param trackElem The Path to choose.
    1153    
     1132
    11541133*/
    11551134int TrackManager::choosePath(TrackElement* trackElem)
     
    11911170      TrackElement* tmpElem = this->firstTrackElem->findByID(i);
    11921171      if (tmpElem->curve)
    1193         for(float f = 0.0; f < 1.0; f+=dt)
    1194           {
    1195             //      printf("%f, %f, %f\n",trackManager->calcPos().x, trackManager->calcPos().y, trackManager->calcPos().z);
    1196             Vector tmpVector = tmpElem->curve->calcPos(f);
    1197             glVertex3f(tmpVector.x, tmpVector.y, tmpVector.z);
    1198           }
     1172        for(float f = 0.0; f < 1.0; f+=dt)
     1173          {
     1174            //      printf("%f, %f, %f\n",trackManager->calcPos().x, trackManager->calcPos().y, trackManager->calcPos().z);
     1175            Vector tmpVector = tmpElem->curve->calcPos(f);
     1176            glVertex3f(tmpVector.x, tmpVector.y, tmpVector.z);
     1177          }
    11991178      glEnd();
    12001179    }
     
    12161195    {
    12171196      for (int i = 1; i <= trackElemCount; i++)
    1218         {
    1219           TrackElement* tmpElem = this->firstTrackElem->findByID(i);
    1220           tmpElem->debug();
    1221         }
     1197        {
     1198          TrackElement* tmpElem = this->firstTrackElem->findByID(i);
     1199          tmpElem->debug();
     1200        }
    12221201    }
    12231202  PRINT(0)("-----------------------------------------\n");
  • orxonox/trunk/src/util/track/track_manager.h

    r4509 r4584  
    1 /*! 
     1/*!
    22    \file track_manager.h
    33    \brief manages all tracks defined in the world and the path the player takes
     
    4040   It is a graph and not a tree, because paths can fork and join again.
    4141*/
    42 class TrackElement
     42class TrackElement : public BaseObject
    4343{
    4444 public:
     
    5151
    5252  TrackElement* getChild(int childNumber) const;
    53   void setName(const char* name);
    54   /** \returns the Name of this TrackElement */
    55   inline const char* getName(void) const { return this->name; };
    5653
    5754 private:
     
    9592  // todo  int enemyKilled(void* entity);
    9693
    97  private:
    98   char* name;                //!< A name for the Trac.
    99  
    10094};
    10195
     
    128122    \li tick(): makes a Step on the Path. increases localTime by dt.
    129123    \li choosePath(): a Function that decides which Path we should follow.
    130    
     124
    131125   TrackManager can be handled as a StateMachine.
    132126   \n\n
    133     Names: 
     127    Names:
    134128    \li TrackManager: handles Tracks
    135129    \li Track:        The Track that the ship can follow
Note: See TracChangeset for help on using the changeset viewer.