Changeset 3433 in orxonox.OLD for orxonox/trunk/src/world.cc
- Timestamp:
- Mar 1, 2005, 2:36:56 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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;
Note: See TracChangeset
for help on using the changeset viewer.