Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/FICN/src/orxonox/objects/SceneNode.cc @ 548

Last change on this file since 548 was 515, checked in by nicolape, 17 years ago

Added some objects for the level loader

File size: 1.1 KB
Line 
1#include <OgreSceneManager.h>
2#include <string>
3
4#include "../orxonox.h"
5#include "../../tinyxml/tinyxml.h"
6#include "../../misc/Tokenizer.h"
7#include "../../misc/String2Number.h"
8
9#include "SceneNode.h"
10
11namespace orxonox
12{
13    CreateFactory(SceneNode);
14
15    SceneNode::SceneNode()
16    {
17        RegisterObject(SceneNode);
18    }
19
20    SceneNode::~SceneNode()
21    {
22    }
23
24    void SceneNode::loadParams(TiXmlElement* xmlElem)
25    {
26        Ogre::SceneManager* mgr = orxonox::Orxonox::getSingleton()->getSceneManager();
27       
28        if (xmlElem->Attribute("name") && xmlElem->Attribute("pos"))
29        {
30                std::string name = xmlElem->Attribute("name");
31
32                std::vector<std::string> pos = tokenize(xmlElem->Attribute("pos"),",");
33                float x, y, z;
34                String2Number<float>(x, pos[0]);
35                String2Number<float>(y, pos[1]);
36                String2Number<float>(z, pos[2]);
37
38               
39                mgr->getRootSceneNode()->createChildSceneNode(name, Vector3(x,y,z));
40               
41                std::cout << "Loader: Created node "<< name <<" : "<<x<<" " << y << " " << z  << std::endl << std::endl;
42        }       
43   }
44}
Note: See TracBrowser for help on using the repository browser.