Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 12, 2008, 4:32:10 AM (16 years ago)
Author:
landauf
Message:
  • Some small changes in XMLPortParam: It's now possible to add functions of another class. an example is setPosition and getPosition that are directly referred to Ogre::Node. Use XMLPortParamExtern if you need this. It takes the object to call the functions on as an additional argument (in our example: this→node_).
  • Removed loadParams functions and reduced the usage of XMLPortParamLoadOnly in several classes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core3/src/orxonox/objects/Ambient.cc

    r1586 r1592  
    6464    }
    6565
    66     bool Ambient::create(){
    67       GraphicsEngine::getSingleton().getSceneManager()->setAmbientLight(ambientLight_);
    68       return Synchronisable::create();
     66    bool Ambient::create()
     67    {
     68        GraphicsEngine::getSingleton().getSceneManager()->setAmbientLight(ambientLight_);
     69        return Synchronisable::create();
    6970    }
    7071
    71     void Ambient::registerAllVariables(){
    72       registerVar(&ambientLight_, sizeof(ColourValue), network::DATA);
    73 
     72    void Ambient::registerAllVariables()
     73    {
     74        registerVar(&ambientLight_, sizeof(ColourValue), network::DATA);
    7475    }
    7576
    76     void Ambient::loadParams(TiXmlElement* xmlElem)
     77    void Ambient::setAmbientLight(const ColourValue& colour)
    7778    {
    78         if (xmlElem->Attribute("colourvalue"))
    79         {
    80         SubString colourvalues(xmlElem->Attribute("colourvalue"), ',');
    81 
    82                 float r, g, b;
    83         convertValue<std::string, float>(&r, colourvalues[0]);
    84         convertValue<std::string, float>(&g, colourvalues[1]);
    85         convertValue<std::string, float>(&b, colourvalues[2]);
    86 
    87                 this->setAmbientLight(ColourValue(r, g, b));
    88 
    89                 COUT(4) << "Loader: Set ambient light: "<<r<<" " << g << " " << b  << std::endl << std::endl;
    90         }
    91    }
    92 
    93    void Ambient::setAmbientLight(const ColourValue& colour)
    94    {
    95         GraphicsEngine::getSingleton().getSceneManager()->setAmbientLight(colour);
    96       ambientLight_=colour;
    97    }
     79        GraphicsEngine::getSingleton().getSceneManager()->setAmbientLight(colour);
     80        ambientLight_=colour;
     81    }
    9882
    9983    /**
     
    10791        BaseObject::XMLPort(xmlelement, mode);
    10892
    109         XMLPortParamLoadOnly(Ambient, "colourvalue", setAmbientLight, xmlelement, mode);
     93        XMLPortParam(Ambient, "colourvalue", setAmbientLight, getAmbienetLight, xmlelement, mode);
    11094        create();
    11195    }
Note: See TracChangeset for help on using the changeset viewer.