Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10284 in orxonox.OLD for branches/playability/src/util


Ignore:
Timestamp:
Jan 17, 2007, 9:11:34 PM (17 years ago)
Author:
bknecht
Message:

some modification for the track

Location:
branches/playability/src/util/track
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/playability/src/util/track/track.cc

    r10209 r10284  
    2727
    2828#include "p_node.h"
     29
     30#include "stdincl.h"
    2931
    3032#include "debug.h"
     
    6870  this->curve = new BezierCurve();
    6971  this->trackNode = new PNode(PNode::getNullParent(), PNODE_ALL);
     72  this->nodeCount = 0;
    7073}
    7174
     
    8386     LOAD_PARAM_START_CYCLE(root, element);
    8487     {
    85            LoadParam_CYCLE(element, "Point", this, Track, addPoint)
     88           LoadParam_CYCLE(element, "addPoint", this, Track, addPoint)
    8689             .describe("Adds a new Point to the currently selected TrackElement");
    8790
     
    100103void Track::addPoint(float x, float y, float z)
    101104{
    102      this->addPoint(Vector (x,y,z));
     105     this->addPointV(Vector (x,y,z));
    103106}
    104107
     
    108111 * @param newPoint
    109112 */
    110 void Track::addPoint(Vector newPoint)
     113void Track::addPointV(Vector newPoint)
    111114{
    112115   this->curve->addNode(newPoint);
     116   if( this->nodeCount == 0) this->trackNode->setAbsCoor(newPoint);
    113117   this->nodeCount++;
     118   PRINTF(4)("Point added to curve %d\n");
    114119}
    115120
     
    117122 * We probably doesn't even need this
    118123 */
    119 void Track::finalize()
    120 {
     124//void Track::finalize()
     125//{
    121126//   for (int i = 1; i<= trackElemCount ;i++)
    122127//     {
     
    159164      this->maxTime = this->firstTrackElem->findByID(i)->endTime; // very bad implemented :/
    160165      */
    161 }
     166//}
    162167
    163168Vector Track::calcPos() const
     
    204209
    205210       // move trackNode of the track
    206        this->trackNode->setAbsCoor(tmp);
     211       this->trackNode->shiftCoor(tmp - this->trackNode->getAbsCoor());
    207212       // set direction and roll angle of trackNode
    208        this->trackNode->setAbsDir(quat);
     213       // this->trackNode->setAbsDir(quat);
    209214     }
    210215}
     
    217222  return this->trackNode;
    218223}
     224
     225/**
     226 *  Imports a model of the Graph into the OpenGL-environment.
     227 * @param dt The Iterator used in seconds for Painting the Graph.
     228
     229   This is for testing facility only. Do this if you want to see the Path inside the Level.
     230   eventually this will all be packed into a gl-list.
     231*/
     232void Track::drawGraph(float dt) const
     233{
     234      glBegin(GL_LINE_STRIP);
     235        for(float f = 0.0; f < 1.0; f+=dt)
     236          {
     237            // PRINTF(4)("drawing",this->calcPos().x, this->calcPos().y, this->calcPos().z);
     238            Vector tmpVector = this->curve->calcPos(f);
     239            glVertex3f(tmpVector.x, tmpVector.y, tmpVector.z);
     240          }
     241      glEnd();
     242}
  • branches/playability/src/util/track/track.h

    r10096 r10284  
    2424   virtual void loadParams(const TiXmlElement* root);
    2525   void addPoint(float x, float y, float z);
    26    void addPoint(Vector newPoint);
     26   void addPointV(Vector newPoint);
    2727
    28    void finalize();
     28   //void finalize();
    2929   inline Vector calcPos() const;
    3030   inline Vector calcDir() const;
     
    3232
    3333   PNode* getTrackNode();
     34   
     35   void drawGraph(float dt) const;
    3436     
    3537   //float                 startingTime;         //!< The time at which this Track begins.
Note: See TracChangeset for help on using the changeset viewer.