Original Post
Greeting, gentlemen. I use directional light and everything's ok, but once i tried changing it either to point or spot it just does nothing. Before that, i changed the position: And my material: Here's one light i tried The questions are: 1. How do i give the coordinates - do i assume that the world center is set in (150, 150, 100) or (0,0,0)? 2. What's wrong with the light?
D3DXMATRIX g_Transform;
D3DXMatrixIdentity(&g_Transform);
D3DXMatrixTranslation(&g_Transform,-150.0f, -150.0f, -100.0f);
g_pd3dDevice->SetTransform(D3DTS_WORLD, &g_Transform);
ZeroMemory(&g_Material, sizeof(D3DMATERIAL9));
g_Material.Diffuse.r = 1.0f;
g_Material.Diffuse.g = 1.0f;
g_Material.Diffuse.b = 1.0f;
g_pd3dDevice->SetMaterial(&g_Material);
ZeroMemory( &light, sizeof(D3DLIGHT9) );
light.Type = D3DLIGHT_SPOT;
light.Diffuse.r = 1.0f;
light.Diffuse.g = 1.0f;
light.Diffuse.b = 1.0f;
light.Position = D3DXVECTOR3(-150.0f, 150.0f, 100.0f);
light.Theta = D3DX_PI/4.0f; light.Phi = D3DX_PI/2.0f;
vecDir = D3DXVECTOR3(0.0f,0.0f,0.0f);
D3DXVec3Normalize( (D3DXVECTOR3*)&light.Direction, &vecDir );
light.Range = 1000.0f;
g_pd3dDevice->SetLight( 0, &light );
g_pd3dDevice->LightEnable( 0, TRUE );