|
D3DLIGHT9 light;
memset(&light, 0, sizeof(D3DLIGHT9));
light.Type = D3DLIGHT_DIRECTIONAL;
light.Diffuse.r = 1.0f;
light.Diffuse.g = 1.0f;
light.Diffuse.b = 1.0f;
light.Diffuse.a = 1.0f;
D3DXVECTOR3 vecDir;
vecDir = D3DXVECTOR3(0.0f,-0.3f,0.5);
D3DXVec3Normalize( (D3DXVECTOR3*)&light.Direction, &vecDir );
light.Direction = vecDir;
Graphic::device->SetLight(0, &light);
Graphic::device->LightEnable( 0, TRUE );
Graphic::device->SetRenderState(D3DRS_LIGHTING, true);
D3DMATERIAL9 material;
ZeroMemory(&material, sizeof(D3DMATERIAL9)); // clear out the struct for use
material.Diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f); // set diffuse color to white
material.Ambient = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f); // set ambient color to white |
|