Showing the changes to libraries/input-plugins/src/input-plugins/ViveControllerManager.cpp (1 of 8 files). Show all
Unified · Split
| @@ -17,14 +17,16 @@ · 16 unmodified lines | |||
| 17 | #include <gpu/Batch.h> | 17 | #include <gpu/Batch.h> |
| 18 | #include <gpu/Context.h> | 18 | #include <gpu/Context.h> |
| 19 | #include <DeferredLightingEffect.h> | 19 | #include <DeferredLightingEffect.h> |
| 20 | #include <display-plugins\openvr\OpenVrHelpers.h> | 20 | #include <display-plugins/openvr/OpenVrHelpers.h> |
| 21 | #include "NumericalConstants.h" | 21 | #include "NumericalConstants.h" |
| 22 | #include "UserActivityLogger.h" | 22 | #include "UserActivityLogger.h" |
| 23 | 23 | ||
| 24 | #ifndef Q_OS_MAC | ||
| 24 | extern vr::IVRSystem* _hmd; | 25 | extern vr::IVRSystem* _hmd; |
| 25 | extern int hmdRefCount; | 26 | extern int hmdRefCount; |
| 26 | extern vr::TrackedDevicePose_t _trackedDevicePose[vr::k_unMaxTrackedDeviceCount]; | 27 | extern vr::TrackedDevicePose_t _trackedDevicePose[vr::k_unMaxTrackedDeviceCount]; |
| 27 | extern mat4 _trackedDevicePoseMat4[vr::k_unMaxTrackedDeviceCount]; | 28 | extern mat4 _trackedDevicePoseMat4[vr::k_unMaxTrackedDeviceCount]; |
| 29 | #endif | ||
| 28 | 30 | ||
| 29 | const unsigned int LEFT_MASK = 0U; | 31 | const unsigned int LEFT_MASK = 0U; |
| 30 | const unsigned int RIGHT_MASK = 1U; | 32 | const unsigned int RIGHT_MASK = 1U; |
| @@ -55,10 +57,15 @@ ViveControllerManager::ViveControllerManager() : · 24 unmodified lines | |||
| 55 | } | 57 | } |
| 56 | 58 | ||
| 57 | bool ViveControllerManager::isSupported() const { | 59 | bool ViveControllerManager::isSupported() const { |
| 60 | #ifndef Q_OS_MAC | ||
| 58 | return vr::VR_IsHmdPresent(); | 61 | return vr::VR_IsHmdPresent(); |
| 62 | #else | ||
| 63 | return false; | ||
| 64 | #endif | ||
| 59 | } | 65 | } |
| 60 | 66 | ||
| 61 | void ViveControllerManager::activate(PluginContainer* container) { | 67 | void ViveControllerManager::activate(PluginContainer* container) { |
| 68 | #ifndef Q_OS_MAC | ||
| 62 | hmdRefCount++; | 69 | hmdRefCount++; |
| 63 | if (!_hmd) { | 70 | if (!_hmd) { |
| 64 | vr::HmdError eError = vr::HmdError_None; | 71 | vr::HmdError eError = vr::HmdError_None; |
| @@ -112,9 +119,11 @@ void ViveControllerManager::activate(PluginContainer* container) { · 47 unmodified lines | |||
| 112 | 119 | ||
| 113 | _modelLoaded = true; | 120 | _modelLoaded = true; |
| 114 | } | 121 | } |
| 122 | #endif | ||
| 115 | } | 123 | } |
| 116 | 124 | ||
| 117 | void ViveControllerManager::deactivate() { | 125 | void ViveControllerManager::deactivate() { |
| 126 | #ifndef Q_OS_MAC | ||
| 118 | hmdRefCount--; | 127 | hmdRefCount--; |
| 119 | 128 | ||
| 120 | if (hmdRefCount == 0 && _hmd) { | 129 | if (hmdRefCount == 0 && _hmd) { |
| @@ -122,6 +131,7 @@ void ViveControllerManager::deactivate() { · 1 unmodified line | |||
| 122 | _hmd = nullptr; | 131 | _hmd = nullptr; |
| 123 | } | 132 | } |
| 124 | _poseStateMap.clear(); | 133 | _poseStateMap.clear(); |
| 134 | #endif | ||
| 125 | } | 135 | } |
| 126 | 136 | ||
| 127 | void ViveControllerManager::updateRendering(RenderArgs* args, render::ScenePointer scene, render::PendingChanges pendingChanges) { | 137 | void ViveControllerManager::updateRendering(RenderArgs* args, render::ScenePointer scene, render::PendingChanges pendingChanges) { |
| @@ -187,12 +197,14 @@ void ViveControllerManager::renderHand(UserInputMapper::PoseValue pose, gpu::Bat · 59 unmodified lines | |||
| 187 | } | 197 | } |
| 188 | 198 | ||
| 189 | void ViveControllerManager::update(float deltaTime, bool jointsCaptured) { | 199 | void ViveControllerManager::update(float deltaTime, bool jointsCaptured) { |
| 200 | #ifndef Q_OS_MAC | ||
| 190 | _poseStateMap.clear(); | 201 | _poseStateMap.clear(); |
| 191 | // TODO: This shouldn't be necessary | 202 | // TODO: This shouldn't be necessary |
| 192 | if (!_hmd) { | 203 | if (!_hmd) { |
| 193 | return; | 204 | return; |
| 194 | } | 205 | } |
| 195 | 206 | return; | |
| 207 | |||
| 196 | _buttonPressedMap.clear(); | 208 | _buttonPressedMap.clear(); |
| 197 | 209 | ||
| 198 | PerformanceTimer perfTimer("ViveControllerManager::update"); | 210 | PerformanceTimer perfTimer("ViveControllerManager::update"); |
| @@ -252,6 +264,7 @@ void ViveControllerManager::update(float deltaTime, bool jointsCaptured) { · 53 unmodified lines | |||
| 252 | } | 264 | } |
| 253 | 265 | ||
| 254 | _trackedControllers = numTrackedControllers; | 266 | _trackedControllers = numTrackedControllers; |
| 267 | #endif | ||
| 255 | } | 268 | } |
| 256 | 269 | ||
| 257 | void ViveControllerManager::focusOutEvent() { | 270 | void ViveControllerManager::focusOutEvent() { |