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