Changeset 1021 for code/trunk/src/orxonox/objects
- Timestamp:
- Apr 10, 2008, 5:03:34 PM (17 years ago)
- Location:
- code/trunk/src/orxonox/objects
- Files:
-
- 2 deleted
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/objects/Camera.cc
r790 r1021 6 6 #include <OgreSceneManager.h> 7 7 #include <OgreSceneNode.h> 8 #include <OgreRoot.h>9 8 #include <OgreRenderWindow.h> 10 9 #include <OgreViewport.h> … … 69 68 70 69 // FIXME: unused var 71 Ogre::Viewport* vp = orxonox::Orxonox::getSingleton()->getOgrePointer()->getR oot()->getAutoCreatedWindow()->addViewport(cam);70 Ogre::Viewport* vp = orxonox::Orxonox::getSingleton()->getOgrePointer()->getRenderWindow()->addViewport(cam); 72 71 73 72 -
code/trunk/src/orxonox/objects/Fighter.cc
r790 r1021 37 37 #include "util/tinyxml/tinyxml.h" 38 38 #include "util/String2Number.h" 39 #include "../core/CoreIncludes.h" 40 #include "../Orxonox.h" 41 #include "../particle/ParticleInterface.h" 39 #include "core/CoreIncludes.h" 40 #include "Orxonox.h" 41 #include "InputHandler.h" 42 #include "particle/ParticleInterface.h" 42 43 #include "weapon/AmmunitionDump.h" 43 44 #include "weapon/BarrelGun.h" … … 207 208 208 209 node->attachObject(cam); 209 Orxonox::getSingleton()->getOgrePointer()->getR oot()->getAutoCreatedWindow()->addViewport(cam);210 Orxonox::getSingleton()->getOgrePointer()->getRenderWindow()->addViewport(cam); 210 211 } 211 212 } … … 254 255 if (!this->setMouseEventCallback_) 255 256 { 256 if ( Orxonox::getSingleton()->getMouse())257 if (InputHandler::getSingleton()->getMouse()) 257 258 { 258 Orxonox::getSingleton()->getMouse()->setEventCallback(this);259 InputHandler::getSingleton()->getMouse()->setEventCallback(this); 259 260 this->setMouseEventCallback_ = true; 260 261 } … … 263 264 WorldEntity::tick(dt); 264 265 265 OIS::Keyboard* mKeyboard = Orxonox::getSingleton()->getKeyboard();266 OIS::Mouse* mMouse = Orxonox::getSingleton()->getMouse();266 OIS::Keyboard* mKeyboard = InputHandler::getSingleton()->getKeyboard(); 267 OIS::Mouse* mMouse = InputHandler::getSingleton()->getMouse(); 267 268 268 269 mKeyboard->capture(); -
code/trunk/src/orxonox/objects/Model.cc
r871 r1021 44 44 { 45 45 RegisterObject(Model); 46 registerAllVariables(); 46 47 } 47 48 … … 63 64 /** 64 65 @brief XML loading and saving. 65 @param xmlelement The XML-element 66 @p 67 aram xmlelement The XML-element 66 68 @param loading Loading (true) or saving (false) 67 69 @return The XML-element … … 82 84 83 85 bool Model::create(){ 86 WorldEntity::create(); 84 87 if(meshSrc_.compare("")!=0){ 85 88 this->mesh_.setMesh(meshSrc_); … … 87 90 COUT(4) << "Loader: Created model" << std::endl; 88 91 } 89 registerAllVariables();90 92 return true; 91 93 } 92 94 93 95 void Model::registerAllVariables(){ 94 // registerVar(&meshSrc_, meshSrc_.length() + 1, network::STRING); 96 WorldEntity::registerAllVariables(); 97 registerVar(&meshSrc_, meshSrc_.length() + 1, network::STRING); 95 98 } 96 99 } -
code/trunk/src/orxonox/objects/Model.h
r871 r1021 22 22 bool create(); 23 23 24 protected: 25 void registerAllVariables(); 26 24 27 private: 25 28 std::string meshSrc_; 26 29 Mesh mesh_; 27 void registerAllVariables();28 30 }; 29 31 } -
code/trunk/src/orxonox/objects/NPC.cc
r790 r1021 85 85 void NPC::tick(float dt) 86 86 { 87 87 update(); 88 88 this->setVelocity(0.995*this->getVelocity() + this->getAcceleration()*dt); 89 89 this->translate(this->getVelocity()*dt); -
code/trunk/src/orxonox/objects/SpaceShip.cc
r978 r1021 39 39 #include "util/String2Number.h" 40 40 #include "util/Math.h" 41 #include "../core/CoreIncludes.h" 42 #include "../core/Debug.h" 43 #include "../Orxonox.h" 44 #include "../particle/ParticleInterface.h" 41 #include "core/CoreIncludes.h" 42 #include "core/Debug.h" 43 #include "Orxonox.h" 44 #include "InputHandler.h" 45 #include "particle/ParticleInterface.h" 45 46 #include "Projectile.h" 46 47 #include "core/XMLPort.h" … … 55 56 { 56 57 RegisterObject(SpaceShip); 58 this->registerAllVariables(); 57 59 58 60 this->setConfigValues(); … … 124 126 this->brakeLoop(loop); 125 127 */ 126 this->init(); 127 128 // this->create(); 129 130 128 131 COUT(3) << "Info: SpaceShip was loaded" << std::endl; 129 132 } … … 135 138 } 136 139 140 bool SpaceShip::create(){ 141 if(Model::create()) 142 this->init(); 143 else 144 return false; 145 return true; 146 } 147 148 void SpaceShip::registerAllVariables(){ 149 Model::registerAllVariables(); 150 151 152 153 } 154 137 155 void SpaceShip::init() 138 156 { … … 202 220 { 203 221 Model::loadParams(xmlElem); 222 this->create(); 204 223 /* 205 224 if (xmlElem->Attribute("forward") && xmlElem->Attribute("rotateupdown") && xmlElem->Attribute("rotaterightleft") && xmlElem->Attribute("looprightleft")) … … 267 286 268 287 this->camNode_->attachObject(cam); 269 Orxonox::getSingleton()->getOgrePointer()->getR oot()->getAutoCreatedWindow()->addViewport(cam);288 Orxonox::getSingleton()->getOgrePointer()->getRenderWindow()->addViewport(cam); 270 289 } 271 290 … … 400 419 if (!this->setMouseEventCallback_) 401 420 { 402 if ( Orxonox::getSingleton()->getMouse())421 if (InputHandler::getSingleton()->getMouse()) 403 422 { 404 Orxonox::getSingleton()->getMouse()->setEventCallback(this);423 InputHandler::getSingleton()->getMouse()->setEventCallback(this); 405 424 this->setMouseEventCallback_ = true; 406 425 } … … 427 446 } 428 447 429 OIS::Keyboard* mKeyboard = Orxonox::getSingleton()->getKeyboard();430 OIS::Mouse* mMouse = Orxonox::getSingleton()->getMouse();448 OIS::Keyboard* mKeyboard = InputHandler::getSingleton()->getKeyboard(); 449 OIS::Mouse* mMouse = InputHandler::getSingleton()->getMouse(); 431 450 432 451 mKeyboard->capture(); -
code/trunk/src/orxonox/objects/SpaceShip.h
r978 r1021 21 21 SpaceShip(); 22 22 ~SpaceShip(); 23 bool create(); 24 void registerAllVariables(); 23 25 void init(); 24 26 void setConfigValues(); -
code/trunk/src/orxonox/objects/WorldEntity.cc
r871 r1021 49 49 RegisterObject(WorldEntity); 50 50 51 if (Orxonox::getSingleton()->getSceneManager()) 52 { 53 std::ostringstream name; 54 name << (WorldEntity::worldEntityCounter_s++); 55 this->setName("WorldEntity" + name.str()); 56 this->node_ = Orxonox::getSingleton()->getSceneManager()->getRootSceneNode()->createChildSceneNode(this->getName()); 57 } 58 else 59 { 60 this->node_ = 0; 61 } 51 //create(); 62 52 63 53 this->bStatic_ = true; … … 67 57 this->rotationRate_ = 0; 68 58 this->momentum_ = 0; 59 60 if (Orxonox::getSingleton()->getSceneManager()) 61 { 62 std::ostringstream name; 63 name << (WorldEntity::worldEntityCounter_s++); 64 this->setName("WorldEntity" + name.str()); 65 this->node_ = Orxonox::getSingleton()->getSceneManager()->getRootSceneNode()->createChildSceneNode(this->getName()); 66 67 registerAllVariables(); 68 } 69 else 70 { 71 this->node_ = 0; 72 } 69 73 } 70 74 … … 89 93 90 94 BaseObject::loadParams(xmlElem); 95 create(); 91 96 /* 92 97 if (xmlElem->Attribute("position")) … … 185 190 } 186 191 187 bool WorldEntity::create(){188 registerAllVariables();189 return true;190 }191 192 192 193 void WorldEntity::registerAllVariables() 193 194 { 194 /*// register coordinates195 // register coordinates 195 196 registerVar( (void*) &(this->getPosition().x), sizeof(this->getPosition().x), network::DATA); 196 197 registerVar( (void*) &(this->getPosition().y), sizeof(this->getPosition().y), network::DATA); … … 200 201 registerVar( (void*) &(this->getOrientation().x), sizeof(this->getOrientation().x), network::DATA); 201 202 registerVar( (void*) &(this->getOrientation().y), sizeof(this->getOrientation().y), network::DATA); 202 registerVar( (void*) &(this->getOrientation().z), sizeof(this->getOrientation().z), network::DATA); */203 registerVar( (void*) &(this->getOrientation().z), sizeof(this->getOrientation().z), network::DATA); 203 204 // not needed at the moment, because we don't have prediction yet 204 / *// register velocity_205 // register velocity_ 205 206 registerVar( (void*) &(this->getVelocity().x), sizeof(this->getVelocity().x), network::DATA); 206 207 registerVar( (void*) &(this->getVelocity().y), sizeof(this->getVelocity().y), network::DATA); … … 210 211 registerVar( (void*) &(this->getRotationAxis().x), sizeof(this->getRotationAxis().x), network::DATA); 211 212 registerVar( (void*) &(this->getRotationAxis().y), sizeof(this->getRotationAxis().y), network::DATA); 212 registerVar( (void*) &(this->getRotationAxis().z), sizeof(this->getRotationAxis().z), network::DATA); */213 registerVar( (void*) &(this->getRotationAxis().z), sizeof(this->getRotationAxis().z), network::DATA); 213 214 } 214 215 -
code/trunk/src/orxonox/objects/WorldEntity.h
r871 r1021 12 12 //#include "util/tinyxml/tinyxml.h" 13 13 #include "core/BaseObject.h" 14 #include " Tickable.h"14 #include "core/Tickable.h" 15 15 #include "../tools/Mesh.h" 16 16 17 17 namespace orxonox 18 18 { 19 class _OrxonoxExport WorldEntity : public BaseObject, public Tickable //, public network::Synchronisable19 class _OrxonoxExport WorldEntity : public BaseObject, public Tickable, public network::Synchronisable 20 20 { 21 21 public: … … 26 26 virtual void loadParams(TiXmlElement* xmlElem); 27 27 virtual void XMLPort(Element& xmlelement, bool loading); 28 bool create();28 inline bool create(){ return true; } 29 29 30 30 void attachWorldEntity(WorldEntity* entity); -
code/trunk/src/orxonox/objects/weapon/AmmunitionDump.cc
r871 r1021 45 45 { 46 46 RegisterObject(AmmunitionDump); 47 registerAllVariables(); 47 48 48 49 for (int i = 0; i < numberOfAmmos_; i++) … … 114 115 return stock_[id]; 115 116 } 117 118 void AmmunitionDump::registerAllVariables(){ 119 registerVar( &numberOfAmmos_, sizeof(int), network::DATA); 120 121 for (int i = 0; i < numberOfAmmos_; i++) 122 { 123 registerVar(&stock_[i], sizeof(int), network::DATA); 124 registerVar(&capacity_[i], sizeof(int), network::DATA); 125 } 126 } 116 127 } -
code/trunk/src/orxonox/objects/weapon/AmmunitionDump.h
r871 r1021 60 60 protected: 61 61 inline bool create() { return true; } 62 void registerAllVariables(); 62 63 63 64 int numberOfAmmos_; -
code/trunk/src/orxonox/objects/weapon/BulletManager.cc
r871 r1021 39 39 { 40 40 RegisterObject(BulletManager); 41 registerAllVariables(); 41 42 bullets_ = new Bullet*[bulletsSize_]; 42 43 } … … 103 104 } 104 105 106 void BulletManager::registerAllVariables(){ 107 registerVar(&bulletsSize_, sizeof(int), network::DATA); 108 registerVar(&bulletsIndex_, sizeof(int), network::DATA); 109 // TODO we got a problem here: 110 // there is no possibility (so far) to synchronise pointers to objects 111 } 112 105 113 } -
code/trunk/src/orxonox/objects/weapon/BulletManager.h
r871 r1021 39 39 #include "util/tinyxml/tinyxml.h" 40 40 #include "core/BaseObject.h" 41 #include " ../Tickable.h"41 #include "core/Tickable.h" 42 42 43 43 namespace orxonox { … … 60 60 protected: 61 61 inline bool create() { return true; } 62 void registerAllVariables(); 62 63 63 64 // Bullet array
Note: See TracChangeset
for help on using the changeset viewer.