Monado OpenXR Runtime
Loading...
Searching...
No Matches
b_space_overseer.h
Go to the documentation of this file.
1// Copyright 2023, Collabora, Ltd.
2// Copyright 2026, NVIDIA CORPORATION.
3// SPDX-License-Identifier: BSL-1.0
4/*!
5 * @file
6 * @brief A implementation of the @ref xrt_space_overseer interface.
7 *
8 * @author Jakob Bornecrantz <jakob@collabora.com>
9 * @ingroup base
10 */
11
12#include "xrt/xrt_space.h"
13
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
19
20struct b_space_overseer;
22
23
24/*
25 *
26 * Main interface.
27 *
28 */
29
30/*!
31 * Create a default implementation of a space overseer.
32 *
33 * @param[in] broadcast Event sink that broadcasts events to all sessions.
34 * @ingroup base
35 */
36struct b_space_overseer *
38
39/*!
40 * Sets up the space overseer and all semantic spaces in a way that works with
41 * the old @ref xrt_tracking_origin information. Will automatically create local
42 * and stage spaces. If another setup is needed the builder should manually set
43 * the space graph up using below functions.
44 *
45 * @ingroup base
46 */
47void
49 struct xrt_device **xdevs,
50 uint32_t xdev_count,
51 struct xrt_device *head,
52 const struct xrt_pose *local_offset,
53 bool root_is_unbounded,
55
56/*!
57 * Creates a space without any offset, this is just for optimisation over a
58 * regular offset space.
59 *
60 * @ingroup base
61 */
62void
64 struct xrt_space *parent,
65 struct xrt_space **out_space);
66
67/*!
68 * The space overseer internally keeps track the space that @ref xrt_device is
69 * in, and then uses that mapping when creating pose spaces. This function
70 * allows builders to create a much more bespoke setup. This function adds a
71 * reference to the space.
72 *
73 * @ingroup base
74 */
75void
77
78
79/*
80 *
81 * Builder helpers.
82 *
83 */
84
85/*!
86 * @copydoc xrt_space_overseer::create_offset_space
87 *
88 * Convenience helper for builder code using @ref b_space_overseer directly.
89 *
90 * @public @memberof b_space_overseer
91 */
92static inline xrt_result_t
94 struct xrt_space *parent,
95 const struct xrt_pose *offset,
96 struct xrt_space **out_space)
97{
98 struct xrt_space_overseer *xso = (struct xrt_space_overseer *)uso;
99 return xrt_space_overseer_create_offset_space(xso, parent, offset, out_space);
100}
101
102/*!
103 * @copydoc xrt_space_overseer::create_pose_space
104 *
105 * Convenience helper for builder code using @ref b_space_overseer directly.
106 *
107 * @public @memberof b_space_overseer
108 */
109static inline xrt_result_t
111 struct xrt_device *xdev,
112 enum xrt_input_name name,
113 struct xrt_space **out_space)
114{
115 struct xrt_space_overseer *xso = (struct xrt_space_overseer *)uso;
116 return xrt_space_overseer_create_pose_space(xso, xdev, name, out_space);
117}
118
119
120#ifdef __cplusplus
121}
122#endif
void b_space_overseer_link_space_to_device(struct b_space_overseer *uso, struct xrt_space *xs, struct xrt_device *xdev)
The space overseer internally keeps track the space that xrt_device is in, and then uses that mapping...
Definition b_space_overseer.c:1315
struct b_space_overseer * b_space_overseer_create(struct xrt_session_event_sink *broadcast)
Create a default implementation of a space overseer.
Definition b_space_overseer.c:1200
void b_space_overseer_create_null_space(struct b_space_overseer *uso, struct xrt_space *parent, struct xrt_space **out_space)
Creates a space without any offset, this is just for optimisation over a regular offset space.
Definition b_space_overseer.c:1302
void b_space_overseer_legacy_setup(struct b_space_overseer *uso, struct xrt_device **xdevs, uint32_t xdev_count, struct xrt_device *head, const struct xrt_pose *local_offset, bool root_is_unbounded, bool per_app_local_spaces)
Sets up the space overseer and all semantic spaces in a way that works with the old xrt_tracking_orig...
Definition b_space_overseer.c:1238
xrt_input_name
Every internal input source known to monado with a baked in type.
Definition xrt_defines.h:917
enum xrt_result xrt_result_t
Result type used across Monado.
Default implementation of the xrt_space_overseer object.
Definition b_space_overseer.c:91
static xrt_result_t b_space_overseer_create_pose_space(struct b_space_overseer *uso, 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 b_space_overseer.h:110
static xrt_result_t b_space_overseer_create_offset_space(struct b_space_overseer *uso, 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 b_space_overseer.h:93
bool per_app_local_spaces
Create independent local and local_floor per application.
Definition b_space_overseer.c:128
struct xrt_session_event_sink * broadcast
Event sink to broadcast events to all sessions.
Definition b_space_overseer.c:107
A single HMD or input device.
Definition xrt_device.h:310
A pose composed of a position and orientation.
Definition xrt_defines.h:479
Used internally from producers of events to push events into session, some sinks might multiplex even...
Definition xrt_session.h:237
Object that oversees and manages spaces, one created for each XR system.
Definition xrt_space.h:97
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:376
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:392
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
Header defining xrt space and space overseer.