Changeset 576 for code/branches/FICN/src/orxonox/objects
- Timestamp:
- Dec 17, 2007, 3:39:17 PM (17 years ago)
- Location:
- code/branches/FICN/src/orxonox/objects
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FICN/src/orxonox/objects/CMakeLists.txt
r565 r576 15 15 SpaceshipSteeringObject.cc 16 16 Model.cc 17 Mesh.cc 17 18 ) 18 19 -
code/branches/FICN/src/orxonox/objects/Model.cc
r556 r576 1 #include <string> 2 3 #include "Model.h" 4 #include "../core/CoreIncludes.h" 5 #include "../orxonox.h" 6 #include "../../tinyxml/tinyxml.h" 7 #include "../../misc/Tokenizer.h" 8 #include "../../misc/String2Number.h" 9 10 namespace orxonox 11 { 12 CreateFactory(Model); 13 14 Model::Model() 15 { 16 RegisterObject(Model); 17 } 18 19 Model::~Model() 20 { 21 } 22 23 void Model::loadParams(TiXmlElement* xmlElem) 24 { 25 std::cout << "1\n"; 26 if (xmlElem->Attribute("position")) 27 { 28 std::cout << "2\n"; 29 std::vector<std::string> pos = tokenize(xmlElem->Attribute("position"),","); 30 float x, y, z; 31 String2Number<float>(x, pos[0]); 32 String2Number<float>(y, pos[1]); 33 String2Number<float>(z, pos[2]); 34 this->setPosition(x, y, z); 35 } 36 37 std::cout << "3\n"; 38 if (xmlElem->Attribute("direction")) 39 { 40 std::cout << "4\n"; 41 std::vector<std::string> pos = tokenize(xmlElem->Attribute("direction"),","); 42 float x, y, z; 43 String2Number<float>(x, pos[0]); 44 String2Number<float>(y, pos[1]); 45 String2Number<float>(z, pos[2]); 46 this->setDirection(x, y, z); 47 } 48 49 std::cout << "5\n"; 50 if (xmlElem->Attribute("mesh")) 51 { 52 std::cout << "6_1\n"; 53 std::string src = xmlElem->Attribute("mesh"); 54 std::cout << "6_2\n"; 55 std::cout << this->mesh_.getEntity() << std::endl; 56 this->mesh_ = Mesh(src); 57 std::cout << "6_3\n"; 58 std::cout << this->mesh_.getEntity() << std::endl; 59 this->attachObject(this->mesh_.getEntity()); 60 std::cout << "6_4\n"; 61 } 62 63 std::cout << "7\n"; 64 if (xmlElem->Attribute("scale")) 65 { 66 std::cout << "8\n"; 67 std::string scaleStr = xmlElem->Attribute("scale"); 68 float scale; 69 String2Number<float>(scale, scaleStr); 70 this->setScale(scale); 71 } 72 std::cout << "9\n"; 73 74 COUT(4) << "Loader: Created model" << std::endl; 75 } 76 } -
code/branches/FICN/src/orxonox/objects/Model.h
r556 r576 1 #ifndef _Model_H__ 2 #define _Model_H__ 3 4 #include "WorldEntity.h" 5 #include "Mesh.h" 6 #include "../../tinyxml/tinyxml.h" 7 8 namespace orxonox 9 { 10 class Model : public WorldEntity 11 { 12 public: 13 Model(); 14 ~Model(); 15 virtual void loadParams(TiXmlElement* xmlElem); 16 17 private: 18 Mesh mesh_; 19 }; 20 } 21 22 #endif -
code/branches/FICN/src/orxonox/objects/WorldEntity.cc
r567 r576 43 43 RegisterObject(WorldEntity); 44 44 45 std::cout << "10_1\n"; 45 46 if (Orxonox::getSingleton()->getSceneManager()) 46 47 { 48 std::cout << "10_2\n"; 47 49 std::ostringstream name; 48 50 name << (WorldEntity::worldEntityCounter_s++); 49 51 this->setName("WorldEntity" + name.str()); 50 52 node_ = Orxonox::getSingleton()->getSceneManager()->getRootSceneNode()->createChildSceneNode(this->getName()); 53 std::cout << "blubbbi: " << this->getName() << " .. " << this->node_ << std::endl; 51 54 } 55 std::cout << "10_3\n"; 52 56 53 57 this->bStatic_ = true; -
code/branches/FICN/src/orxonox/objects/WorldEntity.h
r567 r576 7 7 #include "OgreSceneManager.h" 8 8 #include "OgreSceneNode.h" 9 #include "Mesh.h" 9 10 #include "network/Synchronisable.h" 10 11 … … 45 46 { this->node_->roll(angle, relativeTo); } 46 47 48 inline void rotate(const Vector3 &axis, const Radian &angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL) 49 { this->node_->rotate(axis, angle, relativeTo); } 50 inline void setDirection(Real x, Real y, Real z, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z) 51 { this->node_->setDirection(x, y, z, relativeTo, localDirectionVector); } 52 inline void setDirection(const Vector3 &vec, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z) 53 { this->node_->setDirection(vec, relativeTo, localDirectionVector); } 54 inline void setOrientation(const Ogre::Quaternion quat) 55 { this->node_->setOrientation(quat); } 56 inline void lookAt(const Vector3 &targetPoint, Ogre::Node::TransformSpace relativeTo, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z) 57 { this->node_->lookAt(targetPoint, relativeTo, localDirectionVector); } 47 58 48 inline void rotate(const Vector3 &axis, const Radian &angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL) 49 { this->node_->rotate(axis, angle, relativeTo); } 50 inline void setDirection(Real x, Real y, Real z, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z) 51 { this->node_->setDirection(x, y, z, relativeTo, localDirectionVector); } 52 inline void setDirection(const Vector3 &vec, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z) 53 { this->node_->setDirection(vec, relativeTo, localDirectionVector); } 54 inline void setOrientation(const Ogre::Quaternion quat) 55 { this->node_->setOrientation(quat); } 56 inline void lookAt(const Vector3 &targetPoint, Ogre::Node::TransformSpace relativeTo, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z) 57 { this->node_->lookAt(targetPoint, relativeTo, localDirectionVector); } 59 inline void setScale(const Vector3 &scale) 60 { this->node_->setScale(scale); } 61 inline void setScale(Real x, Real y, Real z) 62 { this->node_->setScale(x, y, z); } 63 inline void setScale(Real scale) 64 { this->node_->setScale(scale, scale, scale); } 65 inline const Vector3& getScale(void) const 66 { return this->node_->getScale(); } 67 inline void scale(const Vector3 &scale) 68 { this->node_->scale(scale); } 69 inline void scale(Real x, Real y, Real z) 70 { this->node_->scale(x, y, z); } 71 inline void scale(Real scale) 72 { this->node_->scale(scale, scale, scale); } 58 73 59 74 inline void attachObject(Ogre::MovableObject *obj) 60 { this->node_->attachObject(obj); } 75 { std::cout << "gux_1" << this->node_ << "\n"; this->node_->attachObject(obj); std::cout << "gux_2\n"; } 76 inline void attachObject(Mesh &mesh) 77 { std::cout << "gux_3" << this->node_ << "\n"; this->node_->attachObject((Ogre::MovableObject*)(mesh.getEntity())); std::cout << "gux_4\n"; } 61 78 inline void detachObject(Ogre::MovableObject *obj) 62 79 { this->node_->detachObject(obj); } 63 80 inline void detachAllObjects() 64 81 { this->node_->detachAllObjects(); } 65 82 66 83 inline void setVelocity(const Vector3& velocity) … … 100 117 inline const Ogre::Quaternion& getOrientation() 101 118 { return this->node_->getOrientation(); } 102 119 103 120 protected: 104 121 void registerAllVariables(); 105 122 106 123 private: 107 124 Ogre::SceneNode* node_;
Note: See TracChangeset
for help on using the changeset viewer.