History

Merge fixes, OSX compile fixes

Bradley Austin Davis committed 11 years ago

Commit 408bb081 parent 114ab9e8 files · +47 −19Browse files

Showing the changes to libraries/input-plugins/src/input-plugins/ViveControllerManager.cpp (1 of 8 files). Show all

Unified · Split

libraries/input-plugins/src/input-plugins/ViveControllerManager.cpp+15−2
@@ -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
24extern vr::IVRSystem* _hmd;25extern vr::IVRSystem* _hmd;
25extern int hmdRefCount;26extern int hmdRefCount;
26extern vr::TrackedDevicePose_t _trackedDevicePose[vr::k_unMaxTrackedDeviceCount];27extern vr::TrackedDevicePose_t _trackedDevicePose[vr::k_unMaxTrackedDeviceCount];
27extern mat4 _trackedDevicePoseMat4[vr::k_unMaxTrackedDeviceCount];28extern mat4 _trackedDevicePoseMat4[vr::k_unMaxTrackedDeviceCount];
29#endif
28 30
29const unsigned int LEFT_MASK = 0U;31const unsigned int LEFT_MASK = 0U;
30const unsigned int RIGHT_MASK = 1U;32const unsigned int RIGHT_MASK = 1U;
@@ -55,10 +57,15 @@ ViveControllerManager::ViveControllerManager() : · 24 unmodified lines
55}57}
56 58
57bool ViveControllerManager::isSupported() const {59bool 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
61void ViveControllerManager::activate(PluginContainer* container) {67void 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
117void ViveControllerManager::deactivate() {125void 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
127void ViveControllerManager::updateRendering(RenderArgs* args, render::ScenePointer scene, render::PendingChanges pendingChanges) {137void 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
189void ViveControllerManager::update(float deltaTime, bool jointsCaptured) {199void ViveControllerManager::update(float deltaTime, bool jointsCaptured) {
200#ifndef Q_OS_MAC
190 _poseStateMap.clear();201 _poseStateMap.clear();
191 // TODO: This shouldn't be necessary202 // 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
257void ViveControllerManager::focusOutEvent() {270void ViveControllerManager::focusOutEvent() {