Setup a directional light

A directional light source illuminates all objects equally from a given direction. It size and distance from the scene are infinite. Therefore it has no falloff and decay. Directional lights cannot cast shadow maps.

To begin, the light object has to be created with the factory:

// Create the light shape:
RED::Object* light = RED::Factory::CreateInstance( CID_REDLightShape );
if( light == NULL )

RED::ILightShape* ilight = light->As< RED::ILightShape >();

The directional light is defined using the RED::ILightShape::SetDirectionalLight function:

// The directional light parameters:
RED::Vector3 position = RED::Vector3( 20.0, 20.0, 60.0 );
RED::Vector3 direction = RED::Vector3::ZERO - position;
RED::Vector3 up = RED::Vector3::ZAXIS;
RED::Color diffuse = RED::Color::WHITE;
RED::Color specular = RED::Color::WHITE;
float intensity = 1.0;

// Define the light as a directional light:
RC_TEST( ilight->SetDirectionalLight( intensity, position, direction, up, diffuse, specular, iresmgr->GetState() ) );

Do not forget to add the light to the scene:

// Add the scene data to the viewpoint:
RC_TEST( icamera->AddShape( light, iresmgr->GetState() ) );