-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAnalog.h
80 lines (66 loc) · 2.37 KB
/
Analog.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#if !defined(__Analog_h__)
#define __Analog_h__
#include <osvr/PluginKit/PluginKit.h>
#include <osvr/PluginKit/AnalogInterfaceC.h>
#include "VirtualMotionData.h"
namespace OSVRVirtualMotion {
namespace AnalogChannels {
enum AnalogChannel {
IsLeftHandAvailable,
IsRightHandAvailable,
LeftLittleProximalBend,
LeftLittleIntermediateBend,
LeftRingProximalBend,
LeftRingIntermediateBend,
LeftMiddleProximalBend,
LeftMiddleIntermediateBend,
LeftIndexProximalBend,
LeftIndexIntermediateBend,
LeftThumbProximalBend,
LeftThumbDistalBend,
RightLittleProximalBend,
RightLittleIntermediateBend,
RightRingProximalBend,
RightRingIntermediateBend,
RightMiddleProximalBend,
RightMiddleIntermediateBend,
RightIndexProximalBend,
RightIndexIntermediateBend,
RightThumbProximalBend,
RightThumbDistalBend,
LeftLittleRingAbduction,
LeftRingMiddleAbduction,
LeftMiddleIndexAbduction,
LeftIndexThumbAbduction,
RightLittleRingAbduction,
RightRingMiddleAbduction,
RightMiddleIndexAbduction,
RightIndexThumbAbduction,
LeftLittleFingerPressure,
LeftRingFingerPressure,
LeftMiddleFingerPressure,
LeftIndexFingerPressure,
LeftThumbFingerPressure,
RightLittleFingerPressure,
RightRingFingerPressure,
RightMiddleFingerPressure,
RightIndexFingerPressure,
RightThumbFingerPressure,
AnalogChannelCount //must be the last element
};
}
class Analog {
public:
Analog(const osvr::pluginkit::DeviceToken& pDeviceToken,
OSVR_DeviceInitOptions pOptions, const VirtualMotionData& pVirtualMotionData);
void update();
double getValue(AnalogChannels::AnalogChannel channel) const;
private:
double getNormalizedValue(uint32 bendValue) const;
const VirtualMotionData& mVirtualMotionData;
const osvr::pluginkit::DeviceToken& mDeviceToken;
OSVR_AnalogDeviceInterface mAnalogInterface;
OSVR_AnalogState mValues[AnalogChannels::AnalogChannelCount];
};
}
#endif