Skip to content
Snippets Groups Projects
Commit 5c1f035e authored by Robert Menzel's avatar Robert Menzel
Browse files

exposed access to the Rifts quaternions

parent 2a50f6ac
No related branches found
No related tags found
No related merge requests found
......@@ -12,10 +12,10 @@
*/
#include <ACGL/ACGL.hh>
//#define ACGL_USE_OCULUS_RIFT
#ifdef ACGL_USE_OCULUS_RIFT
#include <ACGL/Math/Math.hh>
#include <glm/gtc/quaternion.hpp>
#include <ACGL/Scene/HMDCamera.hh>
#include <ACGL/OpenGL/Objects/Texture.hh>
......@@ -43,7 +43,7 @@ class SimpleRiftController
{
public:
/**
* _riftnumber: which device to use in case multiple are attached
* _riftnumber: which device to use in case multiple are attached - NOTE: the Rift SDK has problems supporting this yet!
* _performAutomaticMagneticCalibration: try to calibrate the magetometer to reduce drift
* the user has to look into at least four very different directions
* for this to work.
......@@ -80,6 +80,18 @@ public:
void setFoVMultiplier( float _factor ) { mFoVMultiplier = _factor; updateCameraFoV(); }
float getFoVMultiplier() { return mFoVMultiplier; }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Access to direct sensor data as an alternative to the use of the ACGL camera
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//! get the rotation as a quaternion, the native format of the Rift (with sensor fusion):
glm::quat getFusedRotationQuaternion();
//! get the rotation as a quaternion, the native format of the Rift (without sensor fusion):
glm::quat getRotationQuaternion();
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// RAW parameters for distortion rendering:
......
......@@ -161,6 +161,28 @@ void SimpleRiftController::setPrediction( float _seconds )
}
}
glm::quat riftQuatToGLM( const Quatf &_q )
{
glm::quat glmQuat;
glmQuat.x = _q.x;
glmQuat.y = _q.y;
glmQuat.z = _q.z;
glmQuat.w = _q.w;
return glmQuat;
}
glm::quat SimpleRiftController::getFusedRotationQuaternion()
{
return riftQuatToGLM( mORSensorFusion->GetPredictedOrientation() );
}
glm::quat SimpleRiftController::getRotationQuaternion()
{
return riftQuatToGLM( mORSensorFusion->GetOrientation() );
}
glm::mat4 SimpleRiftController::getProjectionMatrixFromCamera()
{
if (!mCamera) return glm::mat4();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment