Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4324 in orxonox.OLD for orxonox/trunk/src/story_entities/world.cc


Ignore:
Timestamp:
May 27, 2005, 2:13:19 AM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: added a debug level at the end to be able to experiment a little with new load modules and game ideas

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/story_entities/world.cc

    r4320 r4324  
    280280
    281281  this->localCamera = new Camera();
    282   this->localCamera->setName ("camera");
     282  this->localCamera->setName ("Camera");
    283283 
    284284  GraphicsEngine::getInstance()->displayFPS(true);
     
    298298    {
    299299      PRINTF(1)("World has no path specified for loading");
     300      this->loadDebugWorld(this->getStoryID());
    300301      return (ErrorMessage){213,"Path not specified","World::load()"};
    301302    }
     
    471472
    472473
     474
    473475void World::loadDebugWorld(int worldID)
    474476{
     477  printf("ajsdflkajs;dlfaj;slfja;lsjf;lajsf;la;sdfkja;lskdjfashdfklajshdflkjasdfh\n");
    475478  /*monitor progress*/
    476479  this->glmis->step();
     
    537540  lightMan->setAmbientColor(.1,.1,.1);
    538541  lightMan->addLight();
    539   //      lightMan->setAttenuation(1.0, .01, 0.0);
    540   //      lightMan->setDiffuseColor(1,1,1);
    541   //  lightMan->addLight(1);
    542   //  lightMan->setPosition(20, 10, -20);
    543   //  lightMan->setDiffuseColor(0,0,0);
    544542  lightMan->debug();
    545543
     
    556554        lightMan->setPosition(-5.0, 10.0, -40.0);
    557555
    558         // !\todo old track-system has to be removed
    559 
    560         //create helper for player
    561         //HelperParent* hp = new HelperParent ();
    562         /* the player has to be added to this helper */
    563556
    564557        // create a player
     
    581574        this->glmis->step();
    582575
    583         sky = new SkyBox();
    584         //      (SkyBox*)(sky)->setTexture("pictures/sky/skybox", "jpg");
    585         sky->setParent(localCamera);
    586         this->spawn(sky);
    587 
    588         /*monitor progress*/
    589         this->glmis->step();
    590 
    591            
    592         WorldEntity* env = new Environment();
    593         env->setName ("env");
    594         this->spawn(env);
    595 
    596            
    597         /*
    598           Vector* es = new Vector (10, 5, 0);
    599           Quaternion* qs = new Quaternion ();
    600           WorldEntity* pr = new Primitive(P_CYLINDER);
    601           pr->setName("primitive");
    602           this->spawn(pr, this->localPlayer, es, qs, PNODE_MOVEMENT);
    603         */
    604 
    605         /*monitor progress*/
    606         this->glmis->step();
    607 
    608         //          trackManager->setBindSlave(env);
    609         PNode* tn = trackManager->getTrackNode();
    610         tn->addChild(this->localPlayer);
    611         this->localCamera->lookAt(tn);
    612 
    613         //localCamera->setParent(TrackNode::getInstance());
    614         tn->addChild(this->localCamera);
    615         //          localCamera->lookAt(tn);
    616         this->localPlayer->setMode(PNODE_ALL);
    617         //Vector* cameraOffset = new Vector (0, 5, -10);
    618         trackManager->condition(2, LEFTRIGHT, this->localPlayer);
    619         this->glmis->step();
    620         break;
    621       }
    622     case DEBUG_WORLD_1:
    623       {
    624         lightMan->setPosition(.0, .0, .0);
    625         lightMan->setAttenuation(1.0, .01, 0.0);
    626         lightMan->setSpecularColor(1,0,0);
    627         this->nullParent = NullParent::getInstance ();
    628         this->nullParent->setName ("NullParent");
    629 
    630         // create a player
    631         WorldEntity* myPlayer = new Player();
    632         myPlayer->setName ("player");
    633         this->spawn(myPlayer);
    634         this->localPlayer = myPlayer;       
    635            
    636         // bind input
    637         Orxonox *orx = Orxonox::getInstance();
    638         orx->getLocalInput()->bind (myPlayer);
    639            
    640         // bind camera
    641         this->localCamera = new Camera ();
    642         this->localCamera->setName ("camera");
    643         this->localCamera->lookAt(LightManager::getInstance()->getLight(0));
    644         this->localCamera->setParent(this->localPlayer);
    645 
    646         // Create SkySphere
    647         sky = new Skysphere("pictures/sky-replace.jpg");
    648         this->localPlayer->addChild(this->sky);
    649         this->spawn(this->sky);
    650         Vector* es = new Vector (20, 0, 0);
    651         Quaternion* qs = new Quaternion ();
    652 
    653         lightMan->getLight(0)->setParent(trackManager->getTrackNode());
    654         break;
    655       }
    656     case DEBUG_WORLD_2:
    657       {
    658         lightMan->setAmbientColor(.1,.1,.1);
    659         lightMan->addLight();
    660         lightMan->setPosition(-5.0, 10.0, -40.0);
    661         this->nullParent = NullParent::getInstance ();
    662         this->nullParent->setName ("NullParent");
    663 
    664         // !\todo old track-system has to be removed
    665 
    666         //create helper for player
    667         //HelperParent* hp = new HelperParent ();
    668         /* the player has to be added to this helper */
    669 
    670         // create a player
    671         this->localPlayer = new Player ();
    672         this->localPlayer->setName ("player");
    673         this->spawn (this->localPlayer);
    674         /*monitor progress*/
    675         //this->glmis->step();     
    676         this->glmis->step();
    677 
    678         // bind input
    679         Orxonox *orx = Orxonox::getInstance ();
    680         orx->getLocalInput()->bind (this->localPlayer);
    681            
    682         // bind camera
    683         this->localCamera = new Camera();
    684         this->localCamera->setName ("camera");
    685         this->localCamera->lookAt(this->localPlayer);
    686         this->localCamera->setParent(this->localPlayer);
    687            
    688         /*monitor progress*/
    689         this->glmis->step();
    690576
    691577        // Create SkySphere
     
    699585
    700586
    701         WorldEntity* baseNode = new Satellite(Vector(1,0,1), 1.2);
    702         this->localPlayer->addChild(baseNode);
    703         baseNode->setRelCoor(Vector(10.0, 2.0, 1.0));
    704         this->spawn(baseNode);
    705 
    706         WorldEntity* secondNode = new Satellite(Vector(0,0,1), 2.0);
    707         baseNode->addChild(secondNode);
    708         secondNode->setRelCoor(Vector(0.0, 0.0, 3.0));
    709         this->spawn(secondNode);
    710 
    711 
    712         WorldEntity* thirdNode = new Satellite(Vector(0,0,1), 1.0);
    713         secondNode->addChild(thirdNode);
    714         thirdNode->setRelCoor(Vector(2.0, 0.0, 0.0));
    715         this->spawn(thirdNode);
    716 
    717            
    718    
    719         WorldEntity* c = new Environment();
    720         this->localPlayer->addChild(c);
    721         c->setRelCoor(Vector(10.0, 2.0, -1.0));
    722         this->spawn(c);
    723 
    724 
    725            
    726         Animation3D* animation = new Animation3D(c);
    727         animation->setInfinity(ANIM_INF_REPLAY);
    728 
    729 
    730         animation->addKeyFrame(Vector(0, 0, 0), Quaternion(0, Vector(0,1,0)), 1.0, ANIM_NEG_EXP, ANIM_LINEAR);
    731         animation->addKeyFrame(Vector(0, 2, 0), Quaternion(M_PI, Vector(0,1,0)), 1.0, ANIM_NEG_EXP, ANIM_LINEAR);
    732         animation->addKeyFrame(Vector(0, 0, 0), Quaternion(0, Vector(0,1,0)), 1.0, ANIM_NEG_EXP, ANIM_LINEAR);
    733 
    734 
    735 
    736 
    737 
    738 
    739         /*         
    740           KeyFrame* f1 = new KeyFrame;
    741           f1->position = new Vector(-1.1, 0.0, 2.6);
    742           f1->direction = new Quaternion();
    743           f1->time = 1.0;
    744           f1->mode = NEG_EXP;
    745                  
    746                  
    747           KeyFrame* f2 = new KeyFrame;
    748           f2->position = new Vector(-2.1, 0.0, 2.6);
    749           f2->direction = new Quaternion();
    750           f2->time = 0.1;
    751           f2->mode = NEG_EXP;
    752                  
    753           KeyFrame* f3 = new KeyFrame;
    754           f3->position = new Vector(10.0, 2.0, -1.0);
    755           f3->direction = new Quaternion();
    756           f3->time = 0.2;
    757           f3->mode = NEG_EXP;
    758                  
    759           KeyFrame* f4 = new KeyFrame;
    760           f4->position = new Vector(10.0, 5.0, -1.0);
    761           f4->direction = new Quaternion();
    762           f4->time = 1.0;
    763           f4->mode = NEG_EXP;
    764                  
    765                  
    766                  
    767           this->simpleAnimation->animatorBegin();
    768           this->simpleAnimation->selectObject(b);
    769           this->simpleAnimation->setAnimationMode(SINGLE);
    770           this->simpleAnimation->addKeyFrame(f1);
    771           this->simpleAnimation->addKeyFrame(f2);
    772           this->simpleAnimation->start();
    773           this->simpleAnimation->selectObject(c);
    774           this->simpleAnimation->addKeyFrame(f3);
    775           this->simpleAnimation->addKeyFrame(f4);
    776           this->simpleAnimation->start();
    777           this->simpleAnimation->animatorEnd();
    778         */
    779 
    780         /*
    781           Vector* es = new Vector (10, 5, 0);
    782           Quaternion* qs = new Quaternion ();
    783           WorldEntity* pr = new Primitive(P_CYLINDER);
    784           pr->setName("primitive");
    785           this->spawn(pr, this->localPlayer, es, qs, PNODE_MOVEMENT);
    786         */
    787 
     587        terrain = new Terrain("worlds/newGround.obj");
     588        terrain->setRelCoor(Vector(0,-10,0));
     589        this->spawn(terrain);
    788590        /*monitor progress*/
    789591        this->glmis->step();
    790592
    791         //          trackManager->setBindSlave(env);
    792593        PNode* tn = trackManager->getTrackNode();
    793594        tn->addChild(this->localPlayer);
    794 
    795         //localCamera->setParent(TrackNode::getInstance());
     595        this->localCamera->lookAt(tn);
     596
     597
    796598        tn->addChild(this->localCamera);
    797         //          localCamera->lookAt(tn);
    798599        this->localPlayer->setMode(PNODE_ALL);
    799         //Vector* cameraOffset = new Vector (0, 5, -10);
    800600        trackManager->condition(2, LEFTRIGHT, this->localPlayer);
    801601        this->glmis->step();
     602        break;
     603      }
     604    case DEBUG_WORLD_1:
     605      {
     606
     607        break;
     608      }
     609    case DEBUG_WORLD_2:
     610      {
    802611
    803612        break;
    804613      }
    805614    default:
    806       printf("World::load() - no world with ID %i found", this->debugWorldNr );
     615      break;
    807616    }
    808617}
Note: See TracChangeset for help on using the changeset viewer.