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