Delete all the old code in
createScene()
, except for the plane-related code.Create a light and set the light type to directional light:
Ogre::Light* light = mSceneMgr->createLight("Light1"); light->setType(Ogre::Light::LT_DIRECTIONAL);
Set the light to a white color and the light direction to shine in a down-right direction:
light->setDiffuseColour(Ogre::ColourValue(1.0f,1.0f,1.0f)); light->setDirection(Ogre::Vector3(1,-1,0));
Compile and run the application.
We created a directional light and set it to shine down and rightwards with setDirection(1,-1,0)
. In the previous examples, we always had a rather black plane and a small part of the plane was illuminated by our pointlight or spotlight. Here, we used a directional light and hence the complete plane is illuminated. As said before, a directional light can be thought of as the sun, and the sun doesn't have a falloff radius or anything else. So when it shines,...