Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 27, 2005, 7:14:55 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/physics: merged the trunk back to the physics-branche
merged with command:
svn merge -r 4301:HEAD trunk/ branches/physics/
little conflict in particle-system resolved easily

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/physics/src/story_entities/world.cc

    r4314 r4332  
    2727#include "null_parent.h"
    2828#include "helper_parent.h"
     29#include "pilot_node.h"
    2930#include "track_node.h"
    3031#include "world_entity.h"
     
    201202void World::constuctorInit(char* name, int worldID)
    202203{
    203   this->setClassName ("World");
     204  this->setClassID(CL_WORLD, "World");
    204205
    205206  //this->worldName = name;
     
    288289
    289290  this->localCamera = new Camera();
    290   this->localCamera->setName ("camera");
     291  this->localCamera->setName ("Camera");
    291292
    292293  State::getInstance()->setCamera(this->localCamera, this->localCamera->getTarget());
     
    308309    {
    309310      PRINTF(1)("World has no path specified for loading");
     311      this->loadDebugWorld(this->getStoryID());
    310312      return (ErrorMessage){213,"Path not specified","World::load()"};
    311313    }
     
    500502
    501503
     504
     505/**
     506   \brief loads the debug world: only for experimental stuff
     507*/
    502508void World::loadDebugWorld(int worldID)
    503509{
     510  printf("ajsdflkajs;dlfaj;slfja;lsjf;lajsf;la;sdfkja;lskdjfashdfklajshdflkjasdfh\n");
    504511  /*monitor progress*/
    505512  this->glmis->step();
     
    566573  lightMan->setAmbientColor(.1,.1,.1);
    567574  lightMan->addLight();
    568   //      lightMan->setAttenuation(1.0, .01, 0.0);
    569   //      lightMan->setDiffuseColor(1,1,1);
    570   //  lightMan->addLight(1);
    571   //  lightMan->setPosition(20, 10, -20);
    572   //  lightMan->setDiffuseColor(0,0,0);
    573575  lightMan->debug();
    574576
     
    585587        lightMan->setPosition(-5.0, 10.0, -40.0);
    586588
    587         // !\todo old track-system has to be removed
    588 
    589         //create helper for player
    590         //HelperParent* hp = new HelperParent ();
    591         /* the player has to be added to this helper */
    592 
    593         // create a player
     589
    594590        this->localPlayer = new Player ();
    595591        this->localPlayer->setName ("player");
    596592        this->spawn (this->localPlayer);
    597593        /*monitor progress*/
    598         //this->glmis->step();
    599594        this->glmis->step();
    600595
    601         // bind input
    602         Orxonox *orx = Orxonox::getInstance ();
    603         orx->getLocalInput()->bind (this->localPlayer);
    604            
    605596        // bind camera
    606597        this->localCamera = new Camera();
    607598        this->localCamera->setName ("camera");
    608            
    609599        /*monitor progress*/
    610600        this->glmis->step();
    611601
    612         sky = new SkyBox();
    613         //      (SkyBox*)(sky)->setTexture("pictures/sky/skybox", "jpg");
    614         sky->setParent(localCamera);
    615         this->spawn(sky);
    616 
    617         /*monitor progress*/
    618         this->glmis->step();
    619 
    620            
    621         WorldEntity* env = new Environment();
    622         env->setName ("env");
    623         this->spawn(env);
    624 
    625            
    626         /*
    627           Vector* es = new Vector (10, 5, 0);
    628           Quaternion* qs = new Quaternion ();
    629           WorldEntity* pr = new Primitive(P_CYLINDER);
    630           pr->setName("primitive");
    631           this->spawn(pr, this->localPlayer, es, qs, PNODE_MOVEMENT);
    632         */
    633 
    634         /*monitor progress*/
    635         this->glmis->step();
    636 
    637         //          trackManager->setBindSlave(env);
    638         PNode* tn = trackManager->getTrackNode();
    639         tn->addChild(this->localPlayer);
    640         this->localCamera->lookAt(tn);
    641 
    642         //localCamera->setParent(TrackNode::getInstance());
    643         tn->addChild(this->localCamera);
    644         //          localCamera->lookAt(tn);
    645         this->localPlayer->setMode(PNODE_ALL);
    646         //Vector* cameraOffset = new Vector (0, 5, -10);
    647         trackManager->condition(2, LEFTRIGHT, this->localPlayer);
    648         this->glmis->step();
    649         break;
    650       }
    651     case DEBUG_WORLD_1:
    652       {
    653         lightMan->setPosition(.0, .0, .0);
    654         lightMan->setAttenuation(1.0, .01, 0.0);
    655         lightMan->setSpecularColor(1,0,0);
    656         this->nullParent = NullParent::getInstance ();
    657         this->nullParent->setName ("NullParent");
    658 
    659         // create a player
    660         WorldEntity* myPlayer = new Player();
    661         myPlayer->setName ("player");
    662         this->spawn(myPlayer);
    663         this->localPlayer = myPlayer;       
    664            
    665         // bind input
    666         Orxonox *orx = Orxonox::getInstance();
    667         orx->getLocalInput()->bind (myPlayer);
    668            
    669         // bind camera
    670         this->localCamera = new Camera ();
    671         this->localCamera->setName ("camera");
    672         this->localCamera->lookAt(LightManager::getInstance()->getLight(0));
    673         this->localCamera->setParent(this->localPlayer);
    674 
    675         // Create SkySphere
    676         sky = new Skysphere("pictures/sky-replace.jpg");
    677         this->localPlayer->addChild(this->sky);
    678         this->spawn(this->sky);
    679         Vector* es = new Vector (20, 0, 0);
    680         Quaternion* qs = new Quaternion ();
    681 
    682         lightMan->getLight(0)->setParent(trackManager->getTrackNode());
    683         break;
    684       }
    685     case DEBUG_WORLD_2:
    686       {
    687         lightMan->setAmbientColor(.1,.1,.1);
    688         lightMan->addLight();
    689         lightMan->setPosition(-5.0, 10.0, -40.0);
    690         this->nullParent = NullParent::getInstance ();
    691         this->nullParent->setName ("NullParent");
    692 
    693         // !\todo old track-system has to be removed
    694 
    695         //create helper for player
    696         //HelperParent* hp = new HelperParent ();
    697         /* the player has to be added to this helper */
    698 
    699         // create a player
    700         this->localPlayer = new Player ();
    701         this->localPlayer->setName ("player");
    702         this->spawn (this->localPlayer);
    703         /*monitor progress*/
    704         //this->glmis->step();     
    705         this->glmis->step();
    706 
    707         // bind input
    708         Orxonox *orx = Orxonox::getInstance ();
    709         orx->getLocalInput()->bind (this->localPlayer);
    710            
    711         // bind camera
    712         this->localCamera = new Camera();
    713         this->localCamera->setName ("camera");
    714         this->localCamera->lookAt(this->localPlayer);
    715         this->localCamera->setParent(this->localPlayer);
    716            
    717         /*monitor progress*/
    718         this->glmis->step();
    719602
    720603        // Create SkySphere
     
    728611
    729612
    730         WorldEntity* baseNode = new Satellite(Vector(1,0,1), 1.2);
    731         this->localPlayer->addChild(baseNode);
    732         baseNode->setRelCoor(Vector(10.0, 2.0, 1.0));
    733         this->spawn(baseNode);
    734 
    735         WorldEntity* secondNode = new Satellite(Vector(0,0,1), 2.0);
    736         baseNode->addChild(secondNode);
    737         secondNode->setRelCoor(Vector(0.0, 0.0, 3.0));
    738         this->spawn(secondNode);
    739 
    740 
    741         WorldEntity* thirdNode = new Satellite(Vector(0,0,1), 1.0);
    742         secondNode->addChild(thirdNode);
    743         thirdNode->setRelCoor(Vector(2.0, 0.0, 0.0));
    744         this->spawn(thirdNode);
    745 
    746            
    747    
    748         WorldEntity* c = new Environment();
    749         this->localPlayer->addChild(c);
    750         c->setRelCoor(Vector(10.0, 2.0, -1.0));
    751         this->spawn(c);
    752 
    753 
    754            
    755         Animation3D* animation = new Animation3D(c);
    756         animation->setInfinity(ANIM_INF_REPLAY);
    757 
    758 
    759         animation->addKeyFrame(Vector(0, 0, 0), Quaternion(0, Vector(0,1,0)), 1.0, ANIM_NEG_EXP, ANIM_LINEAR);
    760         animation->addKeyFrame(Vector(0, 2, 0), Quaternion(M_PI, Vector(0,1,0)), 1.0, ANIM_NEG_EXP, ANIM_LINEAR);
    761         animation->addKeyFrame(Vector(0, 0, 0), Quaternion(0, Vector(0,1,0)), 1.0, ANIM_NEG_EXP, ANIM_LINEAR);
    762 
    763 
    764 
    765 
    766 
    767 
    768         /*         
    769           KeyFrame* f1 = new KeyFrame;
    770           f1->position = new Vector(-1.1, 0.0, 2.6);
    771           f1->direction = new Quaternion();
    772           f1->time = 1.0;
    773           f1->mode = NEG_EXP;
    774                  
    775                  
    776           KeyFrame* f2 = new KeyFrame;
    777           f2->position = new Vector(-2.1, 0.0, 2.6);
    778           f2->direction = new Quaternion();
    779           f2->time = 0.1;
    780           f2->mode = NEG_EXP;
    781                  
    782           KeyFrame* f3 = new KeyFrame;
    783           f3->position = new Vector(10.0, 2.0, -1.0);
    784           f3->direction = new Quaternion();
    785           f3->time = 0.2;
    786           f3->mode = NEG_EXP;
    787                  
    788           KeyFrame* f4 = new KeyFrame;
    789           f4->position = new Vector(10.0, 5.0, -1.0);
    790           f4->direction = new Quaternion();
    791           f4->time = 1.0;
    792           f4->mode = NEG_EXP;
    793                  
    794                  
    795                  
    796           this->simpleAnimation->animatorBegin();
    797           this->simpleAnimation->selectObject(b);
    798           this->simpleAnimation->setAnimationMode(SINGLE);
    799           this->simpleAnimation->addKeyFrame(f1);
    800           this->simpleAnimation->addKeyFrame(f2);
    801           this->simpleAnimation->start();
    802           this->simpleAnimation->selectObject(c);
    803           this->simpleAnimation->addKeyFrame(f3);
    804           this->simpleAnimation->addKeyFrame(f4);
    805           this->simpleAnimation->start();
    806           this->simpleAnimation->animatorEnd();
    807         */
    808 
    809         /*
    810           Vector* es = new Vector (10, 5, 0);
    811           Quaternion* qs = new Quaternion ();
    812           WorldEntity* pr = new Primitive(P_CYLINDER);
    813           pr->setName("primitive");
    814           this->spawn(pr, this->localPlayer, es, qs, PNODE_MOVEMENT);
    815         */
    816 
     613        terrain = new Terrain("worlds/newGround.obj");
     614        terrain->setRelCoor(Vector(0,-10,0));
     615        this->spawn(terrain);
    817616        /*monitor progress*/
    818617        this->glmis->step();
    819618
    820         //          trackManager->setBindSlave(env);
     619        this->pilotNode = new PilotNode();
     620        this->pilotNode->addChild(this->localPlayer);
     621        this->pilotNode->addChild(this->localCamera);
     622        // bind input
     623        Orxonox *orx = Orxonox::getInstance ();
     624        //orx->getLocalInput()->bind (this->pilotNode);     
     625       
     626        /*
    821627        PNode* tn = trackManager->getTrackNode();
    822628        tn->addChild(this->localPlayer);
    823 
    824         //localCamera->setParent(TrackNode::getInstance());
     629        this->localCamera->lookAt(tn);
     630       
    825631        tn->addChild(this->localCamera);
    826         //          localCamera->lookAt(tn);
    827632        this->localPlayer->setMode(PNODE_ALL);
    828         //Vector* cameraOffset = new Vector (0, 5, -10);
    829633        trackManager->condition(2, LEFTRIGHT, this->localPlayer);
     634        */
    830635        this->glmis->step();
     636        break;
     637      }
     638    case DEBUG_WORLD_1:
     639      {
     640
     641        break;
     642      }
     643    case DEBUG_WORLD_2:
     644      {
    831645
    832646        break;
    833647      }
    834648    default:
    835       printf("World::load() - no world with ID %i found", this->debugWorldNr );
     649      break;
    836650    }
    837651}
     
    848662{
    849663  this->bPause = false;
     664  this->pilotNode = NULL;
    850665  CommandNode* cn = Orxonox::getInstance()->getLocalInput();
    851666  cn->addToWorld(this);
     
    13211136  else if( !strcmp( cmd->cmd, CONFIG_NAME_VIEW4)) this->localCamera->setViewMode(VIEW_RIGHT);
    13221137  else if( !strcmp( cmd->cmd, CONFIG_NAME_VIEW5)) this->localCamera->setViewMode(VIEW_TOP);
    1323 
     1138  else if(this->pilotNode != NULL) if( !strcmp( cmd->cmd, "cursor")) this->pilotNode->command(cmd);
    13241139  return false;
    13251140}
Note: See TracChangeset for help on using the changeset viewer.