Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. glm::mat4 quatToMat4(glm::quat m_q) {
  2.     /**
  3.       * Implement so that the we generate the correct transformation
  4.       * matrix from the input quaternion
  5.       */
  6.     return glm::mat4(1 - 2*(m_q.y * m_q.y + m_q.z * m_q.z), 2*(m_q.x*m_q.y - m_q.w * m_q.z), 2*(m_q.x * m_q.z + m_q.w * m_q.y), 0.0f,
  7.         2*(m_q.x * m_q.y + m_q.w * m_q.z), 1 - 2*(m_q.x * m_q.x + m_q.z * m_q.z), 2*(m_q.y * m_q.z - m_q.w * m_q.x), 0.0f,
  8.         2*(m_q.x * m_q.z - m_q.w * m_q.y), 2*(m_q.y * m_q.z + m_q.w * m_q.x), 1 - 2*(m_q.x * m_q.x + m_q.y * m_q.y), 0.0f,
  9.         0.0f, 0.0f, 0.0f, 1.0f);
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement