Time for action — creating a directional light

  1. Delete all the old code in createScene(), except for the plane-related code.
  2. Create a light and set the light type to directional light:
    Ogre::Light* light = mSceneMgr->createLight("Light1");
    light->setType(Ogre::Light::LT_DIRECTIONAL);
    
  3. 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));
    
  4. Compile and run the application.
    Time for action — creating a directional light

What just happened?

We created a directional light and set it to shine down and rightwards with setDirection(1,-1,0). In the previous examples, we ...

Get Ogre 3D 1.7 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.