How to load a basic sun?

Thista

16-11-2010 15:55:11

I'm trying to create a basic sun in Caelum.


Caelum::SpriteSun* SS = new Caelum::SpriteSun(mSceneMgr, mCaelumSystem->getCaelumCameraNode());
SS->setBodyColour (Ogre::ColourValue(1, 0, 0, 1));
SS->setLightColour(Ogre::ColourValue(1, 0, 0, 1));
mCaelumSystem->setSun(SS);
mCaelumSystem->setObserverLatitude(Ogre::Degree(50));
mCaelumSystem->setObserverLongitude(Ogre::Degree(-50));


I need to be able to create (and see) the sun and know it's exact position so I can place a directional light on its position.

On the moment it's not showing the sun. What am I doing wrong?

Fish

16-11-2010 23:21:41

When you initialize Caelum::CaelumSystem() you can pass in a Caelum::CaelumSystem::CaelumComponent component mask. Something like:


Caelum::CaelumSystem::CaelumComponent componentMask = static_cast<Caelum::CaelumSystem::CaelumComponent> (
Caelum::CaelumSystem::CAELUM_COMPONENT_SUN |
Caelum::CaelumSystem::CAELUM_COMPONENT_MOON |
Caelum::CaelumSystem::CAELUM_COMPONENT_SKY_DOME |
Caelum::CaelumSystem::CAELUM_COMPONENT_CLOUDS |
Caelum::CaelumSystem::CAELUM_COMPONENT_POINT_STARFIELD );

Caelum::CaelumSystem(Ogre::Root::getSingletonPtr(), mSceneMgr, componentMask);
.

then you can call the mCaelumSystem->getSun()->setxxxx() methods to set your Sun light parameters (which are a directional light).

Note that I'm using Caelum 0.4.0.

- Fish