Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ACGL
acgl
Commits
5c1f035e
Commit
5c1f035e
authored
Apr 23, 2014
by
Robert Menzel
Browse files
exposed access to the Rifts quaternions
parent
2a50f6ac
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/ACGL/HardwareSupport/SimpleRiftController.hh
View file @
5c1f035e
...
...
@@ -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:
...
...
src/ACGL/HardwareSupport/SimpleRiftController.cc
View file @
5c1f035e
...
...
@@ -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
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment