Monado OpenXR Runtime
Loading...
Searching...
No Matches
xrt_space.h
Go to the documentation of this file.
1// Copyright 2019-2023, Collabora, Ltd.
2// Copyright 2025-2026, NVIDIA CORPORATION.
3// SPDX-License-Identifier: BSL-1.0
4/*!
5 * @file
6 * @brief Header defining xrt space and space overseer.
7 * @author Jakob Bornecrantz <jakob@collabora.com>
8 * @ingroup xrt_iface
9 */
10
11#pragma once
12
13#include "xrt/xrt_defines.h"
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19#define XRT_MAX_CLIENT_SPACES 128
20struct xrt_device;
22
23/*!
24 * A space very similar to a OpenXR XrSpace but not a full one-to-one mapping,
25 * but used to power XrSpace.
26 *
27 * @see @ref xrt_space_overseer
28 * @see @ref design-spaces
29 * @ingroup xrt_iface
30 */
32{
33 /*!
34 * Reference helper.
35 */
37
38 /*!
39 * Destroy function.
40 */
41 void (*destroy)(struct xrt_space *xs);
42};
43
44/*!
45 * Update the reference counts on space(s).
46 *
47 * @param[in,out] dst Pointer to a object reference: if the object reference is
48 * non-null will decrement its counter. The reference that
49 * @p dst points to will be set to @p src.
50 * @param[in] src New object for @p dst to refer to (may be null).
51 * If non-null, will have its refcount increased.
52 * @ingroup xrt_iface
53 * @relates xrt_space
54 */
55static inline void
56xrt_space_reference(struct xrt_space **dst, struct xrt_space *src)
57{
58 struct xrt_space *old_dst = *dst;
59
60 if (old_dst == src) {
61 return;
62 }
63
64 if (src) {
65 xrt_reference_inc(&src->reference);
66 }
67
68 *dst = src;
69
70 if (old_dst) {
71 if (xrt_reference_dec_and_is_zero(&old_dst->reference)) {
72 old_dst->destroy(old_dst);
73 }
74 }
75}
76
77/*!
78 * Object that oversees and manages spaces, one created for each XR system.
79 *
80 * The space overseer is used by the state tracker to query the poses of spaces
81 * and devices in that space system. While the default implementation
82 * @ref b_space_overseer implements the spaces as a graph of relatable spaces,
83 * that is a implementation detail (the interface also lends itself to that
84 * since bases have parents). As such the graph is not exposed in this interface
85 * and spaces are technically free floating.
86 *
87 * One advantage of the free floating nature is that an overseer implementation
88 * has much greater flexibility in configuring the graph to fit the current XR
89 * system the best, it also have freedom to reconfigure the graph at runtime
90 * should that be needed. Since any potential graph isn't exposed there is no
91 * need to synchronise it across the app process and the service process.
92 *
93 * @see @ref design-spaces
94 * @ingroup xrt_iface
95 */
97{
98 struct
99 {
100 struct xrt_space *root; //!< Root space, always available
101 struct xrt_space *view; //!< View space, may be null (in very rare cases).
102 struct xrt_space *local; //!< Local space, may be null (in very rare cases).
103 struct xrt_space *local_floor; //!< Local floor space, may be null.
104 struct xrt_space *stage; //!< Stage space, may be null.
105 struct xrt_space *unbounded; //!< Unbounded space, only here for slam trackers.
106
107 /*!
108 * Semantic spaces to be mapped to OpenXR spaces.
109 */
110 } semantic;
111
112 //! Ptrs to the localspace
113 struct xrt_space *localspace[XRT_MAX_CLIENT_SPACES];
114 //! Ptrs to the localfloorspace
115 struct xrt_space *localfloorspace[XRT_MAX_CLIENT_SPACES];
116
117 /*!
118 * Create a space with a fixed offset to the parent space.
119 *
120 * @param[in] xso Owning space overseer.
121 * @param[in] parent The parent space for the new space.
122 * @param[in] offset Offset to the space.
123 * @param[out] out_space The newly created space.
124 */
126 struct xrt_space *parent,
127 const struct xrt_pose *offset,
128 struct xrt_space **out_space);
129
130 /*!
131 * Create a space that wraps the @p xdev input pose described by input
132 * @p name, implicitly make the device's tracking space the parent of
133 * the created space. The name pose_space was chosen because while most
134 * input poses are part of the device, they may also be things tracked
135 * by the device. The important part is that the space is following the
136 * pose, that it happens to be attached to device is coincidental.
137 *
138 * @param[in] xso Owning space overseer.
139 * @param[in] xdev Device to get the pose from.
140 * @param[in] name Name of the pose input.
141 * @param[out] out_space The newly created space.
142 */
144 struct xrt_device *xdev,
145 enum xrt_input_name name,
146 struct xrt_space **out_space);
147
148 /*!
149 * Locate a space in the base space.
150 *
151 * @see xrt_device::get_tracked_pose.
152 *
153 * @param[in] xso Owning space overseer.
154 * @param[in] base_space The space that we want the pose in.
155 * @param[in] base_offset Offset if any to the base space.
156 * @param[in] at_timestamp_ns At which time.
157 * @param[in] space The space to be located.
158 * @param[in] offset Offset if any to the located space.
159 * @param[out] out_relation Resulting pose.
160 */
162 struct xrt_space *base_space,
163 const struct xrt_pose *base_offset,
164 int64_t at_timestamp_ns,
165 struct xrt_space *space,
166 const struct xrt_pose *offset,
167 struct xrt_space_relation *out_relation);
168
169 /*!
170 * Locate spaces in the base space.
171 *
172 * @see xrt_device::get_tracked_pose.
173 *
174 * @param[in] xso Owning space overseer.
175 * @param[in] base_space The space that we want the pose in.
176 * @param[in] base_offset Offset if any to the base space.
177 * @param[in] at_timestamp_ns At which time.
178 * @param[in] spaces The array of pointers to spaces to be located.
179 * @param[in] space_count The number of spaces to locate.
180 * @param[in] offsets Array of offset if any to the located spaces.
181 * @param[out] out_relations Array of resulting poses.
182 */
184 struct xrt_space *base_space,
185 const struct xrt_pose *base_offset,
186 int64_t at_timestamp_ns,
187 struct xrt_space **spaces,
188 uint32_t space_count,
189 const struct xrt_pose *offsets,
190 struct xrt_space_relation *out_relations);
191
192 /*!
193 * Locate a the origin of the tracking space of a device, this is not
194 * the same as the device position. In other words, what is the position
195 * of the space that the device is in, and which it returns its poses
196 * in. Needed to use @ref xrt_device::get_view_poses and
197 * @ref xrt_device::get_hand_tracking.
198 *
199 * @see xrt_device::get_tracked_pose.
200 *
201 * @param[in] xso Owning space overseer.
202 * @param[in] base_space The space that we want the pose in.
203 * @param[in] base_offset Offset if any to the base space.
204 * @param[in] at_timestamp_ns At which time.
205 * @param[in] xdev Device to get the pose from.
206 * @param[out] out_relation Resulting pose.
207 */
209 struct xrt_space *base_space,
210 const struct xrt_pose *base_offset,
211 int64_t at_timestamp_ns,
212 struct xrt_device *xdev,
213 struct xrt_space_relation *out_relation);
214
215 /*!
216 * Increment the usage count of a reference space (aka semantic space).
217 * This lets the overseer know when different spaces are being used,
218 * allowing it to triggering a recenter if the local space is used for
219 * the first time, or stopping calculating where the stage space is if
220 * it is not used by the current application.
221 *
222 * @param[in] xso Owning space overseer.
223 * @param[in] type Which reference space is being referenced.
224 */
226
227 /*!
228 * Decrement the usage count of a reference space (aka semantic space).
229 * See @ref xrt_space_overseer::ref_space_inc.
230 *
231 * @param[in] xso Owning space overseer.
232 * @param[in] type Which reference space is being referenced.
233 */
235
236 /*!
237 * Trigger a re-center of the local and local_floor spaces, not all
238 * implementations of @ref xrt_space_overseer may support recenter. The
239 * recenter operation will normally mean that the local and local_floor
240 * will move to the where the view space currently is.
241 *
242 * @param[in] xso The space overseer.
243 */
245
246 /*!
247 * Read the offset from a tracking origin, not all
248 * implementations of @ref xrt_space_overseer may support this.
249 * Outputs are only valid if XRT_SUCCESS is returned.
250 *
251 * @param[in] xso The space overseer.
252 * @param[in] xto The tracking origin.
253 * @param[out] out_offset Pointer to an xrt_pose to write the offset to
254 */
256 struct xrt_tracking_origin *xto,
257 struct xrt_pose *out_offset);
258
259 /*!
260 * Apply an offset to a tracking origin, not all
261 * implementations of @ref xrt_space_overseer may support this.
262 *
263 * @param[in] xso The space overseer.
264 * @param[in] xto The tracking origin.
265 * @param[in] offset The offset to apply.
266 */
268 struct xrt_tracking_origin *xto,
269 const struct xrt_pose *offset);
270
271 /*!
272 * Read the offset from the given reference space, not all
273 * implementations of @ref xrt_space_overseer may support this.
274 * Outputs are only valid if XRT_SUCCESS is returned.
275 *
276 * @param[in] xso The space overseer.
277 * @param[in] type The reference space.
278 * @param[out] out_offset Pointer to write the offset to.
279 */
281 enum xrt_reference_space_type type,
282 struct xrt_pose *out_offset);
283
284 /*!
285 * Apply an offset to the given reference space, not all
286 * implementations of @ref xrt_space_overseer may support this.
287 *
288 * @param[in] xso The space overseer.
289 * @param[in] type The reference space.
290 * @param[in] offset The offset to apply.
291 */
293 enum xrt_reference_space_type type,
294 const struct xrt_pose *offset);
295
296 /*!
297 * Create a localspace and a localfloorspace.
298 *
299 * @param[in] xso Owning space overseer.
300 * @param[out] out_local_space The newly created localspace.
301 * @param[out] out_local_floor_space The newly created localfloorspace.
302 */
304 struct xrt_space **out_local_space,
305 struct xrt_space **out_local_floor_space);
306
307 /*
308 *
309 * Special inter-monado component functions.
310 *
311 */
312
313 /*!
314 * Add a new device to be tracked by the space overseer. The exact
315 * semantic of the space is determined by the implementation of the
316 * space overseer. And may be outright rejected by the implementation.
317 *
318 * After this call completes successfully, the device can be passed
319 * into the @ref xrt_space_overseer::locate_device function, but may
320 * not be locatable immediately.
321 *
322 * This function is not intended to be called by the OpenXR state
323 * tracker, but by other monado components that need to add devices
324 * but does not own the space overseer. Components like the fixer
325 * uppers or for push devices.
326 *
327 * @param[in] xso The space overseer.
328 * @param[in] xdev The device to be tracked.
329 * @return XRT_SUCCESS if added, otherwise an error code.
330 */
332
333 /*!
334 * Remove a device that was previously added with
335 * @ref xrt_space_overseer::add_device. After this call the device can no
336 * longer be located through this space overseer and any pose spaces that
337 * were created for it become invalid.
338 *
339 * Removing a device that was never added (or has already been removed)
340 * is a safe no-op.
341 *
342 * Like @ref xrt_space_overseer::add_device this is not intended to be
343 * called by the OpenXR state tracker, but by other monado components
344 * that add devices but do not own the space overseer, for instance to
345 * support hotplugging.
346 *
347 * @param[in] xso The space overseer.
348 * @param[in] xdev The device to stop tracking.
349 * @return XRT_SUCCESS if removed or not present, otherwise an error code.
350 */
352
353 /*!
354 * Attach a device to a different space then it was associated with
355 * originally, the space overseer might not support this operation.
356 *
357 * For some space overseer implementations this operation requires
358 * that the device has the tracking origin type of
359 * @ref XRT_TRACKING_TYPE_ATTACHABLE. Which space that becomes the
360 * parent space of the device when @p space is NULL is undefined,
361 * and the device might become un-trackable.
362 *
363 * @param[in] xso Owning space overseer.
364 * @param[in] xdev Device to attach.
365 * @param[in] space Space to attach the device to, may be NULL.
366 *
367 * @return XRT_SUCCESS on success.
368 * @return XRT_ERROR_DEVICE_NOT_ATTACHABLE if the device does not have
369 * the XRT_TRACKING_TYPE_ATTACHABLE tracking origin type.
370 */
371 xrt_result_t (*attach_device)(struct xrt_space_overseer *xso, struct xrt_device *xdev, struct xrt_space *space);
372
373
374 /*
375 *
376 * Destroy function always comes last.
377 *
378 */
379
380 /*!
381 * Destroy function.
382 *
383 * @param xso The space overseer.
384 */
385 void (*destroy)(struct xrt_space_overseer *xs);
386};
387
388/*!
389 * @copydoc xrt_space_overseer::create_offset_space
390 *
391 * Helper for calling through the function pointer.
392 *
393 * @public @memberof xrt_space_overseer
394 */
395XRT_NONNULL_ALL static inline xrt_result_t
397 struct xrt_space *parent,
398 const struct xrt_pose *offset,
399 struct xrt_space **out_space)
400{
401 return xso->create_offset_space(xso, parent, offset, out_space);
402}
403
404/*!
405 * @copydoc xrt_space_overseer::create_pose_space
406 *
407 * Helper for calling through the function pointer.
408 *
409 * @public @memberof xrt_space_overseer
410 */
411XRT_NONNULL_ALL static inline xrt_result_t
413 struct xrt_device *xdev,
414 enum xrt_input_name name,
415 struct xrt_space **out_space)
416{
417 return xso->create_pose_space(xso, xdev, name, out_space);
418}
419
420/*!
421 * @copydoc xrt_space_overseer::locate_space
422 *
423 * Helper for calling through the function pointer.
424 *
425 * @public @memberof xrt_space_overseer
426 */
427XRT_NONNULL_ALL static inline xrt_result_t
429 struct xrt_space *base_space,
430 const struct xrt_pose *base_offset,
431 int64_t at_timestamp_ns,
432 struct xrt_space *space,
433 const struct xrt_pose *offset,
434 struct xrt_space_relation *out_relation)
435{
436 return xso->locate_space(xso, base_space, base_offset, at_timestamp_ns, space, offset, out_relation);
437}
438
439/*!
440 * @copydoc xrt_space_overseer::locate_spaces
441 *
442 * Helper for calling through the function pointer.
443 *
444 * @public @memberof xrt_space_overseer
445 */
446XRT_NONNULL_ALL static inline xrt_result_t
448 struct xrt_space *base_space,
449 const struct xrt_pose *base_offset,
450 int64_t at_timestamp_ns,
451 struct xrt_space **spaces,
452 uint32_t space_count,
453 const struct xrt_pose *offsets,
454 struct xrt_space_relation *out_relations)
455{
456 return xso->locate_spaces(xso, base_space, base_offset, at_timestamp_ns, spaces, space_count, offsets,
457 out_relations);
458}
459
460/*!
461 * @copydoc xrt_space_overseer::locate_device
462 *
463 * Helper for calling through the function pointer.
464 *
465 * @public @memberof xrt_space_overseer
466 */
467XRT_NONNULL_ALL static inline xrt_result_t
469 struct xrt_space *base_space,
470 const struct xrt_pose *base_offset,
471 int64_t at_timestamp_ns,
472 struct xrt_device *xdev,
473 struct xrt_space_relation *out_relation)
474{
475 return xso->locate_device(xso, base_space, base_offset, at_timestamp_ns, xdev, out_relation);
476}
477
478/*!
479 * @copydoc xrt_space_overseer::ref_space_inc
480 *
481 * Helper for calling through the function pointer.
482 *
483 * @public @memberof xrt_space_overseer
484 */
485XRT_NONNULL_ALL static inline xrt_result_t
487{
488 return xso->ref_space_inc(xso, type);
489}
490
491/*!
492 * @copydoc xrt_space_overseer::ref_space_dec
493 *
494 * Helper for calling through the function pointer.
495 *
496 * @public @memberof xrt_space_overseer
497 */
498XRT_NONNULL_ALL static inline xrt_result_t
500{
501 return xso->ref_space_dec(xso, type);
502}
503
504/*!
505 * @copydoc xrt_space_overseer::recenter_local_spaces
506 *
507 * Helper for calling through the function pointer.
508 *
509 * @public @memberof xrt_space_overseer
510 */
511XRT_NONNULL_ALL static inline xrt_result_t
516
517/*!
518 * @copydoc xrt_space_overseer::get_tracking_origin_offset
519 *
520 * Helper for calling through the function pointer.
521 *
522 * @public @memberof xrt_space_overseer
523 */
524XRT_NONNULL_ALL static inline xrt_result_t
526 struct xrt_tracking_origin *xto,
527 struct xrt_pose *out_offset)
528{
529 return xso->get_tracking_origin_offset(xso, xto, out_offset);
530}
531
532/*!
533 * @copydoc xrt_space_overseer::set_tracking_origin_offset
534 *
535 * Helper for calling through the function pointer.
536 *
537 * @public @memberof xrt_space_overseer
538 */
539XRT_NONNULL_ALL static inline xrt_result_t
541 struct xrt_tracking_origin *xto,
542 const struct xrt_pose *offset)
543{
544 return xso->set_tracking_origin_offset(xso, xto, offset);
545}
546
547/*!
548 * @copydoc xrt_space_overseer::get_reference_space_offset
549 *
550 * Helper for calling through the function pointer.
551 *
552 * @public @memberof xrt_space_overseer
553 */
554XRT_NONNULL_ALL static inline xrt_result_t
556 enum xrt_reference_space_type type,
557 struct xrt_pose *out_offset)
558{
559 return xso->get_reference_space_offset(xso, type, out_offset);
560}
561
562/*!
563 * @copydoc xrt_space_overseer::set_reference_space_offset
564 *
565 * Helper for calling through the function pointer.
566 *
567 * @public @memberof xrt_space_overseer
568 */
569XRT_NONNULL_ALL static inline xrt_result_t
571 enum xrt_reference_space_type type,
572 const struct xrt_pose *offset)
573{
574 return xso->set_reference_space_offset(xso, type, offset);
575}
576
577/*!
578 * @copydoc xrt_space_overseer::create_local_space
579 *
580 * Helper for calling through the function pointer.
581 *
582 * @public @memberof xrt_space_overseer
583 */
584XRT_NONNULL_ALL static inline xrt_result_t
586 struct xrt_space **out_local_space,
587 struct xrt_space **out_local_floor_space)
588{
589 return xso->create_local_space(xso, out_local_space, out_local_floor_space);
590}
591
592/*!
593 * @copydoc xrt_space_overseer::add_device
594 *
595 * Helper for calling through the function pointer.
596 *
597 * @public @memberof xrt_space_overseer
598 */
599XRT_NONNULL_ALL static inline xrt_result_t
601{
602 return xso->add_device(xso, xdev);
603}
604
605/*!
606 * @copydoc xrt_space_overseer::remove_device
607 *
608 * Helper for calling through the function pointer.
609 *
610 * @public @memberof xrt_space_overseer
611 */
612XRT_NONNULL_ALL static inline xrt_result_t
614{
615 return xso->remove_device(xso, xdev);
616}
617
618/*!
619 * @copydoc xrt_space_overseer::attach_device
620 *
621 * Helper for calling through the function pointer.
622 *
623 * @public @memberof xrt_space_overseer
624 */
625XRT_NONNULL_ALL static inline xrt_result_t
627{
628 return xso->attach_device(xso, xdev, space);
629}
630
631/*!
632 * Helper for calling through the function pointer: does a null check and sets
633 * xc_ptr to null if freed.
634 *
635 * @see xrt_space_overseer::destroy
636 * @public @memberof xrt_space_overseer
637 */
638static inline void
640{
641 struct xrt_space_overseer *xso = *xso_ptr;
642 if (xso == NULL) {
643 return;
644 }
645
646 xso->destroy(xso);
647 *xso_ptr = NULL;
648}
649
650
651#ifdef __cplusplus
652}
653#endif
xrt_input_name
Every internal input source known to monado with a baked in type.
Definition xrt_defines.h:930
enum xrt_result xrt_result_t
Result type used across Monado.
xrt_reference_space_type
Type of a OpenXR mapped reference space, maps to the semantic spaces on the xrt_space_overseer struct...
Definition xrt_defines.h:625
static void xrt_space_reference(struct xrt_space **dst, struct xrt_space *src)
Update the reference counts on space(s).
Definition xrt_space.h:56
A single HMD or input device.
Definition xrt_device.h:340
A pose composed of a position and orientation.
Definition xrt_defines.h:492
A base class for reference counted objects.
Definition xrt_defines.h:99
Object that oversees and manages spaces, one created for each XR system.
Definition xrt_space.h:97
xrt_result_t(* get_reference_space_offset)(struct xrt_space_overseer *xso, enum xrt_reference_space_type type, struct xrt_pose *out_offset)
Read the offset from the given reference space, not all implementations of xrt_space_overseer may sup...
Definition xrt_space.h:280
struct xrt_space * unbounded
Unbounded space, only here for slam trackers.
Definition xrt_space.h:105
struct xrt_space * localspace[128]
Ptrs to the localspace.
Definition xrt_space.h:113
static XRT_NONNULL_ALL xrt_result_t xrt_space_overseer_locate_spaces(struct xrt_space_overseer *xso, struct xrt_space *base_space, const struct xrt_pose *base_offset, int64_t at_timestamp_ns, struct xrt_space **spaces, uint32_t space_count, const struct xrt_pose *offsets, struct xrt_space_relation *out_relations)
Locate spaces in the base space.
Definition xrt_space.h:447
static XRT_NONNULL_ALL xrt_result_t xrt_space_overseer_create_offset_space(struct xrt_space_overseer *xso, struct xrt_space *parent, const struct xrt_pose *offset, struct xrt_space **out_space)
Create a space with a fixed offset to the parent space.
Definition xrt_space.h:396
xrt_result_t(* get_tracking_origin_offset)(struct xrt_space_overseer *xso, struct xrt_tracking_origin *xto, struct xrt_pose *out_offset)
Read the offset from a tracking origin, not all implementations of xrt_space_overseer may support thi...
Definition xrt_space.h:255
xrt_result_t(* remove_device)(struct xrt_space_overseer *xso, struct xrt_device *xdev)
Remove a device that was previously added with xrt_space_overseer::add_device.
Definition xrt_space.h:351
void(* destroy)(struct xrt_space_overseer *xs)
Destroy function.
Definition xrt_space.h:385
static XRT_NONNULL_ALL xrt_result_t xrt_space_overseer_recenter_local_spaces(struct xrt_space_overseer *xso)
Trigger a re-center of the local and local_floor spaces, not all implementations of xrt_space_oversee...
Definition xrt_space.h:512
xrt_result_t(* ref_space_dec)(struct xrt_space_overseer *xso, enum xrt_reference_space_type type)
Decrement the usage count of a reference space (aka semantic space).
Definition xrt_space.h:234
static XRT_NONNULL_ALL xrt_result_t xrt_space_overseer_create_local_space(struct xrt_space_overseer *xso, struct xrt_space **out_local_space, struct xrt_space **out_local_floor_space)
Create a localspace and a localfloorspace.
Definition xrt_space.h:585
static XRT_NONNULL_ALL xrt_result_t xrt_space_overseer_get_tracking_origin_offset(struct xrt_space_overseer *xso, struct xrt_tracking_origin *xto, struct xrt_pose *out_offset)
Read the offset from a tracking origin, not all implementations of xrt_space_overseer may support thi...
Definition xrt_space.h:525
struct xrt_space * local
Local space, may be null (in very rare cases).
Definition xrt_space.h:102
struct xrt_space * local_floor
Local floor space, may be null.
Definition xrt_space.h:103
static XRT_NONNULL_ALL xrt_result_t xrt_space_overseer_set_reference_space_offset(struct xrt_space_overseer *xso, enum xrt_reference_space_type type, const struct xrt_pose *offset)
Apply an offset to the given reference space, not all implementations of xrt_space_overseer may suppo...
Definition xrt_space.h:570
static XRT_NONNULL_ALL xrt_result_t xrt_space_overseer_ref_space_inc(struct xrt_space_overseer *xso, enum xrt_reference_space_type type)
Increment the usage count of a reference space (aka semantic space).
Definition xrt_space.h:486
static XRT_NONNULL_ALL xrt_result_t xrt_space_overseer_ref_space_dec(struct xrt_space_overseer *xso, enum xrt_reference_space_type type)
Decrement the usage count of a reference space (aka semantic space).
Definition xrt_space.h:499
xrt_result_t(* create_offset_space)(struct xrt_space_overseer *xso, struct xrt_space *parent, const struct xrt_pose *offset, struct xrt_space **out_space)
Create a space with a fixed offset to the parent space.
Definition xrt_space.h:125
struct xrt_space * view
View space, may be null (in very rare cases).
Definition xrt_space.h:101
static XRT_NONNULL_ALL xrt_result_t xrt_space_overseer_add_device(struct xrt_space_overseer *xso, struct xrt_device *xdev)
Add a new device to be tracked by the space overseer.
Definition xrt_space.h:600
xrt_result_t(* locate_spaces)(struct xrt_space_overseer *xso, struct xrt_space *base_space, const struct xrt_pose *base_offset, int64_t at_timestamp_ns, struct xrt_space **spaces, uint32_t space_count, const struct xrt_pose *offsets, struct xrt_space_relation *out_relations)
Locate spaces in the base space.
Definition xrt_space.h:183
static XRT_NONNULL_ALL xrt_result_t xrt_space_overseer_attach_device(struct xrt_space_overseer *xso, struct xrt_device *xdev, struct xrt_space *space)
Attach a device to a different space then it was associated with originally, the space overseer might...
Definition xrt_space.h:626
xrt_result_t(* set_tracking_origin_offset)(struct xrt_space_overseer *xso, struct xrt_tracking_origin *xto, const struct xrt_pose *offset)
Apply an offset to a tracking origin, not all implementations of xrt_space_overseer may support this.
Definition xrt_space.h:267
static XRT_NONNULL_ALL xrt_result_t xrt_space_overseer_create_pose_space(struct xrt_space_overseer *xso, struct xrt_device *xdev, enum xrt_input_name name, struct xrt_space **out_space)
Create a space that wraps the xdev input pose described by input name, implicitly make the device's t...
Definition xrt_space.h:412
struct xrt_space * stage
Stage space, may be null.
Definition xrt_space.h:104
static void xrt_space_overseer_destroy(struct xrt_space_overseer **xso_ptr)
Helper for calling through the function pointer: does a null check and sets xc_ptr to null if freed.
Definition xrt_space.h:639
xrt_result_t(* locate_space)(struct xrt_space_overseer *xso, struct xrt_space *base_space, const struct xrt_pose *base_offset, int64_t at_timestamp_ns, struct xrt_space *space, const struct xrt_pose *offset, struct xrt_space_relation *out_relation)
Locate a space in the base space.
Definition xrt_space.h:161
xrt_result_t(* set_reference_space_offset)(struct xrt_space_overseer *xso, enum xrt_reference_space_type type, const struct xrt_pose *offset)
Apply an offset to the given reference space, not all implementations of xrt_space_overseer may suppo...
Definition xrt_space.h:292
xrt_result_t(* add_device)(struct xrt_space_overseer *xso, struct xrt_device *xdev)
Add a new device to be tracked by the space overseer.
Definition xrt_space.h:331
static XRT_NONNULL_ALL xrt_result_t xrt_space_overseer_locate_device(struct xrt_space_overseer *xso, struct xrt_space *base_space, const struct xrt_pose *base_offset, int64_t at_timestamp_ns, struct xrt_device *xdev, struct xrt_space_relation *out_relation)
Locate a the origin of the tracking space of a device, this is not the same as the device position.
Definition xrt_space.h:468
xrt_result_t(* create_local_space)(struct xrt_space_overseer *xso, struct xrt_space **out_local_space, struct xrt_space **out_local_floor_space)
Create a localspace and a localfloorspace.
Definition xrt_space.h:303
struct xrt_space * root
Root space, always available.
Definition xrt_space.h:100
xrt_result_t(* locate_device)(struct xrt_space_overseer *xso, struct xrt_space *base_space, const struct xrt_pose *base_offset, int64_t at_timestamp_ns, struct xrt_device *xdev, struct xrt_space_relation *out_relation)
Locate a the origin of the tracking space of a device, this is not the same as the device position.
Definition xrt_space.h:208
static XRT_NONNULL_ALL xrt_result_t xrt_space_overseer_get_reference_space_offset(struct xrt_space_overseer *xso, enum xrt_reference_space_type type, struct xrt_pose *out_offset)
Read the offset from the given reference space, not all implementations of xrt_space_overseer may sup...
Definition xrt_space.h:555
xrt_result_t(* create_pose_space)(struct xrt_space_overseer *xso, struct xrt_device *xdev, enum xrt_input_name name, struct xrt_space **out_space)
Create a space that wraps the xdev input pose described by input name, implicitly make the device's t...
Definition xrt_space.h:143
xrt_result_t(* attach_device)(struct xrt_space_overseer *xso, struct xrt_device *xdev, struct xrt_space *space)
Attach a device to a different space then it was associated with originally, the space overseer might...
Definition xrt_space.h:371
static XRT_NONNULL_ALL xrt_result_t xrt_space_overseer_remove_device(struct xrt_space_overseer *xso, struct xrt_device *xdev)
Remove a device that was previously added with xrt_space_overseer::add_device.
Definition xrt_space.h:613
xrt_result_t(* recenter_local_spaces)(struct xrt_space_overseer *xso)
Trigger a re-center of the local and local_floor spaces, not all implementations of xrt_space_oversee...
Definition xrt_space.h:244
static XRT_NONNULL_ALL xrt_result_t xrt_space_overseer_set_tracking_origin_offset(struct xrt_space_overseer *xso, struct xrt_tracking_origin *xto, const struct xrt_pose *offset)
Apply an offset to a tracking origin, not all implementations of xrt_space_overseer may support this.
Definition xrt_space.h:540
struct xrt_space * localfloorspace[128]
Ptrs to the localfloorspace.
Definition xrt_space.h:115
static XRT_NONNULL_ALL xrt_result_t xrt_space_overseer_locate_space(struct xrt_space_overseer *xso, struct xrt_space *base_space, const struct xrt_pose *base_offset, int64_t at_timestamp_ns, struct xrt_space *space, const struct xrt_pose *offset, struct xrt_space_relation *out_relation)
Locate a space in the base space.
Definition xrt_space.h:428
xrt_result_t(* ref_space_inc)(struct xrt_space_overseer *xso, enum xrt_reference_space_type type)
Increment the usage count of a reference space (aka semantic space).
Definition xrt_space.h:225
A relation with two spaces, includes velocity and acceleration.
Definition xrt_defines.h:683
A space very similar to a OpenXR XrSpace but not a full one-to-one mapping, but used to power XrSpace...
Definition xrt_space.h:32
struct xrt_reference reference
Reference helper.
Definition xrt_space.h:36
void(* destroy)(struct xrt_space *xs)
Destroy function.
Definition xrt_space.h:41
A tracking system or device origin.
Definition xrt_tracking.h:78
Common defines and enums for XRT.