Changeset 4010 in orxonox.OLD for orxonox/trunk/src/story_entities
- Timestamp:
- May 2, 2005, 3:14:57 PM (20 years ago)
- Location:
- orxonox/trunk/src/story_entities
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/story_entities/campaign.cc
r3832 r4010 19 19 #include "campaign.h" 20 20 21 #include "game_loader.h" 21 22 #include "story_entity.h" 22 23 … … 34 35 this->isInit = false; 35 36 } 36 37 Campaign::Campaign ( TiXmlElement* root) 38 { 39 TiXmlElement* element; 40 const char* string; 41 int id; 42 43 PRINTF0("Loading Campaign...\n"); 44 45 assert( root != NULL); 46 GameLoader* loader = GameLoader::getInstance(); 47 48 this->entities = new tList<StoryEntity>(); 49 this->isInit = false; 50 51 // grab all the necessary parameters 52 string = grabParameter( root, "identifier"); 53 if( string == NULL || sscanf(string, "%d", &id) != 1) 54 { 55 PRINTF0("Campaign is missing a proper 'identifier'\n"); 56 this->setStoryID( -1); 57 } 58 else this->setStoryID( id); 59 60 // find WorldList 61 element = root->FirstChildElement( "WorldList"); 62 if( element == NULL) 63 { 64 PRINTF0("Campaign is missing a proper 'WorldList'\n"); 65 } 66 else 67 element = element->FirstChildElement(); 68 69 // load Worlds/Subcampaigns/Whatever 70 StoryEntity* lastCreated = NULL; 71 while( element != NULL) 72 { 73 printf("Campaign: Constructor: adding a world\n"); 74 StoryEntity* created = (StoryEntity*) loader->fabricate( element); 75 /* 76 if( lastCreated != NULL) 77 created->setNextStoryID( lastCreated->getStoryID()); 78 else 79 created->setNextStoryID( WORLD_ID_GAMEEND); 80 */ 81 if( created != NULL) 82 { 83 this->addEntity( created); 84 lastCreated = created; 85 } 86 element = element->NextSiblingElement(); 87 } 88 //if( lastCreated != NULL) 89 //lastCreated->setStoryID( WORLD_ID_GAMEEND); 90 } 37 91 38 92 Campaign::~Campaign () {} -
orxonox/trunk/src/story_entities/campaign.h
r3608 r4010 14 14 public: 15 15 Campaign (); 16 Campaign ( TiXmlElement* root); 16 17 virtual ~Campaign (); 17 18 -
orxonox/trunk/src/story_entities/world.cc
r3993 r4010 1 1 2 2 3 /* … … 43 44 #include "glmenu_imagescreen.h" 44 45 #include "list.h" 46 #include "game_loader.h" 45 47 46 48 #include "animation3d.h" 47 49 50 #include "substring.h" 48 51 49 52 using namespace std; 50 51 53 52 54 WorldInterface* WorldInterface::singletonRef = 0; … … 114 116 } 115 117 116 118 CREATE_FACTORY(World); 119 120 World::World( TiXmlElement* root) 121 { 122 this->constuctorInit("", -1); 123 124 const char *string; 125 char *name; 126 int id; 127 128 PRINTF0("Creating a World\n"); 129 130 // identifier 131 string = grabParameter( root, "identifier"); 132 if( string == NULL || sscanf(string, "%d", &id) != 1) 133 { 134 PRINTF0("World is missing a proper 'identifier'\n"); 135 this->setStoryID( -1); 136 } 137 else setStoryID( id); 138 139 // next id 140 string = grabParameter( root, "nextid"); 141 if( string == NULL || sscanf(string, "%d", &id) != 1) 142 { 143 PRINTF0("World is missing a proper 'nextid'\n"); 144 this->setStoryID( -1); 145 } 146 else setNextStoryID( id); 147 148 149 // path 150 string = grabParameter( root, "path"); 151 if( string == NULL) 152 { 153 PRINTF0("World is missing a proper 'path'\n"); 154 this->setPath( NULL); 155 } 156 else 157 { 158 name = new char[strlen(string + 2)]; 159 strcpy( name, string); 160 this->setPath( name); 161 } 162 } 117 163 118 164 /** … … 123 169 World::World (char* name) 124 170 { 125 this-> init(name, -1);171 this->constuctorInit(name, -1); 126 172 //NullParent* np = NullParent::getInstance(); 127 173 } … … 133 179 World::World (int worldID) 134 180 { 135 this-> init(NULL, worldID);181 this->constuctorInit(NULL, worldID); 136 182 } 137 183 … … 178 224 NO LEVEL LOADING HERE - NEVER! 179 225 */ 180 void World:: init(char* name, int worldID)226 void World::constuctorInit(char* name, int worldID) 181 227 { 182 228 this->setClassName ("World"); 183 229 184 this->worldName = name; 230 //this->worldName = name; 231 //this->worldName = new char[strlen(name)+1]; 232 //strcpy(this->worldName, name); 185 233 this->debugWorldNr = worldID; 186 234 this->entities = new tList<WorldEntity>(); 187 AnimationPlayer::getInstance(); // initializes the animationPlayer188 235 } 189 236 … … 201 248 wi->init(this); 202 249 this->garbageCollector = GarbageCollector::getInstance(); 250 203 251 this->trackManager = TrackManager::getInstance(); 204 252 this->lightMan = LightManager::getInstance(); … … 206 254 this->nullParent->setName ("NullParent"); 207 255 256 AnimationPlayer::getInstance(); // initializes the animationPlayer 257 208 258 } 209 259 … … 213 263 */ 214 264 ErrorMessage World::load() 215 { 216 // BezierCurve* tmpCurve = new BezierCurve(); 217 if(this->debugWorldNr != -1) 218 { 219 // initializing Font 220 this->glmis->step(); 265 { 266 PRINTF0("> Loading world: '%s'\n", getPath()); 267 268 GameLoader* loader = GameLoader::getInstance(); 269 270 if( getPath() == NULL) 271 { 272 PRINTF0("World has no path specified for loading"); 273 return (ErrorMessage){213,"Path not specified","World::load()"}; 274 } 275 276 TiXmlDocument* XMLDoc = new TiXmlDocument( path); 277 // load the campaign document 278 if( !XMLDoc->LoadFile()) 279 //this->glmis->step(); 280 281 { 282 // report an error 283 PRINTF0("Error loading XML File: %s @ %d:%d\n", XMLDoc->ErrorDesc(), XMLDoc->ErrorRow(), XMLDoc->ErrorCol()); 284 delete XMLDoc; 285 return (ErrorMessage){213,"XML File parsing error","World::load()"}; 286 } 287 288 // check basic validity 289 TiXmlElement* root = XMLDoc->RootElement(); 290 assert( root != NULL); 291 292 if( root == NULL || root->Value() == NULL || strcmp( root->Value(), "WorldDataFile")) 293 { 294 // report an error 295 PRINTF0("Specified XML File is not an orxonox world data file (WorldDataFile element missing)\n"); 296 delete XMLDoc; 297 return (ErrorMessage){213,"Path not a WorldDataFile","World::load()"}; 298 } 299 300 // load the parameters 301 // name 302 char* temp; 303 const char* string = grabParameter( root, "name"); 304 if( string == NULL) 305 { 306 PRINTF0("World is missing a proper 'name'\n"); 307 string = "Unknown"; 308 temp = new char[strlen(string + 2)]; 309 strcpy( temp, string); 310 this->worldName = temp; 311 } 312 else 313 { 314 temp = new char[strlen(string + 2)]; 315 strcpy( temp, string); 316 this->worldName = temp; 317 } 318 319 320 // find WorldEntities 321 TiXmlElement* element = root->FirstChildElement( "WorldEntities"); 322 323 if( element == NULL) 324 { 325 PRINTF0("World is missing 'WorldEntities'\n"); 326 } 327 else 328 { 329 element = element->FirstChildElement(); 330 // load Players/Objects/Whatever 331 PRINTF0("Loading WorldEntities\n"); 332 while( element != NULL) 333 { 334 WorldEntity* created = (WorldEntity*) loader->fabricate( element); 335 if( created != NULL) this->spawn( created); 336 // if we load a 'Player' we use it as localPlayer 337 //todo do this more elegant 338 if( element->Value() != NULL && !strcmp( element->Value(), "Player")) localPlayer = (Player*) created; 339 if( element->Value() != NULL && !strcmp( element->Value(), "SkyBox")) skyBox = (SkyBox*) created; 340 element = element->NextSiblingElement(); 341 } 342 PRINTF0("Done loading WorldEntities\n"); 343 } 344 345 // find Track 346 /*element = root->FirstChildElement( "Track"); 347 if( element == NULL) 348 { 349 PRINTF0("============>>>>>>>>>>>>>>>>>World is missing a 'Track'\n"); 350 } 351 else 352 { 353 //load track 354 PRINTF0("============>>>>>>>>>>>>>>>>Loading Track\n"); 355 356 trackManager->loadTrack( element); 357 trackManager->finalize(); 358 PRINTF0("============>>>>>>>>>>>>>>>>Done loading Track\n"); 359 }*/ 360 361 // free the XML data 362 delete XMLDoc; 363 364 // finalize world 365 // initialize Font 366 // testFont = new FontSet(); 367 // testFont->buildFont("../data/pictures/font.tga"); 368 369 // create null parent 370 this->nullParent = NullParent::getInstance (); 371 this->nullParent->setName ("NullParent"); 372 373 // finalize myPlayer 374 if( localPlayer == NULL) 375 { 376 PRINTF0("No Player specified in World '%s'\n", this->worldName); 377 return (ErrorMessage){213,"No Player defined","World::load()"}; 378 } 379 380 // bind input 381 Orxonox *orx = Orxonox::getInstance (); 382 orx->getLocalInput()->bind (localPlayer); 383 384 // bind camera 385 this->localCamera = new Camera(); 386 this->localCamera->setName ("camera"); 387 //this->localCamera->bind (localPlayer); 388 this->localPlayer->addChild (this->localCamera); 389 390 391 // stuff beyond this point remains to be loaded properly 392 221 393 // initializing the TrackManager 222 394 this->trackManager = TrackManager::getInstance(); 223 395 //trackManager->addPoint(Vector(0,0,0)); 224 396 trackManager->addPoint(Vector(150, -35, 5)); … … 278 450 279 451 280 /*monitor progress*/ 281 this->glmis->step(); 282 283 // LIGHT initialisation 284 285 lightMan->setAmbientColor(.1,.1,.1); 286 lightMan->addLight(); 287 // lightMan->setAttenuation(1.0, .01, 0.0); 288 // lightMan->setDiffuseColor(1,1,1); 289 // lightMan->addLight(1); 290 // lightMan->setPosition(20, 10, -20); 291 // lightMan->setDiffuseColor(0,0,0); 292 lightMan->debug(); 293 294 switch(this->debugWorldNr) 295 { 296 /* 297 this loads the hard-coded debug world. this only for simplicity and will be 298 removed by a reald world-loader, which interprets a world-file. 299 if you want to add an own debug world, just add a case DEBUG_WORLD_[nr] and 300 make whatever you want... 301 */ 302 case DEBUG_WORLD_0: 303 { 304 lightMan->setPosition(-5.0, 10.0, -40.0); 305 306 // !\todo old track-system has to be removed 307 308 //create helper for player 309 //HelperParent* hp = new HelperParent (); 310 /* the player has to be added to this helper */ 311 312 // create a player 313 this->localPlayer = new Player (); 314 this->localPlayer->setName ("player"); 315 this->spawn (this->localPlayer); 316 /*monitor progress*/ 317 //this->glmis->step(); 318 this->glmis->step(); 319 320 // bind input 321 Orxonox *orx = Orxonox::getInstance (); 322 orx->getLocalInput()->bind (this->localPlayer); 452 // LIGHT initialisation 453 lightMan = LightManager::getInstance(); 454 lightMan->setAmbientColor(.1,.1,.1); 455 lightMan->addLight(); 456 // lightMan->setAttenuation(1.0, .01, 0.0); 457 // lightMan->setDiffuseColor(1,1,1); 458 // lightMan->addLight(1); 459 // lightMan->setPosition(20, 10, -20); 460 // lightMan->setDiffuseColor(0,0,0); 461 lightMan->debug(); 462 lightMan->setPosition(-5.0, 10.0, -40.0); 463 464 // trackManager->setBindSlave(env); 465 PNode* tn = trackManager->getTrackNode(); 466 tn->addChild(this->localPlayer); 467 468 //localCamera->setParent(TrackNode::getInstance()); 469 tn->addChild(this->localCamera); 470 localCamera->lookAt(tn); 471 this->localPlayer->setMode(PNODE_ALL); 472 Vector* cameraOffset = new Vector (0, 5, -10); 473 trackManager->condition(2, LEFTRIGHT, this->localPlayer); 474 475 476 // initialize debug coord system 477 objectList = glGenLists(1); 478 glNewList (objectList, GL_COMPILE); 479 480 // trackManager->drawGraph(.01); 481 trackManager->debug(2); 482 glEndList(); 483 484 terrain = new Terrain("../data/worlds/newGround.obj"); 485 terrain->setRelCoor(Vector(0,-10,0)); 486 this->spawn(terrain); 487 488 } 489 490 void World::loadDebugWorld(int worldID) 491 { 492 /*monitor progress*/ 493 this->glmis->step(); 494 495 // LIGHT initialisation 496 497 lightMan->setAmbientColor(.1,.1,.1); 498 lightMan->addLight(); 499 // lightMan->setAttenuation(1.0, .01, 0.0); 500 // lightMan->setDiffuseColor(1,1,1); 501 // lightMan->addLight(1); 502 // lightMan->setPosition(20, 10, -20); 503 // lightMan->setDiffuseColor(0,0,0); 504 lightMan->debug(); 505 506 switch(this->debugWorldNr) 507 { 508 /* 509 this loads the hard-coded debug world. this only for simplicity and will be 510 removed by a reald world-loader, which interprets a world-file. 511 if you want to add an own debug world, just add a case DEBUG_WORLD_[nr] and 512 make whatever you want... 513 */ 514 case DEBUG_WORLD_0: 515 { 516 lightMan->setPosition(-5.0, 10.0, -40.0); 517 518 // !\todo old track-system has to be removed 519 520 //create helper for player 521 //HelperParent* hp = new HelperParent (); 522 /* the player has to be added to this helper */ 523 524 // create a player 525 this->localPlayer = new Player (); 526 this->localPlayer->setName ("player"); 527 this->spawn (this->localPlayer); 528 /*monitor progress*/ 529 //this->glmis->step(); 530 this->glmis->step(); 531 532 // bind input 533 Orxonox *orx = Orxonox::getInstance (); 534 orx->getLocalInput()->bind (this->localPlayer); 323 535 324 325 326 536 // bind camera 537 this->localCamera = new Camera(); 538 this->localCamera->setName ("camera"); 327 539 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 540 /*monitor progress*/ 541 this->glmis->step(); 542 543 // Create SkySphere 544 // this->skySphere = new Skysphere("../data/pictures/sky-replace.jpg"); 545 // this->skySphere->setName("SkySphere"); 546 // this->localCamera->addChild(this->skySphere); 547 // this->spawn(this->skySphere); 548 skyBox = new SkyBox(); 549 skyBox->setTexture("pictures/sky/skybox", "jpg"); 550 skyBox->setParent(localCamera); 551 this->spawn(skyBox); 552 553 /*monitor progress*/ 554 this->glmis->step(); 343 555 344 556 345 346 347 557 WorldEntity* env = new Environment(); 558 env->setName ("env"); 559 this->spawn(env); 348 560 349 561 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 562 /* 563 Vector* es = new Vector (10, 5, 0); 564 Quaternion* qs = new Quaternion (); 565 WorldEntity* pr = new Primitive(P_CYLINDER); 566 pr->setName("primitive"); 567 this->spawn(pr, this->localPlayer, es, qs, PNODE_MOVEMENT); 568 */ 569 570 /*monitor progress*/ 571 this->glmis->step(); 572 573 // trackManager->setBindSlave(env); 574 PNode* tn = trackManager->getTrackNode(); 575 tn->addChild(this->localPlayer); 576 this->localCamera->lookAt(tn); 577 578 //localCamera->setParent(TrackNode::getInstance()); 579 tn->addChild(this->localCamera); 580 // localCamera->lookAt(tn); 581 this->localPlayer->setMode(PNODE_ALL); 582 //Vector* cameraOffset = new Vector (0, 5, -10); 583 trackManager->condition(2, LEFTRIGHT, this->localPlayer); 584 this->glmis->step(); 585 break; 586 } 587 case DEBUG_WORLD_1: 588 { 589 lightMan->setPosition(.0, .0, .0); 590 lightMan->setAttenuation(1.0, .01, 0.0); 591 lightMan->setSpecularColor(1,0,0); 592 this->nullParent = NullParent::getInstance (); 593 this->nullParent->setName ("NullParent"); 594 595 // create a player 596 WorldEntity* myPlayer = new Player(); 597 myPlayer->setName ("player"); 598 this->spawn(myPlayer); 599 this->localPlayer = myPlayer; 388 600 389 390 391 601 // bind input 602 Orxonox *orx = Orxonox::getInstance(); 603 orx->getLocalInput()->bind (myPlayer); 392 604 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 605 // bind camera 606 this->localCamera = new Camera (); 607 this->localCamera->setName ("camera"); 608 this->localCamera->lookAt(LightManager::getInstance()->getLight(0)); 609 this->localCamera->setParent(this->localPlayer); 610 611 // Create SkySphere 612 skySphere = new Skysphere("../data/pictures/sky-replace.jpg"); 613 this->localPlayer->addChild(this->skySphere); 614 this->spawn(this->skySphere); 615 Vector* es = new Vector (20, 0, 0); 616 Quaternion* qs = new Quaternion (); 617 618 lightMan->getLight(0)->setParent(trackManager->getTrackNode()); 619 break; 620 } 621 case DEBUG_WORLD_2: 622 { 623 lightMan->setAmbientColor(.1,.1,.1); 624 lightMan->addLight(); 625 lightMan->setPosition(-5.0, 10.0, -40.0); 626 this->nullParent = NullParent::getInstance (); 627 this->nullParent->setName ("NullParent"); 628 629 // !\todo old track-system has to be removed 630 631 //create helper for player 632 //HelperParent* hp = new HelperParent (); 633 /* the player has to be added to this helper */ 634 635 // create a player 636 this->localPlayer = new Player (); 637 this->localPlayer->setName ("player"); 638 this->spawn (this->localPlayer); 639 /*monitor progress*/ 640 //this->glmis->step(); 641 this->glmis->step(); 642 643 // bind input 644 Orxonox *orx = Orxonox::getInstance (); 645 orx->getLocalInput()->bind (this->localPlayer); 434 646 435 436 437 438 439 647 // bind camera 648 this->localCamera = new Camera(); 649 this->localCamera->setName ("camera"); 650 this->localCamera->lookAt(this->localPlayer); 651 this->localCamera->setParent(this->localPlayer); 440 652 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 653 /*monitor progress*/ 654 this->glmis->step(); 655 656 // Create SkySphere 657 this->skySphere = new Skysphere("../data/pictures/sky-replace.jpg"); 658 this->skySphere->setName("SkySphere"); 659 this->spawn(this->skySphere); 660 this->localCamera->addChild(this->skySphere); 661 this->skySphere->setMode(PNODE_MOVEMENT); 662 /*monitor progress*/ 663 this->glmis->step(); 664 665 666 WorldEntity* baseNode = new Satellite(Vector(1,0,1), 1.2); 667 this->localPlayer->addChild(baseNode); 668 baseNode->setRelCoor(Vector(10.0, 2.0, 1.0)); 669 this->spawn(baseNode); 670 671 WorldEntity* secondNode = new Satellite(Vector(0,0,1), 2.0); 672 baseNode->addChild(secondNode); 673 secondNode->setRelCoor(Vector(0.0, 0.0, 3.0)); 674 this->spawn(secondNode); 675 676 677 WorldEntity* thirdNode = new Satellite(Vector(0,0,1), 1.0); 678 secondNode->addChild(thirdNode); 679 thirdNode->setRelCoor(Vector(2.0, 0.0, 0.0)); 680 this->spawn(thirdNode); 469 681 470 682 471 683 472 473 474 475 684 WorldEntity* c = new Environment(); 685 this->localPlayer->addChild(c); 686 c->setRelCoor(Vector(10.0, 2.0, -1.0)); 687 this->spawn(c); 476 688 477 689 478 690 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 691 Animation3D* animation = new Animation3D(c); 692 animation->setInfinity(ANIM_INF_REPLAY); 693 694 695 animation->addKeyFrame(Vector(0, 0, 0), Quaternion(0, Vector(0,1,0)), 1.0, ANIM_NEG_EXP, ANIM_LINEAR); 696 animation->addKeyFrame(Vector(0, 2, 0), Quaternion(M_PI, Vector(0,1,0)), 1.0, ANIM_NEG_EXP, ANIM_LINEAR); 697 animation->addKeyFrame(Vector(0, 0, 0), Quaternion(0, Vector(0,1,0)), 1.0, ANIM_NEG_EXP, ANIM_LINEAR); 698 699 700 701 702 703 704 /* 705 KeyFrame* f1 = new KeyFrame; 706 f1->position = new Vector(-1.1, 0.0, 2.6); 707 f1->direction = new Quaternion(); 708 f1->time = 1.0; 709 f1->mode = NEG_EXP; 498 710 499 711 500 501 502 503 504 712 KeyFrame* f2 = new KeyFrame; 713 f2->position = new Vector(-2.1, 0.0, 2.6); 714 f2->direction = new Quaternion(); 715 f2->time = 0.1; 716 f2->mode = NEG_EXP; 505 717 506 507 508 509 510 718 KeyFrame* f3 = new KeyFrame; 719 f3->position = new Vector(10.0, 2.0, -1.0); 720 f3->direction = new Quaternion(); 721 f3->time = 0.2; 722 f3->mode = NEG_EXP; 511 723 512 513 514 515 516 724 KeyFrame* f4 = new KeyFrame; 725 f4->position = new Vector(10.0, 5.0, -1.0); 726 f4->direction = new Quaternion(); 727 f4->time = 1.0; 728 f4->mode = NEG_EXP; 517 729 518 730 519 731 520 this->simpleAnimation->animatorBegin(); 521 this->simpleAnimation->selectObject(b); 522 this->simpleAnimation->setAnimationMode(SINGLE); 523 this->simpleAnimation->addKeyFrame(f1); 524 this->simpleAnimation->addKeyFrame(f2); 525 this->simpleAnimation->start(); 526 this->simpleAnimation->selectObject(c); 527 this->simpleAnimation->addKeyFrame(f3); 528 this->simpleAnimation->addKeyFrame(f4); 529 this->simpleAnimation->start(); 530 this->simpleAnimation->animatorEnd(); 531 */ 532 533 /* 534 Vector* es = new Vector (10, 5, 0); 535 Quaternion* qs = new Quaternion (); 536 WorldEntity* pr = new Primitive(P_CYLINDER); 537 pr->setName("primitive"); 538 this->spawn(pr, this->localPlayer, es, qs, PNODE_MOVEMENT); 539 */ 540 541 /*monitor progress*/ 542 this->glmis->step(); 543 544 // trackManager->setBindSlave(env); 545 PNode* tn = trackManager->getTrackNode(); 546 tn->addChild(this->localPlayer); 547 548 //localCamera->setParent(TrackNode::getInstance()); 549 tn->addChild(this->localCamera); 550 // localCamera->lookAt(tn); 551 this->localPlayer->setMode(PNODE_ALL); 552 //Vector* cameraOffset = new Vector (0, 5, -10); 553 trackManager->condition(2, LEFTRIGHT, this->localPlayer); 554 this->glmis->step(); 555 556 break; 557 } 558 default: 559 printf("World::load() - no world with ID %i found", this->debugWorldNr ); 560 } 561 } 562 else if(this->worldName != NULL) 563 { 564 565 } 566 567 // initialize debug coord system 568 objectList = glGenLists(1); 569 glNewList (objectList, GL_COMPILE); 570 571 // trackManager->drawGraph(.01); 572 trackManager->debug(2); 573 glEndList(); 574 575 terrain = new Terrain("../data/worlds/newGround.obj"); 576 terrain->setRelCoor(Vector(0,-10,0)); 577 this->spawn(terrain); 578 579 } 732 this->simpleAnimation->animatorBegin(); 733 this->simpleAnimation->selectObject(b); 734 this->simpleAnimation->setAnimationMode(SINGLE); 735 this->simpleAnimation->addKeyFrame(f1); 736 this->simpleAnimation->addKeyFrame(f2); 737 this->simpleAnimation->start(); 738 this->simpleAnimation->selectObject(c); 739 this->simpleAnimation->addKeyFrame(f3); 740 this->simpleAnimation->addKeyFrame(f4); 741 this->simpleAnimation->start(); 742 this->simpleAnimation->animatorEnd(); 743 */ 744 745 /* 746 Vector* es = new Vector (10, 5, 0); 747 Quaternion* qs = new Quaternion (); 748 WorldEntity* pr = new Primitive(P_CYLINDER); 749 pr->setName("primitive"); 750 this->spawn(pr, this->localPlayer, es, qs, PNODE_MOVEMENT); 751 */ 752 753 /*monitor progress*/ 754 this->glmis->step(); 755 756 // trackManager->setBindSlave(env); 757 PNode* tn = trackManager->getTrackNode(); 758 tn->addChild(this->localPlayer); 759 760 //localCamera->setParent(TrackNode::getInstance()); 761 tn->addChild(this->localCamera); 762 // localCamera->lookAt(tn); 763 this->localPlayer->setMode(PNODE_ALL); 764 //Vector* cameraOffset = new Vector (0, 5, -10); 765 trackManager->condition(2, LEFTRIGHT, this->localPlayer); 766 this->glmis->step(); 767 768 break; 769 } 770 default: 771 printf("World::load() - no world with ID %i found", this->debugWorldNr ); 772 } 773 } 774 580 775 581 776 … … 852 1047 this->tick (); 853 1048 // Update the state 854 this->update (); 1049 this->update (); 855 1050 // Process collision 856 1051 this->collide (); … … 935 1130 } 936 1131 delete iterator; 937 //skySphere->updatePosition(localCamera->absCoordinate); 938 1132 939 1133 /* update tick the rest */ 940 1134 this->trackManager->tick(this->dt); … … 1055 1249 } 1056 1250 1251 void World::setPath( const char* name) 1252 { 1253 this->path = new char[strlen(name)+1]; 1254 strcpy(this->path, name); 1255 } 1256 1257 const char* World::getPath( void) 1258 { 1259 return path; 1260 } -
orxonox/trunk/src/story_entities/world.h
r3851 r4010 11 11 #include "story_entity.h" 12 12 #include "p_node.h" 13 13 #include "xmlparser/tinyxml.h" 14 14 15 15 class World; … … 57 57 World (char* name); 58 58 World (int worldID); 59 World (TiXmlElement* root); 59 60 virtual ~World (); 60 61 … … 70 71 virtual ErrorMessage resume (); 71 72 virtual ErrorMessage destroy (); 73 74 void loadDebugWorld(int worldID); 72 75 73 76 virtual void displayLoadScreen(); … … 85 88 int parentingMode); 86 89 90 const char* getPath(); 91 void setPath( const char* name); 87 92 88 93 private: 89 void init(char* name, int worldID);94 void constuctorInit(char* name, int worldID); 90 95 91 96 Uint32 lastFrame; //!< last time of frame … … 100 105 char* worldName; //!< The name of this World 101 106 int debugWorldNr; //!< The Debug Nr. needed, if something goes wrong 107 char* path; //!< The file from which this world is loaded 102 108 103 109 PNode* nullParent; //!< The zero-point, that everything has as its parent.
Note: See TracChangeset
for help on using the changeset viewer.