- Timestamp:
- Jan 6, 2005, 5:38:49 AM (20 years ago)
- Location:
- orxonox/branches/parenting/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/parenting/src/track_manager.cc
r3351 r3352 221 221 bool TrackManager::addPoint(Vector newPoint) 222 222 { 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 */ 231 bool TrackManager::addPoint(Vector newPoint, TrackElement* trackElem) 232 { 233 if (trackElem->isFresh) 224 234 { 225 235 this->setCurveType(BEZIERCURVE); 226 t his->currentTrackElem->isFresh = false;227 if(t his->currentTrackElem != this->firstTrackElem)236 trackElem->isFresh = false; 237 if(trackElem != this->firstTrackElem) 228 238 { 229 this->addPoint(t his->currentTrackElem->startPoint);230 this->addPoint(t his->currentTrackElem->startTangentPoint);239 this->addPoint(trackElem->startPoint); 240 this->addPoint(trackElem->startTangentPoint); 231 241 } 232 242 } 233 t his->currentTrackElem->curve->addNode(newPoint);234 t his->currentTrackElem->nodeCount++;243 trackElem->curve->addNode(newPoint); 244 trackElem->nodeCount++; 235 245 } 236 246 … … 325 335 326 336 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. 328 338 */ 329 339 void TrackManager::join(unsigned int count, ...) … … 350 360 void TrackManager::joinV(unsigned int count, int* trackIDs) 351 361 { 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 353 374 } 354 375 … … 426 447 void TrackManager::drawGraph(float dt) const 427 448 { 428 glBegin(GL_LINES); 449 429 450 for (int i = 1; i <= trackElemCount; i++) 430 451 { 452 glBegin(GL_LINE_STRIP); 431 453 TrackElement* tmpElem = this->findTrackElementByID(i); 432 printf("Element: %i\n", tmpElem->ID);433 454 if (tmpElem->curve) 434 455 for(float f = 0.0; f < 1.0; f+=dt) … … 438 459 glVertex3f(tmpVector.x, tmpVector.y, tmpVector.z); 439 460 } 440 }441 461 glEnd(); 442 443 462 } 444 463 } 445 464 -
orxonox/branches/parenting/src/track_manager.h
r3350 r3352 116 116 void setDuration(float time); 117 117 bool addPoint(Vector newPoint); 118 bool addPoint(Vector newPoint, TrackElement* trackElem); 118 119 int addHotPoint(Vector newPoint); 119 120 int setSavePoint(void); -
orxonox/branches/parenting/src/world.cc
r3351 r3352 253 253 trackManager->addPoint(Vector(170, 0, 10)); 254 254 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); 255 258 256 259 /*
Note: See TracChangeset
for help on using the changeset viewer.