The open source OpenXR runtime
0
fork

Configure Feed

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

u/builders: Add helper function to create space overseer

+55 -2
+44 -1
src/xrt/auxiliary/util/u_builders.c
··· 1 - // Copyright 2022, Collabora, Ltd. 1 + // Copyright 2022-2023, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 7 7 * @ingroup aux_util 8 8 */ 9 9 10 + #include "xrt/xrt_prober.h" 11 + #include "xrt/xrt_system.h" 10 12 #include "xrt/xrt_tracking.h" 11 13 14 + #include "util/u_debug.h" 12 15 #include "util/u_builders.h" 16 + #include "util/u_space_overseer.h" 17 + 18 + 19 + DEBUG_GET_ONCE_FLOAT_OPTION(tracking_origin_offset_x, "XRT_TRACKING_ORIGIN_OFFSET_X", 0.0f) 20 + DEBUG_GET_ONCE_FLOAT_OPTION(tracking_origin_offset_y, "XRT_TRACKING_ORIGIN_OFFSET_Y", 0.0f) 21 + DEBUG_GET_ONCE_FLOAT_OPTION(tracking_origin_offset_z, "XRT_TRACKING_ORIGIN_OFFSET_Z", 0.0f) 13 22 14 23 15 24 /* ··· 132 141 apply_offset(&right->tracking_origin->offset.position, global_tracking_origin_offset); 133 142 } 134 143 } 144 + 145 + void 146 + u_builder_create_space_overseer(struct xrt_system_devices *xsysd, struct xrt_space_overseer **out_xso) 147 + { 148 + /* 149 + * Tracking origins. 150 + */ 151 + 152 + struct xrt_vec3 global_tracking_origin_offset = { 153 + debug_get_float_option_tracking_origin_offset_x(), 154 + debug_get_float_option_tracking_origin_offset_y(), 155 + debug_get_float_option_tracking_origin_offset_z(), 156 + }; 157 + 158 + u_builder_setup_tracking_origins( // 159 + xsysd->roles.head, // 160 + xsysd->roles.left, // 161 + xsysd->roles.right, // 162 + &global_tracking_origin_offset); // 163 + 164 + 165 + /* 166 + * Space overseer. 167 + */ 168 + 169 + struct u_space_overseer *uso = u_space_overseer_create(); 170 + 171 + struct xrt_pose T_stage_local = XRT_POSE_IDENTITY; 172 + T_stage_local.position.y = 1.6; 173 + 174 + u_space_overseer_legacy_setup(uso, xsysd->xdevs, xsysd->xdev_count, xsysd->roles.head, &T_stage_local); 175 + 176 + *out_xso = (struct xrt_space_overseer *)uso; 177 + }
+11 -1
src/xrt/auxiliary/util/u_builders.h
··· 1 - // Copyright 2022, Collabora, Ltd. 1 + // Copyright 2022-2023, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file ··· 9 9 10 10 #pragma once 11 11 12 + #include "xrt/xrt_space.h" 12 13 #include "xrt/xrt_prober.h" 13 14 14 15 ··· 87 88 struct xrt_device *left, 88 89 struct xrt_device *right, 89 90 struct xrt_vec3 *global_tracking_origin_offset); 91 + 92 + /*! 93 + * Create a legacy space overseer, most builders probably want to have more 94 + * smart then this especially stand alone ones. 95 + * 96 + * @ingroup aux_util 97 + */ 98 + void 99 + u_builder_create_space_overseer(struct xrt_system_devices *xsysd, struct xrt_space_overseer **out_xso); 90 100 91 101 92 102 #ifdef __cplusplus