Skip to content

Commit

Permalink
FreeCAD-VR: Handling the safety warning
Browse files Browse the repository at this point in the history
  • Loading branch information
jriegel committed Sep 14, 2014
1 parent ad2406a commit 250426f
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion src/Gui/View3DInventorRiftViewer.cpp
Expand Up @@ -102,6 +102,7 @@ class CoinRiftWidget : public QGLWidget
~CoinRiftWidget();
void setSceneGraph(SoNode *sceneGraph);
protected:
void handlingSafetyWarning(void);
void initializeGL();
void paintGL();
void resizeGL(int width, int height) {
Expand Down Expand Up @@ -350,8 +351,12 @@ void CoinRiftWidget::initializeGL()

void CoinRiftWidget::paintGL()
{
const int ms(1000 / 60 /*fps*/);
const int ms(1000 / 75 /*fps*/);
QTimer::singleShot(ms, this, SLOT(updateGL()));

// handling the sfety warning
handlingSafetyWarning();

makeCurrent();

ovrPosef eyePose[2];
Expand Down Expand Up @@ -422,6 +427,36 @@ void CoinRiftWidget::paintGL()
doneCurrent();
}

void CoinRiftWidget::handlingSafetyWarning(void)
{
// Health and Safety Warning display state.
ovrHSWDisplayState hswDisplayState;
ovrHmd_GetHSWDisplayState(hmd, &hswDisplayState);
if (hswDisplayState.Displayed)
{
// Dismiss the warning if the user pressed the appropriate key or if the user
// is tapping the side of the HMD.
// If the user has requested to dismiss the warning via keyboard or controller input...
//if (Util_GetAndResetHSWDismissedState())
ovrHmd_DismissHSWDisplay(hmd);
//else
//{
// // Detect a moderate tap on the side of the HMD.
// ovrTrackingState ts = ovrHmd_GetTrackingState(hmd, ovr_GetTimeInSeconds());
// if (ts.StatusFlags & ovrStatus_OrientationTracked)
// {
// const OVR::Vector3f v(ts.RawSensorData.Accelerometer.x,
// ts.RawSensorData.Accelerometer.y,
// ts.RawSensorData.Accelerometer.z);
// // Arbitrary value and representing moderate tap on the side of the DK2 Rift.
// if (v.LengthSq() > 250.f)
// ovrHmd_DismissHSWDisplay(hmd);
// }
//}
}

}


static CoinRiftWidget *window=0;

Expand Down

0 comments on commit 250426f

Please sign in to comment.