-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathTrackerRole.cpp
More file actions
113 lines (107 loc) · 3.86 KB
/
TrackerRole.cpp
File metadata and controls
113 lines (107 loc) · 3.86 KB
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*
SlimeVR Code is placed under the MIT license
Copyright (c) 2021 Eiren Rain
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "TrackerRole.hpp"
std::string GetViveRoleHint(TrackerRole role) {
switch (role) {
case LEFT_CONTROLLER:
case RIGHT_CONTROLLER:
case GENERIC_CONTROLLER:
case LEFT_HAND:
case RIGHT_HAND:
return "vive_tracker_handed";
case LEFT_FOOT:
return "vive_tracker_left_foot";
case RIGHT_FOOT:
return "vive_tracker_right_foot";
case LEFT_SHOULDER:
return "vive_tracker_left_shoulder";
case RIGHT_SHOULDER:
return "vive_tracker_right_shoulder";
case LEFT_ELBOW:
return "vive_tracker_left_elbow";
case RIGHT_ELBOW:
return "vive_tracker_right_elbow";
case LEFT_KNEE:
return "vive_tracker_left_knee";
case RIGHT_KNEE:
return "vive_tracker_right_knee";
case WAIST:
return "vive_tracker_waist";
case CHEST:
return "vive_tracker_chest";
case CAMERA:
return "vive_tracker_camera";
case KEYBOARD:
return "vive_tracker_keyboard";
}
return "";
}
std::string GetViveRole(TrackerRole role) {
switch (role) {
case GENERIC_CONTROLLER:
return "TrackerRole_Handed";
case LEFT_CONTROLLER:
case LEFT_HAND:
return "TrackerRole_Handed,TrackedControllerRole_LeftHand";
case RIGHT_CONTROLLER:
case RIGHT_HAND:
return "TrackerRole_Handed,TrackedControllerRole_RightHand";
case LEFT_FOOT:
return "TrackerRole_LeftFoot";
case RIGHT_FOOT:
return "TrackerRole_RightFoot";
case LEFT_SHOULDER:
return "TrackerRole_LeftShoulder";
case RIGHT_SHOULDER:
return "TrackerRole_RightShoulder";
case LEFT_ELBOW:
return "TrackerRole_LeftElbow";
case RIGHT_ELBOW:
return "TrackerRole_RightElbow";
case LEFT_KNEE:
return "TrackerRole_LeftKnee";
case RIGHT_KNEE:
return "TrackerRole_RightKnee";
case WAIST:
return "TrackerRole_Waist";
case CHEST:
return "TrackerRole_Chest";
case CAMERA:
return "TrackerRole_Camera";
case KEYBOARD:
return "TrackerRole_Keyboard";
}
return "";
}
DeviceType GetDeviceType(TrackerRole role) {
switch (role) {
case LEFT_CONTROLLER:
case LEFT_HAND:
case RIGHT_CONTROLLER:
case RIGHT_HAND:
case GENERIC_CONTROLLER:
return DeviceType::CONTROLLER;
case HMD:
return DeviceType::HMD;
case BEACON:
return DeviceType::TRACKING_REFERENCE;
}
return DeviceType::TRACKER;
}