Monado OpenXR Runtime
gui_common.h
Go to the documentation of this file.
1// Copyright 2019-2024, Collabora, Ltd.
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief Common file for the Monado GUI program.
6 * @author Jakob Bornecrantz <jakob@collabora.com>
7 * @ingroup gui
8 */
9
10#pragma once
11
12#include "xrt/xrt_compiler.h"
13
14
15/*!
16 * @defgroup gui GUI Config Interface
17 * @ingroup xrt
18 *
19 * @brief Small GUI interface to configure Monado based on SDL2.
20 */
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26
27struct xrt_device;
28struct xrt_prober;
29struct xrt_fs;
30struct xrt_frame_sink;
33struct time_state;
36
37
38/*!
39 * A gui program.
40 *
41 * @ingroup gui
42 */
44{
45 bool stopped;
46
47 struct gui_scene_manager *gsm;
48
49 struct xrt_system *xsys;
50 struct xrt_system_devices *xsysd;
51 struct xrt_space_overseer *xso;
52 struct xrt_instance *instance;
53 struct xrt_prober *xp;
54
55 struct gui_ogl_texture *texs[256];
56 size_t num_texs;
57};
58
59/*!
60 * @interface gui_scene
61 * A single currently running scene.
62 *
63 * @see gui_program
64 * @ingroup gui
65 */
67{
68 void (*render)(struct gui_scene *, struct gui_program *);
69 void (*destroy)(struct gui_scene *, struct gui_program *);
70};
71
72/*!
73 * A OpenGL texture.
74 *
75 * @see gui_program
76 * @ingroup gui
77 */
79{
80 uint64_t seq;
81 uint64_t dropped;
82 const char *name;
83 uint32_t w, h;
84 uint32_t id;
85 bool half;
86};
87
88/*!
89 * @addtogroup gui
90 * @{
91 */
92
93/*!
94 * Initialize the prober and open all devices found.
95 *
96 * @public @memberof gui_program
97 */
98int
100
101/*!
102 * Create devices.
103 *
104 * @public @memberof gui_program
105 */
106int
108
109/*!
110 * Update all devices.
111 *
112 * @public @memberof gui_program
113 */
114void
116
117/*!
118 * Destroy all opened devices and destroy the prober.
119 *
120 * @public @memberof gui_program
121 */
122void
124
125/*!
126 * Create a sink that will turn frames into OpenGL textures, since the frame
127 * can come from another thread @ref gui_ogl_sink_update needs to be called.
128 *
129 * Destruction is handled by the frame context.
130 *
131 * @public @memberof gui_ogl_texture
132 * @ingroup gui
133 */
134struct gui_ogl_texture *
135gui_ogl_sink_create(const char *name, struct xrt_frame_context *xfctx, struct xrt_frame_sink **out_sink);
136
137/*!
138 * Update the texture to the latest received frame.
139 *
140 * @public @memberof gui_ogl_texture
141 * @ingroup gui
142 */
143void
144gui_ogl_sink_update(struct gui_ogl_texture * /*tex*/);
145
146/*!
147 * Push the scene to the top of the lists.
148 *
149 * @public @memberof gui_program
150 */
151void
152gui_scene_push_front(struct gui_program *p, struct gui_scene *me);
153
154/*!
155 * Put a scene on the delete list, also removes it from any other list.
156 *
157 * @public @memberof gui_program
158 */
159void
160gui_scene_delete_me(struct gui_program *p, struct gui_scene *me);
161
162/*!
163 * Render the scenes.
164 *
165 * @public @memberof gui_program
166 */
167void
169
170/*!
171 * Initialize the scene manager.
172 *
173 * @public @memberof gui_program
174 */
175void
177
178/*!
179 * Destroy the scene manager.
180 *
181 * @public @memberof gui_program
182 */
183void
185
186
187/*
188 *
189 * Scene creation functions.
190 *
191 */
192
193/*!
194 * Shows the main menu.
195 *
196 * @public @memberof gui_program
197 */
198void
200
201/*!
202 * Shows a UI that lets you select a video device and mode for calibration.
203 *
204 * @public @memberof gui_program
205 */
206void
208
209/*!
210 * Shows a UI that lets you set up tracking overrides.
211 *
212 * @public @memberof gui_program
213 */
214void
216
217/*!
218 * Regular debug UI.
219 *
220 * @public @memberof gui_program
221 */
222void
224
225/*!
226 * Small hand-tracking demo.
227 *
228 * @public @memberof gui_program
229 */
230void
232
233/*!
234 * EuRoC recorder for DepthAI cameras
235 *
236 * @public @memberof gui_program
237 */
238void
240
241/*!
242 * Create a recording view scene.
243 *
244 * @public @memberof gui_program
245 */
246void
247gui_scene_record(struct gui_program *p, const char *camera);
248
249/*!
250 * Remote control debugging UI.
251 *
252 * @param p self
253 * @param address Optional address.
254 *
255 * @public @memberof gui_program
256 */
257void
258gui_scene_remote(struct gui_program *p, const char *address);
259
260/*!
261 * Given the frameserver runs the calibration code on it.
262 * Claims ownership of @p s.
263 *
264 * @public @memberof gui_program
265 */
266void
268 struct xrt_frame_context *xfctx,
269 struct xrt_fs *xfs,
270 struct xrt_settings_tracking *s);
271
272/*!
273 * @}
274 */
275
276#ifdef __cplusplus
277}
278#endif
void gui_scene_delete_me(struct gui_program *p, struct gui_scene *me)
Put a scene on the delete list, also removes it from any other list.
Definition: gui_scene.cpp:45
void gui_prober_update(struct gui_program *p)
Update all devices.
Definition: gui_prober.c:84
void gui_scene_push_front(struct gui_program *p, struct gui_scene *me)
Push the scene to the top of the lists.
Definition: gui_scene.cpp:24
int gui_prober_init(struct gui_program *p)
Initialize the prober and open all devices found.
Definition: gui_prober.c:41
void gui_scene_main_menu(struct gui_program *p)
Shows the main menu.
Definition: gui_scene_main_menu.c:113
void gui_scene_record(struct gui_program *p, const char *camera)
Create a recording view scene.
Definition: gui_scene_record.c:413
void gui_ogl_sink_update(struct gui_ogl_texture *)
Update the texture to the latest received frame.
Definition: gui_ogl_sink.c:115
struct gui_ogl_texture * gui_ogl_sink_create(const char *name, struct xrt_frame_context *xfctx, struct xrt_frame_sink **out_sink)
Create a sink that will turn frames into OpenGL textures, since the frame can come from another threa...
Definition: gui_ogl_sink.c:178
void gui_scene_manager_render(struct gui_program *p)
Render the scenes.
Definition: gui_scene.cpp:64
void gui_scene_select_video_calibrate(struct gui_program *p)
Shows a UI that lets you select a video device and mode for calibration.
Definition: gui_scene_video.c:258
void gui_scene_debug(struct gui_program *p)
Regular debug UI.
Definition: gui_scene_debug.c:1028
void gui_scene_hand_tracking_demo(struct gui_program *p)
Small hand-tracking demo.
Definition: gui_scene_hand_tracking_demo.c:116
void gui_scene_remote(struct gui_program *p, const char *address)
Remote control debugging UI.
Definition: gui_scene_remote.c:448
int gui_prober_select(struct gui_program *p)
Create devices.
Definition: gui_prober.c:71
void gui_scene_tracking_overrides(struct gui_program *p)
Shows a UI that lets you set up tracking overrides.
Definition: gui_scene_tracking_overrides.c:355
void gui_prober_teardown(struct gui_program *p)
Destroy all opened devices and destroy the prober.
Definition: gui_prober.c:101
void gui_scene_manager_init(struct gui_program *p)
Initialize the scene manager.
Definition: gui_scene.cpp:86
void gui_scene_manager_destroy(struct gui_program *p)
Destroy the scene manager.
Definition: gui_scene.cpp:92
void gui_scene_calibrate(struct gui_program *p, struct xrt_frame_context *xfctx, struct xrt_fs *xfs, struct xrt_settings_tracking *s)
Given the frameserver runs the calibration code on it.
Definition: gui_scene_calibrate.c:399
void gui_scene_record_euroc(struct gui_program *p)
EuRoC recorder for DepthAI cameras.
Definition: gui_scene_record_euroc.c:99
A OpenGL texture.
Definition: gui_common.h:79
A gui program.
Definition: gui_common.h:44
Definition: gui_scene.cpp:17
A single currently running scene.
Definition: gui_common.h:67
Time-keeping state structure.
Definition: u_time.cpp:30
A single HMD or input device.
Definition: xrt_device.h:241
Object used to track all sinks and frame producers in a graph.
Definition: xrt_frame.h:108
A object that is sent frames.
Definition: xrt_frame.h:58
Frameserver that generates frames.
Definition: xrt_frameserver.h:70
This interface acts as a root object for Monado.
Definition: xrt_instance.h:114
The main prober that probes and manages found but not opened HMD devices that are connected to the sy...
Definition: xrt_prober.h:132
Holding enough information to recreate a tracking pipeline.
Definition: xrt_settings.h:67
Object that oversees and manages spaces, one created for each XR system.
Definition: xrt_space.h:96
A collection of xrt_device, and an interface for identifying the roles they have been assigned.
Definition: xrt_system.h:219
A system is a collection of devices, policies and optionally a compositor that is organised into a ch...
Definition: xrt_system.h:62
Header holding common defines.