Description
#include
"./include/glm/gtc/quaternion.hpp"
glm::vec3
p = glm::normalize(glm::vec3(1,
1, 1));
glm::quat
q1 = glm::angleAxis(0.0f,
glm::vec3(0.0f,
1.0f, 0.0f));
glm::quat
q2 = glm::angleAxis(180.0f,
p);
// Render an object using SLERP
modelViewMatrixStack.Push();
modelViewMatrixStack.Translate(glm::vec3(0.0f,
2.0f, 150.0f));
//
t
between 0 and 1. Mix overloaded to SLERP
glm::quat
q = glm::mix(q1,
q2, t);
// Cast
quaternion to mat4 to post-multiply
modelViewMatrixStack
*=
glm::mat4_cast(q);
modelViewMatrixStack.Scale(2.0f);
pMainProgram->SetUniform("matrices.modelViewMatrix",
modelViewMatrixStack.Top());
pMainProgram->SetUniform("matrices.normalMatrix", m_pCamera->ComputeNormalMatrix(modelViewMatrixStack.Top()));
m_pSphere->Render();
modelViewMatrixStack.Pop();