Changeset 4283 in orxonox.OLD for orxonox/branches/physics/src/story_entities
- Timestamp:
- May 24, 2005, 10:32:34 PM (20 years ago)
- Location:
- orxonox/branches/physics/src/story_entities
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/physics/src/story_entities/campaign.cc
r4178 r4283 27 27 #include "list.h" 28 28 29 #include "load_param.h" 30 29 31 using namespace std; 30 32 … … 35 37 this->isInit = false; 36 38 } 39 37 40 Campaign::Campaign ( TiXmlElement* root) 38 41 { -
orxonox/branches/physics/src/story_entities/campaign.h
r4178 r4283 8 8 9 9 class World; 10 class TiXmlElement; 10 11 template<class T> class tList; 11 12 -
orxonox/branches/physics/src/story_entities/story_entity.h
r3629 r4283 11 11 #include "story_def.h" 12 12 #include "error.h" 13 14 13 15 14 //! A class that represents something to play in orxonox. it is a container for worlds, movies, mission briefings, etc... -
orxonox/branches/physics/src/story_entities/world.cc
r4274 r4283 33 33 #include "skybox.h" 34 34 #include "satellite.h" 35 #include "test_entity.h" 35 36 #include "terrain.h" 36 37 #include "light.h" … … 41 42 #include "animation_player.h" 42 43 #include "particle_engine.h" 44 #include "graphics_engine.h" 43 45 44 46 #include "command_node.h" … … 53 55 #include "substring.h" 54 56 57 #include "factory.h" 58 55 59 using namespace std; 56 60 … … 121 125 CREATE_FACTORY(World); 122 126 123 World::World( TiXmlElement* root)127 World::World(const TiXmlElement* root) 124 128 { 125 129 this->constuctorInit("", -1); 126 130 this->path = NULL; 127 const char *string; 128 char *name; 129 int id; 130 131 PRINTF0("Creating a World\n"); 132 133 // identifier 134 string = grabParameter( root, "identifier"); 135 if( string == NULL || sscanf(string, "%d", &id) != 1) 136 { 137 PRINTF0("World is missing a proper 'identifier'\n"); 138 this->setStoryID( -1); 139 } 140 else setStoryID( id); 141 142 // next id 143 string = grabParameter( root, "nextid"); 144 if( string == NULL || sscanf(string, "%d", &id) != 1) 145 { 146 PRINTF0("World is missing a proper 'nextid'\n"); 147 this->setStoryID( -1); 148 } 149 else setNextStoryID( id); 150 151 152 // path 153 string = grabParameter( root, "path"); 154 if( string == NULL) 155 { 156 PRINTF0("World is missing a proper 'path'\n"); 157 this->setPath( NULL); 158 } 159 else 160 { 161 name = new char[strlen(string + 2)]; 162 strcpy( name, string); 163 this->setPath( name); 164 } 131 132 this->loadParams(root); 165 133 } 166 134 … … 201 169 202 170 delete WorldInterface::getInstance(); 203 204 171 delete this->nullParent; 205 172 delete this->entities; … … 208 175 delete this->particleEngine; 209 176 TextEngine::getInstance()->flush(); 210 211 177 delete PhysicsEngine::getInstance(); 212 178 delete AnimationPlayer::getInstance(); // this should be at the end of the unloading sequence. 213 179 //delete garbagecollecor 214 180 //delete animator 181 182 LoadClassDescription::printAll(); 215 183 216 184 ResourceManager::getInstance()->unloadAllByPriority(RP_LEVEL); … … 237 205 } 238 206 207 void World::loadParams(const TiXmlElement* root) 208 { 209 const char *string; 210 char *name; 211 int id; 212 213 PRINTF0("Creating a World\n"); 214 215 LoadParam<World>(root, "identifier", this, &World::setStoryID) 216 .describe("Sets the StoryID of this world"); 217 LoadParam<World>(root, "nextid", this, &World::setNextStoryID) 218 .describe("Sets the ID of the next world"); 219 LoadParam<World>(root, "path", this, &World::setPath) 220 .describe("The Filename of this World (relative from the data-dir)"); 221 222 223 /* 224 // identifier 225 string = grabParameter( root, "identifier"); 226 if( string == NULL || sscanf(string, "%d", &id) != 1) 227 { 228 PRINTF0("World is missing a proper 'identifier'\n"); 229 this->setStoryID( -1); 230 } 231 else setStoryID( id); 232 233 // next id 234 string = grabParameter( root, "nextid"); 235 if( string == NULL || sscanf(string, "%d", &id) != 1) 236 { 237 PRINTF0("World is missing a proper 'nextid'\n"); 238 this->setStoryID( -1); 239 } 240 else setNextStoryID( id); 241 242 243 // path 244 string = grabParameter( root, "path"); 245 if( string == NULL) 246 { 247 PRINTF0("World is missing a proper 'path'\n"); 248 this->setPath( NULL); 249 } 250 else 251 { 252 name = new char[strlen(string + 2)]; 253 strcpy( name, string); 254 this->setPath( name); 255 } 256 */ 257 } 258 239 259 240 260 /** … … 262 282 this->localCamera = new Camera(); 263 283 this->localCamera->setName ("camera"); 284 285 GraphicsEngine::getInstance()->displayFPS(true); 264 286 } 265 287 … … 334 356 else 335 357 { 336 this->glmis->load (element);358 this->glmis->loadParams(element); 337 359 this->glmis->draw(); 338 360 } … … 368 390 if( element == NULL) 369 391 { 370 PRINTF 0("============>>>>>>>>>>>>>>>>>World is missing a 'Track'\n");392 PRINTF(0)("World is missing a 'Track'\n"); 371 393 } 372 394 else 373 395 { 374 396 //load track 375 PRINTF 0("============>>>>>>>>>>>>>>>>Loading Track\n");397 PRINTF(4)("Loading Track\n"); 376 398 377 399 trackManager->load( element); 378 400 trackManager->finalize(); 379 PRINTF0("============>>>>>>>>>>>>>>>>Done loading Track\n");380 401 } 381 402 … … 392 413 //this->localCamera->bind (localPlayer); 393 414 this->localPlayer->addChild (this->localCamera); 394 395 396 // stuff beyond this point remains to be loaded properly397 /*398 // initializing the TrackManager399 this->trackManager = TrackManager::getInstance();400 //trackManager->addPoint(Vector(0,0,0));401 trackManager->addPoint(Vector(150, -35, 5));402 trackManager->addPoint(Vector(200,-35, 5));403 trackManager->addPoint(Vector(250, -35, 5));404 trackManager->addPoint(Vector(320,-33,-.55));405 trackManager->setDuration(1);406 trackManager->setSavePoint();407 408 trackManager->addPoint(Vector(410, 0, 0));409 trackManager->addPoint(Vector(510, 20, -10));410 trackManager->addPoint(Vector(550, 20, -10));411 trackManager->addPoint(Vector(570, 20, -10));412 trackManager->setDuration(2);413 415 414 trackManager->forkS("testFork1,testFork2"); 415 trackManager->workOn("testFork1"); 416 trackManager->addPoint(Vector(640, 25, -30)); 417 trackManager->addPoint(Vector(700, 40, -120)); 418 trackManager->addPoint(Vector(800, 50, -150)); 419 trackManager->addPoint(Vector(900, 60, -100)); 420 trackManager->addPoint(Vector(900, 60, -70)); 421 trackManager->addPoint(Vector(990, 65, -15)); 422 trackManager->addPoint(Vector(1050, 65, -10)); 423 trackManager->addPoint(Vector(1100, 65, -20)); 424 trackManager->setDuration(4); 425 426 trackManager->workOn("testFork2"); 427 trackManager->addPoint(Vector(640, 25, 20)); 428 trackManager->addPoint(Vector(670, 50, 120)); 429 trackManager->addPoint(Vector(700, 70, 80)); 430 trackManager->addPoint(Vector(800, 70, 65)); 431 trackManager->addPoint(Vector(850, 65, 65)); 432 trackManager->addPoint(Vector(920, 35, 40)); 433 trackManager->addPoint(Vector(945, 40, 40)); 434 trackManager->addPoint(Vector(970, 24, 40)); 435 trackManager->addPoint(Vector(1000, 40, -7)); 436 trackManager->setDuration(4); 437 438 439 trackManager->joinS("testFork1,testFork2"); 440 441 trackManager->addPoint(Vector(1200, 60, -50)); 442 trackManager->addPoint(Vector(1300, 50, -50)); 443 trackManager->addPoint(Vector(1400, 40, -50)); 444 trackManager->addPoint(Vector(1500, 40, -60)); 445 trackManager->addPoint(Vector(1600, 35, -55)); 446 trackManager->addPoint(Vector(1700, 45, -40)); 447 trackManager->addPoint(Vector(1750, 60, -40)); 448 trackManager->addPoint(Vector(1770, 80, -40)); 449 trackManager->addPoint(Vector(1800, 100, -40)); 450 trackManager->setDuration(10); 451 */ 452 trackManager->finalize(); 453 454 416 455 417 lightMan->setAmbientColor(.1,.1,.1); 456 418 lightMan->addLight(); … … 460 422 // lightMan->setPosition(20, 10, -20); 461 423 // lightMan->setDiffuseColor(0,0,0); 462 lightMan->debug();424 //lightMan->debug(); 463 425 lightMan->setPosition(-5.0, 10.0, -40.0); 464 426 … … 481 443 glNewList (objectList, GL_COMPILE); 482 444 483 trackManager->drawGraph(.01);484 trackManager->debug(2);445 //trackManager->drawGraph(.01); 446 //trackManager->debug(2); 485 447 glEndList(); 486 448 … … 519 481 // new PhysicsConnection(system, gravity); 520 482 521 } 483 484 WorldEntity* testEntity = new TestEntity(); 485 //testEntity->setRelCoor(Vector(570, 10, -15)); 486 testEntity->setRelCoor(Vector(25, -10, -20)); 487 testEntity->setRelDir(Quaternion(M_PI, Vector(0, 1, 0))); 488 this->spawn(testEntity); 489 this->localPlayer->addChild(testEntity); 490 } 491 522 492 523 493 void World::loadDebugWorld(int worldID) … … 525 495 /*monitor progress*/ 526 496 this->glmis->step(); 497 // stuff beyond this point remains to be loaded properly 498 499 // initializing the TrackManager 500 this->trackManager = TrackManager::getInstance(); 501 //trackManager->addPoint(Vector(0,0,0)); 502 trackManager->addPoint(Vector(150, -35, 5)); 503 trackManager->addPoint(Vector(200,-35, 5)); 504 trackManager->addPoint(Vector(250, -35, 5)); 505 trackManager->addPoint(Vector(320,-33,-.55)); 506 trackManager->setDuration(1); 507 trackManager->setSavePoint(); 508 509 trackManager->addPoint(Vector(410, 0, 0)); 510 trackManager->addPoint(Vector(510, 20, -10)); 511 trackManager->addPoint(Vector(550, 20, -10)); 512 trackManager->addPoint(Vector(570, 20, -10)); 513 trackManager->setDuration(2); 514 515 trackManager->forkS("testFork1,testFork2"); 516 trackManager->workOn("testFork1"); 517 trackManager->addPoint(Vector(640, 25, -30)); 518 trackManager->addPoint(Vector(700, 40, -120)); 519 trackManager->addPoint(Vector(800, 50, -150)); 520 trackManager->addPoint(Vector(900, 60, -100)); 521 trackManager->addPoint(Vector(900, 60, -70)); 522 trackManager->addPoint(Vector(990, 65, -15)); 523 trackManager->addPoint(Vector(1050, 65, -10)); 524 trackManager->addPoint(Vector(1100, 65, -20)); 525 trackManager->setDuration(4); 526 527 trackManager->workOn("testFork2"); 528 trackManager->addPoint(Vector(640, 25, 20)); 529 trackManager->addPoint(Vector(670, 50, 120)); 530 trackManager->addPoint(Vector(700, 70, 80)); 531 trackManager->addPoint(Vector(800, 70, 65)); 532 trackManager->addPoint(Vector(850, 65, 65)); 533 trackManager->addPoint(Vector(920, 35, 40)); 534 trackManager->addPoint(Vector(945, 40, 40)); 535 trackManager->addPoint(Vector(970, 24, 40)); 536 trackManager->addPoint(Vector(1000, 40, -7)); 537 trackManager->setDuration(4); 538 539 540 trackManager->joinS("testFork1,testFork2"); 541 542 trackManager->addPoint(Vector(1200, 60, -50)); 543 trackManager->addPoint(Vector(1300, 50, -50)); 544 trackManager->addPoint(Vector(1400, 40, -50)); 545 trackManager->addPoint(Vector(1500, 40, -60)); 546 trackManager->addPoint(Vector(1600, 35, -55)); 547 trackManager->addPoint(Vector(1700, 45, -40)); 548 trackManager->addPoint(Vector(1750, 60, -40)); 549 trackManager->addPoint(Vector(1770, 80, -40)); 550 trackManager->addPoint(Vector(1800, 100, -40)); 551 trackManager->setDuration(10); 552 553 trackManager->finalize(); 554 527 555 528 556 // LIGHT initialisation 529 530 557 lightMan->setAmbientColor(.1,.1,.1); 531 558 lightMan->addLight(); … … 1164 1191 this->trackManager->tick(this->dt); 1165 1192 this->localCamera->tick(this->dt); 1193 AnimationPlayer::getInstance()->tick(this->dtS); 1194 1195 PhysicsEngine::getInstance()->tick(this->dtS); 1196 1197 particleEngine->tick(this->dtS); 1166 1198 this->garbageCollector->tick(this->dtS); 1167 1168 AnimationPlayer::getInstance()->tick(this->dtS); 1169 PhysicsEngine::getInstance()->tick(this->dtS); 1170 1171 particleEngine->tick(this->dtS); 1199 1200 /* actualy the Graphics Engine should tick the world not the other way around... 1201 but since we like the things not too complicated we got it this way around 1202 until there is need or time to do it the other way around. 1203 \todo: GraphicsEngine ticks world: separation of processes and data... 1204 */ 1205 GraphicsEngine::getInstance()->tick(this->dtS); 1172 1206 } 1173 1207 this->lastFrame = currentFrame; -
orxonox/branches/physics/src/story_entities/world.h
r4190 r4283 11 11 #include "story_entity.h" 12 12 #include "p_node.h" 13 #include "xmlparser/tinyxml.h"14 13 15 14 class World; … … 24 23 class GarbageCollector; 25 24 class Text; 25 class TiXmlElement; 26 26 27 27 //! The game world Interface … … 57 57 World (char* name); 58 58 World (int worldID); 59 World ( TiXmlElement* root);59 World (const TiXmlElement* root = NULL); 60 60 virtual ~World (); 61 62 void loadParams(const TiXmlElement* root); 61 63 62 64 double getGameTime();
Note: See TracChangeset
for help on using the changeset viewer.