Commit 5c1f035e authored by Robert Menzel's avatar Robert Menzel

exposed access to the Rifts quaternions

parent 2a50f6ac
...@@ -12,10 +12,10 @@ ...@@ -12,10 +12,10 @@
*/ */
#include <ACGL/ACGL.hh> #include <ACGL/ACGL.hh>
//#define ACGL_USE_OCULUS_RIFT
#ifdef ACGL_USE_OCULUS_RIFT #ifdef ACGL_USE_OCULUS_RIFT
#include <ACGL/Math/Math.hh> #include <ACGL/Math/Math.hh>
#include <glm/gtc/quaternion.hpp>
#include <ACGL/Scene/HMDCamera.hh> #include <ACGL/Scene/HMDCamera.hh>
#include <ACGL/OpenGL/Objects/Texture.hh> #include <ACGL/OpenGL/Objects/Texture.hh>
...@@ -43,7 +43,7 @@ class SimpleRiftController ...@@ -43,7 +43,7 @@ class SimpleRiftController
{ {
public: 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 * _performAutomaticMagneticCalibration: try to calibrate the magetometer to reduce drift
* the user has to look into at least four very different directions * the user has to look into at least four very different directions
* for this to work. * for this to work.
...@@ -80,6 +80,18 @@ public: ...@@ -80,6 +80,18 @@ public:
void setFoVMultiplier( float _factor ) { mFoVMultiplier = _factor; updateCameraFoV(); } void setFoVMultiplier( float _factor ) { mFoVMultiplier = _factor; updateCameraFoV(); }
float getFoVMultiplier() { return mFoVMultiplier; } 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: // RAW parameters for distortion rendering:
......
...@@ -161,6 +161,28 @@ void SimpleRiftController::setPrediction( float _seconds ) ...@@ -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() glm::mat4 SimpleRiftController::getProjectionMatrixFromCamera()
{ {
if (!mCamera) return glm::mat4(); if (!mCamera) return glm::mat4();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment