Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3431 in orxonox.OLD


Ignore:
Timestamp:
Mar 1, 2005, 10:49:43 AM (19 years ago)
Author:
bensch
Message:

orxonox/branches/trackManager: fixed the timing Problem.

File:
1 edited

Legend:

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

    r3430 r3431  
    158158      this->currentTrackElem->children[i] = new TrackElement();
    159159      this->currentTrackElem->children[i]->ID = ++trackElemCount;
    160       this->currentTrackElem->children[i]->startingTime = this->currentTrackElem->endTime;
     160      this->currentTrackElem->children[i]->startingTime = this->currentTrackElem->endTime + this->currentTrackElem->jumpTime;
    161161      this->addPoint(this->currentTrackElem->curve->getNode(this->currentTrackElem->curve->getNodeCount()), this->currentTrackElem->children[i]);
    162162    }
     
    371371void TrackManager::joinV(unsigned int count, int* trackIDs)
    372372{
    373   printf("Joining %d tracks to Track %d\n", count, trackIDs[0]);
     373  printf("Joining %d tracks and merging to Track %d\n", count, trackIDs[0]);
    374374
    375375  // chanching work-on to temporary value. going back at the end.
    376376  int tmpCurrentWorkingID = this->currentTrackElem->ID;
    377377  this->workOn(trackIDs[0]);
    378   float tmpLatestTime = 0;
    379 
    380378  TrackElement* firstJoint = this->currentTrackElem;
     379  float tmpLatestTime = firstJoint->endTime;
     380
    381381  Vector tmpEndPoint = firstJoint->curve->getNode(firstJoint->curve->getNodeCount());
    382382  Vector tmpTangentPoint = firstJoint->curve->getNode(firstJoint->curve->getNodeCount()-1);
     
    394394        tmpLatestTime = tmpJoinElem->endTime;
    395395    }
     396  // time the main Join.
     397  firstJoint->jumpTime = tmpLatestTime - firstJoint->endTime;
     398 
    396399  // Joining:
    397400  for (int i = 1; i < count; i++)
     
    405408          this->addPoint(tmpTangentPoint, tmpJoinElem);
    406409          this->addPoint(tmpEndPoint, tmpJoinElem);
     410          // time all other Joins
    407411          tmpJoinElem->jumpTime = tmpLatestTime - tmpJoinElem->endTime;
    408412         
     
    416420        }
    417421    }
    418   if(currentTrackElem->children)
    419     for(int i = 0; i > currentTrackElem->childCount; i++)
    420       currentTrackElem->children[i]->startingTime = tmpLatestTime;
     422  if(firstJoint->childCount > 0)
     423    for(int i = 0; i < firstJoint->childCount; i++)
     424      {
     425        printf("Setting startingTime of %d to %f.\n", firstJoint->children[i]->ID, tmpLatestTime);
     426        firstJoint->children[i]->startingTime = tmpLatestTime;
     427        firstJoint->children[i]->endTime = tmpLatestTime+firstJoint->children[i]->duration;
     428      }
    421429
    422430  // returning to the TrackElement we were working on.
     
    426434/**
    427435   \brief finalizes the TrackSystem. after this it will not be editable anymore
     436
     437   \todo check for any inconsistencies, output errors
    428438*/
    429439void TrackManager::finalize(void)
     
    571581}
    572582
     583/**
     584   \brief outputs debug information about the trackManager
     585   \param level how much debug
     586*/
    573587void TrackManager::debug(unsigned int level) const
    574588{
     
    607621          if(tmpElem->isFork)
    608622            {
    609               printf("    is A Fork with with %d children.", tmpElem->childCount);
     623              printf("    is A Fork with with %d children.\n", tmpElem->childCount);
    610624            }
    611625          if(tmpElem->isJoined)
Note: See TracChangeset for help on using the changeset viewer.