Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- glm::mat4 quatToMat4(glm::quat m_q) {
- /**
- * Implement so that the we generate the correct transformation
- * matrix from the input quaternion
- */
- 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,
- 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,
- 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,
- 0.0f, 0.0f, 0.0f, 1.0f);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement