Changeset 1232 for code/branches/network3/src/orxonox
- Timestamp:
- May 5, 2008, 1:19:22 AM (17 years ago)
- Location:
- code/branches/network3/src/orxonox
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/network3/src/orxonox/Orxonox.cc
r1184 r1232 326 326 orxonoxHUD_->setEnergyDistr(20,20,60); 327 327 hudOverlay->show(); 328 setupInputSystem(); 328 329 329 330 client_g->establishConnection(); … … 362 363 } 363 364 364 void Orxonox::createScene( void)365 void Orxonox::createScene() 365 366 { 366 367 // Init audio -
code/branches/network3/src/orxonox/objects/Camera.cc
r1212 r1232 127 127 COUT(0) << "t " << this->targetNode_->getPosition() << std::endl; 128 128 if(this->positionNode_ != NULL) 129 //this->cam_->setPosition(this->positionNode_->getPosition());129 this->cam_->setPosition(this->positionNode_->getPosition()); 130 130 if(this->targetNode_ != NULL) 131 131 this->cam_->lookAt(this->targetNode_->getPosition()); … … 139 139 { 140 140 this->bHasFocus_ = false; 141 this->positionNode_->detachObject(cam_); 141 142 } 142 143 -
code/branches/network3/src/orxonox/objects/Model.cc
r1174 r1232 73 73 XMLPortParamLoadOnly(Model, "mesh", setMesh, xmlelement, mode); 74 74 75 create();75 Model::create(); 76 76 } 77 77 -
code/branches/network3/src/orxonox/objects/SpaceShip.cc
r1212 r1232 80 80 81 81 this->camNode_ = 0; 82 this->camName_ = "camNode"; 82 83 83 84 this->tt_ = 0; … … 160 161 161 162 void SpaceShip::registerAllVariables(){ 162 163 164 163 registerVar( &camName_, camName_.length()+1, network::STRING); 165 164 } 166 165 167 166 void SpaceShip::init() 168 167 { 169 createCamera();168 COUT(4) << "================ \t\t\t\tspaceship::init" << std::endl; 170 169 // START CREATING THRUSTER 171 170 this->tt_ = new ParticleInterface(GraphicsEngine::getSingleton().getSceneManager(),"twinthruster" + this->getName(),"Orxonox/engineglow"); … … 198 197 this->greenNode_->setInheritScale(false); 199 198 199 COUT(4) << "attaching red billboard" << std::endl; 200 200 this->redNode_->attachObject(this->redBillboard_.getBillboardSet()); 201 201 this->redNode_->setScale(0.3, 0.3, 0.3); 202 202 203 COUT(4) << "attaching green billboard" << std::endl; 203 204 this->greenNode_->attachObject(this->greenBillboard_.getBillboardSet()); 204 205 this->greenNode_->setScale(0.3, 0.3, 0.3); … … 214 215 this->chFarNode_->setInheritScale(false); 215 216 217 COUT(4) << "attaching crosshair near billboard" << std::endl; 216 218 this->chNearNode_->attachObject(this->crosshairNear_.getBillboardSet()); 217 219 this->chNearNode_->setScale(0.2, 0.2, 0.2); 218 220 221 COUT(4) << "attaching crosshair far billboard" << std::endl; 219 222 this->chFarNode_->attachObject(this->crosshairFar_.getBillboardSet()); 220 223 this->chFarNode_->setScale(0.4, 0.4, 0.4); 221 224 COUT(4) << "attaching camera" << std::endl; 225 226 createCamera(); 222 227 // END of testing crosshair 223 228 } … … 232 237 void SpaceShip::loadParams(TiXmlElement* xmlElem) 233 238 { 239 COUT(4) << "using loadparams" << std::endl; 234 240 Model::loadParams(xmlElem); 235 241 this->create(); 242 this->getFocus(); 236 243 /* 237 244 if (xmlElem->Attribute("forward") && xmlElem->Attribute("rotateupdown") && xmlElem->Attribute("rotaterightleft") && xmlElem->Attribute("looprightleft")) … … 284 291 void SpaceShip::setCamera(const std::string& camera) 285 292 { 293 camName_=camera; 286 294 // change camera attributes here, if you want to ;) 295 } 296 297 void SpaceShip::getFocus(){ 298 COUT(4) << "requesting focus" << std::endl; 299 if(network::Client::getSingleton()==0 || network::Client::getSingleton()->getShipID()==objectID) 300 CameraHandler::getInstance()->requestFocus(cam_); 301 287 302 } 288 303 289 304 void SpaceShip::createCamera(){ 290 this->camNode_ = this->getNode()->createChildSceneNode("CamNode"); 291 camNode_->setPosition(this->getNode()->getPosition() + Vector3(-50,0,10)); 305 COUT(4) << "begin camera creation" << std::endl; 306 this->camNode_ = this->getNode()->createChildSceneNode(camName_); 307 COUT(4) << "position: (this)" << this->getNode()->getPosition() << std::endl; 308 this->camNode_->setPosition(this->getNode()->getPosition() + Vector3(-50,0,10)); 309 COUT(4) << "position: (cam)" << this->camNode_->getPosition() << std::endl; 292 310 /* 293 311 // node->setInheritOrientation(false); … … 295 313 cam->lookAt(Vector3(0,20,0)); 296 314 cam->roll(Degree(0)); 297 */ 315 */COUT(4) << "creating new camera" << std::endl; 298 316 cam_ = new Camera(this->camNode_); 317 COUT(4) << "setting target node" << std::endl; 299 318 cam_->setTargetNode(this->getNode()); 300 CameraHandler::getInstance()->requestFocus(cam_); 319 // this only applies to clients 320 if(network::Client::getSingleton()!=0 && network::Client::getSingleton()->getShipID()==objectID) 321 CameraHandler::getInstance()->requestFocus(cam_); 301 322 // cam->setPosition(Vector3(0,-350,0)); 302 323 //cam->roll(Degree(-90)); 303 324 304 325 //this->camNode_->attachObject(cam); 305 326 COUT(4) << "created camera" << std::endl; 306 327 } 307 328 … … 329 350 void SpaceShip::XMLPort(Element& xmlelement, XMLPort::Mode mode) 330 351 { 352 COUT(4) << "using xmlport" << std::endl; 331 353 Model::XMLPort(xmlelement, mode); 332 354 … … 339 361 XMLPortParamLoadOnly(SpaceShip, "transDamp", setTransDamp, xmlelement, mode); 340 362 XMLPortParamLoadOnly(SpaceShip, "rotDamp", setRotDamp, xmlelement, mode); 363 364 SpaceShip::create(); 365 getFocus(); 341 366 } 342 367 … … 534 559 } 535 560 536 if(!network::Client::getSingleton() ){561 if(!network::Client::getSingleton() || network::Client::getSingleton()->getShipID() == objectID){ 537 562 if (mKeyboard->isKeyDown(OIS::KC_UP) || mKeyboard->isKeyDown(OIS::KC_W)) 538 563 this->acceleration_.x = this->translationAcceleration_; -
code/branches/network3/src/orxonox/objects/SpaceShip.h
r1212 r1232 63 63 void setTransDamp(float value); 64 64 void setRotDamp(float value); 65 66 void getFocus(); 65 67 66 68 static void setMaxSpeedTest(float value) … … 83 85 84 86 Ogre::SceneNode* camNode_; 85 Camera* cam_; 87 Camera* cam_; 88 std::string camName_; 89 86 90 87 91 ParticleInterface* tt_; -
code/branches/network3/src/orxonox/objects/WorldEntity.cc
r1191 r1232 190 190 XMLPortObject(WorldEntity, WorldEntity, "attached", attachWorldEntity, getAttachedWorldEntity, xmlelement, mode, false, true); 191 191 192 //create();192 WorldEntity::create(); 193 193 } 194 194 … … 197 197 { 198 198 // register coordinates 199 registerVar( (void*) &(this->getPosition().x), sizeof(this->getPosition().x), network::DATA );200 registerVar( (void*) &(this->getPosition().y), sizeof(this->getPosition().y), network::DATA );201 registerVar( (void*) &(this->getPosition().z), sizeof(this->getPosition().z), network::DATA );199 registerVar( (void*) &(this->getPosition().x), sizeof(this->getPosition().x), network::DATA, 0x3); 200 registerVar( (void*) &(this->getPosition().y), sizeof(this->getPosition().y), network::DATA, 0x3); 201 registerVar( (void*) &(this->getPosition().z), sizeof(this->getPosition().z), network::DATA, 0x3); 202 202 // register orientation 203 registerVar( (void*) &(this->getOrientation().w), sizeof(this->getOrientation().w), network::DATA );204 registerVar( (void*) &(this->getOrientation().x), sizeof(this->getOrientation().x), network::DATA );205 registerVar( (void*) &(this->getOrientation().y), sizeof(this->getOrientation().y), network::DATA );206 registerVar( (void*) &(this->getOrientation().z), sizeof(this->getOrientation().z), network::DATA );203 registerVar( (void*) &(this->getOrientation().w), sizeof(this->getOrientation().w), network::DATA, 0x3); 204 registerVar( (void*) &(this->getOrientation().x), sizeof(this->getOrientation().x), network::DATA, 0x3); 205 registerVar( (void*) &(this->getOrientation().y), sizeof(this->getOrientation().y), network::DATA, 0x3); 206 registerVar( (void*) &(this->getOrientation().z), sizeof(this->getOrientation().z), network::DATA, 0x3); 207 207 // register velocity_ 208 registerVar( (void*) &(this->getVelocity().x), sizeof(this->getVelocity().x), network::DATA );209 registerVar( (void*) &(this->getVelocity().y), sizeof(this->getVelocity().y), network::DATA );210 registerVar( (void*) &(this->getVelocity().z), sizeof(this->getVelocity().z), network::DATA );208 registerVar( (void*) &(this->getVelocity().x), sizeof(this->getVelocity().x), network::DATA, 0x3); 209 registerVar( (void*) &(this->getVelocity().y), sizeof(this->getVelocity().y), network::DATA, 0x3); 210 registerVar( (void*) &(this->getVelocity().z), sizeof(this->getVelocity().z), network::DATA, 0x3); 211 211 // register rotationAxis/rate 212 registerVar( (void*) &(this->getRotationRate()), sizeof(this->getRotationRate()), network::DATA );213 registerVar( (void*) &(this->getRotationAxis().x), sizeof(this->getRotationAxis().x), network::DATA );214 registerVar( (void*) &(this->getRotationAxis().y), sizeof(this->getRotationAxis().y), network::DATA );215 registerVar( (void*) &(this->getRotationAxis().z), sizeof(this->getRotationAxis().z), network::DATA );212 registerVar( (void*) &(this->getRotationRate()), sizeof(this->getRotationRate()), network::DATA, 0x3); 213 registerVar( (void*) &(this->getRotationAxis().x), sizeof(this->getRotationAxis().x), network::DATA, 0x3); 214 registerVar( (void*) &(this->getRotationAxis().y), sizeof(this->getRotationAxis().y), network::DATA, 0x3); 215 registerVar( (void*) &(this->getRotationAxis().z), sizeof(this->getRotationAxis().z), network::DATA, 0x3); 216 216 // register scale of node 217 registerVar( (void*) &(this->getScale().x), sizeof(this->getScale().x), network::DATA );218 registerVar( (void*) &(this->getScale().y), sizeof(this->getScale().y), network::DATA );219 registerVar( (void*) &(this->getScale().z), sizeof(this->getScale().z), network::DATA );217 registerVar( (void*) &(this->getScale().x), sizeof(this->getScale().x), network::DATA, 0x3); 218 registerVar( (void*) &(this->getScale().y), sizeof(this->getScale().y), network::DATA, 0x3); 219 registerVar( (void*) &(this->getScale().z), sizeof(this->getScale().z), network::DATA, 0x3); 220 220 //register staticity 221 registerVar( (void*) &(this->bStatic_), sizeof(this->bStatic_), network::DATA); 221 registerVar( (void*) &(this->bStatic_), sizeof(this->bStatic_), network::DATA, 0x3); 222 //register acceleration 223 // register velocity_ 224 registerVar( (void*) &(this->getAcceleration().x), sizeof(this->getAcceleration().x), network::DATA, 0x3); 225 registerVar( (void*) &(this->getAcceleration().y), sizeof(this->getAcceleration().y), network::DATA, 0x3); 226 registerVar( (void*) &(this->getAcceleration().z), sizeof(this->getAcceleration().z), network::DATA, 0x3); 222 227 } 223 228
Note: See TracChangeset
for help on using the changeset viewer.