diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-03-10 16:28:29 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-03-10 18:35:13 +0100 |
commit | 34a9d3691171864068a24a88442e6635ff29d738 (patch) | |
tree | a1da9c4f181a2d544be9428c245dbd696c3e0d9f | |
parent | 4ad4b8839cec4bc0b75ad74cfa138e40f12a6302 (diff) |
tracker/steamvr: reduce indentation
No functional changes.
-rw-r--r-- | tracker-steamvr/steamvr.cpp | 112 |
1 files changed, 56 insertions, 56 deletions
diff --git a/tracker-steamvr/steamvr.cpp b/tracker-steamvr/steamvr.cpp index 530a455e..689e0ba9 100644 --- a/tracker-steamvr/steamvr.cpp +++ b/tracker-steamvr/steamvr.cpp @@ -48,67 +48,67 @@ void device_list::fill_device_specs(QList<device_spec>& list) pose_t device_states[max_devices]; - if (v) + if (!v) + return; + + v->GetDeviceToAbsoluteTrackingPose(origin::TrackingUniverseSeated, 0, + device_states, vr::k_unMaxTrackedDeviceCount); + + constexpr unsigned bufsiz = vr::k_unMaxPropertyStringSize; + static char str[bufsiz+1] {}; // vr_lock prevents reentrancy + + for (unsigned k = 0; k < vr::k_unMaxTrackedDeviceCount; k++) { - v->GetDeviceToAbsoluteTrackingPose(origin::TrackingUniverseSeated, 0, - device_states, vr::k_unMaxTrackedDeviceCount); + if (v->GetTrackedDeviceClass(k) == vr::ETrackedDeviceClass::TrackedDeviceClass_Invalid) + { + qDebug() << "no device with index"; + continue; + } + + if (!device_states[k].bDeviceIsConnected) + { + qDebug() << "device not connected but proceeding"; + continue; + } - constexpr unsigned bufsiz = vr::k_unMaxPropertyStringSize; - static char str[bufsiz+1] {}; // vr_lock prevents reentrancy + unsigned len; - for (unsigned k = 0; k < vr::k_unMaxTrackedDeviceCount; k++) + len = v->GetStringTrackedDeviceProperty(k, vr::ETrackedDeviceProperty::Prop_SerialNumber_String, str, bufsiz); + if (!len) { - if (v->GetTrackedDeviceClass(k) == vr::ETrackedDeviceClass::TrackedDeviceClass_Invalid) - { - qDebug() << "no device with index"; - continue; - } - - if (!device_states[k].bDeviceIsConnected) - { - qDebug() << "device not connected but proceeding"; - continue; - } - - unsigned len; - - len = v->GetStringTrackedDeviceProperty(k, vr::ETrackedDeviceProperty::Prop_SerialNumber_String, str, bufsiz); - if (!len) - { - qDebug() << "steamvr: getting serial number failed for" << k; - continue; - } - - device_spec dev; - - dev.serial = str; - - len = v->GetStringTrackedDeviceProperty(k, vr::ETrackedDeviceProperty::Prop_ModelNumber_String, str, bufsiz); - if (!len) - { - qDebug() << "steamvr: getting model number failed for" << k; - continue; - } - - switch (v->GetTrackedDeviceClass(k)) - { - case vr::ETrackedDeviceClass::TrackedDeviceClass_HMD: - dev.type = "HMD"; break; - case vr::ETrackedDeviceClass::TrackedDeviceClass_Controller: - dev.type = "Controller"; break; - case vr::ETrackedDeviceClass::TrackedDeviceClass_TrackingReference: - dev.type = "Tracker"; break; - default: - dev.type = "Unknown"; break; - } - - dev.model = str; - dev.pose = device_states[k]; - dev.k = k; - dev.is_connected = device_states[k].bDeviceIsConnected; - - list.push_back(dev); + qDebug() << "steamvr: getting serial number failed for" << k; + continue; } + + device_spec dev; + + dev.serial = str; + + len = v->GetStringTrackedDeviceProperty(k, vr::ETrackedDeviceProperty::Prop_ModelNumber_String, str, bufsiz); + if (!len) + { + qDebug() << "steamvr: getting model number failed for" << k; + continue; + } + + switch (v->GetTrackedDeviceClass(k)) + { + case vr::ETrackedDeviceClass::TrackedDeviceClass_HMD: + dev.type = "HMD"; break; + case vr::ETrackedDeviceClass::TrackedDeviceClass_Controller: + dev.type = "Controller"; break; + case vr::ETrackedDeviceClass::TrackedDeviceClass_TrackingReference: + dev.type = "Tracker"; break; + default: + dev.type = "Unknown"; break; + } + + dev.model = str; + dev.pose = device_states[k]; + dev.k = k; + dev.is_connected = device_states[k].bDeviceIsConnected; + + list.push_back(dev); } }); } |