[515] | 1 | #include <OgreSceneManager.h> |
---|
| 2 | #include <OgreSceneNode.h> |
---|
| 3 | #include <OgreRoot.h> |
---|
| 4 | #include <OgreRenderWindow.h> |
---|
| 5 | |
---|
| 6 | #include <string> |
---|
| 7 | |
---|
[614] | 8 | #include "../Orxonox.h" |
---|
| 9 | #include "../GraphicsEngine.h" |
---|
[515] | 10 | #include "../../tinyxml/tinyxml.h" |
---|
| 11 | #include "../../misc/Tokenizer.h" |
---|
| 12 | #include "../../misc/String2Number.h" |
---|
[560] | 13 | #include "../core/Debug.h" |
---|
[515] | 14 | |
---|
| 15 | #include "SpaceshipSteeringObject.h" |
---|
| 16 | |
---|
[612] | 17 | #include "../SpaceshipSteering.h" |
---|
[515] | 18 | |
---|
| 19 | namespace orxonox |
---|
| 20 | { |
---|
| 21 | CreateFactory(SpaceshipSteeringObject); |
---|
| 22 | |
---|
| 23 | SpaceshipSteeringObject::SpaceshipSteeringObject() |
---|
| 24 | { |
---|
| 25 | RegisterObject(SpaceshipSteeringObject); |
---|
| 26 | } |
---|
| 27 | |
---|
| 28 | SpaceshipSteeringObject::~SpaceshipSteeringObject() |
---|
| 29 | { |
---|
| 30 | } |
---|
| 31 | |
---|
| 32 | void SpaceshipSteeringObject::loadParams(TiXmlElement* xmlElem) |
---|
| 33 | { |
---|
[663] | 34 | SpaceshipSteering* steering = orxonox::Orxonox::getSingleton()->getSteeringPointer(); |
---|
[560] | 35 | |
---|
[663] | 36 | if (xmlElem->Attribute("node") && xmlElem->Attribute("forward") && xmlElem->Attribute("rotateupdown") && xmlElem->Attribute("rotaterightleft") && xmlElem->Attribute("looprightleft")) |
---|
| 37 | { |
---|
| 38 | std::string nodeStr = xmlElem->Attribute("node"); |
---|
| 39 | std::string forwardStr = xmlElem->Attribute("forward"); |
---|
| 40 | std::string rotateupdownStr = xmlElem->Attribute("rotateupdown"); |
---|
| 41 | std::string rotaterightleftStr = xmlElem->Attribute("rotaterightleft"); |
---|
| 42 | std::string looprightleftStr = xmlElem->Attribute("looprightleft"); |
---|
[515] | 43 | |
---|
[663] | 44 | float forward, rotateupdown, rotaterightleft, looprightleft; |
---|
| 45 | String2Number<float>(forward, forwardStr); |
---|
| 46 | String2Number<float>(rotateupdown, rotateupdownStr); |
---|
| 47 | String2Number<float>(rotaterightleft, rotaterightleftStr); |
---|
| 48 | String2Number<float>(looprightleft, looprightleftStr); |
---|
[560] | 49 | |
---|
[663] | 50 | steering = new SpaceshipSteering(forward, rotateupdown, rotaterightleft, looprightleft); |
---|
[560] | 51 | |
---|
[663] | 52 | Ogre::SceneManager* mgr = orxonox::Orxonox::getSingleton()->getSceneManager(); |
---|
| 53 | Ogre::SceneNode* sceneNode = (Ogre::SceneNode*)mgr->getRootSceneNode()->getChild(nodeStr); |
---|
[560] | 54 | |
---|
[663] | 55 | steering->addNode(sceneNode); |
---|
[560] | 56 | |
---|
| 57 | |
---|
| 58 | |
---|
| 59 | |
---|
[663] | 60 | COUT(4) << "Loader: Initialized spaceship steering at node " << nodeStr << " values "<< forward << " " << rotateupdown << " "<< rotaterightleft << " "<< looprightleft << " "<< std::endl << std::endl; |
---|
| 61 | } |
---|
[515] | 62 | } |
---|
| 63 | } |
---|