summaryrefslogtreecommitdiffhomepage
path: root/tracker-steamvr/steamvr.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'tracker-steamvr/steamvr.hpp')
-rw-r--r--tracker-steamvr/steamvr.hpp66
1 files changed, 66 insertions, 0 deletions
diff --git a/tracker-steamvr/steamvr.hpp b/tracker-steamvr/steamvr.hpp
new file mode 100644
index 00000000..2947f3f1
--- /dev/null
+++ b/tracker-steamvr/steamvr.hpp
@@ -0,0 +1,66 @@
+#pragma once
+#include "api/plugin-api.hpp"
+#include "ui_dialog.h"
+#include "compat/util.hpp"
+#include "options/options.hpp"
+
+#include <openvr.h>
+
+#include <atomic>
+#include <cmath>
+#include <memory>
+
+#include <QString>
+#include <QMutex>
+#include <QMutexLocker>
+
+using namespace options;
+
+struct settings : opts
+{
+ settings() : opts("valve-steamvr") {}
+};
+
+class steamvr : public ITracker
+{
+public:
+ steamvr();
+ ~steamvr() override;
+ void start_tracker(QFrame *) override;
+ void data(double *data) override;
+private:
+ using error_t = vr::EVRInitError;
+ using vr_t = vr::IVRSystem*;
+
+ vr_t vr;
+
+ settings s;
+ static void vr_deleter();
+ static vr_t vr_init(error_t& error);
+ static QString strerror(error_t error);
+};
+
+class dialog : public ITrackerDialog
+{
+ Q_OBJECT
+public:
+ dialog();
+
+ void register_tracker(ITracker *) override;
+ void unregister_tracker() override;
+private:
+ Ui::dialog ui;
+ settings s;
+ vr::IVRSystem* vr;
+private slots:
+ void doOK();
+ void doCancel();
+};
+
+class metadata : public Metadata
+{
+public:
+ QString name() { return QString(QCoreApplication::translate("metadata", "Valve SteamVR")); }
+ QIcon icon() { return QIcon(":/images/rift_tiny.png"); }
+};
+