Original Post
I am working on a camera system, and stole some code from an online resource to try to understand how it works. However, once implemented, things stop working. I have narrowed the problem down to this bit of code:
D3DXMATRIX view;
D3DXMatrixIdentity(&view);
D3DXVec3Normalize(&vLook, &vLook);
D3DXVec3Cross(&vRight, &vUp, &vLook);
D3DXVec3Normalize(&vRight, &vRight);
D3DXVec3Cross(&vUp, &vLook, &vRight);
D3DXVec3Normalize(&vUp, &vUp);
view._11 = vRight.x;
view._12 = vUp.x;
view._13 = vLook.x;
view._14 = 0.0f;
view._21 = vRight.y;
view._22 = vUp.y;
view._23 = vLook.y;
view._24 = 0.0f;
view._31 = vRight.z;
view._32 = vUp.z;
view._33 = vLook.z;
view._34 = 0.0f;
view._41 = -D3DXVec3Dot(&vEye, &vRight);
view._42 = -D3DXVec3Dot(&vEye, &vUp);
view._43 = -D3DXVec3Dot(&vEye, &vLook);
view._44 = 1.0f;
pd3dDevice->SetTransform(D3DTS_VIEW, &view);
The vectors are preinitialized to:
D3DXVECTOR3 vEye( 0.0f, 80.0f, -70.0f );
D3DXVECTOR3 vLook( 0.0f, 0.0f, 0.0f );
D3DXVECTOR3 vUp( 0.0f, 1.0f, 0.0f );
D3DXVECTOR3 vRight(1.0f, 0.0f, 0.0f);
That is my UpdateViewMatrix() method, which is called pre rendering. With it commented out, everything renders normally. With it there, I cannot see anything on the screen. I printed out the vertices for each vector, and they looked fine. What am I doing wrong? Thanks!