GlobeEngine
openvroverlaycontroller.h
Go to the documentation of this file.
1 //====== Copyright Valve Corporation, All rights reserved. =======
2 
3 #ifndef OPENVROVERLAYCONTROLLER_H
4 #define OPENVROVERLAYCONTROLLER_H
5 
6 #ifdef _WIN32
7 #pragma once
8 #endif
9 
10 #include "openvr.h"
11 
12 #include <QtCore/QtCore>
13 // because of incompatibilities with QtOpenGL and GLEW we need to cherry pick includes
14 #include <QVector2D>
15 #include <QMatrix4x4>
16 #include <QVector>
17 #include <QVector2D>
18 #include <QVector3D>
19 #include <QtGui/QOpenGLContext>
20 #include <QtWidgets/QGraphicsScene>
21 #include <QOffscreenSurface>
22 class QOpenGLFramebufferObject;
23 
24 class COpenVROverlayController : public QObject
25 {
26  Q_OBJECT
27  typedef QObject BaseClass;
28 
29 public:
31 
32 public:
34  virtual ~COpenVROverlayController();
35 
36  bool Init();
37  void Shutdown();
38  void EnableRestart();
39 
40  bool BHMDAvailable();
41  vr::IVRSystem *GetVRSystem();
42  vr::HmdError GetLastHmdError();
43 
44  QString GetVRDriverString();
45  QString GetVRDisplayString();
46  QString GetName() { return m_strName; }
47 
48  void SetWidget( QWidget *pWidget );
49 
50 public slots:
51  void OnSceneChanged( const QList<QRectF>& );
52  void OnTimeoutPumpEvents();
53 
54 protected:
55 
56 private:
57  bool ConnectToVRRuntime();
58  void DisconnectFromVRRuntime();
59 
60  vr::TrackedDevicePose_t m_rTrackedDevicePose[ vr::k_unMaxTrackedDeviceCount ];
61  QString m_strVRDriver;
62  QString m_strVRDisplay;
63  QString m_strName;
64 
65  vr::HmdError m_eLastHmdError;
66 
67 private:
68  vr::HmdError m_eCompositorError;
69  vr::HmdError m_eOverlayError;
70  vr::Compositor_OverlaySettings m_overlaySettings;
71  vr::VROverlayHandle_t m_ulOverlayHandle;
72  vr::VROverlayHandle_t m_ulOverlayThumbnailHandle;
73 
74  QOpenGLContext *m_pOpenGLContext;
75  QGraphicsScene *m_pScene;
76  QOpenGLFramebufferObject *m_pFbo;
77  QOffscreenSurface *m_pOffscreenSurface;
78 
79  QTimer *m_pPumpEventsTimer;
80 
81  // the widget we're drawing into the texture
82  QWidget *m_pWidget;
83 
84  QPointF m_ptLastMouse;
85  Qt::MouseButtons m_lastMouseButtons;
86  bool m_bManualMouseHandling;
87 };
88 
89 
90 #endif // OPENVROVERLAYCONTROLLER_H
void OnTimeoutPumpEvents()
Definition: openvroverlaycontroller.cpp:200
void SetWidget(QWidget *pWidget)
Definition: openvroverlaycontroller.cpp:330
void OnSceneChanged(const QList< QRectF > &)
Definition: openvroverlaycontroller.cpp:171
QString GetName()
Definition: openvroverlaycontroller.h:46
void Shutdown()
Definition: openvroverlaycontroller.cpp:151
bool BHMDAvailable()
Definition: openvroverlaycontroller.cpp:404
static COpenVROverlayController * SharedInstance()
Definition: openvroverlaycontroller.cpp:24
Definition: openvroverlaycontroller.h:24
QString GetVRDriverString()
Definition: openvroverlaycontroller.cpp:386
COpenVROverlayController()
Definition: openvroverlaycontroller.cpp:37
vr::HmdError GetLastHmdError()
Definition: openvroverlaycontroller.cpp:414
bool Init()
Definition: openvroverlaycontroller.cpp:88
QString GetVRDisplayString()
Definition: openvroverlaycontroller.cpp:395
virtual ~COpenVROverlayController()
Definition: openvroverlaycontroller.cpp:60
vr::IVRSystem * GetVRSystem()