The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

d/ht, h/mercury: Use u_file_get_hand_tracking_models_dir

Needed for Windows SteamVR driver

+11 -43
+6 -1
src/xrt/drivers/ht/ht_driver.c
··· 24 24 #include "util/u_config_json.h" 25 25 #include "util/u_debug.h" 26 26 #include "util/u_sink.h" 27 + #include "util/u_file.h" 27 28 28 29 #include "tracking/t_hand_tracking.h" 29 30 ··· 249 250 250 251 struct t_hand_tracking_sync *sync = NULL; 251 252 252 - sync = t_hand_tracking_sync_mercury_create(calib, extra_camera_info); 253 + char path[1024] = {0}; 254 + 255 + u_file_get_hand_tracking_models_dir(path, ARRAY_SIZE(path)); 256 + 257 + sync = t_hand_tracking_sync_mercury_create(calib, extra_camera_info, path); 253 258 254 259 struct ht_device *htd = ht_device_create_common(calib, false, xfctx, sync); 255 260
+2 -1
src/xrt/tracking/hand/mercury/hg_interface.h
··· 23 23 */ 24 24 struct t_hand_tracking_sync * 25 25 t_hand_tracking_sync_mercury_create(struct t_stereo_camera_calibration *calib, 26 - struct t_camera_extra_info extra_camera_info); 26 + struct t_camera_extra_info extra_camera_info, 27 + const char *models_folder); 27 28 28 29 #ifdef __cplusplus 29 30 } // extern "C"
+3 -41
src/xrt/tracking/hand/mercury/hg_sync.cpp
··· 108 108 return true; 109 109 } 110 110 111 - static void 112 - getModelsFolder(struct HandTracking *hgt) 113 - { 114 - // Please bikeshed me on this! I don't know where is the best place to put this stuff! 115 - #if 0 116 - char exec_location[1024] = {}; 117 - readlink("/proc/self/exe", exec_location, 1024); 118 - 119 - HG_DEBUG(hgt, "Exec at %s\n", exec_location); 120 - 121 - int end = 0; 122 - while (exec_location[end] != '\0') { 123 - HG_DEBUG(hgt, "%d", end); 124 - end++; 125 - } 126 - 127 - while (exec_location[end] != '/' && end != 0) { 128 - HG_DEBUG(hgt, "%d %c", end, exec_location[end]); 129 - exec_location[end] = '\0'; 130 - end--; 131 - } 132 - 133 - strcat(exec_location, "../share/monado/hand-tracking-models/"); 134 - strcpy(hgt->startup_config.model_slug, exec_location); 135 - #else 136 - const char *xdg_data_home = getenv("XDG_DATA_HOME"); 137 - const char *home = getenv("HOME"); 138 - if (xdg_data_home != NULL) { 139 - strcpy(hgt->models_folder, xdg_data_home); 140 - strcat(hgt->models_folder, "/monado/hand-tracking-models/"); 141 - } else if (home != NULL) { 142 - strcpy(hgt->models_folder, home); 143 - strcat(hgt->models_folder, "/.local/share/monado/hand-tracking-models/"); 144 - } else { 145 - assert(false); 146 - } 147 - #endif 148 - } 149 - 150 111 static inline bool 151 112 check_outside_view(struct HandTracking *hgt, struct t_camera_extra_info_one_view boundary, xrt_vec2 &keypoint) 152 113 { ··· 1092 1053 1093 1054 extern "C" t_hand_tracking_sync * 1094 1055 t_hand_tracking_sync_mercury_create(struct t_stereo_camera_calibration *calib, 1095 - struct t_camera_extra_info extra_camera_info) 1056 + struct t_camera_extra_info extra_camera_info, 1057 + const char *models_folder) 1096 1058 { 1097 1059 XRT_TRACE_MARKER(); 1098 1060 ··· 1110 1072 // We have to reference it, getCalibration points at it. 1111 1073 t_stereo_camera_calibration_reference(&hgt->calib, calib); 1112 1074 getCalibration(hgt, *calib); 1113 - getModelsFolder(hgt); 1075 + strncpy(hgt->models_folder, models_folder, ARRAY_SIZE(hgt->models_folder)); 1114 1076 1115 1077 1116 1078 hgt->views[0].hgt = hgt;