Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/FICN/src/orxonox/objects/Ambient.cc @ 507

Last change on this file since 507 was 507, checked in by nicolape, 16 years ago
  • Skybox and ambient light load now from level file sample.oxw. Added objects to and methods to parse this tags. Added a tokenizer function to split strings into smaller strings (for reading out the light colours for examle). Moved Tokenizer and String2number into misc directory. deleted old unised xml class
File size: 1.0 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 "Ambient.h"
10
11namespace orxonox
12{
13    CreateFactory(Ambient);
14
15    Ambient::Ambient()
16    {
17        RegisterObject(Ambient);
18    }
19
20    Ambient::~Ambient()
21    {
22    }
23
24    void Ambient::loadParams(TiXmlElement* xmlElem)
25    {
26        Ogre::SceneManager* mgr = orxonox::Orxonox::getSingleton()->getSceneManager();
27       
28        if (xmlElem->Attribute("colourvalue"))
29        {
30               
31                std::vector<std::string> colourvalues = tokenize(xmlElem->Attribute("colourvalue"),",");
32                float r, g, b;
33                String2Number<float>(r, colourvalues[0]);
34                String2Number<float>(g, colourvalues[1]);
35                String2Number<float>(b, colourvalues[2]);
36                 
37                mgr->setAmbientLight(ColourValue(r,g,b));
38               
39                std::cout << "Loader: Set ambient light: "<<r<<" " << g << " " << b  << std::endl << std::endl;
40        }       
41   }
42}
Note: See TracBrowser for help on using the repository browser.