Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3350 in orxonox.OLD for orxonox


Ignore:
Timestamp:
Jan 6, 2005, 4:40:08 AM (20 years ago)
Author:
bensch
Message:

orxonox/branches/parenting: TrackManager: implemented Debug-output:

  1. function draw() to draw the Track in Full
  2. function debug, that Prints information about the state of the TrackManager
Location:
orxonox/branches/parenting/src
Files:
3 edited

Legend:

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

    r3349 r3350  
    226226      this->currentTrackElem->isFresh = false;
    227227      if(this->currentTrackElem != this->firstTrackElem)
    228         this->addPoint(this->currentTrackElem->startPoint);
    229         this->addPoint(this->currentTrackElem->startTangentPoint);
    230      
     228        {
     229          this->addPoint(this->currentTrackElem->startPoint);
     230          this->addPoint(this->currentTrackElem->startTangentPoint);
     231        }
    231232    }
    232233  this->currentTrackElem->curve->addNode(newPoint);
     
    409410}
    410411
     412
     413
     414// DEBUG //
     415
     416/**
     417   \brief Imports a model of the Graph into the OpenGL-environment.
     418   \param dt The Iterator used in seconds for Painting the Graph.
     419
     420   This is for testing facility only. Do this if you want to see the Path inside the Level.
     421   eventually this will all be packed into a gl-list.
     422*/
     423void TrackManager::drawGraph(float dt) const
     424{
     425  glBegin(GL_LINES);
     426  for (int i = 1; i <= trackElemCount; i++)
     427    {
     428      TrackElement* tmpElem = this->findTrackElementByID(i);
     429      printf("Element: %i\n", tmpElem->ID);
     430      if (tmpElem->curve)
     431        for(float f = 0.0; f < 1.0; f+=dt)
     432          {
     433            //      printf("%f, %f, %f\n",trackManager->calcPos().x, trackManager->calcPos().y, trackManager->calcPos().z);
     434            Vector tmpVector = tmpElem->curve->calcPos(f);
     435            glVertex3f(tmpVector.x, tmpVector.y, tmpVector.z);
     436          }
     437    }
     438  glEnd();
     439 
     440 
     441}
     442
     443void TrackManager::debug(unsigned int level) const
     444{
     445  printf("::CLASS TRACKMANAGER::debug information::\n");
     446  //  printf("Status is: %
     447  printf(" Consists of %d elements\n", this->trackElemCount);
     448  printf(" localTime is: %f\n", this->localTime);
     449  if (level >= 2)
     450    {
     451      for (int i = 1; i <= trackElemCount; i++)
     452        {
     453          TrackElement* tmpElem = this->findTrackElementByID(i);
     454          printf("  ::TrackElement:%i::", tmpElem->ID);
     455          if(tmpElem->name)
     456            printf("name:%s::", tmpElem->name);
     457          printf("\n   TimeTable: starting at = %f; ends at = %f; duration = %f\n", tmpElem->startingTime, tmpElem->startingTime+tmpElem->duration, tmpElem->duration);
     458          printf("   consists of %d Points\n", tmpElem->nodeCount);
     459
     460          if(tmpElem->isFresh)
     461            printf("   has not jet eddited in any way\n");
     462          if(tmpElem->isSavePoint)
     463            printf("   is a SavePoint\n");
     464          if(tmpElem->isFork)
     465            printf("   is A Fork with with %d children\n", tmpElem->childCount);
     466          if(tmpElem->isJoined)
     467            printf("   is Joined at the End\n");
     468
     469                   
     470        }
     471    }
     472}
  • orxonox/branches/parenting/src/track_manager.h

    r3349 r3350  
    106106
    107107  TrackElement* findTrackElementByID(unsigned int trackID) const;
    108 
     108 
    109109 public:
    110110  ~TrackManager(void);
     
    131131  void choosePath(int graphID);
    132132
     133  // DEBUG //
     134  void drawGraph(float dt) const;
     135  void debug(unsigned int level) const;
    133136};
    134137
  • orxonox/branches/parenting/src/world.cc

    r3348 r3350  
    236236      trackManager->addPoint(Vector(80,0,-10));
    237237      trackManager->addPoint(Vector(90,0,-10));
     238      trackManager->setDuration(.5);
     239      trackManager->setSavePoint();
     240      trackManager->addPoint(Vector(110,0,5));
     241      trackManager->addPoint(Vector(120,0, 10));
     242      trackManager->addPoint(Vector(130,0, 10));
     243      trackManager->addPoint(Vector(140,0,-10));
     244      trackManager->addPoint(Vector(150,0,-10));
    238245      trackManager->setDuration(.5);
    239246     
     
    548555    }
    549556  glEnd();
     557
     558  trackManager->drawGraph(.01);
     559  trackManager->debug(2);
     560  /*
     561  glBegin(GL_LINES);
    550562  float i;
    551   glBegin(GL_LINES);
    552   for(i = 0.0; i<1; i+=.01)
    553     {
    554       trackManager->tick (.01);
    555       printf("%f, %f, %f\n",trackManager->calcPos().x, trackManager->calcPos().y, trackManager->calcPos().z);
    556       glVertex3f(trackManager->calcPos().x, trackManager->calcPos().y, trackManager->calcPos().z);
    557     }
    558   /*
    559563  for(i = 0.0; i<1; i+=.01)
    560564    {
Note: See TracChangeset for help on using the changeset viewer.