tangled
alpha
login
or
join now
matrixfurry.com
/
monado
0
fork
atom
The open source OpenXR runtime
0
fork
atom
overview
issues
pulls
pipelines
t/common: Refactor WinMR builder [NFC]
Jakob Bornecrantz
2 years ago
8b30819b
0a8fa312
+24
-20
1 changed file
expand all
collapse all
unified
split
src
xrt
targets
common
target_builder_wmr.c
+24
-20
src/xrt/targets/common/target_builder_wmr.c
···
271
271
assert(xret_unlock == XRT_SUCCESS);
272
272
(void)xret_unlock;
273
273
274
274
-
struct u_system_devices *usysd = u_system_devices_allocate();
274
274
+
struct xrt_system_devices *xsysd = NULL;
275
275
+
{
276
276
+
struct u_system_devices *usysd = u_system_devices_allocate();
277
277
+
xsysd = &usysd->base;
278
278
+
}
275
279
276
276
-
usysd->base.xdevs[usysd->base.xdev_count++] = head;
280
280
+
xsysd->xdevs[xsysd->xdev_count++] = head;
277
281
if (left != NULL) {
278
278
-
usysd->base.xdevs[usysd->base.xdev_count++] = left;
282
282
+
xsysd->xdevs[xsysd->xdev_count++] = left;
279
283
}
280
284
if (right != NULL) {
281
281
-
usysd->base.xdevs[usysd->base.xdev_count++] = right;
285
285
+
xsysd->xdevs[xsysd->xdev_count++] = right;
282
286
}
283
287
if (ht_left != NULL) {
284
284
-
usysd->base.xdevs[usysd->base.xdev_count++] = ht_left;
288
288
+
xsysd->xdevs[xsysd->xdev_count++] = ht_left;
285
289
}
286
290
if (ht_right != NULL) {
287
287
-
usysd->base.xdevs[usysd->base.xdev_count++] = ht_right;
291
291
+
xsysd->xdevs[xsysd->xdev_count++] = ht_right;
288
292
}
289
293
290
290
-
usysd->base.roles.head = head;
291
291
-
if (left != NULL) {
292
292
-
usysd->base.roles.left = left;
293
293
-
} else {
294
294
-
usysd->base.roles.left = ht_left;
294
294
+
// Use hand tracking if no controllers.
295
295
+
if (left == NULL) {
296
296
+
left = ht_left;
295
297
}
296
296
-
if (right != NULL) {
297
297
-
usysd->base.roles.right = right;
298
298
-
} else {
299
299
-
usysd->base.roles.right = ht_right;
298
298
+
if (right == NULL) {
299
299
+
right = ht_right;
300
300
}
301
301
302
302
-
// Find hand tracking devices.
303
303
-
usysd->base.roles.hand_tracking.left = u_system_devices_get_ht_device_left(&usysd->base);
304
304
-
usysd->base.roles.hand_tracking.right = u_system_devices_get_ht_device_right(&usysd->base);
302
302
+
303
303
+
// Assign to role(s).
304
304
+
xsysd->roles.head = head;
305
305
+
xsysd->roles.left = left;
306
306
+
xsysd->roles.right = right;
307
307
+
xsysd->roles.hand_tracking.left = ht_left;
308
308
+
xsysd->roles.hand_tracking.right = ht_right;
305
309
306
310
// Create space overseer last once all devices set.
307
311
struct xrt_space_overseer *xso = NULL;
308
308
-
u_builder_create_space_overseer(&usysd->base, &xso);
312
312
+
u_builder_create_space_overseer(xsysd, &xso);
309
313
assert(xso != NULL);
310
314
311
315
···
313
317
* Output.
314
318
*/
315
319
316
316
-
*out_xsysd = &usysd->base;
320
320
+
*out_xsysd = xsysd;
317
321
*out_xso = xso;
318
322
319
323
return XRT_SUCCESS;