diff options
Diffstat (limited to 'tracker-steamvr')
-rw-r--r-- | tracker-steamvr/lang/de_DE.ts | 33 | ||||
-rw-r--r-- | tracker-steamvr/lang/zh_CN.ts | 2 | ||||
-rw-r--r-- | tracker-steamvr/steamvr.cpp | 48 | ||||
-rw-r--r-- | tracker-steamvr/steamvr.hpp | 4 |
4 files changed, 70 insertions, 17 deletions
diff --git a/tracker-steamvr/lang/de_DE.ts b/tracker-steamvr/lang/de_DE.ts new file mode 100644 index 00000000..1282ec9a --- /dev/null +++ b/tracker-steamvr/lang/de_DE.ts @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1" language="de_DE"> +<context> + <name>dialog</name> + <message> + <source>Valve SteamVR</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Device</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>steamvr</name> + <message> + <source>No HMD connected</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Can't find device with that serial</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>steamvr_metadata</name> + <message> + <source>Valve SteamVR</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tracker-steamvr/lang/zh_CN.ts b/tracker-steamvr/lang/zh_CN.ts index 7b68034b..2c6f7230 100644 --- a/tracker-steamvr/lang/zh_CN.ts +++ b/tracker-steamvr/lang/zh_CN.ts @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> -<TS version="2.1"> +<TS version="2.1" language="zh_CN"> <context> <name>dialog</name> <message> diff --git a/tracker-steamvr/steamvr.cpp b/tracker-steamvr/steamvr.cpp index 3bcfcc25..bd0c9c1e 100644 --- a/tracker-steamvr/steamvr.cpp +++ b/tracker-steamvr/steamvr.cpp @@ -26,7 +26,7 @@ #include <QMessageBox> #include <QDebug> -QMutex device_list::mtx(QMutex::Recursive); +QRecursiveMutex device_list::mtx; template<typename F> auto with_vr_lock(F&& fun) -> decltype(fun(vr_t(), vr_error_t())) @@ -89,12 +89,17 @@ void device_list::fill_device_specs(QList<device_spec>& list) switch (v->GetTrackedDeviceClass(k)) { - case vr::ETrackedDeviceClass::TrackedDeviceClass_HMD: + using enum vr::ETrackedDeviceClass; + case TrackedDeviceClass_HMD: dev.type = "HMD"; break; - case vr::ETrackedDeviceClass::TrackedDeviceClass_Controller: + case TrackedDeviceClass_Controller: dev.type = "Controller"; break; - case vr::ETrackedDeviceClass::TrackedDeviceClass_TrackingReference: - dev.type = "Tracker"; break; + case TrackedDeviceClass_TrackingReference: + dev.type = "Tracking reference"; break; + case TrackedDeviceClass_DisplayRedirect: + dev.type = "Display redirect"; break; + case TrackedDeviceClass_GenericTracker: + dev.type = "Generic"; break; default: dev.type = "Unknown"; break; } @@ -216,9 +221,17 @@ module_status steamvr::start_tracker(QFrame*) err = tr("Can't find device with that serial"); if (err.isEmpty()) - return status_ok(); - else - return error(err); + { + if (auto* c = vr::VRCompositor(); c != nullptr) + { + c->SetTrackingSpace(origin::TrackingUniverseSeated); + return status_ok(); + } + else + return error("vr::VRCompositor == NULL"); + } + + return error(err); }); } @@ -253,12 +266,19 @@ bool steamvr::center() { if (v->GetTrackedDeviceClass(device_index) == vr::ETrackedDeviceClass::TrackedDeviceClass_HMD) { - // Reset yaw and position - v->ResetSeatedZeroPose(); - - // Use chaperone universe real world up instead of opentrack's initial pose centering - // Note: Controllers will be centered based on initial headset position. - return true; + auto* c = vr::VRChaperone(); + if (!c) + { + eval_once(qDebug() << "steamvr: vr::VRChaperone == NULL"); + return false; + } + else + { + c->ResetZeroPose(origin::TrackingUniverseSeated); + // Use chaperone universe real world up instead of opentrack's initial pose centering + // Note: Controllers will be centered based on initial headset position. + return true; + } } else // with controllers, resetting the seated pose does nothing diff --git a/tracker-steamvr/steamvr.hpp b/tracker-steamvr/steamvr.hpp index 61da2e05..cc70ffc5 100644 --- a/tracker-steamvr/steamvr.hpp +++ b/tracker-steamvr/steamvr.hpp @@ -8,7 +8,7 @@ #include <climits> #include <QString> -#include <QMutex> +#include <QRecursiveMutex> #include <QList> #include <openvr.h> @@ -57,7 +57,7 @@ struct device_list final private: QList<device_spec> device_specs; - static QMutex mtx; + static QRecursiveMutex mtx; static tt vr_init_(); static void fill_device_specs(QList<device_spec>& list); static tt vr_init(); |