- Timestamp:
- Jan 5, 2005, 12:53:42 AM (20 years ago)
- Location:
- orxonox/branches/parenting/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/parenting/src/track_manager.cc
r3332 r3333 34 34 this->cond; //!< todo think!! 35 35 this->ID = -1; 36 this->length =0; 36 this->startingTime = 0; //!< \todo eventually set this to the max time of TrackManager. 37 this->duration =0; 37 38 this->curveType = BEZIERCURVE; 38 39 this->nodeCount = 0; … … 58 59 delete this->children[i]; 59 60 } 61 if (children) 62 delete children; 63 } 64 65 /** 66 \brief reserves Space for childCount children 67 \param childCount The Count of children to make space for. 68 */ 69 void TrackElement::initChildren(unsigned int childCount) 70 { 71 this->childCount = childCount; 72 this->children = new TrackElement*[childCount]; 73 for (int i=0; i<childCount; i++) 74 this->children[i] = new TrackElement(); 60 75 } 61 76 … … 183 198 184 199 /** 185 \brief Sets the lengthof the current path in seconds.186 \param time The lengthin seconds.187 */ 188 189 void TrackManager::set Length(float time)190 { 191 this->currentTrackElem-> length= time;200 \brief Sets the duration of the current path in seconds. 201 \param time The duration in seconds. 202 */ 203 204 void TrackManager::setDuration(float time) 205 { 206 this->currentTrackElem->duration = time; 192 207 } 193 208 … … 196 211 \param newPoint The point to add. 197 212 */ 198 voidTrackManager::addPoint(Vector newPoint)213 bool TrackManager::addPoint(Vector newPoint) 199 214 { 200 215 if (this->currentTrackElem->isFresh) … … 209 224 \brief adds save/splitpoint. 210 225 \param newPoint The point to add. 211 */ 212 void TrackManager::addHotPoint(Vector newPoint) 226 \returns A Pointer to a newly appended Curve 227 */ 228 int TrackManager::addHotPoint(Vector newPoint) 213 229 { 214 230 if (this->currentTrackElem->isFresh) … … 224 240 /** 225 241 \brief Sets the last HotPoint into a savePoint. 242 \returns A Pointer to a newly appended Curve 226 243 227 244 If no HotPoint was defined the last added Point will be rendered into a savePoint. \n 228 245 If the HotPoint was defined as a fork the Point will \b not be set into a savePoint. 229 246 */ 230 voidTrackManager::setSavePoint(void)247 int TrackManager::setSavePoint(void) 231 248 { 232 249 if (this->currentTrackElem->isFork || this->currentTrackElem->isSavePoint) 233 return ;250 return this->currentTrackElem->children[1]->ID; 234 251 this->currentTrackElem->isSavePoint = true; 235 252 236 this->currentTrackElem-> children = new TrackElement*[1];253 this->currentTrackElem->initChildren(1); 237 254 } 238 255 … … 273 290 this->currentTrackElem->isFork = true; 274 291 275 this->currentTrackElem-> children = new TrackElement*[count];292 this->currentTrackElem->initChildren(count); 276 293 } 277 294 … … 327 344 Vector TrackManager::calcPos() const 328 345 { 329 346 return this->currentTrackElem->curve->calcPos(this->localTime); 330 347 } 331 348 … … 336 353 Vector TrackManager::calcDir() const 337 354 { 338 355 return this->currentTrackElem->curve->calcDir(this->localTime); 339 356 } 340 357 … … 342 359 \brief Advances the local-time of the Track around dt 343 360 \param dt The time about which to advance. 361 362 This function also checks, if the TrackElement has to be changed. 344 363 */ 345 364 void TrackManager::tick(float dt) -
orxonox/branches/parenting/src/track_manager.h
r3332 r3333 33 33 ~TrackElement(void); 34 34 35 void initChildren(unsigned int childCount); 36 35 37 TrackElement* findByID(unsigned int trackID); 36 38 … … 41 43 PathCondition cond; //!< The Split Condition; 42 44 int ID; //!< The ID of this TrackElement 43 float length; //!< The time usedto cross this TrackElement (curve). 45 float startingTime; //!< The time at which this Track begins. 46 float duration; //!< The time used to cross this TrackElement (curve). 44 47 CurveType curveType; //!< The CurveType this will have. 45 48 int nodeCount; //!< The count of points this TrackElement has. … … 61 64 \li workOn(): changes the ID that will be altered through the changes. 62 65 \li setCurveType(): lets you set the CurveType of the Curve we are Working on. (default is BezierCurve, set this as early as possible, for this uses resources). 63 \li set Length(): sets the length of the current path in seconds.66 \li setDuration(): sets the length of the current path in seconds. 64 67 \li addPoint(): adds a point to the Curve. 65 68 \li addHotPoint(): adds save/splitpoint.\n … … 102 105 103 106 TrackElement* findTrackElementByID(unsigned int trackID) const; 104 105 107 106 108 public: … … 111 113 void workOn(unsigned int trackID); 112 114 void setCurveType(CurveType curveType); 113 void set Length(float time);114 voidaddPoint(Vector newPoint);115 voidaddHotPoint(Vector newPoint);116 voidsetSavePoint(void);115 void setDuration(float time); 116 bool addPoint(Vector newPoint); 117 int addHotPoint(Vector newPoint); 118 int setSavePoint(void); 117 119 void fork(unsigned int count, ...); 118 120 void forkV(unsigned int count, int* trackIDs);
Note: See TracChangeset
for help on using the changeset viewer.