glm::quat fromOVR( OVR::Quatf quat ) { OVR::Vector3f OVRaxis; float angle; quat.GetAxisAngle(&OVRaxis, &angle); //convert axis type glm::vec3 axis = glm::vec3(OVRaxis.x, OVRaxis.y, OVRaxis.z); //construct glm orientation quaternion glm::quat orientation = glm::angleAxis(glm::degrees(angle), glm::normalize(axis)); return orientation; }
void OculusHMD::prepareForDraw() { OVR::Quatf ovrQuat = m_system->SFusion.GetOrientation(); OVR::Vector3f OVRaxis; float angle; ovrQuat.GetAxisAngle(&OVRaxis, &angle); glm::vec3 axis =glm::vec3(OVRaxis.x, OVRaxis.y, OVRaxis.z); glm::quat orientation = glm::angleAxis(glm::degrees(angle), glm::normalize(axis)); glm::vec3 parentPos = glm::vec3(parentNode()->worldTransform() * glm::vec4(0,0,0,1)); m_boneTracker->setOrientation(glm::mat3_cast(orientation)); RenderToTextureDisplay::prepareForDraw(); }