1 | /**************************************************************************/ |
2 | /* openxr_interaction_profile_metadata.cpp */ |
3 | /**************************************************************************/ |
4 | /* This file is part of: */ |
5 | /* GODOT ENGINE */ |
6 | /* https://godotengine.org */ |
7 | /**************************************************************************/ |
8 | /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ |
9 | /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ |
10 | /* */ |
11 | /* Permission is hereby granted, free of charge, to any person obtaining */ |
12 | /* a copy of this software and associated documentation files (the */ |
13 | /* "Software"), to deal in the Software without restriction, including */ |
14 | /* without limitation the rights to use, copy, modify, merge, publish, */ |
15 | /* distribute, sublicense, and/or sell copies of the Software, and to */ |
16 | /* permit persons to whom the Software is furnished to do so, subject to */ |
17 | /* the following conditions: */ |
18 | /* */ |
19 | /* The above copyright notice and this permission notice shall be */ |
20 | /* included in all copies or substantial portions of the Software. */ |
21 | /* */ |
22 | /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ |
23 | /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ |
24 | /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ |
25 | /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ |
26 | /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ |
27 | /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ |
28 | /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ |
29 | /**************************************************************************/ |
30 | |
31 | #include "openxr_interaction_profile_metadata.h" |
32 | |
33 | #include "../openxr_api.h" |
34 | |
35 | OpenXRInteractionProfileMetadata *OpenXRInteractionProfileMetadata::singleton = nullptr; |
36 | |
37 | OpenXRInteractionProfileMetadata::OpenXRInteractionProfileMetadata() { |
38 | singleton = this; |
39 | |
40 | _register_core_metadata(); |
41 | OpenXRAPI::register_extension_metadata(); |
42 | } |
43 | |
44 | OpenXRInteractionProfileMetadata::~OpenXRInteractionProfileMetadata() { |
45 | singleton = nullptr; |
46 | } |
47 | |
48 | void OpenXRInteractionProfileMetadata::_bind_methods() { |
49 | ClassDB::bind_method(D_METHOD("register_profile_rename" , "old_name" , "new_name" ), &OpenXRInteractionProfileMetadata::register_profile_rename); |
50 | ClassDB::bind_method(D_METHOD("register_top_level_path" , "display_name" , "openxr_path" , "openxr_extension_name" ), &OpenXRInteractionProfileMetadata::register_top_level_path); |
51 | ClassDB::bind_method(D_METHOD("register_interaction_profile" , "display_name" , "openxr_path" , "openxr_extension_name" ), &OpenXRInteractionProfileMetadata::register_interaction_profile); |
52 | ClassDB::bind_method(D_METHOD("register_io_path" , "interaction_profile" , "display_name" , "toplevel_path" , "openxr_path" , "openxr_extension_name" , "action_type" ), &OpenXRInteractionProfileMetadata::register_io_path); |
53 | } |
54 | |
55 | void OpenXRInteractionProfileMetadata::register_profile_rename(const String &p_old_name, const String &p_new_name) { |
56 | ERR_FAIL_COND(profile_renames.has(p_old_name)); |
57 | |
58 | profile_renames[p_old_name] = p_new_name; |
59 | } |
60 | |
61 | String OpenXRInteractionProfileMetadata::check_profile_name(const String &p_name) const { |
62 | if (profile_renames.has(p_name)) { |
63 | return profile_renames[p_name]; |
64 | } |
65 | |
66 | return p_name; |
67 | } |
68 | |
69 | void OpenXRInteractionProfileMetadata::register_top_level_path(const String &p_display_name, const String &p_openxr_path, const String &p_openxr_extension_name) { |
70 | ERR_FAIL_COND_MSG(has_top_level_path(p_openxr_path), p_openxr_path + " had already been registered" ); |
71 | |
72 | TopLevelPath new_toplevel_path = { |
73 | p_display_name, |
74 | p_openxr_path, |
75 | p_openxr_extension_name |
76 | }; |
77 | |
78 | top_level_paths.push_back(new_toplevel_path); |
79 | } |
80 | |
81 | void OpenXRInteractionProfileMetadata::register_interaction_profile(const String &p_display_name, const String &p_openxr_path, const String &p_openxr_extension_name) { |
82 | ERR_FAIL_COND_MSG(has_interaction_profile(p_openxr_path), p_openxr_path + " has already been registered" ); |
83 | |
84 | InteractionProfile new_profile; |
85 | new_profile.display_name = p_display_name; |
86 | new_profile.openxr_path = p_openxr_path; |
87 | new_profile.openxr_extension_name = p_openxr_extension_name; |
88 | |
89 | interaction_profiles.push_back(new_profile); |
90 | } |
91 | |
92 | void OpenXRInteractionProfileMetadata::register_io_path(const String &p_interaction_profile, const String &p_display_name, const String &p_toplevel_path, const String &p_openxr_path, const String &p_openxr_extension_name, OpenXRAction::ActionType p_action_type) { |
93 | ERR_FAIL_COND_MSG(!has_interaction_profile(p_interaction_profile), "Unknown interaction profile " + p_interaction_profile); |
94 | ERR_FAIL_COND_MSG(!has_top_level_path(p_toplevel_path), "Unknown top level path " + p_toplevel_path); |
95 | |
96 | for (int i = 0; i < interaction_profiles.size(); i++) { |
97 | if (interaction_profiles[i].openxr_path == p_interaction_profile) { |
98 | ERR_FAIL_COND_MSG(interaction_profiles[i].has_io_path(p_openxr_path), p_interaction_profile + " already has io path " + p_openxr_path + " registered!" ); |
99 | |
100 | IOPath new_io_path = { |
101 | p_display_name, |
102 | p_toplevel_path, |
103 | p_openxr_path, |
104 | p_openxr_extension_name, |
105 | p_action_type |
106 | }; |
107 | |
108 | interaction_profiles.ptrw()[i].io_paths.push_back(new_io_path); |
109 | } |
110 | } |
111 | } |
112 | |
113 | bool OpenXRInteractionProfileMetadata::has_top_level_path(const String p_openxr_path) const { |
114 | for (int i = 0; i < top_level_paths.size(); i++) { |
115 | if (top_level_paths[i].openxr_path == p_openxr_path) { |
116 | return true; |
117 | } |
118 | } |
119 | |
120 | return false; |
121 | } |
122 | |
123 | String OpenXRInteractionProfileMetadata::get_top_level_name(const String p_openxr_path) const { |
124 | for (int i = 0; i < top_level_paths.size(); i++) { |
125 | if (top_level_paths[i].openxr_path == p_openxr_path) { |
126 | return top_level_paths[i].display_name; |
127 | } |
128 | } |
129 | |
130 | return String(); |
131 | } |
132 | |
133 | String OpenXRInteractionProfileMetadata::get_top_level_extension(const String p_openxr_path) const { |
134 | for (int i = 0; i < top_level_paths.size(); i++) { |
135 | if (top_level_paths[i].openxr_path == p_openxr_path) { |
136 | return top_level_paths[i].openxr_extension_name; |
137 | } |
138 | } |
139 | |
140 | return XR_PATH_UNSUPPORTED_NAME; |
141 | } |
142 | |
143 | bool OpenXRInteractionProfileMetadata::has_interaction_profile(const String p_openxr_path) const { |
144 | for (int i = 0; i < interaction_profiles.size(); i++) { |
145 | if (interaction_profiles[i].openxr_path == p_openxr_path) { |
146 | return true; |
147 | } |
148 | } |
149 | |
150 | return false; |
151 | } |
152 | |
153 | String OpenXRInteractionProfileMetadata::get_interaction_profile_extension(const String p_openxr_path) const { |
154 | for (int i = 0; i < interaction_profiles.size(); i++) { |
155 | if (interaction_profiles[i].openxr_path == p_openxr_path) { |
156 | return interaction_profiles[i].openxr_extension_name; |
157 | } |
158 | } |
159 | |
160 | return XR_PATH_UNSUPPORTED_NAME; |
161 | } |
162 | |
163 | const OpenXRInteractionProfileMetadata::InteractionProfile *OpenXRInteractionProfileMetadata::get_profile(const String p_openxr_path) const { |
164 | for (int i = 0; i < interaction_profiles.size(); i++) { |
165 | if (interaction_profiles[i].openxr_path == p_openxr_path) { |
166 | return &interaction_profiles[i]; |
167 | } |
168 | } |
169 | |
170 | return nullptr; |
171 | } |
172 | |
173 | bool OpenXRInteractionProfileMetadata::InteractionProfile::has_io_path(const String p_io_path) const { |
174 | for (int i = 0; i < io_paths.size(); i++) { |
175 | if (io_paths[i].openxr_path == p_io_path) { |
176 | return true; |
177 | } |
178 | } |
179 | |
180 | return false; |
181 | } |
182 | |
183 | const OpenXRInteractionProfileMetadata::IOPath *OpenXRInteractionProfileMetadata::InteractionProfile::get_io_path(const String p_io_path) const { |
184 | for (int i = 0; i < io_paths.size(); i++) { |
185 | if (io_paths[i].openxr_path == p_io_path) { |
186 | return &io_paths[i]; |
187 | } |
188 | } |
189 | |
190 | return nullptr; |
191 | } |
192 | |
193 | const OpenXRInteractionProfileMetadata::IOPath *OpenXRInteractionProfileMetadata::get_io_path(const String p_interaction_profile, const String p_io_path) const { |
194 | const OpenXRInteractionProfileMetadata::InteractionProfile *profile = get_profile(p_interaction_profile); |
195 | if (profile != nullptr) { |
196 | return profile->get_io_path(p_io_path); |
197 | } |
198 | |
199 | return nullptr; |
200 | } |
201 | |
202 | PackedStringArray OpenXRInteractionProfileMetadata::get_interaction_profile_paths() const { |
203 | PackedStringArray arr; |
204 | |
205 | for (int i = 0; i < interaction_profiles.size(); i++) { |
206 | arr.push_back(interaction_profiles[i].openxr_path); |
207 | } |
208 | |
209 | return arr; |
210 | } |
211 | |
212 | void OpenXRInteractionProfileMetadata::_register_core_metadata() { |
213 | // Note, currently we add definitions that belong in extensions. |
214 | // Extensions are registered when our OpenXRAPI is instantiated |
215 | // however this does not happen in the editor. |
216 | // We are changing this in another PR, once that is accepted we |
217 | // can make the changes to move code into extensions where needed. |
218 | |
219 | // Note that we'll make an exception for XR_EXT_palm_pose, which is used everywhere |
220 | |
221 | // Our core toplevel paths |
222 | register_top_level_path("Left hand controller" , "/user/hand/left" , "" ); |
223 | register_top_level_path("Right hand controller" , "/user/hand/right" , "" ); |
224 | register_top_level_path("Head" , "/user/head" , "" ); |
225 | register_top_level_path("Gamepad" , "/user/gamepad" , "" ); |
226 | register_top_level_path("Treadmill" , "/user/treadmill" , "" ); |
227 | |
228 | // TODO move this into OpenXRHTCViveTrackerExtension once this is supported. |
229 | // register_top_level_path("Handheld object tracker", "/user/vive_tracker_htcx/role/handheld_object", XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME); |
230 | register_top_level_path("Left foot tracker" , "/user/vive_tracker_htcx/role/left_foot" , XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME); |
231 | register_top_level_path("Right foot tracker" , "/user/vive_tracker_htcx/role/right_foot" , XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME); |
232 | register_top_level_path("Left shoulder tracker" , "/user/vive_tracker_htcx/role/left_shoulder" , XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME); |
233 | register_top_level_path("Right shoulder tracker" , "/user/vive_tracker_htcx/role/right_shoulder" , XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME); |
234 | register_top_level_path("Left elbow tracker" , "/user/vive_tracker_htcx/role/left_elbow" , XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME); |
235 | register_top_level_path("Right elbow tracker" , "/user/vive_tracker_htcx/role/right_elbow" , XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME); |
236 | register_top_level_path("Left knee tracker" , "/user/vive_tracker_htcx/role/left_knee" , XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME); |
237 | register_top_level_path("Right knee tracker" , "/user/vive_tracker_htcx/role/right_knee" , XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME); |
238 | register_top_level_path("Waist tracker" , "/user/vive_tracker_htcx/role/waist" , XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME); |
239 | register_top_level_path("Chest tracker" , "/user/vive_tracker_htcx/role/chest" , XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME); |
240 | register_top_level_path("Camera tracker" , "/user/vive_tracker_htcx/role/camera" , XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME); |
241 | register_top_level_path("Keyboard tracker" , "/user/vive_tracker_htcx/role/keyboard" , XR_HTCX_VIVE_TRACKER_INTERACTION_EXTENSION_NAME); |
242 | |
243 | // Fallback Khronos simple controller |
244 | register_interaction_profile("Simple controller" , "/interaction_profiles/khr/simple_controller" , "" ); |
245 | register_io_path("/interaction_profiles/khr/simple_controller" , "Grip pose" , "/user/hand/left" , "/user/hand/left/input/grip/pose" , "" , OpenXRAction::OPENXR_ACTION_POSE); |
246 | register_io_path("/interaction_profiles/khr/simple_controller" , "Grip pose" , "/user/hand/right" , "/user/hand/right/input/grip/pose" , "" , OpenXRAction::OPENXR_ACTION_POSE); |
247 | register_io_path("/interaction_profiles/khr/simple_controller" , "Aim pose" , "/user/hand/left" , "/user/hand/left/input/aim/pose" , "" , OpenXRAction::OPENXR_ACTION_POSE); |
248 | register_io_path("/interaction_profiles/khr/simple_controller" , "Aim pose" , "/user/hand/right" , "/user/hand/right/input/aim/pose" , "" , OpenXRAction::OPENXR_ACTION_POSE); |
249 | register_io_path("/interaction_profiles/khr/simple_controller" , "Palm pose" , "/user/hand/left" , "/user/hand/left/input/palm_ext/pose" , XR_EXT_PALM_POSE_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE); |
250 | register_io_path("/interaction_profiles/khr/simple_controller" , "Palm pose" , "/user/hand/right" , "/user/hand/right/input/palm_ext/pose" , XR_EXT_PALM_POSE_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE); |
251 | |
252 | register_io_path("/interaction_profiles/khr/simple_controller" , "Menu click" , "/user/hand/left" , "/user/hand/left/input/menu/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
253 | register_io_path("/interaction_profiles/khr/simple_controller" , "Menu click" , "/user/hand/right" , "/user/hand/right/input/menu/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
254 | register_io_path("/interaction_profiles/khr/simple_controller" , "Select click" , "/user/hand/left" , "/user/hand/left/input/select/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
255 | register_io_path("/interaction_profiles/khr/simple_controller" , "Select click" , "/user/hand/right" , "/user/hand/right/input/select/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
256 | |
257 | register_io_path("/interaction_profiles/khr/simple_controller" , "Haptic output" , "/user/hand/left" , "/user/hand/left/output/haptic" , "" , OpenXRAction::OPENXR_ACTION_HAPTIC); |
258 | register_io_path("/interaction_profiles/khr/simple_controller" , "Haptic output" , "/user/hand/right" , "/user/hand/right/output/haptic" , "" , OpenXRAction::OPENXR_ACTION_HAPTIC); |
259 | |
260 | // Original HTC Vive wands |
261 | register_interaction_profile("HTC Vive wand" , "/interaction_profiles/htc/vive_controller" , "" ); |
262 | register_io_path("/interaction_profiles/htc/vive_controller" , "Grip pose" , "/user/hand/left" , "/user/hand/left/input/grip/pose" , "" , OpenXRAction::OPENXR_ACTION_POSE); |
263 | register_io_path("/interaction_profiles/htc/vive_controller" , "Grip pose" , "/user/hand/right" , "/user/hand/right/input/grip/pose" , "" , OpenXRAction::OPENXR_ACTION_POSE); |
264 | register_io_path("/interaction_profiles/htc/vive_controller" , "Aim pose" , "/user/hand/left" , "/user/hand/left/input/aim/pose" , "" , OpenXRAction::OPENXR_ACTION_POSE); |
265 | register_io_path("/interaction_profiles/htc/vive_controller" , "Aim pose" , "/user/hand/right" , "/user/hand/right/input/aim/pose" , "" , OpenXRAction::OPENXR_ACTION_POSE); |
266 | register_io_path("/interaction_profiles/htc/vive_controller" , "Palm pose" , "/user/hand/left" , "/user/hand/left/input/palm_ext/pose" , XR_EXT_PALM_POSE_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE); |
267 | register_io_path("/interaction_profiles/htc/vive_controller" , "Palm pose" , "/user/hand/right" , "/user/hand/right/input/palm_ext/pose" , XR_EXT_PALM_POSE_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE); |
268 | |
269 | register_io_path("/interaction_profiles/htc/vive_controller" , "Menu click" , "/user/hand/left" , "/user/hand/left/input/menu/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
270 | register_io_path("/interaction_profiles/htc/vive_controller" , "Menu click" , "/user/hand/right" , "/user/hand/right/input/menu/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
271 | register_io_path("/interaction_profiles/htc/vive_controller" , "System click" , "/user/hand/left" , "/user/hand/left/input/system/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
272 | register_io_path("/interaction_profiles/htc/vive_controller" , "System click" , "/user/hand/right" , "/user/hand/right/input/system/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
273 | |
274 | register_io_path("/interaction_profiles/htc/vive_controller" , "Trigger" , "/user/hand/left" , "/user/hand/left/input/trigger/value" , "" , OpenXRAction::OPENXR_ACTION_FLOAT); |
275 | register_io_path("/interaction_profiles/htc/vive_controller" , "Trigger click" , "/user/hand/left" , "/user/hand/left/input/trigger/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
276 | register_io_path("/interaction_profiles/htc/vive_controller" , "Trigger" , "/user/hand/right" , "/user/hand/right/input/trigger/value" , "" , OpenXRAction::OPENXR_ACTION_FLOAT); |
277 | register_io_path("/interaction_profiles/htc/vive_controller" , "Trigger click" , "/user/hand/right" , "/user/hand/right/input/trigger/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
278 | |
279 | register_io_path("/interaction_profiles/htc/vive_controller" , "Squeeze click" , "/user/hand/left" , "/user/hand/left/input/squeeze/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
280 | register_io_path("/interaction_profiles/htc/vive_controller" , "Squeeze click" , "/user/hand/right" , "/user/hand/right/input/squeeze/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
281 | |
282 | register_io_path("/interaction_profiles/htc/vive_controller" , "Trackpad" , "/user/hand/left" , "/user/hand/left/input/trackpad" , "" , OpenXRAction::OPENXR_ACTION_VECTOR2); |
283 | register_io_path("/interaction_profiles/htc/vive_controller" , "Trackpad click" , "/user/hand/left" , "/user/hand/left/input/trackpad/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
284 | register_io_path("/interaction_profiles/htc/vive_controller" , "Trackpad touch" , "/user/hand/left" , "/user/hand/left/input/trackpad/touch" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
285 | register_io_path("/interaction_profiles/htc/vive_controller" , "Trackpad" , "/user/hand/right" , "/user/hand/right/input/trackpad" , "" , OpenXRAction::OPENXR_ACTION_VECTOR2); |
286 | register_io_path("/interaction_profiles/htc/vive_controller" , "Trackpad click" , "/user/hand/right" , "/user/hand/right/input/trackpad/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
287 | register_io_path("/interaction_profiles/htc/vive_controller" , "Trackpad touch" , "/user/hand/right" , "/user/hand/right/input/trackpad/touch" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
288 | |
289 | register_io_path("/interaction_profiles/htc/vive_controller" , "Haptic output" , "/user/hand/left" , "/user/hand/left/output/haptic" , "" , OpenXRAction::OPENXR_ACTION_HAPTIC); |
290 | register_io_path("/interaction_profiles/htc/vive_controller" , "Haptic output" , "/user/hand/right" , "/user/hand/right/output/haptic" , "" , OpenXRAction::OPENXR_ACTION_HAPTIC); |
291 | |
292 | // Microsoft motion controller (original WMR controllers) |
293 | register_interaction_profile("MS Motion controller" , "/interaction_profiles/microsoft/motion_controller" , "" ); |
294 | register_io_path("/interaction_profiles/microsoft/motion_controller" , "Grip pose" , "/user/hand/left" , "/user/hand/left/input/grip/pose" , "" , OpenXRAction::OPENXR_ACTION_POSE); |
295 | register_io_path("/interaction_profiles/microsoft/motion_controller" , "Grip pose" , "/user/hand/right" , "/user/hand/right/input/grip/pose" , "" , OpenXRAction::OPENXR_ACTION_POSE); |
296 | register_io_path("/interaction_profiles/microsoft/motion_controller" , "Aim pose" , "/user/hand/left" , "/user/hand/left/input/aim/pose" , "" , OpenXRAction::OPENXR_ACTION_POSE); |
297 | register_io_path("/interaction_profiles/microsoft/motion_controller" , "Aim pose" , "/user/hand/right" , "/user/hand/right/input/aim/pose" , "" , OpenXRAction::OPENXR_ACTION_POSE); |
298 | register_io_path("/interaction_profiles/microsoft/motion_controller" , "Palm pose" , "/user/hand/left" , "/user/hand/left/input/palm_ext/pose" , XR_EXT_PALM_POSE_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE); |
299 | register_io_path("/interaction_profiles/microsoft/motion_controller" , "Palm pose" , "/user/hand/right" , "/user/hand/right/input/palm_ext/pose" , XR_EXT_PALM_POSE_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE); |
300 | |
301 | register_io_path("/interaction_profiles/microsoft/motion_controller" , "Menu click" , "/user/hand/left" , "/user/hand/left/input/menu/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
302 | register_io_path("/interaction_profiles/microsoft/motion_controller" , "Menu click" , "/user/hand/right" , "/user/hand/right/input/menu/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
303 | |
304 | register_io_path("/interaction_profiles/microsoft/motion_controller" , "Trigger" , "/user/hand/left" , "/user/hand/left/input/trigger/value" , "" , OpenXRAction::OPENXR_ACTION_FLOAT); |
305 | register_io_path("/interaction_profiles/microsoft/motion_controller" , "Trigger click" , "/user/hand/left" , "/user/hand/left/input/trigger/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
306 | register_io_path("/interaction_profiles/microsoft/motion_controller" , "Trigger" , "/user/hand/right" , "/user/hand/right/input/trigger/value" , "" , OpenXRAction::OPENXR_ACTION_FLOAT); |
307 | register_io_path("/interaction_profiles/microsoft/motion_controller" , "Trigger click" , "/user/hand/right" , "/user/hand/right/input/trigger/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
308 | |
309 | register_io_path("/interaction_profiles/microsoft/motion_controller" , "Squeeze click" , "/user/hand/left" , "/user/hand/left/input/squeeze/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
310 | register_io_path("/interaction_profiles/microsoft/motion_controller" , "Squeeze click" , "/user/hand/right" , "/user/hand/right/input/squeeze/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
311 | |
312 | register_io_path("/interaction_profiles/microsoft/motion_controller" , "Thumbstick" , "/user/hand/left" , "/user/hand/left/input/thumbstick" , "" , OpenXRAction::OPENXR_ACTION_VECTOR2); |
313 | register_io_path("/interaction_profiles/microsoft/motion_controller" , "Thumbstick click" , "/user/hand/left" , "/user/hand/left/input/thumbstick/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
314 | register_io_path("/interaction_profiles/microsoft/motion_controller" , "Thumbstick" , "/user/hand/right" , "/user/hand/right/input/thumbstick" , "" , OpenXRAction::OPENXR_ACTION_VECTOR2); |
315 | register_io_path("/interaction_profiles/microsoft/motion_controller" , "Thumbstick click" , "/user/hand/right" , "/user/hand/right/input/thumbstick/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
316 | |
317 | register_io_path("/interaction_profiles/microsoft/motion_controller" , "Trackpad" , "/user/hand/left" , "/user/hand/left/input/trackpad" , "" , OpenXRAction::OPENXR_ACTION_VECTOR2); |
318 | register_io_path("/interaction_profiles/microsoft/motion_controller" , "Trackpad click" , "/user/hand/left" , "/user/hand/left/input/trackpad/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
319 | register_io_path("/interaction_profiles/microsoft/motion_controller" , "Trackpad touch" , "/user/hand/left" , "/user/hand/left/input/trackpad/touch" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
320 | register_io_path("/interaction_profiles/microsoft/motion_controller" , "Trackpad" , "/user/hand/right" , "/user/hand/right/input/trackpad" , "" , OpenXRAction::OPENXR_ACTION_VECTOR2); |
321 | register_io_path("/interaction_profiles/microsoft/motion_controller" , "Trackpad click" , "/user/hand/right" , "/user/hand/right/input/trackpad/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
322 | register_io_path("/interaction_profiles/microsoft/motion_controller" , "Trackpad touch" , "/user/hand/right" , "/user/hand/right/input/trackpad/touch" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
323 | |
324 | register_io_path("/interaction_profiles/microsoft/motion_controller" , "Haptic output" , "/user/hand/left" , "/user/hand/left/output/haptic" , "" , OpenXRAction::OPENXR_ACTION_HAPTIC); |
325 | register_io_path("/interaction_profiles/microsoft/motion_controller" , "Haptic output" , "/user/hand/right" , "/user/hand/right/output/haptic" , "" , OpenXRAction::OPENXR_ACTION_HAPTIC); |
326 | |
327 | // Meta touch controller (original touch controllers, Quest 1 and Quest 2 controllers) |
328 | register_interaction_profile("Touch controller" , "/interaction_profiles/oculus/touch_controller" , "" ); |
329 | register_io_path("/interaction_profiles/oculus/touch_controller" , "Grip pose" , "/user/hand/left" , "/user/hand/left/input/grip/pose" , "" , OpenXRAction::OPENXR_ACTION_POSE); |
330 | register_io_path("/interaction_profiles/oculus/touch_controller" , "Grip pose" , "/user/hand/right" , "/user/hand/right/input/grip/pose" , "" , OpenXRAction::OPENXR_ACTION_POSE); |
331 | register_io_path("/interaction_profiles/oculus/touch_controller" , "Aim pose" , "/user/hand/left" , "/user/hand/left/input/aim/pose" , "" , OpenXRAction::OPENXR_ACTION_POSE); |
332 | register_io_path("/interaction_profiles/oculus/touch_controller" , "Aim pose" , "/user/hand/right" , "/user/hand/right/input/aim/pose" , "" , OpenXRAction::OPENXR_ACTION_POSE); |
333 | register_io_path("/interaction_profiles/oculus/touch_controller" , "Palm pose" , "/user/hand/left" , "/user/hand/left/input/palm_ext/pose" , XR_EXT_PALM_POSE_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE); |
334 | register_io_path("/interaction_profiles/oculus/touch_controller" , "Palm pose" , "/user/hand/right" , "/user/hand/right/input/palm_ext/pose" , XR_EXT_PALM_POSE_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE); |
335 | |
336 | register_io_path("/interaction_profiles/oculus/touch_controller" , "Menu click" , "/user/hand/left" , "/user/hand/left/input/menu/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
337 | register_io_path("/interaction_profiles/oculus/touch_controller" , "System click" , "/user/hand/right" , "/user/hand/right/input/system/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
338 | |
339 | register_io_path("/interaction_profiles/oculus/touch_controller" , "X click" , "/user/hand/left" , "/user/hand/left/input/x/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
340 | register_io_path("/interaction_profiles/oculus/touch_controller" , "X touch" , "/user/hand/left" , "/user/hand/left/input/x/touch" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
341 | register_io_path("/interaction_profiles/oculus/touch_controller" , "Y click" , "/user/hand/left" , "/user/hand/left/input/y/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
342 | register_io_path("/interaction_profiles/oculus/touch_controller" , "Y touch" , "/user/hand/left" , "/user/hand/left/input/y/touch" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
343 | register_io_path("/interaction_profiles/oculus/touch_controller" , "A click" , "/user/hand/right" , "/user/hand/right/input/a/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
344 | register_io_path("/interaction_profiles/oculus/touch_controller" , "A touch" , "/user/hand/right" , "/user/hand/right/input/a/touch" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
345 | register_io_path("/interaction_profiles/oculus/touch_controller" , "B click" , "/user/hand/right" , "/user/hand/right/input/b/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
346 | register_io_path("/interaction_profiles/oculus/touch_controller" , "B touch" , "/user/hand/right" , "/user/hand/right/input/b/touch" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
347 | |
348 | register_io_path("/interaction_profiles/oculus/touch_controller" , "Trigger" , "/user/hand/left" , "/user/hand/left/input/trigger/value" , "" , OpenXRAction::OPENXR_ACTION_FLOAT); |
349 | register_io_path("/interaction_profiles/oculus/touch_controller" , "Trigger touch" , "/user/hand/left" , "/user/hand/left/input/trigger/touch" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
350 | register_io_path("/interaction_profiles/oculus/touch_controller" , "Trigger" , "/user/hand/right" , "/user/hand/right/input/trigger/value" , "" , OpenXRAction::OPENXR_ACTION_FLOAT); |
351 | register_io_path("/interaction_profiles/oculus/touch_controller" , "Trigger touch" , "/user/hand/right" , "/user/hand/right/input/trigger/touch" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
352 | |
353 | register_io_path("/interaction_profiles/oculus/touch_controller" , "Squeeze" , "/user/hand/left" , "/user/hand/left/input/squeeze/value" , "" , OpenXRAction::OPENXR_ACTION_FLOAT); |
354 | register_io_path("/interaction_profiles/oculus/touch_controller" , "Squeeze" , "/user/hand/right" , "/user/hand/right/input/squeeze/value" , "" , OpenXRAction::OPENXR_ACTION_FLOAT); |
355 | |
356 | register_io_path("/interaction_profiles/oculus/touch_controller" , "Thumbstick" , "/user/hand/left" , "/user/hand/left/input/thumbstick" , "" , OpenXRAction::OPENXR_ACTION_VECTOR2); |
357 | register_io_path("/interaction_profiles/oculus/touch_controller" , "Thumbstick click" , "/user/hand/left" , "/user/hand/left/input/thumbstick/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
358 | register_io_path("/interaction_profiles/oculus/touch_controller" , "Thumbstick touch" , "/user/hand/left" , "/user/hand/left/input/thumbstick/touch" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
359 | register_io_path("/interaction_profiles/oculus/touch_controller" , "Thumbstick" , "/user/hand/right" , "/user/hand/right/input/thumbstick" , "" , OpenXRAction::OPENXR_ACTION_VECTOR2); |
360 | register_io_path("/interaction_profiles/oculus/touch_controller" , "Thumbstick click" , "/user/hand/right" , "/user/hand/right/input/thumbstick/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
361 | register_io_path("/interaction_profiles/oculus/touch_controller" , "Thumbstick touch" , "/user/hand/right" , "/user/hand/right/input/thumbstick/touch" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
362 | |
363 | register_io_path("/interaction_profiles/oculus/touch_controller" , "Haptic output" , "/user/hand/left" , "/user/hand/left/output/haptic" , "" , OpenXRAction::OPENXR_ACTION_HAPTIC); |
364 | register_io_path("/interaction_profiles/oculus/touch_controller" , "Haptic output" , "/user/hand/right" , "/user/hand/right/output/haptic" , "" , OpenXRAction::OPENXR_ACTION_HAPTIC); |
365 | |
366 | // Valve Index controller |
367 | register_interaction_profile("Index controller" , "/interaction_profiles/valve/index_controller" , "" ); |
368 | register_io_path("/interaction_profiles/valve/index_controller" , "Grip pose" , "/user/hand/left" , "/user/hand/left/input/grip/pose" , "" , OpenXRAction::OPENXR_ACTION_POSE); |
369 | register_io_path("/interaction_profiles/valve/index_controller" , "Grip pose" , "/user/hand/right" , "/user/hand/right/input/grip/pose" , "" , OpenXRAction::OPENXR_ACTION_POSE); |
370 | register_io_path("/interaction_profiles/valve/index_controller" , "Aim pose" , "/user/hand/left" , "/user/hand/left/input/aim/pose" , "" , OpenXRAction::OPENXR_ACTION_POSE); |
371 | register_io_path("/interaction_profiles/valve/index_controller" , "Aim pose" , "/user/hand/right" , "/user/hand/right/input/aim/pose" , "" , OpenXRAction::OPENXR_ACTION_POSE); |
372 | register_io_path("/interaction_profiles/valve/index_controller" , "Palm pose" , "/user/hand/left" , "/user/hand/left/input/palm_ext/pose" , XR_EXT_PALM_POSE_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE); |
373 | register_io_path("/interaction_profiles/valve/index_controller" , "Palm pose" , "/user/hand/right" , "/user/hand/right/input/palm_ext/pose" , XR_EXT_PALM_POSE_EXTENSION_NAME, OpenXRAction::OPENXR_ACTION_POSE); |
374 | |
375 | register_io_path("/interaction_profiles/valve/index_controller" , "System click" , "/user/hand/left" , "/user/hand/left/input/system/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
376 | register_io_path("/interaction_profiles/valve/index_controller" , "System click" , "/user/hand/right" , "/user/hand/right/input/system/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
377 | |
378 | register_io_path("/interaction_profiles/valve/index_controller" , "A click" , "/user/hand/left" , "/user/hand/left/input/a/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
379 | register_io_path("/interaction_profiles/valve/index_controller" , "A touch" , "/user/hand/left" , "/user/hand/left/input/a/touch" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
380 | register_io_path("/interaction_profiles/valve/index_controller" , "A click" , "/user/hand/right" , "/user/hand/right/input/a/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
381 | register_io_path("/interaction_profiles/valve/index_controller" , "A touch" , "/user/hand/right" , "/user/hand/right/input/a/touch" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
382 | register_io_path("/interaction_profiles/valve/index_controller" , "B click" , "/user/hand/left" , "/user/hand/left/input/b/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
383 | register_io_path("/interaction_profiles/valve/index_controller" , "B touch" , "/user/hand/left" , "/user/hand/left/input/b/touch" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
384 | register_io_path("/interaction_profiles/valve/index_controller" , "B click" , "/user/hand/right" , "/user/hand/right/input/b/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
385 | register_io_path("/interaction_profiles/valve/index_controller" , "B touch" , "/user/hand/right" , "/user/hand/right/input/b/touch" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
386 | |
387 | register_io_path("/interaction_profiles/valve/index_controller" , "Trigger" , "/user/hand/left" , "/user/hand/left/input/trigger/value" , "" , OpenXRAction::OPENXR_ACTION_FLOAT); |
388 | register_io_path("/interaction_profiles/valve/index_controller" , "Trigger click" , "/user/hand/left" , "/user/hand/left/input/trigger/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
389 | register_io_path("/interaction_profiles/valve/index_controller" , "Trigger touch" , "/user/hand/left" , "/user/hand/left/input/trigger/touch" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
390 | register_io_path("/interaction_profiles/valve/index_controller" , "Trigger" , "/user/hand/right" , "/user/hand/right/input/trigger/value" , "" , OpenXRAction::OPENXR_ACTION_FLOAT); |
391 | register_io_path("/interaction_profiles/valve/index_controller" , "Trigger click" , "/user/hand/right" , "/user/hand/right/input/trigger/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
392 | register_io_path("/interaction_profiles/valve/index_controller" , "Trigger touch" , "/user/hand/right" , "/user/hand/right/input/trigger/touch" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
393 | |
394 | register_io_path("/interaction_profiles/valve/index_controller" , "Squeeze" , "/user/hand/left" , "/user/hand/left/input/squeeze/value" , "" , OpenXRAction::OPENXR_ACTION_FLOAT); |
395 | register_io_path("/interaction_profiles/valve/index_controller" , "Squeeze force" , "/user/hand/left" , "/user/hand/left/input/squeeze/force" , "" , OpenXRAction::OPENXR_ACTION_FLOAT); |
396 | register_io_path("/interaction_profiles/valve/index_controller" , "Squeeze" , "/user/hand/right" , "/user/hand/right/input/squeeze/value" , "" , OpenXRAction::OPENXR_ACTION_FLOAT); |
397 | register_io_path("/interaction_profiles/valve/index_controller" , "Squeeze force" , "/user/hand/right" , "/user/hand/right/input/squeeze/force" , "" , OpenXRAction::OPENXR_ACTION_FLOAT); |
398 | |
399 | register_io_path("/interaction_profiles/valve/index_controller" , "Thumbstick" , "/user/hand/left" , "/user/hand/left/input/thumbstick" , "" , OpenXRAction::OPENXR_ACTION_VECTOR2); |
400 | register_io_path("/interaction_profiles/valve/index_controller" , "Thumbstick click" , "/user/hand/left" , "/user/hand/left/input/thumbstick/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
401 | register_io_path("/interaction_profiles/valve/index_controller" , "Thumbstick touch" , "/user/hand/left" , "/user/hand/left/input/thumbstick/touch" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
402 | register_io_path("/interaction_profiles/valve/index_controller" , "Thumbstick" , "/user/hand/right" , "/user/hand/right/input/thumbstick" , "" , OpenXRAction::OPENXR_ACTION_VECTOR2); |
403 | register_io_path("/interaction_profiles/valve/index_controller" , "Thumbstick click" , "/user/hand/right" , "/user/hand/right/input/thumbstick/click" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
404 | register_io_path("/interaction_profiles/valve/index_controller" , "Thumbstick touch" , "/user/hand/right" , "/user/hand/right/input/thumbstick/touch" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
405 | |
406 | register_io_path("/interaction_profiles/valve/index_controller" , "Trackpad" , "/user/hand/left" , "/user/hand/left/input/trackpad" , "" , OpenXRAction::OPENXR_ACTION_VECTOR2); |
407 | register_io_path("/interaction_profiles/valve/index_controller" , "Trackpad force" , "/user/hand/left" , "/user/hand/left/input/trackpad/force" , "" , OpenXRAction::OPENXR_ACTION_FLOAT); |
408 | register_io_path("/interaction_profiles/valve/index_controller" , "Trackpad touch" , "/user/hand/left" , "/user/hand/left/input/trackpad/touch" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
409 | register_io_path("/interaction_profiles/valve/index_controller" , "Trackpad" , "/user/hand/right" , "/user/hand/right/input/trackpad" , "" , OpenXRAction::OPENXR_ACTION_VECTOR2); |
410 | register_io_path("/interaction_profiles/valve/index_controller" , "Trackpad force" , "/user/hand/right" , "/user/hand/right/input/trackpad/force" , "" , OpenXRAction::OPENXR_ACTION_FLOAT); |
411 | register_io_path("/interaction_profiles/valve/index_controller" , "Trackpad touch" , "/user/hand/right" , "/user/hand/right/input/trackpad/touch" , "" , OpenXRAction::OPENXR_ACTION_BOOL); |
412 | |
413 | register_io_path("/interaction_profiles/valve/index_controller" , "Haptic output" , "/user/hand/left" , "/user/hand/left/output/haptic" , "" , OpenXRAction::OPENXR_ACTION_HAPTIC); |
414 | register_io_path("/interaction_profiles/valve/index_controller" , "Haptic output" , "/user/hand/right" , "/user/hand/right/output/haptic" , "" , OpenXRAction::OPENXR_ACTION_HAPTIC); |
415 | } |
416 | |