Changeset 618 for code/branches/FICN/src/orxonox/objects
- Timestamp:
- Dec 18, 2007, 4:47:58 PM (17 years ago)
- Location:
- code/branches/FICN/src/orxonox/objects
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FICN/src/orxonox/objects/Camera.cc
r614 r618 30 30 void Camera::loadParams(TiXmlElement* xmlElem) 31 31 { 32 32 Ogre::SceneManager* mgr = orxonox::Orxonox::getSingleton()->getSceneManager(); 33 33 34 35 36 //<Camera name="Camera" pos="0,0,-250" lookat="0,0,0" />34 if (xmlElem->Attribute("name") && xmlElem->Attribute("pos") && xmlElem->Attribute("lookat") && xmlElem->Attribute("node")) 35 { 36 // <Camera name="Camera" pos="0,0,-250" lookat="0,0,0" /> 37 37 38 39 40 38 std::string name = xmlElem->Attribute("name"); 39 std::string pos = xmlElem->Attribute("pos"); 40 std::string lookat = xmlElem->Attribute("lookat"); 41 41 42 42 Ogre::Camera *cam = mgr->createCamera(name); 43 43 44 45 46 47 48 44 float x, y, z; 45 std::vector<std::string> posVec = tokenize(xmlElem->Attribute("pos"),","); 46 String2Number<float>(x, posVec[0]); 47 String2Number<float>(y, posVec[1]); 48 String2Number<float>(z, posVec[2]); 49 49 50 50 cam->setPosition(Vector3(x,y,z)); 51 51 52 53 54 55 52 posVec = tokenize(xmlElem->Attribute("lookat"),","); 53 String2Number<float>(x, posVec[0]); 54 String2Number<float>(y, posVec[1]); 55 String2Number<float>(z, posVec[2]); 56 56 57 57 cam->lookAt(Vector3(x,y,z)); 58 58 59 59 std::string node = xmlElem->Attribute("node"); 60 60 61 62 61 Ogre::SceneNode* sceneNode = (Ogre::SceneNode*)mgr->getRootSceneNode()->createChildSceneNode(node); //getChild(node); 62 sceneNode->attachObject((Ogre::MovableObject*)cam); 63 63 64 64 65 65 Ogre::Viewport* vp = orxonox::Orxonox::getSingleton()->getOgrePointer()->getRoot()->getAutoCreatedWindow()->addViewport(cam); 66 66 67 67 68 69 68 COUT(4) << "Loader: Created camera "<< name << std::endl << std::endl; 69 } 70 70 } 71 71 } -
code/branches/FICN/src/orxonox/objects/SceneNode.cc
r616 r618 25 25 void SceneNode::loadParams(TiXmlElement* xmlElem) 26 26 { 27 28 29 27 if (xmlElem->Attribute("name") && xmlElem->Attribute("pos")) 28 { 29 name_ = xmlElem->Attribute("name"); 30 30 31 32 33 34 35 31 std::vector<std::string> pos = tokenize(xmlElem->Attribute("pos"),","); 32 //float x, y, z_; 33 String2Number<float>(x_, pos[0]); 34 String2Number<float>(y_, pos[1]); 35 String2Number<float>(z_, pos[2]); 36 36 37 37 sx_ = 1; sy_ = 1; sz_ = 1; 38 38 if (xmlElem->Attribute("scale")) 39 39 { 40 41 42 43 40 pos = tokenize(xmlElem->Attribute("scale"),","); 41 String2Number<float>(sx_, pos[0]); 42 String2Number<float>(sy_, pos[1]); 43 String2Number<float>(sz_, pos[2]); 44 44 } 45 45 yaw_ = 0.0; … … 67 67 68 68 COUT(4) << "Loader: loaded node "<< name_ <<" : "<< x_ <<" " << y_ << " " << z_ << std::endl << std::endl; 69 69 } 70 70 } 71 71
Note: See TracChangeset
for help on using the changeset viewer.