Monado OpenXR Runtime
Loading...
Searching...
No Matches
XRTVRSystem.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 IVRSystem interface version.
6 *
7 * @author Beyley Cardellio <ep1cm1n10n123@gmail.com>
8 * @ingroup openvr_interfaces
9 */
10
11#pragma once
12
13#include "openvr_interfaces_unified.h"
14
15#include "XRTVRClientCore.hpp"
16
17
18namespace xrt::state_trackers::openvr {
19
20class XRTVRSystem_026 : public vr::IVRSystem_026
21{
22private:
24
25public:
27
28 virtual ~XRTVRSystem_026() = default;
29
30 /* Display Methods */
31
32 void
33 GetRecommendedRenderTargetSize(uint32_t *pnWidth, uint32_t *pnHeight) override;
34
35 vr::HmdMatrix44_t
36 GetProjectionMatrix(vr::EVREye eEye, float fNearZ, float fFarZ) override;
37
38 void
39 GetProjectionRaw(vr::EVREye eEye, float *pfLeft, float *pfRight, float *pfTop, float *pfBottom) override;
40
41 bool
42 ComputeDistortion(vr::EVREye eEye,
43 float fU,
44 float fV,
45 vr::DistortionCoordinates_t *pDistortionCoordinates) override;
46
47 bool
48 ComputeDistortionSet(vr::EVREye eEye,
49 vr::EVRDistortionChannel eChannel,
50 bool bAsNormalizedDeviceCoordinates,
51 uint32_t nNumCoordinates,
52 const vr::DistortionCoordinate_t *pInput,
53 vr::DistortionCoordinate_t *pOutput) override;
54
55 vr::HmdMatrix34_t
56 GetEyeToHeadTransform(vr::EVREye eEye) override;
57
58 bool
59 GetTimeSinceLastVsync(float *pfSecondsSinceLastVsync, uint64_t *pulFrameCounter) override;
60
61 int32_t
62 GetD3D9AdapterIndex() override;
63
64 void
65 GetDXGIOutputInfo(int32_t *pnAdapterIndex) override;
66
67 void
68 GetOutputDevice(uint64_t *pnDevice, vr::ETextureType textureType, VkInstance_T *pInstance = nullptr) override;
69
70 /* Display Mode methods */
71
72 bool
73 IsDisplayOnDesktop() override;
74
75 bool
76 SetDisplayVisibility(bool bIsVisibleOnDesktop) override;
77
78 /* Tracking Methods */
79
80 void
81 GetDeviceToAbsoluteTrackingPose(vr::ETrackingUniverseOrigin eOrigin,
82 float fPredictedSecondsToPhotonsFromNow,
83 VR_ARRAY_COUNT(unTrackedDevicePoseArrayCount)
84 vr::TrackedDevicePose_t *pTrackedDevicePoseArray,
85 uint32_t unTrackedDevicePoseArrayCount) override;
86
87 vr::HmdMatrix34_t
88 GetSeatedZeroPoseToStandingAbsoluteTrackingPose() override;
89
90 vr::HmdMatrix34_t
91 GetRawZeroPoseToStandingAbsoluteTrackingPose() override;
92
93 uint32_t
94 GetSortedTrackedDeviceIndicesOfClass(
95 vr::ETrackedDeviceClass eTrackedDeviceClass,
96 VR_ARRAY_COUNT(unTrackedDeviceIndexArrayCount) vr::TrackedDeviceIndex_t *punTrackedDeviceIndexArray,
97 uint32_t unTrackedDeviceIndexArrayCount,
98 vr::TrackedDeviceIndex_t unRelativeToTrackedDeviceIndex = vr::k_unTrackedDeviceIndex_Hmd) override;
99
100 vr::EDeviceActivityLevel
101 GetTrackedDeviceActivityLevel(vr::TrackedDeviceIndex_t unDeviceId) override;
102
103 void
104 ApplyTransform(vr::TrackedDevicePose_t *pOutputPose,
105 const vr::TrackedDevicePose_t *pTrackedDevicePose,
106 const vr::HmdMatrix34_t *pTransform) override;
107
108 vr::TrackedDeviceIndex_t
109 GetTrackedDeviceIndexForControllerRole(vr::ETrackedControllerRole unDeviceType) override;
110
111 vr::ETrackedControllerRole
112 GetControllerRoleForTrackedDeviceIndex(vr::TrackedDeviceIndex_t unDeviceIndex) override;
113
114 /* Property methods */
115
116 vr::ETrackedDeviceClass
117 GetTrackedDeviceClass(vr::TrackedDeviceIndex_t unDeviceIndex) override;
118
119 bool
120 IsTrackedDeviceConnected(vr::TrackedDeviceIndex_t unDeviceIndex) override;
121
122 bool
123 GetBoolTrackedDeviceProperty(vr::TrackedDeviceIndex_t unDeviceIndex,
124 vr::ETrackedDeviceProperty prop,
125 vr::ETrackedPropertyError *pError = 0L) override;
126
127 float
128 GetFloatTrackedDeviceProperty(vr::TrackedDeviceIndex_t unDeviceIndex,
129 vr::ETrackedDeviceProperty prop,
130 vr::ETrackedPropertyError *pError = 0L) override;
131
132 int32_t
133 GetInt32TrackedDeviceProperty(vr::TrackedDeviceIndex_t unDeviceIndex,
134 vr::ETrackedDeviceProperty prop,
135 vr::ETrackedPropertyError *pError = 0L) override;
136
137 uint64_t
138 GetUint64TrackedDeviceProperty(vr::TrackedDeviceIndex_t unDeviceIndex,
139 vr::ETrackedDeviceProperty prop,
140 vr::ETrackedPropertyError *pError = 0L) override;
141
142 vr::HmdMatrix34_t
143 GetMatrix34TrackedDeviceProperty(vr::TrackedDeviceIndex_t unDeviceIndex,
144 vr::ETrackedDeviceProperty prop,
145 vr::ETrackedPropertyError *pError = 0L) override;
146
147 uint32_t
148 GetArrayTrackedDeviceProperty(vr::TrackedDeviceIndex_t unDeviceIndex,
149 vr::ETrackedDeviceProperty prop,
150 vr::PropertyTypeTag_t propType,
151 void *pBuffer,
152 uint32_t unBufferSize,
153 vr::ETrackedPropertyError *pError = 0L) override;
154
155 uint32_t
156 GetStringTrackedDeviceProperty(vr::TrackedDeviceIndex_t unDeviceIndex,
157 vr::ETrackedDeviceProperty prop,
158 VR_OUT_STRING() char *pchValue,
159 uint32_t unBufferSize,
160 vr::ETrackedPropertyError *pError = 0L) override;
161
162 const char *
163 GetPropErrorNameFromEnum(vr::ETrackedPropertyError error) override;
164
165 /* Event methods */
166
167 bool
168 PollNextEvent(vr::VREvent_t *pEvent, uint32_t uncbVREvent) override;
169
170 bool
171 PollNextEventWithPose(vr::ETrackingUniverseOrigin eOrigin,
172 vr::VREvent_t *pEvent,
173 uint32_t uncbVREvent,
174 vr::TrackedDevicePose_t *pTrackedDevicePose) override;
175
176 bool
177 PollNextEventWithPoseAndOverlays(vr::ETrackingUniverseOrigin eOrigin,
178 vr::VREvent_t *pEvent,
179 uint32_t uncbVREvent,
180 vr::TrackedDevicePose_t *pTrackedDevicePose,
181 vr::VROverlayHandle_t *pulOverlayHandle) override;
182
183 const char *
184 GetEventTypeNameFromEnum(vr::EVREventType eType) override;
185
186 /* Rendering helper methods */
187
188 vr::HiddenAreaMesh_t
189 GetHiddenAreaMesh(vr::EVREye eEye, vr::EHiddenAreaMeshType type = vr::k_eHiddenAreaMesh_Standard) override;
190
191 bool
192 GetEyeTrackedFoveationCenter(vr::HmdVector2_t *pNdcLeft, vr::HmdVector2_t *pNdcRight) override;
193
194 bool
195 GetEyeTrackedFoveationCenterForProjection(const vr::HmdMatrix44_t *pProjMat, vr::HmdVector2_t *pNdc) override;
196
197 /* Controller methods */
198
199 bool
200 GetControllerState(vr::TrackedDeviceIndex_t unControllerDeviceIndex,
201 vr::VRControllerState_t *pControllerState,
202 uint32_t unControllerStateSize) override;
203
204 bool
205 GetControllerStateWithPose(vr::ETrackingUniverseOrigin eOrigin,
206 vr::TrackedDeviceIndex_t unControllerDeviceIndex,
207 vr::VRControllerState_t *pControllerState,
208 uint32_t unControllerStateSize,
209 vr::TrackedDevicePose_t *pTrackedDevicePose) override;
210
211 void
212 TriggerHapticPulse(vr::TrackedDeviceIndex_t unControllerDeviceIndex,
213 uint32_t unAxisId,
214 unsigned short usDurationMicroSec) override;
215
216 const char *
217 GetButtonIdNameFromEnum(vr::EVRButtonId eButtonId) override;
218
219 const char *
220 GetControllerAxisTypeNameFromEnum(vr::EVRControllerAxisType eAxisType) override;
221
222 bool
223 IsInputAvailable() override;
224
225 bool
226 IsSteamVRDrawingControllers() override;
227
228 bool
229 ShouldApplicationPause() override;
230
231 bool
232 ShouldApplicationReduceRenderingWork() override;
233
234 /* Firmware methods */
235
236 vr::EVRFirmwareError
237 PerformFirmwareUpdate(vr::TrackedDeviceIndex_t unDeviceIndex) override;
238
239 /* Application life cycle methods */
240
241 void
242 AcknowledgeQuit_Exiting() override;
243
244 /* App container sandbox methods */
245
246 uint32_t
247 GetAppContainerFilePaths(VR_OUT_STRING() char *pchBuffer, uint32_t unBufferSize) override;
248
249 /* System methods */
250
251 const char *
252 GetRuntimeVersion() override;
253
254 vr::EVRInitError
255 SetSDKVersion(uint32_t nVersionMajor, uint32_t nVersionMinor, uint32_t nVersionBuild) override;
256};
257
258}; // namespace xrt::state_trackers::openvr
Implementation of the latest IVRClientCore interface version.
Definition XRTVRClientCore.hpp:35