- Timestamp:
- Mar 1, 2005, 2:36:56 PM (20 years ago)
- Location:
- orxonox/trunk
- Files:
-
- 2 deleted
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/configure
r3424 r3433 6442 6442 done 6443 6443 6444 if test x jpegHeader = xno; then6444 if test x$jpegHeader = xno; then 6445 6445 echo " not including jpeg." 6446 6446 else -
orxonox/trunk/src/Makefile.am
r3421 r3433 18 18 ini_parser.cc \ 19 19 keynames.cc \ 20 track.cc \21 20 base_entity.cc \ 22 21 game_loader.cc \ … … 45 44 npc.h \ 46 45 stdincl.h \ 46 glincl.h \ 47 47 ai.h \ 48 48 environment.h \ … … 52 52 error.h \ 53 53 player.h \ 54 track.h \55 54 camera.h \ 56 55 ini_parser.h \ -
orxonox/trunk/src/Makefile.in
r3429 r3433 57 57 world_entity.$(OBJEXT) vector.$(OBJEXT) camera.$(OBJEXT) \ 58 58 command_node.$(OBJEXT) ini_parser.$(OBJEXT) keynames.$(OBJEXT) \ 59 track.$(OBJEXT) base_entity.$(OBJEXT) game_loader.$(OBJEXT) \60 campaign.$(OBJEXT) story_entity.$(OBJEXT) \61 environment.$(OBJEXT) model.$(OBJEXT) objModel.$(OBJEXT) \62 array.$(OBJEXT) material.$(OBJEXT) texture.$(OBJEXT) \63 list.$(OBJEXT) p_node.$(OBJEXT) null_parent.$(OBJEXT) \64 base_object.$(OBJEXT) helper_parent.$(OBJEXT) \65 track_manager.$(OBJEXT) matrix.$(OBJEXT) curve.$(OBJEXT) \66 glmenu_imagescreen.$(OBJEXT)skysphere.$(OBJEXT)59 base_entity.$(OBJEXT) game_loader.$(OBJEXT) campaign.$(OBJEXT) \ 60 story_entity.$(OBJEXT) environment.$(OBJEXT) model.$(OBJEXT) \ 61 objModel.$(OBJEXT) array.$(OBJEXT) material.$(OBJEXT) \ 62 texture.$(OBJEXT) list.$(OBJEXT) p_node.$(OBJEXT) \ 63 null_parent.$(OBJEXT) base_object.$(OBJEXT) \ 64 helper_parent.$(OBJEXT) track_manager.$(OBJEXT) \ 65 matrix.$(OBJEXT) curve.$(OBJEXT) glmenu_imagescreen.$(OBJEXT) \ 66 skysphere.$(OBJEXT) 67 67 orxonox_OBJECTS = $(am_orxonox_OBJECTS) 68 68 orxonox_LDADD = $(LDADD) … … 87 87 @AMDEP_TRUE@ ./$(DEPDIR)/player.Po ./$(DEPDIR)/skysphere.Po \ 88 88 @AMDEP_TRUE@ ./$(DEPDIR)/story_entity.Po ./$(DEPDIR)/texture.Po \ 89 @AMDEP_TRUE@ ./$(DEPDIR)/track.Po ./$(DEPDIR)/track_manager.Po \ 90 @AMDEP_TRUE@ ./$(DEPDIR)/vector.Po ./$(DEPDIR)/world.Po \ 91 @AMDEP_TRUE@ ./$(DEPDIR)/world_entity.Po 89 @AMDEP_TRUE@ ./$(DEPDIR)/track_manager.Po ./$(DEPDIR)/vector.Po \ 90 @AMDEP_TRUE@ ./$(DEPDIR)/world.Po ./$(DEPDIR)/world_entity.Po 92 91 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ 93 92 $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) … … 228 227 ini_parser.cc \ 229 228 keynames.cc \ 230 track.cc \231 229 base_entity.cc \ 232 230 game_loader.cc \ … … 255 253 npc.h \ 256 254 stdincl.h \ 255 glincl.h \ 257 256 ai.h \ 258 257 environment.h \ … … 262 261 error.h \ 263 262 player.h \ 264 track.h \265 263 camera.h \ 266 264 ini_parser.h \ … … 318 316 esac; \ 319 317 done; \ 320 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/Makefile'; \318 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ 321 319 cd $(top_srcdir) && \ 322 $(AUTOMAKE) -- foreignsrc/Makefile320 $(AUTOMAKE) --gnu src/Makefile 323 321 .PRECIOUS: Makefile 324 322 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status … … 398 396 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/story_entity.Po@am__quote@ 399 397 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/texture.Po@am__quote@ 400 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/track.Po@am__quote@401 398 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/track_manager.Po@am__quote@ 402 399 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vector.Po@am__quote@ -
orxonox/trunk/src/console/Makefile.in
r3424 r3433 203 203 esac; \ 204 204 done; \ 205 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/console/Makefile'; \205 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/console/Makefile'; \ 206 206 cd $(top_srcdir) && \ 207 $(AUTOMAKE) -- foreignsrc/console/Makefile207 $(AUTOMAKE) --gnu src/console/Makefile 208 208 .PRECIOUS: Makefile 209 209 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
orxonox/trunk/src/curve.cc
r3365 r3433 40 40 } 41 41 currentNode->position = newNode; 42 currentNode->next = 0; // not sure if this really points to NULL!!42 currentNode->next = 0; 43 43 currentNode->number = (++nodeCount); 44 44 this->rebuild(); … … 46 46 } 47 47 48 void Curve::addNode(const Vector& newNode, unsigned int insertPosition) 49 { 50 51 if (this->nodeCount == 0 || insertPosition > this->nodeCount) 52 return addNode(newNode); 53 54 if (insertPosition == 0) 55 insertPosition = 1; 56 57 PathNode* insNode = new PathNode; 58 59 // relinking 60 PathNode* tmpNode = this->firstNode; 61 if (insertPosition > 1) 62 { 63 while (tmpNode->next->number != insertPosition) 64 tmpNode= tmpNode->next; 65 insNode->next = tmpNode->next; 66 tmpNode->next = insNode; 67 } 68 else 69 { 70 insNode->next = this->firstNode; 71 this->firstNode = insNode; 72 } 73 // renumbering 74 insNode->number = insertPosition; 75 tmpNode = insNode->next; 76 while (tmpNode) 77 { 78 tmpNode->number++; 79 tmpNode = tmpNode->next; 80 } 81 82 // finished 83 insNode->position = newNode; 84 ++nodeCount; 85 this->rebuild(); 86 return; 87 } 88 48 89 /** 49 90 \brief Finds a Node by its Number, and returns its Position … … 53 94 Vector Curve::getNode(unsigned int nodeToFind) 54 95 { 55 if (nodeToFind > this->nodeCount )96 if (nodeToFind > this->nodeCount || nodeToFind < 0) 56 97 return Vector(0,0,0); 57 98 PathNode* tmpNode = this->firstNode; … … 60 101 return tmpNode->position; 61 102 } 103 104 /** 105 \brief Outputs information about the state of this Curve 106 */ 107 void Curve::debug(void) 108 { 109 printf("<<-------------------------------\n"); 110 printf("Curve Information:\n"); 111 printf("NodeCount: %d\n", this->nodeCount); 112 PathNode* tmpNode = this->firstNode; 113 while (tmpNode) 114 { 115 printf("node #%d: %f, %f, %f\n", tmpNode->number, tmpNode->position.x, tmpNode->position.y, tmpNode->position.z); 116 tmpNode = tmpNode->next; 117 } 118 printf("------------------------------->>\n"); 119 } 120 62 121 63 122 /////////////////////////////////// … … 142 201 143 202 // rebuilding the Derivation curve 144 if(this->derivation == 0)203 if(this->derivation <= 1) 145 204 { 146 205 tmpNode = firstNode; … … 202 261 } 203 262 263 Vector BezierCurve::calcAcc (float t) 264 { 265 return dirCurve->dirCurve->calcPos(t); 266 } 267 204 268 /** 205 269 \brief Calculates the Quaternion needed for our rotations … … 374 438 } 375 439 440 Vector UPointCurve::calcAcc (float t) 441 { 442 } 443 376 444 /** 377 445 \brief Calculates the Quaternion needed for our rotations -
orxonox/trunk/src/curve.h
r3365 r3433 23 23 Vector curvePoint; //!< The point on the Cureve at a local Time. 24 24 float localTime; //!< If the time of one point is asked more than once the programm will not calculate it again. 25 Curve* dirCurve; //!< The derivation-curve of this Curve.26 25 int derivation; //!< Which derivation of a Curve is this. 27 26 … … 42 41 virtual void rebuild(void) = 0; 43 42 public: 43 Curve* dirCurve; //!< The derivation-curve of this Curve. 44 44 void addNode(const Vector& newNode); 45 void addNode(const Vector& newNode, unsigned int insertPosition); 45 46 Vector getNode(unsigned int nodeToFind); 46 47 inline int getNodeCount(void) { return this->nodeCount;} … … 48 49 virtual Vector calcPos(float t) = 0; 49 50 virtual Vector calcDir(float t) = 0; 51 virtual Vector calcAcc(float t) = 0; 50 52 virtual Quaternion calcQuat(float t) = 0; 51 53 54 // DEBUG 55 void debug(void); 52 56 }; 53 57 … … 69 73 Vector calcPos(float t); 70 74 Vector calcDir(float t); 75 Vector calcAcc(float t); 71 76 Quaternion calcQuat(float t); 72 77 … … 105 110 Vector calcPos(float t); 106 111 Vector calcDir(float t); 112 Vector calcAcc(float t); 107 113 Quaternion calcQuat(float t); 108 114 -
orxonox/trunk/src/debug.h
r3395 r3433 34 34 /////////////////////////////////////////////////// 35 35 36 #ifdef 36 #ifdef DEBUG 37 37 extern int verbose; 38 38 #define PRINTF(x) \ -
orxonox/trunk/src/environment.cc
r3396 r3433 55 55 glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z); 56 56 //rotate 57 this->getAbsDir 57 this->getAbsDir().matrix (matrix); 58 58 glMultMatrixf((float*)matrix); 59 59 60 glMatrixMode(GL_MODELVIEW);61 60 this->model->draw(); 62 61 } -
orxonox/trunk/src/game_loader.cc
r3225 r3433 25 25 #include "command_node.h" 26 26 #include "vector.h" 27 #include "track.h"28 27 29 28 #include <string.h> -
orxonox/trunk/src/gui/Makefile.in
r3424 r3433 234 234 esac; \ 235 235 done; \ 236 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/gui/Makefile'; \236 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/gui/Makefile'; \ 237 237 cd $(top_srcdir) && \ 238 $(AUTOMAKE) -- foreignsrc/gui/Makefile238 $(AUTOMAKE) --gnu src/gui/Makefile 239 239 .PRECIOUS: Makefile 240 240 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
orxonox/trunk/src/importer/Makefile.in
r3429 r3433 215 215 esac; \ 216 216 done; \ 217 echo ' cd $(top_srcdir) && $(AUTOMAKE) -- foreignsrc/importer/Makefile'; \217 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/importer/Makefile'; \ 218 218 cd $(top_srcdir) && \ 219 $(AUTOMAKE) -- foreignsrc/importer/Makefile219 $(AUTOMAKE) --gnu src/importer/Makefile 220 220 .PRECIOUS: Makefile 221 221 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status -
orxonox/trunk/src/p_node.cc
r3370 r3433 214 214 */ 215 215 Quaternion PNode::getAbsDir () 216 {} 216 { 217 return this->absDirection; 218 } 217 219 218 220 -
orxonox/trunk/src/stdincl.h
r3365 r3433 22 22 #endif 23 23 24 #ifndef __APPLE__ 25 #include <SDL/SDL.h> 26 #include <GL/gl.h> 27 #include <GL/glu.h> 28 #else 29 #include <SDL.h> 30 #include <OpenGL/gl.h> 31 #include <OpenGL/glu.h> 32 #endif 24 #include "glincl.h" 33 25 26 // MATH // 27 #include "matrix.h" 34 28 #include "vector.h" 35 #include "matrix.h"36 29 #include "curve.h" 37 //#include "coordinates.h" 30 38 31 #include "list.h" 39 32 #include "list_template.h" 40 #include "error.h"41 #include "debug.h"42 33 #include "message_structures.h" 43 34 #include "orxonox.h" … … 45 36 #include "base_object.h" 46 37 38 #include "error.h" 39 #include "debug.h" 40 47 41 #endif /* _STDINCL_H */ -
orxonox/trunk/src/track_manager.cc
r3365 r3433 1 2 3 1 /* 4 2 orxonox - the future of 3D-vertical-scrollers … … 12 10 13 11 ### File Specific: 14 main-programmer: Patrick Boenzli12 main-programmer: Benjamin Grauer 15 13 co-programmer: ... 16 14 */ … … 19 17 #include "track_manager.h" 20 18 #include <stdarg.h> 21 19 #include "p_node.h" 22 20 23 21 using namespace std; … … 38 36 this->startingTime = 0; //!< \todo eventually set this to the max time of TrackManager. 39 37 this->duration = 1; 38 this->endTime = 1; 39 this->jumpTime = 0; 40 40 this->curveType = BEZIERCURVE; 41 41 this->nodeCount = 0; 42 42 this->childCount = 0; 43 43 this->name = NULL; 44 this->startPoint = Vector(0,0,0);45 this->startTangentPoint = Vector(0,0,0);46 44 this->curve = NULL; 47 45 this->children = NULL; … … 111 109 this->maxTime = 0; 112 110 this->trackElemCount = 1; 111 this->bindSlave = NULL; 113 112 } 114 113 … … 151 150 { 152 151 this->currentTrackElem->childCount = childCount; 152 this->currentTrackElem->mainJoin = true; 153 153 this->currentTrackElem->children = new TrackElement*[childCount]; 154 154 for (int i=0; i<childCount; i++) … … 156 156 this->currentTrackElem->children[i] = new TrackElement(); 157 157 this->currentTrackElem->children[i]->ID = ++trackElemCount; 158 this->currentTrackElem->children[i]->startingTime = this->currentTrackElem->startingTime+this->currentTrackElem->duration; 159 this->currentTrackElem->children[i]->startPoint = this->currentTrackElem->curve->getNode(this->currentTrackElem->curve->getNodeCount()); 160 this->currentTrackElem->children[i]->startTangentPoint = (this->currentTrackElem->children[i]->startPoint *2) - this->currentTrackElem->curve->getNode(this->currentTrackElem->curve->getNodeCount()-1); 158 this->currentTrackElem->children[i]->startingTime = this->currentTrackElem->endTime + this->currentTrackElem->jumpTime; 159 this->addPoint(this->currentTrackElem->curve->getNode(this->currentTrackElem->curve->getNodeCount()), this->currentTrackElem->children[i]); 161 160 } 162 161 } … … 193 192 \brief curveType The Type to set 194 193 */ 195 void TrackManager::setCurveType(CurveType curveType )196 { 197 if (!t his->currentTrackElem->isFresh)194 void TrackManager::setCurveType(CurveType curveType, TrackElement* trackElem) 195 { 196 if (!trackElem->isFresh) 198 197 { 199 198 PRINTF(2)("It is not possible to change the type of a Curve after you have have appended some points to it\n"); 200 199 return; 201 200 } 202 t his->currentTrackElem->curveType = curveType;201 trackElem->curveType = curveType; 203 202 switch (curveType) 204 203 { 205 204 case BEZIERCURVE: 206 t his->currentTrackElem->curve = new BezierCurve();205 trackElem->curve = new BezierCurve(); 207 206 break; 208 207 case UPOINTCURVE: 209 t his->currentTrackElem->curve = new UPointCurve();208 trackElem->curve = new UPointCurve(); 210 209 break; 211 210 } … … 220 219 { 221 220 this->currentTrackElem->duration = time; 221 this->currentTrackElem->endTime = this->currentTrackElem->startingTime + time; 222 222 } 223 223 … … 240 240 if (trackElem->isFresh) 241 241 { 242 this->setCurveType(BEZIERCURVE );242 this->setCurveType(BEZIERCURVE, trackElem); 243 243 trackElem->isFresh = false; 244 if(trackElem != this->firstTrackElem)245 {246 this->addPoint(trackElem->startPoint);247 this->addPoint(trackElem->startTangentPoint);248 }249 244 } 250 245 trackElem->curve->addNode(newPoint); … … 374 369 void TrackManager::joinV(unsigned int count, int* trackIDs) 375 370 { 376 printf("Joining %d tracks to Track %d\n", count, trackIDs[0]);371 printf("Joining %d tracks and merging to Track %d\n", count, trackIDs[0]); 377 372 378 373 // chanching work-on to temporary value. going back at the end. 379 374 int tmpCurrentWorkingID = this->currentTrackElem->ID; 380 375 this->workOn(trackIDs[0]); 381 382 376 TrackElement* firstJoint = this->currentTrackElem; 377 float tmpLatestTime = firstJoint->endTime; 378 383 379 Vector tmpEndPoint = firstJoint->curve->getNode(firstJoint->curve->getNodeCount()); 384 Vector tmpTangentPoint = firstJoint->curve->getNode(firstJoint->curve->getNodeCount()-1); 380 Vector tmpTangentPoint = firstJoint->curve->getNode(firstJoint->curve->getNodeCount()-1); 381 Vector tmpc2Point = firstJoint->curve->getNode(firstJoint->curve->getNodeCount()-2); 385 382 firstJoint->isJoined = true; 386 firstJoint->mainJoin = true;383 // firstJoint->mainJoin = true; 387 384 if(!firstJoint->isHotPoint) 388 385 this->setSavePoint(); 389 386 // Timing: 387 for (int i = 0; i < count; i++) 388 { 389 TrackElement* tmpJoinElem = this->findTrackElementByID(trackIDs[i]); 390 if (tmpJoinElem->childCount == 0 391 && tmpJoinElem->endTime > tmpLatestTime) 392 tmpLatestTime = tmpJoinElem->endTime; 393 } 394 // time the main Join. 395 firstJoint->jumpTime = tmpLatestTime - firstJoint->endTime; 396 397 // Joining: 390 398 for (int i = 1; i < count; i++) 391 399 { … … 395 403 else 396 404 { 405 this->addPoint(tmpc2Point, tmpJoinElem); 397 406 this->addPoint(tmpTangentPoint, tmpJoinElem); 398 407 this->addPoint(tmpEndPoint, tmpJoinElem); 408 // time all other Joins 409 tmpJoinElem->jumpTime = tmpLatestTime - tmpJoinElem->endTime; 399 410 400 411 //Copying Joint-Info … … 403 414 tmpJoinElem->isSavePoint = firstJoint->isSavePoint; 404 415 tmpJoinElem->isFork = firstJoint->isFork; 405 416 406 417 tmpJoinElem->isJoined = true; 407 418 } 408 419 } 420 if(firstJoint->childCount > 0) 421 for(int i = 0; i < firstJoint->childCount; i++) 422 { 423 printf("Setting startingTime of %d to %f.\n", firstJoint->children[i]->ID, tmpLatestTime); 424 firstJoint->children[i]->startingTime = tmpLatestTime; 425 firstJoint->children[i]->endTime = tmpLatestTime+firstJoint->children[i]->duration; 426 } 427 409 428 // returning to the TrackElement we were working on. 410 429 this->workOn(tmpCurrentWorkingID); 411 430 } 412 431 432 /** 433 \brief finalizes the TrackSystem. after this it will not be editable anymore 434 435 \todo check for any inconsistencies, output errors 436 */ 437 void TrackManager::finalize(void) 438 { 439 for (int i = 1; i<= trackElemCount ;i++) 440 { 441 TrackElement* tmpElem = findTrackElementByID(i); 442 if (tmpElem->childCount>0 && tmpElem->mainJoin) 443 { 444 for (int j = 0; j < tmpElem->childCount; j++) 445 { 446 447 // c1-continuity 448 tmpElem->children[j]->curve->addNode(tmpElem->children[j]->curve->getNode(0) + 449 ((tmpElem->children[j]->curve->getNode(0) - 450 tmpElem->curve->getNode(tmpElem->curve->getNodeCount()-1)) 451 ),2); 452 tmpElem->children[j]->nodeCount++; 453 // c2-continuity 454 tmpElem->children[j]->curve->addNode((tmpElem->curve->getNode(tmpElem->curve->getNodeCount())- 455 tmpElem->curve->getNode(tmpElem->curve->getNodeCount()-1)) * 4 + 456 tmpElem->curve->getNode(tmpElem->curve->getNodeCount()-2), 3); 457 tmpElem->children[j]->nodeCount++; 458 printf("accelerations: %d-in: count: %d, %f, %f, %f\n %d-out: count: %d %f, %f, %f\n", 459 tmpElem->ID, tmpElem->nodeCount, 460 tmpElem->curve->calcAcc(0.999).x, tmpElem->curve->calcAcc(0.999).y, tmpElem->curve->calcAcc(0.999).z, 461 tmpElem->children[j]->ID, tmpElem->children[j]->nodeCount, 462 tmpElem->children[j]->curve->calcAcc(0).x, tmpElem->children[j]->curve->calcAcc(0).y, tmpElem->children[j]->curve->calcAcc(0).z); 463 } 464 } 465 } 466 } 467 468 413 469 // RUNTIME // 414 470 … … 429 485 Vector TrackManager::calcDir() const 430 486 { 431 return this->currentTrackElem->curve->calcDir((this->localTime -this->currentTrackElem->startingTime)/this->currentTrackElem->duration);487 return this->currentTrackElem->curve->calcDir((this->localTime - this->currentTrackElem->startingTime)/this->currentTrackElem->duration); 432 488 } 433 489 … … 440 496 void TrackManager::tick(float dt) 441 497 { 498 dt /= 1000; 499 printf("CurrentTrackID: %d, LocalTime is: %f, timestep is: %f\n", this->currentTrackElem->ID, this->localTime, dt); 442 500 if (this->localTime <= this->firstTrackElem->duration) 443 501 this->jumpTo(this->localTime); 444 502 this->localTime += dt; 445 if (this->localTime > this->currentTrackElem->startingTime + this->currentTrackElem->duration && this->currentTrackElem->childCount > 0) 446 this->currentTrackElem = this->currentTrackElem->children[0]; 503 if (this->localTime > this->currentTrackElem->endTime 504 && this->currentTrackElem->children) 505 { 506 if (this->currentTrackElem->jumpTime > 0) 507 this->jumpTo(this->localTime + this->currentTrackElem->jumpTime); 508 this->currentTrackElem = this->currentTrackElem->children[0]; 509 } 510 if (this->bindSlave) 511 { 512 Vector tmp = this->calcPos(); 513 Quaternion quat = Quaternion(this->calcDir(), Vector(this->currentTrackElem->curve->calcAcc((localTime-this->currentTrackElem->startingTime)/this->currentTrackElem->duration).x,1,this->currentTrackElem->curve->calcAcc((localTime-this->currentTrackElem->startingTime)/this->currentTrackElem->duration).z)); 514 this->bindSlave->setAbsCoor(&tmp); 515 this->bindSlave->setAbsDir(&quat); 516 } 447 517 } 448 518 … … 471 541 } 472 542 543 /** 544 \brief Sets the PNode, that should be moved along the Tack 545 \param bindSlave the PNode to set 546 */ 547 void TrackManager::setBindSlave(PNode* bindSlave) 548 { 549 if (!this->bindSlave) 550 this->bindSlave = bindSlave; 551 } 473 552 474 553 … … 500 579 } 501 580 581 /** 582 \brief outputs debug information about the trackManager 583 \param level how much debug 584 */ 502 585 void TrackManager::debug(unsigned int level) const 503 586 { … … 516 599 if(tmpElem->isFresh) 517 600 printf(" has not jet eddited in any way\n"); 518 printf("\n TimeTable: starting at = %f; ends at = %f; duration = %f\n", tmpElem->startingTime, tmpElem->startingTime+tmpElem->duration, tmpElem->duration);601 printf("\n TimeTable: startingTime=%f; endTime=%f; duration=%f; jumpTime=%f\n", tmpElem->startingTime, tmpElem->endTime, tmpElem->duration, tmpElem->jumpTime); 519 602 printf(" consists of %d Points\n", tmpElem->nodeCount); 520 603 if (tmpElem->childCount == 0) … … 536 619 if(tmpElem->isFork) 537 620 { 538 printf(" is A Fork with with %d children. ", tmpElem->childCount);621 printf(" is A Fork with with %d children.\n", tmpElem->childCount); 539 622 } 540 623 if(tmpElem->isJoined) -
orxonox/trunk/src/track_manager.h
r3365 r3433 14 14 #include "stdincl.h" 15 15 16 class PNode; 16 17 17 18 //! condition for choosing a certain Path. \todo implement a useful way. … … 45 46 float startingTime; //!< The time at which this Track begins. 46 47 float duration; //!< The time used to cross this TrackElement (curve). 48 float endTime; //!< The time at which this Track ends. 49 float jumpTime; //!< The Time this Track has to jump to its preceding Track (only >0 if Track isJoined==true) 47 50 CurveType curveType; //!< The CurveType this will have. 48 51 int nodeCount; //!< The count of points this TrackElement has. 49 52 char* name; //!< A name for the Trac. 50 Vector startPoint; //!< A Vector that Points to the first point of the containing Curve. (for c1-steadiness)51 Vector startTangentPoint; //!< A Vector that points into the direction of the previous Curve. (for c1-steadiness)52 53 Curve* curve; //!< The Curve of this TrackElement 53 54 int childCount; //!< The number of Children This TrackElement has. … … 59 60 //! The TrackManager handles the flow of the Players through the game. 60 61 /** 61 \todo write the methodes62 62 63 63 <b>The TrackManager works as followed:</b> \n … … 104 104 float maxTime; //!< The maximal time the track has. 105 105 int trackElemCount; //!< The count of TrackElements that exist. 106 PNode* bindSlave; 106 107 107 108 void initChildren(unsigned int childCount); … … 115 116 // Methods to change the Path (initialisation) 116 117 void workOn(unsigned int trackID); 117 void setCurveType(CurveType curveType); 118 inline void setCurveType(CurveType curveType) { this->setCurveType (curveType, this->currentTrackElem);} 119 void setCurveType(CurveType curveType, TrackElement* trackElem); 118 120 void setDuration(float time); 119 121 bool addPoint(Vector newPoint); … … 126 128 void join(unsigned int count, ...); 127 129 void joinV(unsigned int count, int* trackIDs); 130 void finalize(void); 128 131 129 132 // Methods to calculate the position on the Path (runtime) … … 134 137 void choosePath(int graphID); 135 138 139 void setBindSlave(PNode* bindSlave); 140 136 141 // DEBUG // 137 142 void drawGraph(float dt) const; -
orxonox/trunk/src/world.cc
r3429 r3433 19 19 #include "collision.h" 20 20 #include "track_manager.h" 21 #include "track.h"22 21 #include "player.h" 23 22 #include "command_node.h" … … 143 142 void World::destroy() 144 143 { 144 delete trackManager; 145 145 } 146 146 … … 180 180 trackManager->addPoint(Vector(30,0,5)); 181 181 trackManager->addPoint(Vector(40,0,5)); 182 trackManager->setDuration( .5);182 trackManager->setDuration(2); 183 183 trackManager->setSavePoint(); 184 184 trackManager->addPoint(Vector(50,10,10)); … … 187 187 trackManager->addPoint(Vector(80,0,-10)); 188 188 trackManager->addPoint(Vector(90,0,-10)); 189 trackManager->setDuration( .5);189 trackManager->setDuration(5); 190 190 trackManager->setSavePoint(); 191 191 trackManager->addPoint(Vector(110,0,5)); … … 194 194 trackManager->addPoint(Vector(140,0,-10)); 195 195 trackManager->addPoint(Vector(150,0,-10)); 196 trackManager->setDuration( .5);196 trackManager->setDuration(3); 197 197 int fork11, fork12, fork13, fork14; 198 198 trackManager->fork(4, &fork11, &fork12, &fork13, &fork14); … … 200 200 trackManager->addPoint(Vector(170, 0, -15)); 201 201 trackManager->addPoint(Vector(180, 0, -15)); 202 trackManager->setDuration(3); 202 203 trackManager->workOn(fork12); 203 204 trackManager->addPoint(Vector(170, 0, 10)); … … 205 206 trackManager->addPoint(Vector(190,2,5)); 206 207 trackManager->addPoint(Vector(200,2,5)); 208 trackManager->setDuration(7); 207 209 int fork21, fork22; 208 210 trackManager->fork(2, &fork21, &fork22); … … 213 215 trackManager->addPoint(Vector(250, 0, 0)); 214 216 trackManager->addPoint(Vector(260, 0, 5)); 217 trackManager->setDuration(3); 215 218 trackManager->join(2, fork12, fork11); 216 219 trackManager->workOn(fork22); … … 219 222 trackManager->addPoint(Vector(240, 0, 10)); 220 223 trackManager->addPoint(Vector(250, 0, 5)); 224 trackManager->setDuration(6); 221 225 trackManager->workOn(fork13); 222 226 trackManager->addPoint(Vector(200,-10,5)); 223 227 trackManager->addPoint(Vector(250,-10,5)); 224 printf("fork14: %d\n", fork14);228 trackManager->setDuration(3); 225 229 trackManager->workOn(fork14); 226 230 trackManager->addPoint(Vector(200,15,0)); 227 231 trackManager->addPoint(Vector(210,0,10)); 228 229 230 232 trackManager->setDuration(1); 231 233 trackManager->join(4, fork21, fork22, fork13, fork14); 232 234 trackManager->workOn(10); 235 trackManager->addPoint(Vector(250,-10,5)); 236 trackManager->addPoint(Vector(260,-10,5)); 237 trackManager->finalize(); 238 233 239 /*monitor progress*/ 234 240 this->glmis->step(); 235 241 236 242 /* 237 tmpCurve->addNode(Vector(10,0,-10)); 238 //tmpCurve->addNode(Vector(10,2,5)); 239 //tmpCurve->addNode(Vector(10,3,-5)); 240 // tmpCurve->addNode(Vector(10,1,5)); 241 tmpCurve->addNode(Vector(10,0,5)); 243 tmpCurve->addNode(Vector(10, -1, -1)); 244 tmpCurve->addNode(Vector(10, -2, 2)); 245 tmpCurve->addNode(Vector(10, 3, 3)); 246 tmpCurve->addNode(Vector(10, 4, -4), 0); 247 tmpCurve->addNode(Vector(10, -1, -1)); 248 tmpCurve->addNode(Vector(10, -2, 2)); 249 tmpCurve->addNode(Vector(10, 3, 3)); 250 tmpCurve->addNode(Vector(10, 4, -4), 0); 251 tmpCurve->debug(); 242 252 */ 243 253 switch(this->debugWorldNr) … … 254 264 this->nullParent->setName ("NullParent"); 255 265 256 // create some path nodes257 this->pathnodes = new Vector[6];258 this->pathnodes[0] = Vector(0, 0, 0);259 this->pathnodes[1] = Vector(1000, 0, 0);260 // this->pathnodes[2] = Vector(-100, 140, 0);261 // this->pathnodes[3] = Vector(0, 180, 0);262 // this->pathnodes[4] = Vector(100, 140, 0);263 // this->pathnodes[5] = Vector(100, 40, 0);264 265 // create the tracks266 this->tracklen = 2;267 this->track = new Track[2];268 for( int i = 0; i < this->tracklen; i++)269 {270 this->track[i] = Track( i, (i+1)%this->tracklen, &this->pathnodes[i], &this->pathnodes[(i+1)%this->tracklen]);271 }272 266 // !\todo old track-system has to be removed 273 267 … … 281 275 this->spawn (myPlayer); 282 276 this->localPlayer = myPlayer; 283 284 277 /*monitor progress*/ 285 278 this->glmis->step(); … … 309 302 /*monitor progress*/ 310 303 this->glmis->step(); 304 305 trackManager->setBindSlave(env); 311 306 312 307 break; … … 338 333 339 334 340 341 // create the tracks342 this->tracklen = 6;343 this->track = new Track[6];344 for( int i = 0; i < this->tracklen; i++)345 {346 this->track[i] = Track( i, (i+1)%this->tracklen, &this->pathnodes[i], &this->pathnodes[(i+1)%this->tracklen]);347 }348 335 349 336 // create a player … … 543 530 } 544 531 */ 545 //draw track546 glBegin(GL_LINES);547 glColor3f(0.0, 1.0, 1.0);548 for( int i = 0; i < tracklen; i++)549 {550 glVertex3f(pathnodes[i].x,pathnodes[i].y,pathnodes[i].z);551 glVertex3f(pathnodes[(i+1)%tracklen].x,pathnodes[(i+1)%tracklen].y,pathnodes[(i+1)%tracklen].z);552 }553 glEnd();554 555 532 /* 556 533 glBegin(GL_LINE_STRIP); … … 565 542 trackManager->drawGraph(.01); 566 543 trackManager->debug(2); 567 delete trackManager; 568 569 /* 544 /* 570 545 glBegin(GL_LINES); 571 546 float i; … … 678 653 t = loc->part; 679 654 680 if( t >= trac klen )655 if( t >= traclen ) 681 656 { 682 657 printf("An entity is out of the game area\n"); … … 736 711 void World::unload() 737 712 { 738 if( pathnodes) delete []pathnodes; 739 if( track) delete []pathnodes; 740 } 741 742 743 void World::setTrackLen(Uint32 len) 744 { 745 this->tracklen = len; 746 } 747 748 int World::getTrackLen() 749 { 750 return this->tracklen; 751 } 752 713 714 } 753 715 754 716 … … 910 872 this->update (); 911 873 this->localCamera->timeSlice(dt); 874 this->trackManager->tick(dt); 912 875 } 913 876 this->lastFrame = currentFrame; -
orxonox/trunk/src/world.h
r3419 r3433 12 12 13 13 class TrackManager; 14 class Track;15 14 class WorldEntity; 16 15 class Camera; … … 49 48 virtual void releaseLoadScreen(); 50 49 51 void setTrackLen (Uint32 tracklen);52 int getTrackLen ();53 50 //bool system_command (Command* cmd); 54 51 Camera* getCamera (); … … 61 58 // base level data 62 59 TrackManager* trackManager; 63 Track* track;64 Uint32 tracklen; // number of Tracks the World consist of65 60 Vector* pathnodes; 66 61 Camera* localCamera;
Note: See TracChangeset
for help on using the changeset viewer.