I want to position my spot light and have it look in a direction for rendering my shadow map. So for a simple test I have a light positioned directly above my test objects pointing straight down.
To simulate this I setup a matrix like so.
CMatrix testLightPos;
testLightPos.Translate(CPoint(0.f, -250.f, 0.f)); // set pos
testLightPos.Rotate(CPoint(-90.f,0.f,0.f)); // rotate X to face down
objectMgr.RenderShadowMap(testLightPos);
So for this test, I setup a matrix at a point above my test objects and rotate x 90 degrees so that the camera is pointing straight down. Shadows on the test objects render correctly and all looks good.
I'm assuming I'll be able to use D3DXMatrixLookAtLH to do the same thing.
D3DXMATRIX test;
D3DXMatrixLookAtLH(&test,
&D3DXVECTOR3(0.f, 250.f, 0.f), // eye
&D3DXVECTOR3(0.f, 1.f, 0.f), // target
&D3DXVECTOR3(0.f, 1.f, 0.f)); // Y up
The matrix from D3DXMatrixLookAtLH doesn't work and in comparing the two, the data in each of the matrices are different.
Either I'm not using D3DXMatrixLookAtLH correctly or it's not used in this way. I don't know.