- Timestamp:
- Jan 20, 2007, 9:27:04 PM (18 years ago)
- Location:
- branches/playability/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/lib/math/curve.cc
r9110 r10297 142 142 tmpNode = tmpNode->next; 143 143 return tmpNode->position; 144 } 145 146 /** 147 * This function returns an approximation of the length of the curve 148 * 149 */ 150 float Curve::getLength() 151 { 152 float length = 0; 153 PathNode* tmpNode = this->firstNode; 154 for(int i = 1; i < this->nodeCount; i++) 155 { 156 length += Vector(tmpNode->next->position - tmpNode->position).len(); 157 } 158 return length; 144 159 } 145 160 -
branches/playability/src/lib/math/curve.h
r6616 r10297 47 47 /** @returns the directional Curve */ 48 48 Curve* getDirCurve() const { return this->dirCurve; }; 49 float getLength(); 49 50 50 51 /** @param t the value on the curve [0-1] @returns Vector to the position */ -
branches/playability/src/util/track/track.cc
r10284 r10297 65 65 this->curveType = CURVE_BEZIER; 66 66 // this->startingTime = 0; 67 this->duration = 10;68 this->endTime = 10;67 this->duration = 20; 68 this->endTime = 20; 69 69 this->width = 10; 70 70 this->curve = new BezierCurve(); … … 88 88 LoadParam_CYCLE(element, "addPoint", this, Track, addPoint) 89 89 .describe("Adds a new Point to the currently selected TrackElement"); 90 LoadParam_CYCLE(element, "speed", this, Track, setSpeed) 91 .describe("Sets speed of traveling"); 90 92 91 93 } … … 116 118 if( this->nodeCount == 0) this->trackNode->setAbsCoor(newPoint); 117 119 this->nodeCount++; 118 PRINTF(4)("Point added to curve %d\n"); 120 // PRINTF(0)("Point added to curve\n"); 121 } 122 123 /** 124 * This function sets the speed of the trackNode by altering the duration 125 * of the time the trackNode travels on the whole track. This is bad because 126 * the speed depends on the length of the curve. (by getting the curve's length 127 * this function will make a lot more sense) 128 */ 129 void Track::setSpeed(float speed) 130 { 131 this->duration = this->duration/speed; 132 119 133 } 120 134 … … 211 225 this->trackNode->shiftCoor(tmp - this->trackNode->getAbsCoor()); 212 226 // set direction and roll angle of trackNode 213 //this->trackNode->setAbsDir(quat);227 this->trackNode->setAbsDir(quat); 214 228 } 215 229 } … … 230 244 eventually this will all be packed into a gl-list. 231 245 */ 232 void Track::drawGraph(float dt) const246 /*void Track::drawGraph(float dt) const 233 247 { 234 248 glBegin(GL_LINE_STRIP); … … 240 254 } 241 255 glEnd(); 242 } 256 }*/ -
branches/playability/src/util/track/track.h
r10284 r10297 25 25 void addPoint(float x, float y, float z); 26 26 void addPointV(Vector newPoint); 27 void setSpeed(float speed); 27 28 28 29 //void finalize(); … … 33 34 PNode* getTrackNode(); 34 35 35 void drawGraph(float dt) const;36 // void drawGraph(float dt) const; 36 37 37 38 //float startingTime; //!< The time at which this Track begins. -
branches/playability/src/world_entities/space_ships/space_ship.cc
r10291 r10297 843 843 this->travelNode->updateNode(0.01f); 844 844 this->isTravelDistanceInit = false; 845 846 if(this->entityTrack) 847 this->travelNode->setParent(this->entityTrack->getTrackNode()); 845 848 846 849 this->setParent(this->travelNode); … … 1027 1030 1028 1031 //this moves camera and ship along the travel path. 1029 this->travelNode->shiftCoor(Vector(this->cameraSpeed * dt, 0, 0)); 1032 if(!this->entityTrack) 1033 this->travelNode->shiftCoor(Vector(this->cameraSpeed * dt, 0, 0)); 1030 1034 1031 1035 break; -
branches/playability/src/world_entities/world_entity.cc
r10284 r10297 683 683 } 684 684 685 if (this->entityTrack)686 this->entityTrack->drawGraph(0.02);685 //if (this->entityTrack) 686 //this->entityTrack->drawGraph(0.02); 687 687 688 688 // if( this->aabbNode != NULL)
Note: See TracChangeset
for help on using the changeset viewer.