Monado OpenXR Runtime
Loading...
Searching...
No Matches
XRTVRClientCore.hpp
Go to the documentation of this file.
1// Copyright 2026, Beyley Cardellio
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief Implementation of the latest IVRClientCore interface version.
6 *
7 * @author Beyley Cardellio <ep1cm1n10n123@gmail.com>
8 * @ingroup openvr_interfaces
9 */
10
11#pragma once
12
13#include "xrt/xrt_instance.h"
14#include "xrt/xrt_system.h"
15#include "xrt/xrt_session.h"
16#include "xrt/xrt_compositor.h"
17
18#include "openvr_devices.hpp"
19#include "openvr_events.hpp"
20#include "openvr_input.hpp"
21
23
24#include "openvr_interfaces_unified.h"
25#include "IVRClientCore_003.h"
26
27#include <memory>
28
29
30namespace xrt::state_trackers::openvr {
31
32#define SUPPORTED_CORE_INTERFACES(_) _(VRClientCore, _003)
33#define SUPPORTED_INTERFACES(_) \
34 _(VRApplications, _001) \
35 _(VRApplications, _002) \
36 _(VRApplications, _003) \
37 _(VRApplications, _004) \
38 _(VRApplications, _005) \
39 _(VRApplications, _006) \
40 _(VRApplications, _007) \
41 _(VRApplications, _008) \
42 _(VRChaperone, _002) \
43 _(VRChaperone, _003) \
44 _(VRChaperone, _004) \
45 _(VRChaperoneSetup, _004) \
46 _(VRChaperoneSetup, _005) \
47 _(VRChaperoneSetup, _006) \
48 _(VRCompositor, _005) \
49 _(VRCompositor, _006) \
50 _(VRCompositor, _007) \
51 _(VRCompositor, _008) \
52 _(VRCompositor, _009) \
53 _(VRCompositor, _010) \
54 _(VRCompositor, _011) \
55 _(VRCompositor, _012) \
56 _(VRCompositor, _013) \
57 _(VRCompositor, _014) \
58 _(VRCompositor, _015) \
59 _(VRCompositor, _016) \
60 _(VRCompositor, _018) \
61 _(VRCompositor, _019) \
62 _(VRCompositor, _020) \
63 _(VRCompositor, _021) \
64 _(VRCompositor, _022) \
65 _(VRCompositor, _024) \
66 _(VRCompositor, _026) \
67 _(VRCompositor, _027) \
68 _(VRCompositor, _028) \
69 _(VRCompositor, _029) \
70 _(VRControlPanel, _001) \
71 _(VRDebug, _001) \
72 _(VRDriverManager, _001) \
73 _(VRExtendedDisplay, _001) \
74 _(VRHeadsetView, _001) \
75 _(VRInput, _003) \
76 _(VRInput, _004) \
77 _(VRInput, _005) \
78 _(VRInput, _006) \
79 _(VRInput, _007) \
80 _(VRInput, _010) \
81 _(VRInput, _011) \
82 _(VRIOBuffer, _001) \
83 _(VRIOBuffer, _002) \
84 _(VRIPCResourceManagerClient, _001) \
85 _(VRIPCResourceManagerClient, _002) \
86 _(VRNotifications, _001) \
87 _(VRNotifications, _002) \
88 _(VROverlay, _001) \
89 _(VROverlay, _002) \
90 _(VROverlay, _003) \
91 _(VROverlay, _004) \
92 _(VROverlay, _005) \
93 _(VROverlay, _006) \
94 _(VROverlay, _007) \
95 _(VROverlay, _008) \
96 _(VROverlay, _010) \
97 _(VROverlay, _011) \
98 _(VROverlay, _012) \
99 _(VROverlay, _013) \
100 _(VROverlay, _014) \
101 _(VROverlay, _016) \
102 _(VROverlay, _017) \
103 _(VROverlay, _018) \
104 _(VROverlay, _019) \
105 _(VROverlay, _020) \
106 _(VROverlay, _021) \
107 _(VROverlay, _022) \
108 _(VROverlay, _024) \
109 _(VROverlay, _025) \
110 _(VROverlay, _026) \
111 _(VROverlay, _027) \
112 _(VROverlay, _028) \
113 _(VROverlayView, _003) \
114 _(VRRenderModels, _001) \
115 _(VRRenderModels, _002) \
116 _(VRRenderModels, _004) \
117 _(VRRenderModels, _005) \
118 _(VRRenderModels, _006) \
119 _(VRResources, _001) \
120 _(VRScreenshots, _001) \
121 _(VRSettings, _001) \
122 _(VRSettings, _002) \
123 _(VRSettings, _003) \
124 _(VRSpatialAnchors, _001) \
125 _(VRSystem, _003) \
126 _(VRSystem, _004) \
127 _(VRSystem, _005) \
128 _(VRSystem, _006) \
129 _(VRSystem, _007) \
130 _(VRSystem, _009) \
131 _(VRSystem, _010) \
132 _(VRSystem, _011) \
133 _(VRSystem, _012) \
134 _(VRSystem, _014) \
135 _(VRSystem, _015) \
136 _(VRSystem, _016) \
137 _(VRSystem, _017) \
138 _(VRSystem, _019) \
139 _(VRSystem, _020) \
140 _(VRSystem, _021) \
141 _(VRSystem, _022) \
142 _(VRSystem, _023) \
143 _(VRSystem, _026) \
144 _(VRTrackedCamera, _001) \
145 _(VRTrackedCamera, _002) \
146 _(VRTrackedCamera, _003) \
147 _(VRTrackedCamera, _004) \
148 _(VRTrackedCamera, _005) \
149 _(VRTrackedCamera, _006)
150
151class XRTVRClientCore_003 : public vr::IVRClientCore_003
152{
153public: // Fields
154 xrt_instance *xinst{nullptr};
155 xrt_app_instance *xainst{nullptr};
156
157 xrt_system *xsys{nullptr};
158 xrt_app_system *xasys{nullptr};
159 xrt_system_devices *xsysd{nullptr};
160 xrt_space_overseer *xso{nullptr};
161 xrt_system_compositor *xsysc{nullptr};
162
163 xrt_session *xs{nullptr};
164 xrt_compositor_native *xcn{nullptr};
165
166 std::shared_ptr<Compositor> compositor{};
167 std::shared_ptr<Devices> devices{};
168 std::shared_ptr<Events> events{};
169 std::shared_ptr<Input> input{};
170
171 vr::EVRApplicationType application_type{};
172
173#define XRTVR_INTERFACE_MEMBER(name, version) std::shared_ptr<vr::I##name##version> name##version{nullptr};
174 SUPPORTED_INTERFACES(XRTVR_INTERFACE_MEMBER)
175#undef XRTVR_INTERFACE_MEMBER
176
177private: // Methods
178 bool
179 isHeadless()
180 {
181 return this->application_type == vr::EVRApplicationType::VRApplication_Background;
182 }
183
184public: // Methods
185 vr::EVRInitError
186 Init(vr::EVRApplicationType eApplicationType, const char *pStartupInfo) override;
187
188 void
189 Cleanup() override;
190
191 vr::EVRInitError
192 IsInterfaceVersionValid(const char *pchInterfaceVersion) override;
193
194 void *
195 GetGenericInterface(const char *pchNameAndVersion, vr::EVRInitError *peError) override;
196
197 bool
198 BIsHmdPresent() override;
199
200 const char *
201 GetEnglishStringForHmdError(vr::EVRInitError eError) override;
202
203 const char *
204 GetIDForVRInitError(vr::EVRInitError eError) override;
205};
206
207}; // namespace xrt::state_trackers::openvr
Definition XRTVRClientCore.hpp:152
Implementation of compositor-related functionality for OpenVR.
Implementation of a dynamic OpenVR devices array using the xrt_system_devices interface.
Implementation of OpenVR event handling and related functionality.
Implementation of OpenVR input.
This interface acts as a way to store per-application policy for xrt_instance.
Definition xrt_app_policy.h:36
This interface acts as a way to store per-application policy for xrt_system.
Definition xrt_app_policy.h:142
Main compositor server interface.
Definition xrt_compositor.h:2218
This interface acts as a root object for Monado.
Definition xrt_instance.h:124
The XRT representation of XrSession, this object does not have all of the functionality of a session,...
Definition xrt_session.h:264
Object that oversees and manages spaces, one created for each XR system.
Definition xrt_space.h:97
The system compositor handles composition for a system.
Definition xrt_compositor.h:2479
A collection of xrt_device, and an interface for identifying the roles they have been assigned.
Definition xrt_system.h:216
A system is a collection of devices, policies and optionally a compositor that is organised into a ch...
Definition xrt_system.h:65
Header declaring XRT graphics interfaces.
Header for xrt_instance object.
Header for session object.
Header for system objects.