-
Notifications
You must be signed in to change notification settings - Fork 14
/
Tracker.h
94 lines (71 loc) · 2.42 KB
/
Tracker.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include <osvr/PluginKit/PluginKit.h>
#include <osvr/PluginKit/TrackerInterfaceC.h>
#include <osvr/PluginKit/SkeletonInterfaceC.h>
#include <osvr/Util/Pose3C.h>
#include "LeapData.h"
namespace LeapOsvr {
/** @brief Handles tracker and skeleton interfaces */
class Tracker {
public:
Tracker(const osvr::pluginkit::DeviceToken& pDeviceToken,
OSVR_DeviceInitOptions pOptions, const LeapData& pLeapData);
void update();
private:
enum Channel {
Elbow,
Wrist,
Palm,
// Leap motion thumbs are reported anatomically incorrect
// we correct this in the device semantic paths
ThumbMeta, // null/zero joint
ThumbProx, // actually the metacarpal
ThumbInter, // actually the proximal
ThumbDist, // distal
IndexMeta,
IndexProx,
IndexInter,
IndexDist,
MiddleMeta,
MiddleProx,
MiddleInter,
MiddleDist,
RingMeta,
RingProx,
RingInter,
RingDist,
PinkyMeta,
PinkyProx,
PinkyInter,
PinkyDist,
ChannelsPerHand //must be the last element
};
enum FingerType {
Thumb,
Index,
Middle,
Ring,
Pinky,
NumFingerTypes // must be the last element
};
enum JointType {
MetaCarpal,
Proximal,
Intermediate,
Distal,
NumJointTypes // must be last element
};
const LeapData& mLeapData;
const osvr::pluginkit::DeviceToken& mDeviceToken;
OSVR_TrackerDeviceInterface mTrackerInterface;
OSVR_SkeletonDeviceInterface mSkeletonInterface;
Channel mChannelMap[5][4];
void sendHand(const LEAP_HAND &pHand);
void sendFinger(const LEAP_DIGIT &pFinger, FingerType pFingerType, bool pIsLeft);
void sendBone(const LEAP_BONE &pBone, FingerType pFingerType, JointType pJointType,
bool pIsLeft);
void sendPose(Channel pChannel, bool pIsLeft,
const LEAP_VECTOR &pPosition, const LEAP_QUATERNION &pRotation);
OSVR_Vec3 getOsvrVector(const LEAP_VECTOR &pVector);
OSVR_Quaternion getOsvrQuaternion(const LEAP_QUATERNION &pRotation, bool pIsLeft);
};
}