Changeset 10284 in orxonox.OLD for branches/playability/src/util
- Timestamp:
- Jan 17, 2007, 9:11:34 PM (18 years ago)
- Location:
- branches/playability/src/util/track
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/util/track/track.cc
r10209 r10284 27 27 28 28 #include "p_node.h" 29 30 #include "stdincl.h" 29 31 30 32 #include "debug.h" … … 68 70 this->curve = new BezierCurve(); 69 71 this->trackNode = new PNode(PNode::getNullParent(), PNODE_ALL); 72 this->nodeCount = 0; 70 73 } 71 74 … … 83 86 LOAD_PARAM_START_CYCLE(root, element); 84 87 { 85 LoadParam_CYCLE(element, " Point", this, Track, addPoint)88 LoadParam_CYCLE(element, "addPoint", this, Track, addPoint) 86 89 .describe("Adds a new Point to the currently selected TrackElement"); 87 90 … … 100 103 void Track::addPoint(float x, float y, float z) 101 104 { 102 this->addPoint (Vector (x,y,z));105 this->addPointV(Vector (x,y,z)); 103 106 } 104 107 … … 108 111 * @param newPoint 109 112 */ 110 void Track::addPoint (Vector newPoint)113 void Track::addPointV(Vector newPoint) 111 114 { 112 115 this->curve->addNode(newPoint); 116 if( this->nodeCount == 0) this->trackNode->setAbsCoor(newPoint); 113 117 this->nodeCount++; 118 PRINTF(4)("Point added to curve %d\n"); 114 119 } 115 120 … … 117 122 * We probably doesn't even need this 118 123 */ 119 void Track::finalize()120 {124 //void Track::finalize() 125 //{ 121 126 // for (int i = 1; i<= trackElemCount ;i++) 122 127 // { … … 159 164 this->maxTime = this->firstTrackElem->findByID(i)->endTime; // very bad implemented :/ 160 165 */ 161 }166 //} 162 167 163 168 Vector Track::calcPos() const … … 204 209 205 210 // move trackNode of the track 206 this->trackNode->s etAbsCoor(tmp);211 this->trackNode->shiftCoor(tmp - this->trackNode->getAbsCoor()); 207 212 // set direction and roll angle of trackNode 208 this->trackNode->setAbsDir(quat);213 // this->trackNode->setAbsDir(quat); 209 214 } 210 215 } … … 217 222 return this->trackNode; 218 223 } 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 */ 232 void 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 24 24 virtual void loadParams(const TiXmlElement* root); 25 25 void addPoint(float x, float y, float z); 26 void addPoint (Vector newPoint);26 void addPointV(Vector newPoint); 27 27 28 void finalize();28 //void finalize(); 29 29 inline Vector calcPos() const; 30 30 inline Vector calcDir() const; … … 32 32 33 33 PNode* getTrackNode(); 34 35 void drawGraph(float dt) const; 34 36 35 37 //float startingTime; //!< The time at which this Track begins.
Note: See TracChangeset
for help on using the changeset viewer.