Monado OpenXR Runtime
xrt_space.h
Go to the documentation of this file.
1// Copyright 2019-2023, Collabora, Ltd.
2// Copyright 2025, 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) {
66 }
67
68 *dst = src;
69
70 if (old_dst) {
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 u_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 * Attach a device to a different space then it was associated with
335 * originally, the space overseer might not support this operation.
336 *
337 * For some space overseer implementations this operation requires
338 * that the device has the tracking origin type of
339 * @ref XRT_TRACKING_TYPE_ATTACHABLE. Which space that becomes the
340 * parent space of the device when @p space is NULL is undefined,
341 * and the device might become un-trackable.
342 *
343 * @param[in] xso Owning space overseer.
344 * @param[in] xdev Device to attach.
345 * @param[in] space Space to attach the device to, may be NULL.
346 *
347 * @return XRT_SUCCESS on success.
348 * @return XRT_ERROR_DEVICE_NOT_ATTACHABLE if the device does not have
349 * the XRT_TRACKING_TYPE_ATTACHABLE tracking origin type.
350 */
351 xrt_result_t (*attach_device)(struct xrt_space_overseer *xso, struct xrt_device *xdev, struct xrt_space *space);
352
353
354 /*
355 *
356 * Destroy function always comes last.
357 *
358 */
359
360 /*!
361 * Destroy function.
362 *
363 * @param xso The space overseer.
364 */
365 void (*destroy)(struct xrt_space_overseer *xs);
366};
367
368/*!
369 * @copydoc xrt_space_overseer::create_offset_space
370 *
371 * Helper for calling through the function pointer.
372 *
373 * @public @memberof xrt_space_overseer
374 */
375static inline xrt_result_t
377 struct xrt_space *parent,
378 const struct xrt_pose *offset,
379 struct xrt_space **out_space)
380{
381 return xso->create_offset_space(xso, parent, offset, out_space);
382}
383
384/*!
385 * @copydoc xrt_space_overseer::create_pose_space
386 *
387 * Helper for calling through the function pointer.
388 *
389 * @public @memberof xrt_space_overseer
390 */
391static inline xrt_result_t
393 struct xrt_device *xdev,
394 enum xrt_input_name name,
395 struct xrt_space **out_space)
396{
397 return xso->create_pose_space(xso, xdev, name, out_space);
398}
399
400/*!
401 * @copydoc xrt_space_overseer::locate_space
402 *
403 * Helper for calling through the function pointer.
404 *
405 * @public @memberof xrt_space_overseer
406 */
407static inline xrt_result_t
409 struct xrt_space *base_space,
410 const struct xrt_pose *base_offset,
411 int64_t at_timestamp_ns,
412 struct xrt_space *space,
413 const struct xrt_pose *offset,
414 struct xrt_space_relation *out_relation)
415{
416 return xso->locate_space(xso, base_space, base_offset, at_timestamp_ns, space, offset, out_relation);
417}
418
419/*!
420 * @copydoc xrt_space_overseer::locate_spaces
421 *
422 * Helper for calling through the function pointer.
423 *
424 * @public @memberof xrt_space_overseer
425 */
426static inline xrt_result_t
428 struct xrt_space *base_space,
429 const struct xrt_pose *base_offset,
430 int64_t at_timestamp_ns,
431 struct xrt_space **spaces,
432 uint32_t space_count,
433 const struct xrt_pose *offsets,
434 struct xrt_space_relation *out_relations)
435{
436 return xso->locate_spaces(xso, base_space, base_offset, at_timestamp_ns, spaces, space_count, offsets,
437 out_relations);
438}
439
440/*!
441 * @copydoc xrt_space_overseer::locate_device
442 *
443 * Helper for calling through the function pointer.
444 *
445 * @public @memberof xrt_space_overseer
446 */
447static inline xrt_result_t
449 struct xrt_space *base_space,
450 const struct xrt_pose *base_offset,
451 int64_t at_timestamp_ns,
452 struct xrt_device *xdev,
453 struct xrt_space_relation *out_relation)
454{
455 return xso->locate_device(xso, base_space, base_offset, at_timestamp_ns, xdev, out_relation);
456}
457
458/*!
459 * @copydoc xrt_space_overseer::ref_space_inc
460 *
461 * Helper for calling through the function pointer.
462 *
463 * @public @memberof xrt_space_overseer
464 */
465static inline xrt_result_t
467{
468 return xso->ref_space_inc(xso, type);
469}
470
471/*!
472 * @copydoc xrt_space_overseer::ref_space_dec
473 *
474 * Helper for calling through the function pointer.
475 *
476 * @public @memberof xrt_space_overseer
477 */
478static inline xrt_result_t
480{
481 return xso->ref_space_dec(xso, type);
482}
483
484/*!
485 * @copydoc xrt_space_overseer::recenter_local_spaces
486 *
487 * Helper for calling through the function pointer.
488 *
489 * @public @memberof xrt_space_overseer
490 */
491static inline xrt_result_t
493{
494 return xso->recenter_local_spaces(xso);
495}
496
497/*!
498 * @copydoc xrt_space_overseer::get_tracking_origin_offset
499 *
500 * Helper for calling through the function pointer.
501 *
502 * @public @memberof xrt_space_overseer
503 */
504static inline xrt_result_t
506 struct xrt_tracking_origin *xto,
507 struct xrt_pose *out_offset)
508{
509 return xso->get_tracking_origin_offset(xso, xto, out_offset);
510}
511
512/*!
513 * @copydoc xrt_space_overseer::set_tracking_origin_offset
514 *
515 * Helper for calling through the function pointer.
516 *
517 * @public @memberof xrt_space_overseer
518 */
519static inline xrt_result_t
521 struct xrt_tracking_origin *xto,
522 const struct xrt_pose *offset)
523{
524 return xso->set_tracking_origin_offset(xso, xto, offset);
525}
526
527/*!
528 * @copydoc xrt_space_overseer::get_reference_space_offset
529 *
530 * Helper for calling through the function pointer.
531 *
532 * @public @memberof xrt_space_overseer
533 */
534static inline xrt_result_t
536 enum xrt_reference_space_type type,
537 struct xrt_pose *out_offset)
538{
539 return xso->get_reference_space_offset(xso, type, out_offset);
540}
541
542/*!
543 * @copydoc xrt_space_overseer::set_reference_space_offset
544 *
545 * Helper for calling through the function pointer.
546 *
547 * @public @memberof xrt_space_overseer
548 */
549static inline xrt_result_t
551 enum xrt_reference_space_type type,
552 const struct xrt_pose *offset)
553{
554 return xso->set_reference_space_offset(xso, type, offset);
555}
556
557/*!
558 * @copydoc xrt_space_overseer::create_local_space
559 *
560 * Helper for calling through the function pointer.
561 *
562 * @public @memberof xrt_space_overseer
563 */
564static inline xrt_result_t
566 struct xrt_space **out_local_space,
567 struct xrt_space **out_local_floor_space)
568{
569 return xso->create_local_space(xso, out_local_space, out_local_floor_space);
570}
571
572/*!
573 * @copydoc xrt_space_overseer::add_device
574 *
575 * Helper for calling through the function pointer.
576 *
577 * @public @memberof xrt_space_overseer
578 */
579static inline xrt_result_t
581{
582 return xso->add_device(xso, xdev);
583}
584
585/*!
586 * @copydoc xrt_space_overseer::attach_device
587 *
588 * Helper for calling through the function pointer.
589 *
590 * @public @memberof xrt_space_overseer
591 */
592static inline xrt_result_t
594{
595 return xso->attach_device(xso, xdev, space);
596}
597
598/*!
599 * Helper for calling through the function pointer: does a null check and sets
600 * xc_ptr to null if freed.
601 *
602 * @see xrt_space_overseer::destroy
603 * @public @memberof xrt_space_overseer
604 */
605static inline void
607{
608 struct xrt_space_overseer *xso = *xso_ptr;
609 if (xso == NULL) {
610 return;
611 }
612
613 xso->destroy(xso);
614 *xso_ptr = NULL;
615}
616
617
618#ifdef __cplusplus
619}
620#endif
static XRT_CHECK_RESULT bool xrt_reference_dec_and_is_zero(struct xrt_reference *xref)
Decrement the reference and return true if the value is now zero.
Definition: xrt_defines.h:2410
xrt_input_name
Every internal input source known to monado with a baked in type.
Definition: xrt_defines.h:1359
enum xrt_result xrt_result_t
Result type used across Monado.
static void xrt_reference_inc(struct xrt_reference *xref)
Increment the reference, probably want xrt_reference_inc_and_was_zero.
Definition: xrt_defines.h:2366
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:612
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:309
enum xrt_device_name name
Enum identifier of the device.
Definition: xrt_device.h:311
A pose composed of a position and orientation.
Definition: xrt_defines.h:479
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
static 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:505
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
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
void(* destroy)(struct xrt_space_overseer *xs)
Destroy function.
Definition: xrt_space.h:365
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
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_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:580
static 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:479
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
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_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:550
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_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:427
struct xrt_space * stage
Stage space, may be null.
Definition: xrt_space.h:104
static 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:593
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:606
static 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:466
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
static 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:492
static 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:565
static 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:408
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
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
static 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:376
static 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:448
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_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:535
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
static 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:520
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:351
static 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:392
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
struct xrt_space * localfloorspace[128]
Ptrs to the localfloorspace.
Definition: xrt_space.h:115
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:670
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:75
Common defines and enums for XRT.