FreeCAD-VR: Handling the safety warning
This commit is contained in:
parent
ad2406a763
commit
250426f792
|
@ -102,6 +102,7 @@ public:
|
|||
~CoinRiftWidget();
|
||||
void setSceneGraph(SoNode *sceneGraph);
|
||||
protected:
|
||||
void handlingSafetyWarning(void);
|
||||
void initializeGL();
|
||||
void paintGL();
|
||||
void resizeGL(int width, int height) {
|
||||
|
@ -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];
|
||||
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user