The MakeMyLights Function

The MyScene function calls the MakeMyLights function to create the directional and ambient lights used in Helworld.c. MakeMyLights calls the IDirect3DRM::CreateLightRGB and IDirect3DRMFrame::AddLight methods to create a bright directional light and add it to a light frame, and to create a dim ambient light and add it to the entire scene. (Ambient lights are always associated with an entire scene.)

/////////////////////////////////////////////////////////////////////

//

// MakeMyLights

// Create lights used in the scene.

//

/////////////////////////////////////////////////////////////////////

void MakeMyLights(LPDIRECT3DRMFRAME lpScene, LPDIRECT3DRMFRAME lpCamera,

LPDIRECT3DRMFRAME lpLightFrame1,

LPDIRECT3DRMLIGHT * lplpLight1, LPDIRECT3DRMLIGHT * lplpLight2)

{

lpD3DRM->lpVtbl->CreateLightRGB(lpD3DRM, D3DRMLIGHT_DIRECTIONAL,

D3DVAL(0.9), D3DVAL(0.9), D3DVAL(0.9), lplpLight1);

lpLightFrame1->lpVtbl->AddLight(lpLightFrame1, *lplpLight1);

lpD3DRM->lpVtbl->CreateLightRGB(lpD3DRM, D3DRMLIGHT_AMBIENT,

D3DVAL(0.1), D3DVAL(0.1), D3DVAL(0.1), lplpLight2);

lpScene->lpVtbl->AddLight(lpScene, *lplpLight2);

}