Guest User

Untitled

a guest
Oct 19th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. // Set the yaw (Y axis), pitch (X axis), and roll (Z axis) rotations in radians.
  2. pitch = m_rotationX * 0.0174532925f;
  3. yaw = m_rotationY * 0.0174532925f;
  4. roll = m_rotationZ * 0.0174532925f;
  5.  
  6. // Create the rotation matrix from the yaw, pitch, and roll values.
  7. D3DXMatrixRotationYawPitchRoll(&rotationMatrix, yaw, pitch, roll);
  8.  
  9. // Transform the lookAt and up vector by the rotation matrix so the view is correctly rotated at the origin.
  10. D3DXVec3TransformCoord(&lookAt, &lookAt, &rotationMatrix);
  11. D3DXVec3TransformCoord(&up, &up, &rotationMatrix);
  12.  
  13. // Translate the rotated camera position to the location of the viewer.
  14. lookAt = position + lookAt;
  15.  
  16. // Finally create the view matrix from the three updated vectors.
  17. D3DXMatrixLookAtLH(&m_viewMatrix, &position, &lookAt, &up);
Add Comment
Please, Sign In to add comment