LightList: iterating (a sample code needed)

SONB

14-04-2006 13:48:36

Hi everybody!

Sorry for a noob question but how can I iterate through a list (i.e. LightList), pick i.e. a light and assign it to my Ogre::Light *light? My app is loading a scene with a light and I want to move it around and change it's properties.

I was playing around with iterator and all but I can't get it working.. Could you post a sample code so I know how to do it right? :)


Thanx a lot in advance!



SONB

Lioric

14-04-2006 17:16:06

Some in the lines of


LightList& lights = oScene.getLightList();

LightList::iterator it = lights.begin();
LightList::iterator iend = lights.end();

for(; it != iend; ++it) {

Light* light = (*it);

// use the light pointer

}


or you can use:



LightList& lights = oScene.getLightList();

UINT size = lights.size();

for(UINT i=0; i<size; ++i) {

Light* light = lights[i];

// use the light pointer

}