Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Set the yaw (Y axis), pitch (X axis), and roll (Z axis) rotations in radians.
- pitch = m_rotationX * 0.0174532925f;
- yaw = m_rotationY * 0.0174532925f;
- roll = m_rotationZ * 0.0174532925f;
- // Create the rotation matrix from the yaw, pitch, and roll values.
- D3DXMatrixRotationYawPitchRoll(&rotationMatrix, yaw, pitch, roll);
- // Transform the lookAt and up vector by the rotation matrix so the view is correctly rotated at the origin.
- D3DXVec3TransformCoord(&lookAt, &lookAt, &rotationMatrix);
- D3DXVec3TransformCoord(&up, &up, &rotationMatrix);
- // Translate the rotated camera position to the location of the viewer.
- lookAt = position + lookAt;
- // Finally create the view matrix from the three updated vectors.
- D3DXMatrixLookAtLH(&m_viewMatrix, &position, &lookAt, &up);
Add Comment
Please, Sign In to add comment