Changeset 599 for code/branches
- Timestamp:
- Dec 17, 2007, 9:56:47 PM (17 years ago)
- Location:
- code/branches/FICN
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FICN/bin/run-script
r531 r599 22 22 fi 23 23 fi 24 exec ./main $1 24 exec ./main $1 $2 $3 -
code/branches/FICN/run
r531 r599 1 1 #!/bin/bash 2 2 cd bin 3 ./run-script $1 3 ./run-script $1 $2 $3 4 4 cd .. -
code/branches/FICN/src/network/GameStateManager.cc
r590 r599 93 93 retval->id=id++; 94 94 // reserve a little memory and increase it later on 95 COUT(2) << "mallocing" << std::endl;95 //COUT(2) << "mallocing" << std::endl; 96 96 retval->data = (unsigned char*)malloc(memsize); 97 COUT(2) << "malloced" << std::endl;97 //COUT(2) << "malloced" << std::endl; 98 98 99 99 // offset of memory functions -
code/branches/FICN/src/network/Synchronisable.cc
r592 r599 115 115 int n=0; 116 116 for(i=syncList.begin(); n<datasize && i!=syncList.end(); ++i){ 117 COUT(2) << "size of variable: " << i->size << std::endl;118 COUT(2) << "size of variable: " << i->size << std::endl;119 117 //COUT(2) << "size of variable: " << i->size << std::endl; 120 118 //(std::memcpy(retVal.data+n, (const void*)(&(i->size)), sizeof(int)); -
code/branches/FICN/src/orxonox/objects/SceneNode.cc
r590 r599 25 25 void SceneNode::loadParams(TiXmlElement* xmlElem) 26 26 { 27 Ogre::SceneManager* mgr = orxonox::Orxonox::getSingleton()->getSceneManager();28 29 27 if (xmlElem->Attribute("name") && xmlElem->Attribute("pos")) 30 28 { 31 std::string name= xmlElem->Attribute("name");29 name_ = xmlElem->Attribute("name"); 32 30 33 31 std::vector<std::string> pos = tokenize(xmlElem->Attribute("pos"),","); 34 float x, y, z;35 String2Number<float>(x , pos[0]);36 String2Number<float>(y , pos[1]);37 String2Number<float>(z , pos[2]);32 //float x, y, z_; 33 String2Number<float>(x_, pos[0]); 34 String2Number<float>(y_, pos[1]); 35 String2Number<float>(z_, pos[2]); 38 36 39 float sx = 1, sy = 1, sz= 1;37 sx_ = 1; sy_ = 1; sz_ = 1; 40 38 if (xmlElem->Attribute("scale")) 41 39 { 42 40 pos = tokenize(xmlElem->Attribute("scale"),","); 43 String2Number<float>(sx, pos[0]); 44 String2Number<float>(sy, pos[1]); 45 String2Number<float>(sz, pos[2]); 41 String2Number<float>(sx_, pos[0]); 42 String2Number<float>(sy_, pos[1]); 43 String2Number<float>(sz_, pos[2]); 44 } 45 yaw_ = 0.0; 46 if (xmlElem->Attribute("yaw")) 47 { 48 String2Number<float>(yaw_,xmlElem->Attribute("yaw")); 49 } 50 pitch_ = 0.0; 51 if (xmlElem->Attribute("pitch")) 52 { 53 String2Number<float>(pitch_,xmlElem->Attribute("pitch")); 54 } 55 roll_ = 0.0; 56 if (xmlElem->Attribute("roll")) 57 { 58 String2Number<float>(roll_,xmlElem->Attribute("roll")); 46 59 } 47 60 48 float yaw = 0.0; 49 if (xmlElem->Attribute("yaw")) 50 { 51 String2Number<float>(yaw,xmlElem->Attribute("yaw")); 52 } 53 float pitch = 0.0; 54 if (xmlElem->Attribute("pitch")) 55 { 56 String2Number<float>(pitch,xmlElem->Attribute("pitch")); 57 } 58 float roll = 0.0; 59 if (xmlElem->Attribute("roll")) 60 { 61 String2Number<float>(roll,xmlElem->Attribute("roll")); 62 } 61 if(xmlElem->Attribute("node")) 62 nodeName_ = xmlElem->Attribute("node"); 63 else 64 nodeName_ = ""; 65 66 create(); 63 67 64 Ogre::SceneNode *parentNode; 65 if (xmlElem->Attribute("node")) 66 parentNode = mgr->getSceneNode(xmlElem->Attribute("node")); 67 else 68 parentNode = mgr->getRootSceneNode(); 69 70 Ogre::SceneNode* node = parentNode->createChildSceneNode(name, Vector3(x,y,z)); 71 node->scale(sx,sy,sz); 72 node->yaw(Ogre::Degree(yaw)); 73 node->pitch(Ogre::Degree(pitch)); 74 node->roll(Ogre::Degree(roll)); 75 76 COUT(4) << "Loader: Created node "<< name <<" : "<<x<<" " << y << " " << z << std::endl << std::endl; 68 COUT(4) << "Loader: loaded node "<< name_ <<" : "<< x_ <<" " << y_ << " " << z_ << std::endl << std::endl; 77 69 } 78 70 } 79 71 80 72 void SceneNode::registerAllVariables(){ 81 73 registerVar(&x_, sizeof(float), network::DATA); 74 registerVar(&y_, sizeof(float), network::DATA); 75 registerVar(&z_, sizeof(float), network::DATA); 76 registerVar(&sx_, sizeof(float), network::DATA); 77 registerVar(&sy_, sizeof(float), network::DATA); 78 registerVar(&sz_, sizeof(float), network::DATA); 79 registerVar(&yaw_, sizeof(float), network::DATA); 80 registerVar(&pitch_, sizeof(float), network::DATA); 81 registerVar(&roll_, sizeof(float), network::DATA); 82 registerVar(&name_, sizeof(float), network::STRING); 83 registerVar(&nodeName_, sizeof(float), network::STRING); 82 84 } 83 85 84 86 bool SceneNode::create(){ 87 Ogre::SceneManager* mgr = orxonox::Orxonox::getSingleton()->getSceneManager(); 88 89 Ogre::SceneNode *parentNode; 90 if (nodeName_.compare("")!=0) 91 parentNode = mgr->getSceneNode(nodeName_); 92 else 93 parentNode = mgr->getRootSceneNode(); 94 95 Ogre::SceneNode* node = parentNode->createChildSceneNode(name_, Vector3(x_,y_,z_)); 96 node->scale(sx_,sy_,sz_); 97 node->yaw(Ogre::Degree(yaw_)); 98 node->pitch(Ogre::Degree(pitch_)); 99 node->roll(Ogre::Degree(roll_)); 85 100 return true; 86 101 } -
code/branches/FICN/src/orxonox/objects/SceneNode.h
r590 r599 23 23 float sx_, sy_, sz_; 24 24 float yaw_, pitch_, roll_; 25 std::string node_; 25 std::string name_; 26 std::string nodeName_; 26 27 27 28 }; -
code/branches/FICN/src/orxonox/orxonox.cc
r592 r599 226 226 //TODO: give config file to Ogre 227 227 std::string mode; 228 if(argc>=2)229 mode = std::string(argv[1]);230 else231 mode = "";228 // if(argc>=2) 229 // mode = std::string(argv[1]); 230 // else 231 // mode = ""; 232 232 ArgReader ar = ArgReader(argc, argv); 233 233 ar.checkArgument("mode", mode, false); 234 234 ar.checkArgument("data", this->dataPath_, false); 235 ar.checkArgument("ip", serverIp_, false); 235 236 if(ar.errorHandling()) die(); 236 237 … … 238 239 { 239 240 serverInit(path); 240 mode = SERVER;241 mode_ = SERVER; 241 242 } 242 243 else if(mode == std::string("client")) 243 244 { 244 245 clientInit(path); 245 mode = CLIENT;246 mode_ = CLIENT; 246 247 } 247 248 else if(mode == std::string("presentation")) 248 249 { 249 250 serverInit(path); 250 mode = PRESENTATION;251 mode_ = PRESENTATION; 251 252 } 252 253 else{ 253 254 standaloneInit(path); 254 mode = STANDALONE;255 mode_ = STANDALONE; 255 256 } 256 257 } … … 267 268 setupScene(); 268 269 setupInputSystem(); 270 if(mode_!=CLIENT){ // remove this in future ---- presentation hack 271 } 272 else 273 std::cout << "client here" << std::endl; 269 274 createFrameListener(); 270 275 Factory::createClassHierarchy(); … … 273 278 server_g->open(); 274 279 break; 280 case CLIENT: 281 client_g->establishConnection(); 282 break; 275 283 case SERVER: 276 case CLIENT:277 284 case STANDALONE: 278 285 default: … … 356 363 void Orxonox::serverInit(std::string path) 357 364 { 365 COUT(2) << "initialising server" << std::endl; 358 366 ogre_->setConfigPath(path); 359 367 ogre_->setup(); … … 366 374 void Orxonox::clientInit(std::string path) 367 375 { 376 COUT(2) << "initialising client" << std::endl; 368 377 ogre_->setConfigPath(path); 369 378 ogre_->setup(); 370 client_g = new network::Client(); // address here 379 if(serverIp_.compare("")==0) 380 client_g = new network::Client(); 381 else 382 client_g = new network::Client(serverIp_, 55556); 371 383 if(!ogre_->load()) die(/* unable to load */); 372 384 ogre_->getRoot()->addFrameListener(new network::ClientFrameListener()); … … 523 535 ogre_->getRoot()->addFrameListener(TimerFL); 524 536 525 frameListener_ = new OrxListener(keyboard_, mouse_, auMan_, steering_); 537 //if(mode_!=CLIENT) // just a hack ------- remove this in future 538 frameListener_ = new OrxListener(keyboard_, mouse_, auMan_, steering_); 526 539 ogre_->getRoot()->addFrameListener(frameListener_); 527 540 } … … 536 549 ogre_->getRoot()->getAutoCreatedWindow()->getMetrics(width, height, depth, left, top); 537 550 538 const OIS::MouseState &ms = mouse_->getMouseState(); 539 ms.width = width; 540 ms.height = height; 541 551 if(mode_!=CLIENT){ 552 const OIS::MouseState &ms = mouse_->getMouseState(); 553 ms.width = width; 554 ms.height = height; 555 } 542 556 ogre_->getRoot()->startRendering(); 543 557 } -
code/branches/FICN/src/orxonox/orxonox.h
r584 r599 79 79 // this is used to identify the mode (server/client/...) we're in 80 80 gameMode mode_; 81 std::string serverIp_; 81 82 }; 82 83 }
Note: See TracChangeset
for help on using the changeset viewer.