Advertisement
Guest User

Untitled

a guest
Feb 20th, 2015
407
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. glm::mat4 Camera::GetOrientation() const
  2. {
  3.     glm::mat4 mat(1);//identity matrix
  4.    
  5.     mat *= glm::rotate(glm::radians(_verticalAngle), glm::vec3(1, 0, 0));//rotate vertical (around the x axis)
  6.     mat *= glm::rotate(glm::radians(_horizontalAngle), glm::vec3(0, 1, 0));//rotate horizontal (around the y axis)
  7.     //no need to rotate around the z axis. Keep in mind that the rotation order is important in order to avoid gimbal lock.
  8.  
  9.     return mat;
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement