Changeset 1264 for code/branches/merge
- Timestamp:
- May 13, 2008, 5:01:10 PM (17 years ago)
- Location:
- code/branches/merge
- Files:
-
- 18 edited
- 38 copied
Legend:
- Unmodified
- Added
- Removed
-
code/branches/merge/CMakeLists.txt
r1219 r1264 42 42 43 43 # global compiler/linker flags. force -O2! 44 SET(CMAKE_C_FLAGS "$ENV{CFLAGS} -O 2-Wall -g -ggdb")45 SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -O 2-Wall -g -ggdb")44 SET(CMAKE_C_FLAGS "$ENV{CFLAGS} -O0 -Wall -g -ggdb") 45 SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -O0 -Wall -g -ggdb") 46 46 SET(CMAKE_LD_FLAGS "$ENV{LDFLAGS}") 47 47 SET(CMAKE_EXE_LINKER_FLAGS " --no-undefined") -
code/branches/merge/bin/levels/sample.oxw
r1102 r1264 9 9 </audio--> 10 10 11 < Ambient colourvalue="1,1,1" />11 <!--Ambient colourvalue="1,1,1" /--> 12 12 <Skybox src="Orxonox/StarSkyBox" /> 13 14 13 <SpaceShip camera="true" position="0,0,0" scale="10" yawpitchroll="-90,-90,0" mesh="assf3.mesh" maxSpeed="500" maxSideAndBackSpeed="50" maxRotation="1.0" transAcc="200" rotAcc="3.0" transDamp="75" rotDamp="1.0" /> 15 14 … … 31 30 </Model--> 32 31 33 < Model position="-200,1000,500" scale="10" mesh="hoover_body.mesh" yawpitchroll="-90,-90,0" />32 <!--Model position="-200,1000,500" scale="10" mesh="hoover_body.mesh" yawpitchroll="-90,-90,0" /> 34 33 <Model position="-200,1000,500" scale="10" mesh="hoover_gear0.mesh" yawpitchroll="-90,-90,0" /> 35 34 <Model position="-200,1000,500" scale="10" mesh="hoover_gear1.mesh" yawpitchroll="-90,-90,0" /> 36 35 <Model position="-200,1000,500" scale="10" mesh="hoover_gear2.mesh" yawpitchroll="-90,-90,0" /> 37 <Model position="-200,1000,500" scale="10" mesh="hoover_turbine.mesh" yawpitchroll="-90,-90,0" / >36 <Model position="-200,1000,500" scale="10" mesh="hoover_turbine.mesh" yawpitchroll="-90,-90,0" /--> 38 37 39 38 -
code/branches/merge/cmake/FindBoost.cmake
r790 r1264 101 101 # Add in some path suffixes. These will have to be updated whenever a new Boost version comes out. 102 102 SET(SUFFIX_FOR_PATH 103 boost 103 104 boost-1_34_1 104 105 boost-1_34_0 -
code/branches/merge/src/orxonox/CMakeLists.txt
r1224 r1264 16 16 objects/Ambient.cc 17 17 objects/Camera.cc 18 objects/CameraHandler.cc 18 19 objects/Explosion.cc 19 20 objects/Model.cc -
code/branches/merge/src/orxonox/Orxonox.cc
r1263 r1264 189 189 GraphicsEngine::getSingleton().destroy(); 190 190 191 if ( client_g)192 delete client_g;191 if (network::Client::getSingleton()) 192 network::Client::destroySingleton(); 193 193 if (server_g) 194 194 delete server_g; 195 195 } 196 196 197 197 198 /** … … 395 396 396 397 if (serverIp_.compare("") == 0) 397 client_g = ne w network::Client();398 client_g = network::Client::createSingleton(); 398 399 else 399 client_g = ne w network::Client(serverIp_, NETWORK_PORT);400 client_g = network::Client::createSingleton(serverIp_, NETWORK_PORT); 400 401 401 402 client_g->establishConnection(); … … 511 512 } 512 513 514 if(mode_==CLIENT) 515 network::Client::getSingleton()->closeConnection(); 516 else if(mode_==SERVER) 517 server_g->close(); 513 518 return true; 514 519 } -
code/branches/merge/src/orxonox/objects/Ambient.cc
r1209 r1264 57 57 RegisterObject(Ambient); 58 58 Ambient::instance_s = this; 59 registerAllVariables(); 59 60 } 60 61 … … 63 64 } 64 65 66 bool Ambient::create(){ 67 GraphicsEngine::getSingleton().getSceneManager()->setAmbientLight(ambientLight_); 68 return true; 69 } 70 71 void Ambient::registerAllVariables(){ 72 registerVar(&ambientLight_, sizeof(ColourValue), network::DATA); 73 74 } 75 65 76 void Ambient::loadParams(TiXmlElement* xmlElem) 66 77 { … … 83 94 { 84 95 GraphicsEngine::getSingleton().getSceneManager()->setAmbientLight(colour); 96 ambientLight_=colour; 85 97 } 86 98 … … 96 108 97 109 XMLPortParamLoadOnly(Ambient, "colourvalue", setAmbientLight, xmlelement, mode); 110 create(); 98 111 } 99 112 } -
code/branches/merge/src/orxonox/objects/Ambient.h
r1056 r1264 34 34 #include "util/Math.h" 35 35 #include "core/BaseObject.h" 36 #include "network/Synchronisable.h" 36 37 37 38 namespace orxonox 38 39 { 39 class _OrxonoxExport Ambient : public BaseObject 40 class _OrxonoxExport Ambient : public BaseObject, network::Synchronisable 40 41 { 41 42 public: … … 46 47 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 47 48 void setAmbientLight(const ColourValue& colour); 49 bool create(); 50 void registerAllVariables(); 48 51 49 52 static void setAmbientLightTest(const ColourValue& colour) … … 52 55 private: 53 56 static Ambient* instance_s; 57 ColourValue ambientLight_; 54 58 55 59 }; -
code/branches/merge/src/orxonox/objects/Camera.cc
r1209 r1264 47 47 namespace orxonox 48 48 { 49 49 //CreateFactory(Camera); 50 50 51 Camera::Camera() 51 Camera::Camera(Ogre::SceneNode* node) 52 { 53 //RegisterObject(Camera); 54 this->bHasFocus_ = false; 55 if( node != NULL ) 56 this->setCameraNode(node); 57 58 } 59 60 Camera::~Camera() 61 { 62 } 63 64 /*void Camera::loadParams(TiXmlElement* xmlElem) 65 { 66 Ogre::SceneManager* mgr = GraphicsEngine::getSingleton().getSceneManager(); 67 68 if (xmlElem->Attribute("name") && xmlElem->Attribute("pos") && xmlElem->Attribute("lookat") && xmlElem->Attribute("node")) 52 69 { 53 RegisterObject(Camera); 70 // <Camera name="Camera" pos="0,0,-250" lookat="0,0,0" /> 71 72 std::string name = xmlElem->Attribute("name"); 73 std::string pos = xmlElem->Attribute("pos"); 74 std::string lookat = xmlElem->Attribute("lookat"); 75 76 this->cam_ = mgr->createCamera(name); 77 78 float x, y, z; 79 SubString posVec(xmlElem->Attribute("pos"), ','); 80 convertValue<std::string, float>(&x, posVec[0]); 81 convertValue<std::string, float>(&y, posVec[1]); 82 convertValue<std::string, float>(&z, posVec[2]); 83 84 setPosition(Vector3(x,y,z)); 85 86 //std::string target = xmlElem->Attribute("lookat"); 87 posVec.split(xmlElem->Attribute("lookat"), ','); 88 convertValue<std::string, float>(&x, posVec[0]); 89 convertValue<std::string, float>(&y, posVec[1]); 90 convertValue<std::string, float>(&z, posVec[2]); 91 92 cam_->lookAt(Vector3(x,y,z)); 93 94 /*std::string node = xmlElem->Attribute("node"); 95 96 Ogre::SceneNode* sceneNode = (Ogre::SceneNode*)mgr->getRootSceneNode()->createChildSceneNode(node); //getChild(node); 97 sceneNode->attachObject((Ogre::MovableObject*)cam_); 98 */ 99 100 // FIXME: unused var 101 //Ogre::Viewport* vp = 102 //GraphicsEngine::getSingleton().getRenderWindow()->addViewport(cam_); 103 /* 104 105 COUT(4) << "Loader: Created camera "<< name << std::endl << std::endl; 54 106 } 107 }*/ 55 108 56 Camera::~Camera() 57 { 58 } 109 void Camera::setCameraNode(Ogre::SceneNode* node) 110 { 111 this->positionNode_ = node; 112 // set camera to node values according to camera mode 113 } 59 114 60 void Camera::loadParams(TiXmlElement* xmlElem) 61 { 62 Ogre::SceneManager* mgr = GraphicsEngine::getSingleton().getSceneManager(); 115 void Camera::setTargetNode(Ogre::SceneNode* obj) 116 { 117 this->targetNode_ = obj; 118 } 63 119 64 if (xmlElem->Attribute("name") && xmlElem->Attribute("pos") && xmlElem->Attribute("lookat") && xmlElem->Attribute("node")) 65 { 66 // <Camera name="Camera" pos="0,0,-250" lookat="0,0,0" /> 120 /** 121 don't move anything before here! here the Ogre camera is set to values of this camera 122 always call update after changes 123 */ 124 void Camera::update() 125 { 126 COUT(0) << "p " << this->positionNode_->getPosition() << std::endl; 127 COUT(0) << "t " << this->targetNode_->getPosition() << std::endl; 128 if(this->positionNode_ != NULL) 129 this->cam_->setPosition(this->positionNode_->getPosition()); 130 if(this->targetNode_ != NULL) 131 this->cam_->lookAt(this->targetNode_->getPosition()); 132 } 67 133 68 std::string name = xmlElem->Attribute("name"); 69 std::string pos = xmlElem->Attribute("pos"); 70 std::string lookat = xmlElem->Attribute("lookat"); 134 /** 135 what to do when camera loses focus (do not request focus in this function!!) 136 this is called by the CameraHandler singleton class to notify the camera 137 */ 138 void Camera::removeFocus() 139 { 140 this->bHasFocus_ = false; 141 this->positionNode_->detachObject(cam_); 142 } 71 143 72 Ogre::Camera *cam = mgr->createCamera(name); 73 74 float x, y, z; 75 SubString posVec(xmlElem->Attribute("pos"), ','); 76 convertValue<std::string, float>(&x, posVec[0]); 77 convertValue<std::string, float>(&y, posVec[1]); 78 convertValue<std::string, float>(&z, posVec[2]); 79 80 cam->setPosition(Vector3(x,y,z)); 81 82 posVec = SubString(xmlElem->Attribute("lookat"), ','); 83 convertValue<std::string, float>(&x, posVec[0]); 84 convertValue<std::string, float>(&y, posVec[1]); 85 convertValue<std::string, float>(&z, posVec[2]); 86 87 cam->lookAt(Vector3(x,y,z)); 88 89 std::string node = xmlElem->Attribute("node"); 90 91 Ogre::SceneNode* sceneNode = (Ogre::SceneNode*)mgr->getRootSceneNode()->createChildSceneNode(node); //getChild(node); 92 sceneNode->attachObject((Ogre::MovableObject*)cam); 93 94 // FIXME: unused var 95 //Ogre::Viewport* vp = 96 GraphicsEngine::getSingleton().getRenderWindow()->addViewport(cam); 97 98 99 COUT(4) << "Loader: Created camera "<< name << std::endl << std::endl; 100 } 101 } 144 void Camera::setFocus(Ogre::Camera* ogreCam) 145 { 146 this->bHasFocus_ = true; 147 this->cam_ = ogreCam; 148 this->positionNode_->attachObject(cam_); 149 } 102 150 } -
code/branches/merge/src/orxonox/objects/Camera.h
r1056 r1264 30 30 #define _Camera_H__ 31 31 32 #include <OgrePrerequisites.h> 33 #include <OgreSceneNode.h> 34 #include <OgreCamera.h> 35 32 36 #include "OrxonoxPrereqs.h" 33 34 #include "core/BaseObject.h"35 37 36 38 namespace orxonox 37 39 { 38 class _OrxonoxExport Camera : public BaseObject40 class _OrxonoxExport Camera 39 41 { 40 public: 41 Camera(); 42 virtual ~Camera(); 42 friend class CameraHandler; 43 public: 44 Camera(Ogre::SceneNode* node = NULL); 45 virtual ~Camera(); 46 47 //inline void setPosition(Ogre::Vector3 pos) { position_->setPosition(pos); cam_->setPosition(pos); } 48 void setCameraNode(Ogre::SceneNode* node); 49 inline Ogre::SceneNode* getCameraNode() { return this->positionNode_; } 50 // maybe also BaseObject 51 void setTargetNode(Ogre::SceneNode* obj); 43 52 44 53 45 void loadParams(TiXmlElement* xmlElem); 54 void update(); 55 inline bool hasFocus() { return this->bHasFocus_; } 46 56 47 private: 57 private: 58 void removeFocus(); 59 void setFocus(Ogre::Camera* ogreCam); 48 60 49 61 private: 62 Ogre::SceneNode* targetNode_; 63 Ogre::SceneNode* positionNode_; 64 Ogre::Camera* cam_; 65 bool bHasFocus_; 50 66 }; 51 67 } -
code/branches/merge/src/orxonox/objects/Model.cc
r1263 r1264 62 62 XMLPortParamLoadOnly(Model, "mesh", setMesh, xmlelement, mode); 63 63 64 create();64 Model::create(); 65 65 } 66 66 … … 71 71 72 72 bool Model::create(){ 73 WorldEntity::create(); 73 if(!WorldEntity::create()) 74 return false; 74 75 if ((this->meshSrc_ != "") && (this->meshSrc_.size() > 0)) 75 76 { 76 77 this->mesh_.setMesh(meshSrc_); 77 78 this->attachObject(this->mesh_.getEntity()); 78 COUT(4) << "Loader : Created model" << std::endl;79 COUT(4) << "Loader (Model.cc): Created model" << std::endl; 79 80 } 80 81 return true; … … 82 83 83 84 void Model::registerAllVariables(){ 84 WorldEntity::registerAllVariables(); 85 // WorldEntity::registerAllVariables(); 86 COUT(5) << "Model.cc:registering new meshsrc with size: " << meshSrc_.length()+1 << " this: " << this << std::endl; 85 87 registerVar(&meshSrc_, meshSrc_.length() + 1, network::STRING); 86 88 } -
code/branches/merge/src/orxonox/objects/NPC.cc
r1263 r1264 40 40 { 41 41 RegisterObject(NPC); 42 registerAllVariables(); 42 43 } 43 44 … … 59 60 this->translate(location); 60 61 movable_ = movable; 62 } 63 64 void NPC::registerAllVariables(){ 65 Model::registerAllVariables(); 66 registerVar(&movable_, sizeof(movable_), network::DATA); 67 } 68 69 bool NPC::create(){ 70 Model::create(); 71 return true; 61 72 } 62 73 -
code/branches/merge/src/orxonox/objects/NPC.h
r1056 r1264 52 52 void update(); 53 53 void setValues(Vector3 location, Vector3 speed, Vector3 acceleration, bool movable); 54 void registerAllVariables(); 55 bool create(); 54 56 55 57 private: -
code/branches/merge/src/orxonox/objects/Skybox.cc
r1209 r1264 47 47 { 48 48 RegisterObject(Skybox); 49 registerAllVariables(); 49 50 } 50 51 … … 57 58 if (xmlElem->Attribute("src")) 58 59 { 59 s td::string skyboxSrc= xmlElem->Attribute("src");60 this->setSkybox(skyboxSrc);60 skyboxSrc_ = xmlElem->Attribute("src"); 61 this->create(); 61 62 62 COUT(4) << "Loader: Set skybox: "<< skyboxSrc << std::endl << std::endl;63 COUT(4) << "Loader: Set skybox: "<< skyboxSrc_ << std::endl << std::endl; 63 64 } 64 65 } … … 69 70 } 70 71 72 void Skybox::setSkyboxSrc(const std::string& src){ 73 skyboxSrc_ = src; 74 } 75 71 76 /** 72 77 @brief XML loading and saving. … … 79 84 BaseObject::XMLPort(xmlelement, mode); 80 85 81 XMLPortParamLoadOnly(Skybox, "src", setSkybox, xmlelement, mode); 86 XMLPortParamLoadOnly(Skybox, "src", setSkyboxSrc, xmlelement, mode); 87 create(); 82 88 } 89 90 bool Skybox::create(){ 91 this->setSkybox(skyboxSrc_); 92 return true; 93 } 94 95 void Skybox::registerAllVariables(){ 96 registerVar(&skyboxSrc_, skyboxSrc_.length()+1 ,network::STRING); 97 } 98 83 99 } -
code/branches/merge/src/orxonox/objects/Skybox.h
r1056 r1264 33 33 34 34 #include "core/BaseObject.h" 35 #include "network/Synchronisable.h" 35 36 36 37 namespace orxonox 37 38 { 38 class _OrxonoxExport Skybox : public BaseObject 39 class _OrxonoxExport Skybox : public BaseObject, public network::Synchronisable 39 40 { 40 41 public: … … 45 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 46 47 void setSkybox(const std::string& skyboxname); 48 49 bool create(); 50 void registerAllVariables(); 51 void setSkyboxSrc(const std::string &src); 47 52 48 53 private: 54 std::string skyboxSrc_; 49 55 50 56 -
code/branches/merge/src/orxonox/objects/SpaceShip.cc
r1263 r1264 23 23 * Fabian 'x3n' Landau 24 24 * Co-authors: 25 * ...25 * Benjamin Knecht 26 26 * 27 27 */ … … 37 37 #include <OgreSceneNode.h> 38 38 39 #include "CameraHandler.h" 39 40 #include "tinyxml/tinyxml.h" 40 41 #include "ois/OIS.h" … … 50 51 #include "core/XMLPort.h" 51 52 #include "core/ConsoleCommand.h" 53 #include "network/Client.h" 52 54 53 55 namespace orxonox … … 64 66 SpaceShip::SpaceShip() 65 67 { 68 RegisterObject(SpaceShip); 69 this->registerAllVariables(); 70 66 71 SpaceShip::instance_s = this; 72 73 this->setConfigValues(); 67 74 68 75 this->setMouseEventCallback_ = false; … … 73 80 74 81 this->camNode_ = 0; 82 this->camName_ = "camNode"; 75 83 76 84 this->tt_ = 0; … … 96 104 this->setRotationAxis(1, 0, 0); 97 105 this->setStatic(false); 98 /* 99 this->moveForward_ = 0; 100 this->rotateUp_ = 0; 101 this->rotateDown_ = 0; 102 this->rotateRight_ = 0; 103 this->rotateLeft_ = 0; 104 this->loopRight_ = 0; 105 this->loopLeft_ = 0; 106 this->brakeForward_ = 0; 107 this->brakeRotate_ = 0; 108 this->brakeLoop_ = 0; 109 this->speedForward_ = 0; 110 this->speedRotateUpDown_ = 0; 111 this->speedRotateRightLeft_ = 0; 112 this->speedLoopRightLeft_ = 0; 113 this->maxSpeedForward_ = 0; 114 this->maxSpeedRotateUpDown_ = 0; 115 this->maxSpeedRotateRightLeft_ = 0; 116 this->maxSpeedLoopRightLeft_ = 0; 117 this->accelerationForward_ = 0; 118 this->accelerationRotateUpDown_ = 0; 119 this->accelerationRotateRightLeft_ = 0; 120 this->accelerationLoopRightLeft_ = 0; 121 122 this->speed = 250; 123 this->loop = 100; 124 this->rotate = 10; 125 this->mouseX = 0; 126 this->mouseY = 0; 127 this->maxMouseX = 0; 128 this->minMouseX = 0; 129 this->moved = false; 130 131 this->brakeRotate(rotate*10); 132 this->brakeLoop(loop); 133 */ 134 // this->create(); 135 136 RegisterObject(SpaceShip); 137 this->registerAllVariables(); 138 this->setConfigValues(); 106 107 server_=false; 108 139 109 140 110 COUT(3) << "Info: SpaceShip was loaded" << std::endl; … … 156 126 157 127 void SpaceShip::registerAllVariables(){ 158 Model::registerAllVariables(); 159 160 128 registerVar( &camName_, camName_.length()+1, network::STRING, 0x1); 129 registerVar( &maxSpeed_, sizeof(maxSpeed_), network::DATA, 0x1); 130 registerVar( &maxSideAndBackSpeed_, sizeof(maxSideAndBackSpeed_), network::DATA, 0x1); 131 registerVar( &maxRotation_, sizeof(maxRotation_), network::DATA, 0x1); 132 registerVar( &translationAcceleration_, sizeof(translationAcceleration_), network::DATA, 0x1); 133 registerVar( &rotationAcceleration_, sizeof(rotationAcceleration_), network::DATA, 0x1); 134 registerVar( &rotationAccelerationRadian_, sizeof(rotationAccelerationRadian_), network::DATA, 0x1); 135 registerVar( &translationDamping_, sizeof(translationDamping_), network::DATA, 0x1); 136 registerVar( &rotationDamping_, sizeof(rotationDamping_), network::DATA, 0x1); 137 registerVar( &rotationDampingRadian_, sizeof(rotationDampingRadian_), network::DATA, 0x1); 161 138 162 139 } … … 164 141 void SpaceShip::init() 165 142 { 166 if (!setMouseEventCallback_) 167 { 168 InputManager::addMouseHandler(this, "SpaceShip"); 169 setMouseEventCallback_ = true; 170 } 143 if ((!network::Client::getSingleton() || network::Client::getSingleton()->getShipID()==objectID )) 144 { 145 if (!setMouseEventCallback_) 146 { 147 InputManager::addMouseHandler(this, "SpaceShip"); 148 setMouseEventCallback_ = true; 149 } 150 } 171 151 172 152 // START CREATING THRUSTER … … 222 202 this->chFarNode_->setScale(0.4, 0.4, 0.4); 223 203 204 createCamera(); 224 205 // END of testing crosshair 225 206 } … … 236 217 Model::loadParams(xmlElem); 237 218 this->create(); 219 this->getFocus(); 238 220 /* 239 221 if (xmlElem->Attribute("forward") && xmlElem->Attribute("rotateupdown") && xmlElem->Attribute("rotaterightleft") && xmlElem->Attribute("looprightleft")) … … 286 268 void SpaceShip::setCamera(const std::string& camera) 287 269 { 288 Ogre::Camera *cam = GraphicsEngine::getSingleton().getSceneManager()->createCamera("ShipCam"); 289 this->camNode_ = this->getNode()->createChildSceneNode("CamNode"); 270 camName_=camera; 271 // change camera attributes here, if you want to ;) 272 } 273 274 void SpaceShip::getFocus(){ 275 COUT(4) << "requesting focus" << std::endl; 276 if(network::Client::getSingleton()==0 || network::Client::getSingleton()->getShipID()==objectID) 277 CameraHandler::getInstance()->requestFocus(cam_); 278 279 } 280 281 void SpaceShip::createCamera(){ 282 // COUT(4) << "begin camera creation" << std::endl; 283 this->camNode_ = this->getNode()->createChildSceneNode(camName_); 284 COUT(4) << "position: (this)" << this->getNode()->getPosition() << std::endl; 285 this->camNode_->setPosition(/*this->getNode()->getPosition() +*/ Vector3(-50,0,10)); 286 COUT(4) << "position: (cam)" << this->camNode_->getPosition() << std::endl; 290 287 /* 291 288 // node->setInheritOrientation(false); … … 293 290 cam->lookAt(Vector3(0,20,0)); 294 291 cam->roll(Degree(0)); 295 */ 296 297 cam->setPosition(Vector3(-200,0,35)); 292 *//*COUT(4) << "creating new camera" << std::endl;*/ 293 cam_ = new Camera(this->camNode_); 294 295 cam_->setTargetNode(this->getNode()); 298 296 // cam->setPosition(Vector3(0,-350,0)); 299 cam->lookAt(Vector3(0,0,35));300 cam->roll(Degree(-90));301 302 this->camNode_->attachObject(cam);303 GraphicsEngine::getSingleton().getRenderWindow()->addViewport(cam); 297 if(network::Client::getSingleton()!=0 && network::Client::getSingleton()->getShipID()==objectID){ 298 this->setBacksync(true); 299 CameraHandler::getInstance()->requestFocus(cam_); 300 } 301 304 302 } 305 303 … … 337 335 XMLPortParamLoadOnly(SpaceShip, "transDamp", setTransDamp, xmlelement, mode); 338 336 XMLPortParamLoadOnly(SpaceShip, "rotDamp", setRotDamp, xmlelement, mode); 337 server_=true; // TODO: this is only a hack 338 SpaceShip::create(); 339 getFocus(); 339 340 } 340 341 … … 448 449 if (this->bLMousePressed_ && this->timeToReload_ <= 0) 449 450 { 450 new Projectile(this); 451 Projectile *p = new Projectile(this); 452 p->setBacksync(true); 451 453 this->timeToReload_ = this->reloadTime_; 452 454 } … … 520 522 } 521 523 522 if (mKeyboard->isKeyDown(OIS::KC_UP) || mKeyboard->isKeyDown(OIS::KC_W)) 524 if( (network::Client::getSingleton() && network::Client::getSingleton()->getShipID() == objectID) || server_ ){ 525 COUT(4) << "steering our ship: " << objectID << " mkeyboard: " << mKeyboard << std::endl; 526 if (mKeyboard->isKeyDown(OIS::KC_UP) || mKeyboard->isKeyDown(OIS::KC_W)) 523 527 this->acceleration_.x = this->translationAcceleration_; 524 else if(mKeyboard->isKeyDown(OIS::KC_DOWN) || mKeyboard->isKeyDown(OIS::KC_S))528 else if(mKeyboard->isKeyDown(OIS::KC_DOWN) || mKeyboard->isKeyDown(OIS::KC_S)) 525 529 this->acceleration_.x = -this->translationAcceleration_; 526 else530 else 527 531 this->acceleration_.x = 0; 528 532 529 if (mKeyboard->isKeyDown(OIS::KC_RIGHT) || mKeyboard->isKeyDown(OIS::KC_D))533 if (mKeyboard->isKeyDown(OIS::KC_RIGHT) || mKeyboard->isKeyDown(OIS::KC_D)) 530 534 this->acceleration_.y = -this->translationAcceleration_; 531 else if (mKeyboard->isKeyDown(OIS::KC_LEFT) || mKeyboard->isKeyDown(OIS::KC_A))535 else if (mKeyboard->isKeyDown(OIS::KC_LEFT) || mKeyboard->isKeyDown(OIS::KC_A)) 532 536 this->acceleration_.y = this->translationAcceleration_; 533 else537 else 534 538 this->acceleration_.y = 0; 535 539 536 if (mKeyboard->isKeyDown(OIS::KC_DELETE) || mKeyboard->isKeyDown(OIS::KC_Q))540 if (mKeyboard->isKeyDown(OIS::KC_DELETE) || mKeyboard->isKeyDown(OIS::KC_Q)) 537 541 this->momentum_ = Radian(-this->rotationAccelerationRadian_); 538 else if (mKeyboard->isKeyDown(OIS::KC_PGDOWN) || mKeyboard->isKeyDown(OIS::KC_E))542 else if (mKeyboard->isKeyDown(OIS::KC_PGDOWN) || mKeyboard->isKeyDown(OIS::KC_E)) 539 543 this->momentum_ = Radian(this->rotationAccelerationRadian_); 540 else544 else 541 545 this->momentum_ = 0; 546 }/*else 547 COUT(4) << "not steering ship: " << objectID << " our ship: " << network::Client::getSingleton()->getShipID() << std::endl;*/ 542 548 543 549 WorldEntity::tick(dt); -
code/branches/merge/src/orxonox/objects/SpaceShip.h
r1219 r1264 23 23 * Fabian 'x3n' Landau 24 24 * Co-authors: 25 * ...25 * Benjamin Knecht 26 26 * 27 27 */ … … 35 35 36 36 #include "core/InputHandler.h" 37 #include "Camera.h" 37 38 #include "Model.h" 38 39 #include "../tools/BillboardSet.h" … … 62 63 void setRotDamp(float value); 63 64 65 void getFocus(); 66 64 67 static void setMaxSpeedTest(float value) 65 68 { SpaceShip::instance_s->setMaxSpeed(value); } … … 72 75 73 76 private: 77 void createCamera(); 74 78 static SpaceShip* instance_s; 75 79 … … 81 85 82 86 Ogre::SceneNode* camNode_; 87 Camera* cam_; 88 std::string camName_; 89 83 90 84 91 ParticleInterface* tt_; … … 117 124 118 125 float emitterRate_; 126 bool server_; 119 127 }; 120 128 } -
code/branches/merge/src/orxonox/objects/WorldEntity.cc
r1263 r1264 66 66 } 67 67 } 68 68 69 69 70 WorldEntity::~WorldEntity() 70 71 { 72 // just to make sure we clean out all scene nodes 73 if(this->getNode()) 74 this->getNode()->removeAndDestroyAllChildren(); 71 75 } 72 76 … … 75 79 if (!this->bStatic_) 76 80 { 81 // COUT(4) << "acceleration: " << this->acceleration_ << " velocity: " << this->velocity_ << std::endl; 77 82 this->velocity_ += (dt * this->acceleration_); 78 83 this->translate(dt * this->velocity_, Ogre::Node::TS_LOCAL); … … 89 94 create(); 90 95 } 96 91 97 92 98 void WorldEntity::setYawPitchRoll(const Degree& yaw, const Degree& pitch, const Degree& roll) … … 115 121 116 122 XMLPortObject(WorldEntity, WorldEntity, "attached", attachWorldEntity, getAttachedWorldEntity, xmlelement, mode, false, true); 123 124 WorldEntity::create(); 117 125 } 118 126 … … 121 129 { 122 130 // register coordinates 123 registerVar( (void*) &(this->getPosition().x), sizeof(this->getPosition().x), network::DATA );124 registerVar( (void*) &(this->getPosition().y), sizeof(this->getPosition().y), network::DATA );125 registerVar( (void*) &(this->getPosition().z), sizeof(this->getPosition().z), network::DATA );131 registerVar( (void*) &(this->getPosition().x), sizeof(this->getPosition().x), network::DATA, 0x3); 132 registerVar( (void*) &(this->getPosition().y), sizeof(this->getPosition().y), network::DATA, 0x3); 133 registerVar( (void*) &(this->getPosition().z), sizeof(this->getPosition().z), network::DATA, 0x3); 126 134 // register orientation 127 registerVar( (void*) &(this->getOrientation().w), sizeof(this->getOrientation().w), network::DATA); 128 registerVar( (void*) &(this->getOrientation().x), sizeof(this->getOrientation().x), network::DATA); 129 registerVar( (void*) &(this->getOrientation().y), sizeof(this->getOrientation().y), network::DATA); 130 registerVar( (void*) &(this->getOrientation().z), sizeof(this->getOrientation().z), network::DATA); 131 // not needed at the moment, because we don't have prediction yet 135 registerVar( (void*) &(this->getOrientation().w), sizeof(this->getOrientation().w), network::DATA, 0x3); 136 registerVar( (void*) &(this->getOrientation().x), sizeof(this->getOrientation().x), network::DATA, 0x3); 137 registerVar( (void*) &(this->getOrientation().y), sizeof(this->getOrientation().y), network::DATA, 0x3); 138 registerVar( (void*) &(this->getOrientation().z), sizeof(this->getOrientation().z), network::DATA, 0x3); 132 139 // register velocity_ 133 registerVar( (void*) &(this->getVelocity().x), sizeof(this->getVelocity().x), network::DATA); 134 registerVar( (void*) &(this->getVelocity().y), sizeof(this->getVelocity().y), network::DATA); 135 registerVar( (void*) &(this->getVelocity().z), sizeof(this->getVelocity().z), network::DATA); 136 // register rotationAxis/rate 137 registerVar( (void*) &(this->getRotationRate()), sizeof(this->getRotationRate()), network::DATA); 138 registerVar( (void*) &(this->getRotationAxis().x), sizeof(this->getRotationAxis().x), network::DATA); 139 registerVar( (void*) &(this->getRotationAxis().y), sizeof(this->getRotationAxis().y), network::DATA); 140 registerVar( (void*) &(this->getRotationAxis().z), sizeof(this->getRotationAxis().z), network::DATA); 140 // registerVar( (void*) &(this->getVelocity().x), sizeof(this->getVelocity().x), network::DATA, 0x3); 141 // registerVar( (void*) &(this->getVelocity().y), sizeof(this->getVelocity().y), network::DATA, 0x3); 142 // registerVar( (void*) &(this->getVelocity().z), sizeof(this->getVelocity().z), network::DATA, 0x3); 143 // // register rotationAxis/rate 144 // registerVar( (void*) &(this->getRotationRate()), sizeof(this->getRotationRate()), network::DATA, 0x3); 145 // registerVar( (void*) &(this->getRotationAxis().x), sizeof(this->getRotationAxis().x), network::DATA, 0x3); 146 // registerVar( (void*) &(this->getRotationAxis().y), sizeof(this->getRotationAxis().y), network::DATA, 0x3); 147 // registerVar( (void*) &(this->getRotationAxis().z), sizeof(this->getRotationAxis().z), network::DATA, 0x3); 148 // register scale of node 149 registerVar( (void*) &(this->getScale().x), sizeof(this->getScale().x), network::DATA, 0x3); 150 registerVar( (void*) &(this->getScale().y), sizeof(this->getScale().y), network::DATA, 0x3); 151 registerVar( (void*) &(this->getScale().z), sizeof(this->getScale().z), network::DATA, 0x3); 152 //register staticity 153 registerVar( (void*) &(this->bStatic_), sizeof(this->bStatic_), network::DATA, 0x3); 154 //register acceleration 155 // register velocity_ 156 // registerVar( (void*) &(this->getAcceleration().x), sizeof(this->getAcceleration().x), network::DATA, 0x3); 157 // registerVar( (void*) &(this->getAcceleration().y), sizeof(this->getAcceleration().y), network::DATA, 0x3); 158 // registerVar( (void*) &(this->getAcceleration().z), sizeof(this->getAcceleration().z), network::DATA, 0x3); 141 159 } 142 160 -
code/branches/merge/src/orxonox/particle/ParticleInterface.cc
r1039 r1264 63 63 ParticleInterface::~ParticleInterface(void) 64 64 { 65 while(particleSystem_->getNumEmitters()>0) 66 particleSystem_->removeEmitter(particleSystem_->getNumEmitters()-1); 65 67 sceneManager_->destroyParticleSystem(particleSystem_); 66 68 }
Note: See TracChangeset
for help on using the changeset viewer.