/work/obj-fuzz/dist/include/openvr.h
Line | Count | Source (jump to first uncovered line) |
1 | | #pragma once |
2 | | |
3 | | // openvr.h |
4 | | //========= Copyright Valve Corporation ============// |
5 | | // Dynamically generated file. Do not modify this file directly. |
6 | | |
7 | | #ifndef _OPENVR_API |
8 | | #define _OPENVR_API |
9 | | |
10 | | #include <stdint.h> |
11 | | |
12 | | |
13 | | |
14 | | // vrtypes.h |
15 | | #ifndef _INCLUDE_VRTYPES_H |
16 | | #define _INCLUDE_VRTYPES_H |
17 | | |
18 | | // Forward declarations to avoid requiring vulkan.h |
19 | | struct VkDevice_T; |
20 | | struct VkPhysicalDevice_T; |
21 | | struct VkInstance_T; |
22 | | struct VkQueue_T; |
23 | | |
24 | | // Forward declarations to avoid requiring d3d12.h |
25 | | struct ID3D12Resource; |
26 | | struct ID3D12CommandQueue; |
27 | | |
28 | | namespace vr |
29 | | { |
30 | | #pragma pack( push, 8 ) |
31 | | |
32 | | typedef void* glSharedTextureHandle_t; |
33 | | typedef int32_t glInt_t; |
34 | | typedef uint32_t glUInt_t; |
35 | | |
36 | | // right-handed system |
37 | | // +y is up |
38 | | // +x is to the right |
39 | | // -z is forward |
40 | | // Distance unit is meters |
41 | | struct HmdMatrix34_t |
42 | | { |
43 | | float m[3][4]; |
44 | | }; |
45 | | |
46 | | struct HmdMatrix44_t |
47 | | { |
48 | | float m[4][4]; |
49 | | }; |
50 | | |
51 | | struct HmdVector3_t |
52 | | { |
53 | | float v[3]; |
54 | | }; |
55 | | |
56 | | struct HmdVector4_t |
57 | | { |
58 | | float v[4]; |
59 | | }; |
60 | | |
61 | | struct HmdVector3d_t |
62 | | { |
63 | | double v[3]; |
64 | | }; |
65 | | |
66 | | struct HmdVector2_t |
67 | | { |
68 | | float v[2]; |
69 | | }; |
70 | | |
71 | | struct HmdQuaternion_t |
72 | | { |
73 | | double w, x, y, z; |
74 | | }; |
75 | | |
76 | | struct HmdColor_t |
77 | | { |
78 | | float r, g, b, a; |
79 | | }; |
80 | | |
81 | | struct HmdQuad_t |
82 | | { |
83 | | HmdVector3_t vCorners[ 4 ]; |
84 | | }; |
85 | | |
86 | | struct HmdRect2_t |
87 | | { |
88 | | HmdVector2_t vTopLeft; |
89 | | HmdVector2_t vBottomRight; |
90 | | }; |
91 | | |
92 | | /** Used to return the post-distortion UVs for each color channel. |
93 | | * UVs range from 0 to 1 with 0,0 in the upper left corner of the |
94 | | * source render target. The 0,0 to 1,1 range covers a single eye. */ |
95 | | struct DistortionCoordinates_t |
96 | | { |
97 | | float rfRed[2]; |
98 | | float rfGreen[2]; |
99 | | float rfBlue[2]; |
100 | | }; |
101 | | |
102 | | enum EVREye |
103 | | { |
104 | | Eye_Left = 0, |
105 | | Eye_Right = 1 |
106 | | }; |
107 | | |
108 | | enum ETextureType |
109 | | { |
110 | | TextureType_DirectX = 0, // Handle is an ID3D11Texture |
111 | | TextureType_OpenGL = 1, // Handle is an OpenGL texture name or an OpenGL render buffer name, depending on submit flags |
112 | | TextureType_Vulkan = 2, // Handle is a pointer to a VRVulkanTextureData_t structure |
113 | | TextureType_IOSurface = 3, // Handle is a macOS cross-process-sharable IOSurfaceRef |
114 | | TextureType_DirectX12 = 4, // Handle is a pointer to a D3D12TextureData_t structure |
115 | | TextureType_DXGISharedHandle = 5, // Handle is a HANDLE DXGI share handle, only supported for Overlay render targets. |
116 | | // this texture is used directly by our renderer, so only perform atomic (copyresource or resolve) on it |
117 | | }; |
118 | | |
119 | | enum EColorSpace |
120 | | { |
121 | | ColorSpace_Auto = 0, // Assumes 'gamma' for 8-bit per component formats, otherwise 'linear'. This mirrors the DXGI formats which have _SRGB variants. |
122 | | ColorSpace_Gamma = 1, // Texture data can be displayed directly on the display without any conversion (a.k.a. display native format). |
123 | | ColorSpace_Linear = 2, // Same as gamma but has been converted to a linear representation using DXGI's sRGB conversion algorithm. |
124 | | }; |
125 | | |
126 | | struct Texture_t |
127 | | { |
128 | | void* handle; // See ETextureType definition above |
129 | | ETextureType eType; |
130 | | EColorSpace eColorSpace; |
131 | | }; |
132 | | |
133 | | // Handle to a shared texture (HANDLE on Windows obtained using OpenSharedResource). |
134 | | typedef uint64_t SharedTextureHandle_t; |
135 | | #define INVALID_SHARED_TEXTURE_HANDLE ((vr::SharedTextureHandle_t)0) |
136 | | |
137 | | enum ETrackingResult |
138 | | { |
139 | | TrackingResult_Uninitialized = 1, |
140 | | |
141 | | TrackingResult_Calibrating_InProgress = 100, |
142 | | TrackingResult_Calibrating_OutOfRange = 101, |
143 | | |
144 | | TrackingResult_Running_OK = 200, |
145 | | TrackingResult_Running_OutOfRange = 201, |
146 | | }; |
147 | | |
148 | | typedef uint32_t DriverId_t; |
149 | | static const uint32_t k_nDriverNone = 0xFFFFFFFF; |
150 | | |
151 | | static const uint32_t k_unMaxDriverDebugResponseSize = 32768; |
152 | | |
153 | | /** Used to pass device IDs to API calls */ |
154 | | typedef uint32_t TrackedDeviceIndex_t; |
155 | | static const uint32_t k_unTrackedDeviceIndex_Hmd = 0; |
156 | | static const uint32_t k_unMaxTrackedDeviceCount = 64; |
157 | | static const uint32_t k_unTrackedDeviceIndexOther = 0xFFFFFFFE; |
158 | | static const uint32_t k_unTrackedDeviceIndexInvalid = 0xFFFFFFFF; |
159 | | |
160 | | /** Describes what kind of object is being tracked at a given ID */ |
161 | | enum ETrackedDeviceClass |
162 | | { |
163 | | TrackedDeviceClass_Invalid = 0, // the ID was not valid. |
164 | | TrackedDeviceClass_HMD = 1, // Head-Mounted Displays |
165 | | TrackedDeviceClass_Controller = 2, // Tracked controllers |
166 | | TrackedDeviceClass_GenericTracker = 3, // Generic trackers, similar to controllers |
167 | | TrackedDeviceClass_TrackingReference = 4, // Camera and base stations that serve as tracking reference points |
168 | | TrackedDeviceClass_DisplayRedirect = 5, // Accessories that aren't necessarily tracked themselves, but may redirect video output from other tracked devices |
169 | | }; |
170 | | |
171 | | |
172 | | /** Describes what specific role associated with a tracked device */ |
173 | | enum ETrackedControllerRole |
174 | | { |
175 | | TrackedControllerRole_Invalid = 0, // Invalid value for controller type |
176 | | TrackedControllerRole_LeftHand = 1, // Tracked device associated with the left hand |
177 | | TrackedControllerRole_RightHand = 2, // Tracked device associated with the right hand |
178 | | TrackedControllerRole_OptOut = 3, // Tracked device is opting out of left/right hand selection |
179 | | TrackedControllerRole_Max = 4 |
180 | | }; |
181 | | |
182 | | |
183 | | /** describes a single pose for a tracked object */ |
184 | | struct TrackedDevicePose_t |
185 | | { |
186 | | HmdMatrix34_t mDeviceToAbsoluteTracking; |
187 | | HmdVector3_t vVelocity; // velocity in tracker space in m/s |
188 | | HmdVector3_t vAngularVelocity; // angular velocity in radians/s (?) |
189 | | ETrackingResult eTrackingResult; |
190 | | bool bPoseIsValid; |
191 | | |
192 | | // This indicates that there is a device connected for this spot in the pose array. |
193 | | // It could go from true to false if the user unplugs the device. |
194 | | bool bDeviceIsConnected; |
195 | | }; |
196 | | |
197 | | /** Identifies which style of tracking origin the application wants to use |
198 | | * for the poses it is requesting */ |
199 | | enum ETrackingUniverseOrigin |
200 | | { |
201 | | TrackingUniverseSeated = 0, // Poses are provided relative to the seated zero pose |
202 | | TrackingUniverseStanding = 1, // Poses are provided relative to the safe bounds configured by the user |
203 | | TrackingUniverseRawAndUncalibrated = 2, // Poses are provided in the coordinate system defined by the driver. It has Y up and is unified for devices of the same driver. You usually don't want this one. |
204 | | }; |
205 | | |
206 | | typedef uint64_t WebConsoleHandle_t; |
207 | | #define INVALID_WEB_CONSOLE_HANDLE ((vr::WebConsoleHandle_t)0) |
208 | | |
209 | | // Refers to a single container of properties |
210 | | typedef uint64_t PropertyContainerHandle_t; |
211 | | typedef uint32_t PropertyTypeTag_t; |
212 | | |
213 | | static const PropertyContainerHandle_t k_ulInvalidPropertyContainer = 0; |
214 | | static const PropertyTypeTag_t k_unInvalidPropertyTag = 0; |
215 | | |
216 | | typedef PropertyContainerHandle_t DriverHandle_t; |
217 | | static const PropertyContainerHandle_t k_ulInvalidDriverHandle = 0; |
218 | | |
219 | | // Use these tags to set/get common types as struct properties |
220 | | static const PropertyTypeTag_t k_unFloatPropertyTag = 1; |
221 | | static const PropertyTypeTag_t k_unInt32PropertyTag = 2; |
222 | | static const PropertyTypeTag_t k_unUint64PropertyTag = 3; |
223 | | static const PropertyTypeTag_t k_unBoolPropertyTag = 4; |
224 | | static const PropertyTypeTag_t k_unStringPropertyTag = 5; |
225 | | |
226 | | static const PropertyTypeTag_t k_unHmdMatrix34PropertyTag = 20; |
227 | | static const PropertyTypeTag_t k_unHmdMatrix44PropertyTag = 21; |
228 | | static const PropertyTypeTag_t k_unHmdVector3PropertyTag = 22; |
229 | | static const PropertyTypeTag_t k_unHmdVector4PropertyTag = 23; |
230 | | |
231 | | static const PropertyTypeTag_t k_unHiddenAreaPropertyTag = 30; |
232 | | static const PropertyTypeTag_t k_unPathHandleInfoTag = 31; |
233 | | static const PropertyTypeTag_t k_unActionPropertyTag = 32; |
234 | | static const PropertyTypeTag_t k_unInputValuePropertyTag = 33; |
235 | | static const PropertyTypeTag_t k_unWildcardPropertyTag = 34; |
236 | | static const PropertyTypeTag_t k_unHapticVibrationPropertyTag = 35; |
237 | | |
238 | | static const PropertyTypeTag_t k_unOpenVRInternalReserved_Start = 1000; |
239 | | static const PropertyTypeTag_t k_unOpenVRInternalReserved_End = 10000; |
240 | | |
241 | | |
242 | | /** Each entry in this enum represents a property that can be retrieved about a |
243 | | * tracked device. Many fields are only valid for one ETrackedDeviceClass. */ |
244 | | enum ETrackedDeviceProperty |
245 | | { |
246 | | Prop_Invalid = 0, |
247 | | |
248 | | // general properties that apply to all device classes |
249 | | Prop_TrackingSystemName_String = 1000, |
250 | | Prop_ModelNumber_String = 1001, |
251 | | Prop_SerialNumber_String = 1002, |
252 | | Prop_RenderModelName_String = 1003, |
253 | | Prop_WillDriftInYaw_Bool = 1004, |
254 | | Prop_ManufacturerName_String = 1005, |
255 | | Prop_TrackingFirmwareVersion_String = 1006, |
256 | | Prop_HardwareRevision_String = 1007, |
257 | | Prop_AllWirelessDongleDescriptions_String = 1008, |
258 | | Prop_ConnectedWirelessDongle_String = 1009, |
259 | | Prop_DeviceIsWireless_Bool = 1010, |
260 | | Prop_DeviceIsCharging_Bool = 1011, |
261 | | Prop_DeviceBatteryPercentage_Float = 1012, // 0 is empty, 1 is full |
262 | | Prop_StatusDisplayTransform_Matrix34 = 1013, |
263 | | Prop_Firmware_UpdateAvailable_Bool = 1014, |
264 | | Prop_Firmware_ManualUpdate_Bool = 1015, |
265 | | Prop_Firmware_ManualUpdateURL_String = 1016, |
266 | | Prop_HardwareRevision_Uint64 = 1017, |
267 | | Prop_FirmwareVersion_Uint64 = 1018, |
268 | | Prop_FPGAVersion_Uint64 = 1019, |
269 | | Prop_VRCVersion_Uint64 = 1020, |
270 | | Prop_RadioVersion_Uint64 = 1021, |
271 | | Prop_DongleVersion_Uint64 = 1022, |
272 | | Prop_BlockServerShutdown_Bool = 1023, |
273 | | Prop_CanUnifyCoordinateSystemWithHmd_Bool = 1024, |
274 | | Prop_ContainsProximitySensor_Bool = 1025, |
275 | | Prop_DeviceProvidesBatteryStatus_Bool = 1026, |
276 | | Prop_DeviceCanPowerOff_Bool = 1027, |
277 | | Prop_Firmware_ProgrammingTarget_String = 1028, |
278 | | Prop_DeviceClass_Int32 = 1029, |
279 | | Prop_HasCamera_Bool = 1030, |
280 | | Prop_DriverVersion_String = 1031, |
281 | | Prop_Firmware_ForceUpdateRequired_Bool = 1032, |
282 | | Prop_ViveSystemButtonFixRequired_Bool = 1033, |
283 | | Prop_ParentDriver_Uint64 = 1034, |
284 | | Prop_ResourceRoot_String = 1035, |
285 | | Prop_RegisteredDeviceType_String = 1036, |
286 | | Prop_InputProfilePath_String = 1037, // input profile to use for this device in the input system. Will default to tracking system name if this isn't provided |
287 | | Prop_NeverTracked_Bool = 1038, // Used for devices that will never have a valid pose by design |
288 | | Prop_NumCameras_Int32 = 1039, |
289 | | Prop_CameraFrameLayout_Int32 = 1040, // EVRTrackedCameraFrameLayout value |
290 | | |
291 | | // Properties that are unique to TrackedDeviceClass_HMD |
292 | | Prop_ReportsTimeSinceVSync_Bool = 2000, |
293 | | Prop_SecondsFromVsyncToPhotons_Float = 2001, |
294 | | Prop_DisplayFrequency_Float = 2002, |
295 | | Prop_UserIpdMeters_Float = 2003, |
296 | | Prop_CurrentUniverseId_Uint64 = 2004, |
297 | | Prop_PreviousUniverseId_Uint64 = 2005, |
298 | | Prop_DisplayFirmwareVersion_Uint64 = 2006, |
299 | | Prop_IsOnDesktop_Bool = 2007, |
300 | | Prop_DisplayMCType_Int32 = 2008, |
301 | | Prop_DisplayMCOffset_Float = 2009, |
302 | | Prop_DisplayMCScale_Float = 2010, |
303 | | Prop_EdidVendorID_Int32 = 2011, |
304 | | Prop_DisplayMCImageLeft_String = 2012, |
305 | | Prop_DisplayMCImageRight_String = 2013, |
306 | | Prop_DisplayGCBlackClamp_Float = 2014, |
307 | | Prop_EdidProductID_Int32 = 2015, |
308 | | Prop_CameraToHeadTransform_Matrix34 = 2016, |
309 | | Prop_DisplayGCType_Int32 = 2017, |
310 | | Prop_DisplayGCOffset_Float = 2018, |
311 | | Prop_DisplayGCScale_Float = 2019, |
312 | | Prop_DisplayGCPrescale_Float = 2020, |
313 | | Prop_DisplayGCImage_String = 2021, |
314 | | Prop_LensCenterLeftU_Float = 2022, |
315 | | Prop_LensCenterLeftV_Float = 2023, |
316 | | Prop_LensCenterRightU_Float = 2024, |
317 | | Prop_LensCenterRightV_Float = 2025, |
318 | | Prop_UserHeadToEyeDepthMeters_Float = 2026, |
319 | | Prop_CameraFirmwareVersion_Uint64 = 2027, |
320 | | Prop_CameraFirmwareDescription_String = 2028, |
321 | | Prop_DisplayFPGAVersion_Uint64 = 2029, |
322 | | Prop_DisplayBootloaderVersion_Uint64 = 2030, |
323 | | Prop_DisplayHardwareVersion_Uint64 = 2031, |
324 | | Prop_AudioFirmwareVersion_Uint64 = 2032, |
325 | | Prop_CameraCompatibilityMode_Int32 = 2033, |
326 | | Prop_ScreenshotHorizontalFieldOfViewDegrees_Float = 2034, |
327 | | Prop_ScreenshotVerticalFieldOfViewDegrees_Float = 2035, |
328 | | Prop_DisplaySuppressed_Bool = 2036, |
329 | | Prop_DisplayAllowNightMode_Bool = 2037, |
330 | | Prop_DisplayMCImageWidth_Int32 = 2038, |
331 | | Prop_DisplayMCImageHeight_Int32 = 2039, |
332 | | Prop_DisplayMCImageNumChannels_Int32 = 2040, |
333 | | Prop_DisplayMCImageData_Binary = 2041, |
334 | | Prop_SecondsFromPhotonsToVblank_Float = 2042, |
335 | | Prop_DriverDirectModeSendsVsyncEvents_Bool = 2043, |
336 | | Prop_DisplayDebugMode_Bool = 2044, |
337 | | Prop_GraphicsAdapterLuid_Uint64 = 2045, |
338 | | Prop_DriverProvidedChaperonePath_String = 2048, |
339 | | Prop_ExpectedTrackingReferenceCount_Int32 = 2049, // expected number of sensors or basestations to reserve UI space for |
340 | | Prop_ExpectedControllerCount_Int32 = 2050, // expected number of tracked controllers to reserve UI space for |
341 | | Prop_NamedIconPathControllerLeftDeviceOff_String = 2051, // placeholder icon for "left" controller if not yet detected/loaded |
342 | | Prop_NamedIconPathControllerRightDeviceOff_String = 2052, // placeholder icon for "right" controller if not yet detected/loaded |
343 | | Prop_NamedIconPathTrackingReferenceDeviceOff_String = 2053, // placeholder icon for sensor/base if not yet detected/loaded |
344 | | Prop_DoNotApplyPrediction_Bool = 2054, |
345 | | Prop_CameraToHeadTransforms_Matrix34_Array = 2055, |
346 | | Prop_DistortionMeshResolution_Int32 = 2056, // custom resolution of compositor calls to IVRSystem::ComputeDistortion |
347 | | Prop_DriverIsDrawingControllers_Bool = 2057, |
348 | | Prop_DriverRequestsApplicationPause_Bool = 2058, |
349 | | Prop_DriverRequestsReducedRendering_Bool = 2059, |
350 | | Prop_MinimumIpdStepMeters_Float = 2060, |
351 | | Prop_AudioBridgeFirmwareVersion_Uint64 = 2061, |
352 | | Prop_ImageBridgeFirmwareVersion_Uint64 = 2062, |
353 | | |
354 | | // Properties that are unique to TrackedDeviceClass_Controller |
355 | | Prop_AttachedDeviceId_String = 3000, |
356 | | Prop_SupportedButtons_Uint64 = 3001, |
357 | | Prop_Axis0Type_Int32 = 3002, // Return value is of type EVRControllerAxisType |
358 | | Prop_Axis1Type_Int32 = 3003, // Return value is of type EVRControllerAxisType |
359 | | Prop_Axis2Type_Int32 = 3004, // Return value is of type EVRControllerAxisType |
360 | | Prop_Axis3Type_Int32 = 3005, // Return value is of type EVRControllerAxisType |
361 | | Prop_Axis4Type_Int32 = 3006, // Return value is of type EVRControllerAxisType |
362 | | Prop_ControllerRoleHint_Int32 = 3007, // Return value is of type ETrackedControllerRole |
363 | | |
364 | | // Properties that are unique to TrackedDeviceClass_TrackingReference |
365 | | Prop_FieldOfViewLeftDegrees_Float = 4000, |
366 | | Prop_FieldOfViewRightDegrees_Float = 4001, |
367 | | Prop_FieldOfViewTopDegrees_Float = 4002, |
368 | | Prop_FieldOfViewBottomDegrees_Float = 4003, |
369 | | Prop_TrackingRangeMinimumMeters_Float = 4004, |
370 | | Prop_TrackingRangeMaximumMeters_Float = 4005, |
371 | | Prop_ModeLabel_String = 4006, |
372 | | |
373 | | // Properties that are used for user interface like icons names |
374 | | Prop_IconPathName_String = 5000, // DEPRECATED. Value not referenced. Now expected to be part of icon path properties. |
375 | | Prop_NamedIconPathDeviceOff_String = 5001, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others |
376 | | Prop_NamedIconPathDeviceSearching_String = 5002, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others |
377 | | Prop_NamedIconPathDeviceSearchingAlert_String = 5003, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others |
378 | | Prop_NamedIconPathDeviceReady_String = 5004, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others |
379 | | Prop_NamedIconPathDeviceReadyAlert_String = 5005, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others |
380 | | Prop_NamedIconPathDeviceNotReady_String = 5006, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others |
381 | | Prop_NamedIconPathDeviceStandby_String = 5007, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others |
382 | | Prop_NamedIconPathDeviceAlertLow_String = 5008, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others |
383 | | |
384 | | // Properties that are used by helpers, but are opaque to applications |
385 | | Prop_DisplayHiddenArea_Binary_Start = 5100, |
386 | | Prop_DisplayHiddenArea_Binary_End = 5150, |
387 | | Prop_ParentContainer = 5151, |
388 | | |
389 | | // Properties that are unique to drivers |
390 | | Prop_UserConfigPath_String = 6000, |
391 | | Prop_InstallPath_String = 6001, |
392 | | Prop_HasDisplayComponent_Bool = 6002, |
393 | | Prop_HasControllerComponent_Bool = 6003, |
394 | | Prop_HasCameraComponent_Bool = 6004, |
395 | | Prop_HasDriverDirectModeComponent_Bool = 6005, |
396 | | Prop_HasVirtualDisplayComponent_Bool = 6006, |
397 | | |
398 | | // Properties that are set internally based on other information provided by drivers |
399 | | Prop_ControllerType_String = 7000, |
400 | | Prop_LegacyInputProfile_String = 7001, |
401 | | |
402 | | // Vendors are free to expose private debug data in this reserved region |
403 | | Prop_VendorSpecific_Reserved_Start = 10000, |
404 | | Prop_VendorSpecific_Reserved_End = 10999, |
405 | | |
406 | | Prop_TrackedDeviceProperty_Max = 1000000, |
407 | | }; |
408 | | |
409 | | /** No string property will ever be longer than this length */ |
410 | | static const uint32_t k_unMaxPropertyStringSize = 32 * 1024; |
411 | | |
412 | | /** Used to return errors that occur when reading properties. */ |
413 | | enum ETrackedPropertyError |
414 | | { |
415 | | TrackedProp_Success = 0, |
416 | | TrackedProp_WrongDataType = 1, |
417 | | TrackedProp_WrongDeviceClass = 2, |
418 | | TrackedProp_BufferTooSmall = 3, |
419 | | TrackedProp_UnknownProperty = 4, // Driver has not set the property (and may not ever). |
420 | | TrackedProp_InvalidDevice = 5, |
421 | | TrackedProp_CouldNotContactServer = 6, |
422 | | TrackedProp_ValueNotProvidedByDevice = 7, |
423 | | TrackedProp_StringExceedsMaximumLength = 8, |
424 | | TrackedProp_NotYetAvailable = 9, // The property value isn't known yet, but is expected soon. Call again later. |
425 | | TrackedProp_PermissionDenied = 10, |
426 | | TrackedProp_InvalidOperation = 11, |
427 | | TrackedProp_CannotWriteToWildcards = 12, |
428 | | }; |
429 | | |
430 | | /** Allows the application to control what part of the provided texture will be used in the |
431 | | * frame buffer. */ |
432 | | struct VRTextureBounds_t |
433 | | { |
434 | | float uMin, vMin; |
435 | | float uMax, vMax; |
436 | | }; |
437 | | |
438 | | /** Allows specifying pose used to render provided scene texture (if different from value returned by WaitGetPoses). */ |
439 | | struct VRTextureWithPose_t : public Texture_t |
440 | | { |
441 | | HmdMatrix34_t mDeviceToAbsoluteTracking; // Actual pose used to render scene textures. |
442 | | }; |
443 | | |
444 | | struct VRTextureDepthInfo_t |
445 | | { |
446 | | void* handle; // See ETextureType definition above |
447 | | HmdMatrix44_t mProjection; |
448 | | HmdVector2_t vRange; // 0..1 |
449 | | }; |
450 | | |
451 | | struct VRTextureWithDepth_t : public Texture_t |
452 | | { |
453 | | VRTextureDepthInfo_t depth; |
454 | | }; |
455 | | |
456 | | struct VRTextureWithPoseAndDepth_t : public VRTextureWithPose_t |
457 | | { |
458 | | VRTextureDepthInfo_t depth; |
459 | | }; |
460 | | |
461 | | /** Allows the application to control how scene textures are used by the compositor when calling Submit. */ |
462 | | enum EVRSubmitFlags |
463 | | { |
464 | | // Simple render path. App submits rendered left and right eye images with no lens distortion correction applied. |
465 | | Submit_Default = 0x00, |
466 | | |
467 | | // App submits final left and right eye images with lens distortion already applied (lens distortion makes the images appear |
468 | | // barrel distorted with chromatic aberration correction applied). The app would have used the data returned by |
469 | | // vr::IVRSystem::ComputeDistortion() to apply the correct distortion to the rendered images before calling Submit(). |
470 | | Submit_LensDistortionAlreadyApplied = 0x01, |
471 | | |
472 | | // If the texture pointer passed in is actually a renderbuffer (e.g. for MSAA in OpenGL) then set this flag. |
473 | | Submit_GlRenderBuffer = 0x02, |
474 | | |
475 | | // Do not use |
476 | | Submit_Reserved = 0x04, |
477 | | |
478 | | // Set to indicate that pTexture is a pointer to a VRTextureWithPose_t. |
479 | | // This flag can be combined with Submit_TextureWithDepth to pass a VRTextureWithPoseAndDepth_t. |
480 | | Submit_TextureWithPose = 0x08, |
481 | | |
482 | | // Set to indicate that pTexture is a pointer to a VRTextureWithDepth_t. |
483 | | // This flag can be combined with Submit_TextureWithPose to pass a VRTextureWithPoseAndDepth_t. |
484 | | Submit_TextureWithDepth = 0x10, |
485 | | }; |
486 | | |
487 | | /** Data required for passing Vulkan textures to IVRCompositor::Submit. |
488 | | * Be sure to call OpenVR_Shutdown before destroying these resources. */ |
489 | | struct VRVulkanTextureData_t |
490 | | { |
491 | | uint64_t m_nImage; // VkImage |
492 | | VkDevice_T *m_pDevice; |
493 | | VkPhysicalDevice_T *m_pPhysicalDevice; |
494 | | VkInstance_T *m_pInstance; |
495 | | VkQueue_T *m_pQueue; |
496 | | uint32_t m_nQueueFamilyIndex; |
497 | | uint32_t m_nWidth, m_nHeight, m_nFormat, m_nSampleCount; |
498 | | }; |
499 | | |
500 | | /** Data required for passing D3D12 textures to IVRCompositor::Submit. |
501 | | * Be sure to call OpenVR_Shutdown before destroying these resources. */ |
502 | | struct D3D12TextureData_t |
503 | | { |
504 | | ID3D12Resource *m_pResource; |
505 | | ID3D12CommandQueue *m_pCommandQueue; |
506 | | uint32_t m_nNodeMask; |
507 | | }; |
508 | | |
509 | | /** Status of the overall system or tracked objects */ |
510 | | enum EVRState |
511 | | { |
512 | | VRState_Undefined = -1, |
513 | | VRState_Off = 0, |
514 | | VRState_Searching = 1, |
515 | | VRState_Searching_Alert = 2, |
516 | | VRState_Ready = 3, |
517 | | VRState_Ready_Alert = 4, |
518 | | VRState_NotReady = 5, |
519 | | VRState_Standby = 6, |
520 | | VRState_Ready_Alert_Low = 7, |
521 | | }; |
522 | | |
523 | | /** The types of events that could be posted (and what the parameters mean for each event type) */ |
524 | | enum EVREventType |
525 | | { |
526 | | VREvent_None = 0, |
527 | | |
528 | | VREvent_TrackedDeviceActivated = 100, |
529 | | VREvent_TrackedDeviceDeactivated = 101, |
530 | | VREvent_TrackedDeviceUpdated = 102, |
531 | | VREvent_TrackedDeviceUserInteractionStarted = 103, |
532 | | VREvent_TrackedDeviceUserInteractionEnded = 104, |
533 | | VREvent_IpdChanged = 105, |
534 | | VREvent_EnterStandbyMode = 106, |
535 | | VREvent_LeaveStandbyMode = 107, |
536 | | VREvent_TrackedDeviceRoleChanged = 108, |
537 | | VREvent_WatchdogWakeUpRequested = 109, |
538 | | VREvent_LensDistortionChanged = 110, |
539 | | VREvent_PropertyChanged = 111, |
540 | | VREvent_WirelessDisconnect = 112, |
541 | | VREvent_WirelessReconnect = 113, |
542 | | |
543 | | VREvent_ButtonPress = 200, // data is controller |
544 | | VREvent_ButtonUnpress = 201, // data is controller |
545 | | VREvent_ButtonTouch = 202, // data is controller |
546 | | VREvent_ButtonUntouch = 203, // data is controller |
547 | | |
548 | | VREvent_DualAnalog_Press = 250, // data is dualAnalog |
549 | | VREvent_DualAnalog_Unpress = 251, // data is dualAnalog |
550 | | VREvent_DualAnalog_Touch = 252, // data is dualAnalog |
551 | | VREvent_DualAnalog_Untouch = 253, // data is dualAnalog |
552 | | VREvent_DualAnalog_Move = 254, // data is dualAnalog |
553 | | VREvent_DualAnalog_ModeSwitch1 = 255, // data is dualAnalog |
554 | | VREvent_DualAnalog_ModeSwitch2 = 256, // data is dualAnalog |
555 | | VREvent_DualAnalog_Cancel = 257, // data is dualAnalog |
556 | | |
557 | | VREvent_MouseMove = 300, // data is mouse |
558 | | VREvent_MouseButtonDown = 301, // data is mouse |
559 | | VREvent_MouseButtonUp = 302, // data is mouse |
560 | | VREvent_FocusEnter = 303, // data is overlay |
561 | | VREvent_FocusLeave = 304, // data is overlay |
562 | | VREvent_Scroll = 305, // data is mouse |
563 | | VREvent_TouchPadMove = 306, // data is mouse |
564 | | VREvent_OverlayFocusChanged = 307, // data is overlay, global event |
565 | | |
566 | | VREvent_InputFocusCaptured = 400, // data is process DEPRECATED |
567 | | VREvent_InputFocusReleased = 401, // data is process DEPRECATED |
568 | | VREvent_SceneFocusLost = 402, // data is process |
569 | | VREvent_SceneFocusGained = 403, // data is process |
570 | | VREvent_SceneApplicationChanged = 404, // data is process - The App actually drawing the scene changed (usually to or from the compositor) |
571 | | VREvent_SceneFocusChanged = 405, // data is process - New app got access to draw the scene |
572 | | VREvent_InputFocusChanged = 406, // data is process |
573 | | VREvent_SceneApplicationSecondaryRenderingStarted = 407, // data is process |
574 | | VREvent_SceneApplicationUsingWrongGraphicsAdapter = 408, // data is process |
575 | | VREvent_ActionBindingReloaded = 409, // data is process - The App that action binds reloaded for |
576 | | |
577 | | VREvent_HideRenderModels = 410, // Sent to the scene application to request hiding render models temporarily |
578 | | VREvent_ShowRenderModels = 411, // Sent to the scene application to request restoring render model visibility |
579 | | |
580 | | VREvent_ConsoleOpened = 420, |
581 | | VREvent_ConsoleClosed = 421, |
582 | | |
583 | | VREvent_OverlayShown = 500, |
584 | | VREvent_OverlayHidden = 501, |
585 | | VREvent_DashboardActivated = 502, |
586 | | VREvent_DashboardDeactivated = 503, |
587 | | VREvent_DashboardThumbSelected = 504, // Sent to the overlay manager - data is overlay |
588 | | VREvent_DashboardRequested = 505, // Sent to the overlay manager - data is overlay |
589 | | VREvent_ResetDashboard = 506, // Send to the overlay manager |
590 | | VREvent_RenderToast = 507, // Send to the dashboard to render a toast - data is the notification ID |
591 | | VREvent_ImageLoaded = 508, // Sent to overlays when a SetOverlayRaw or SetOverlayFromFile call finishes loading |
592 | | VREvent_ShowKeyboard = 509, // Sent to keyboard renderer in the dashboard to invoke it |
593 | | VREvent_HideKeyboard = 510, // Sent to keyboard renderer in the dashboard to hide it |
594 | | VREvent_OverlayGamepadFocusGained = 511, // Sent to an overlay when IVROverlay::SetFocusOverlay is called on it |
595 | | VREvent_OverlayGamepadFocusLost = 512, // Send to an overlay when it previously had focus and IVROverlay::SetFocusOverlay is called on something else |
596 | | VREvent_OverlaySharedTextureChanged = 513, |
597 | | //VREvent_DashboardGuideButtonDown = 514, // These are no longer sent |
598 | | //VREvent_DashboardGuideButtonUp = 515, |
599 | | VREvent_ScreenshotTriggered = 516, // Screenshot button combo was pressed, Dashboard should request a screenshot |
600 | | VREvent_ImageFailed = 517, // Sent to overlays when a SetOverlayRaw or SetOverlayfromFail fails to load |
601 | | VREvent_DashboardOverlayCreated = 518, |
602 | | VREvent_SwitchGamepadFocus = 519, |
603 | | |
604 | | // Screenshot API |
605 | | VREvent_RequestScreenshot = 520, // Sent by vrclient application to compositor to take a screenshot |
606 | | VREvent_ScreenshotTaken = 521, // Sent by compositor to the application that the screenshot has been taken |
607 | | VREvent_ScreenshotFailed = 522, // Sent by compositor to the application that the screenshot failed to be taken |
608 | | VREvent_SubmitScreenshotToDashboard = 523, // Sent by compositor to the dashboard that a completed screenshot was submitted |
609 | | VREvent_ScreenshotProgressToDashboard = 524, // Sent by compositor to the dashboard that a completed screenshot was submitted |
610 | | |
611 | | VREvent_PrimaryDashboardDeviceChanged = 525, |
612 | | VREvent_RoomViewShown = 526, // Sent by compositor whenever room-view is enabled |
613 | | VREvent_RoomViewHidden = 527, // Sent by compositor whenever room-view is disabled |
614 | | |
615 | | VREvent_Notification_Shown = 600, |
616 | | VREvent_Notification_Hidden = 601, |
617 | | VREvent_Notification_BeginInteraction = 602, |
618 | | VREvent_Notification_Destroyed = 603, |
619 | | |
620 | | VREvent_Quit = 700, // data is process |
621 | | VREvent_ProcessQuit = 701, // data is process |
622 | | VREvent_QuitAborted_UserPrompt = 702, // data is process |
623 | | VREvent_QuitAcknowledged = 703, // data is process |
624 | | VREvent_DriverRequestedQuit = 704, // The driver has requested that SteamVR shut down |
625 | | |
626 | | VREvent_ChaperoneDataHasChanged = 800, |
627 | | VREvent_ChaperoneUniverseHasChanged = 801, |
628 | | VREvent_ChaperoneTempDataHasChanged = 802, |
629 | | VREvent_ChaperoneSettingsHaveChanged = 803, |
630 | | VREvent_SeatedZeroPoseReset = 804, |
631 | | |
632 | | VREvent_AudioSettingsHaveChanged = 820, |
633 | | |
634 | | VREvent_BackgroundSettingHasChanged = 850, |
635 | | VREvent_CameraSettingsHaveChanged = 851, |
636 | | VREvent_ReprojectionSettingHasChanged = 852, |
637 | | VREvent_ModelSkinSettingsHaveChanged = 853, |
638 | | VREvent_EnvironmentSettingsHaveChanged = 854, |
639 | | VREvent_PowerSettingsHaveChanged = 855, |
640 | | VREvent_EnableHomeAppSettingsHaveChanged = 856, |
641 | | VREvent_SteamVRSectionSettingChanged = 857, |
642 | | VREvent_LighthouseSectionSettingChanged = 858, |
643 | | VREvent_NullSectionSettingChanged = 859, |
644 | | VREvent_UserInterfaceSectionSettingChanged = 860, |
645 | | VREvent_NotificationsSectionSettingChanged = 861, |
646 | | VREvent_KeyboardSectionSettingChanged = 862, |
647 | | VREvent_PerfSectionSettingChanged = 863, |
648 | | VREvent_DashboardSectionSettingChanged = 864, |
649 | | VREvent_WebInterfaceSectionSettingChanged = 865, |
650 | | |
651 | | VREvent_StatusUpdate = 900, |
652 | | |
653 | | VREvent_WebInterface_InstallDriverCompleted = 950, |
654 | | |
655 | | VREvent_MCImageUpdated = 1000, |
656 | | |
657 | | VREvent_FirmwareUpdateStarted = 1100, |
658 | | VREvent_FirmwareUpdateFinished = 1101, |
659 | | |
660 | | VREvent_KeyboardClosed = 1200, |
661 | | VREvent_KeyboardCharInput = 1201, |
662 | | VREvent_KeyboardDone = 1202, // Sent when DONE button clicked on keyboard |
663 | | |
664 | | VREvent_ApplicationTransitionStarted = 1300, |
665 | | VREvent_ApplicationTransitionAborted = 1301, |
666 | | VREvent_ApplicationTransitionNewAppStarted = 1302, |
667 | | VREvent_ApplicationListUpdated = 1303, |
668 | | VREvent_ApplicationMimeTypeLoad = 1304, |
669 | | VREvent_ApplicationTransitionNewAppLaunchComplete = 1305, |
670 | | VREvent_ProcessConnected = 1306, |
671 | | VREvent_ProcessDisconnected = 1307, |
672 | | |
673 | | VREvent_Compositor_MirrorWindowShown = 1400, |
674 | | VREvent_Compositor_MirrorWindowHidden = 1401, |
675 | | VREvent_Compositor_ChaperoneBoundsShown = 1410, |
676 | | VREvent_Compositor_ChaperoneBoundsHidden = 1411, |
677 | | |
678 | | VREvent_TrackedCamera_StartVideoStream = 1500, |
679 | | VREvent_TrackedCamera_StopVideoStream = 1501, |
680 | | VREvent_TrackedCamera_PauseVideoStream = 1502, |
681 | | VREvent_TrackedCamera_ResumeVideoStream = 1503, |
682 | | VREvent_TrackedCamera_EditingSurface = 1550, |
683 | | |
684 | | VREvent_PerformanceTest_EnableCapture = 1600, |
685 | | VREvent_PerformanceTest_DisableCapture = 1601, |
686 | | VREvent_PerformanceTest_FidelityLevel = 1602, |
687 | | |
688 | | VREvent_MessageOverlay_Closed = 1650, |
689 | | VREvent_MessageOverlayCloseRequested = 1651, |
690 | | |
691 | | VREvent_Input_HapticVibration = 1700, // data is hapticVibration |
692 | | |
693 | | // Vendors are free to expose private events in this reserved region |
694 | | VREvent_VendorSpecific_Reserved_Start = 10000, |
695 | | VREvent_VendorSpecific_Reserved_End = 19999, |
696 | | }; |
697 | | |
698 | | |
699 | | /** Level of Hmd activity */ |
700 | | // UserInteraction_Timeout means the device is in the process of timing out. |
701 | | // InUse = ( k_EDeviceActivityLevel_UserInteraction || k_EDeviceActivityLevel_UserInteraction_Timeout ) |
702 | | // VREvent_TrackedDeviceUserInteractionStarted fires when the devices transitions from Standby -> UserInteraction or Idle -> UserInteraction. |
703 | | // VREvent_TrackedDeviceUserInteractionEnded fires when the devices transitions from UserInteraction_Timeout -> Idle |
704 | | enum EDeviceActivityLevel |
705 | | { |
706 | | k_EDeviceActivityLevel_Unknown = -1, |
707 | | k_EDeviceActivityLevel_Idle = 0, // No activity for the last 10 seconds |
708 | | k_EDeviceActivityLevel_UserInteraction = 1, // Activity (movement or prox sensor) is happening now |
709 | | k_EDeviceActivityLevel_UserInteraction_Timeout = 2, // No activity for the last 0.5 seconds |
710 | | k_EDeviceActivityLevel_Standby = 3, // Idle for at least 5 seconds (configurable in Settings -> Power Management) |
711 | | }; |
712 | | |
713 | | |
714 | | /** VR controller button and axis IDs */ |
715 | | enum EVRButtonId |
716 | | { |
717 | | k_EButton_System = 0, |
718 | | k_EButton_ApplicationMenu = 1, |
719 | | k_EButton_Grip = 2, |
720 | | k_EButton_DPad_Left = 3, |
721 | | k_EButton_DPad_Up = 4, |
722 | | k_EButton_DPad_Right = 5, |
723 | | k_EButton_DPad_Down = 6, |
724 | | k_EButton_A = 7, |
725 | | |
726 | | k_EButton_ProximitySensor = 31, |
727 | | |
728 | | k_EButton_Axis0 = 32, |
729 | | k_EButton_Axis1 = 33, |
730 | | k_EButton_Axis2 = 34, |
731 | | k_EButton_Axis3 = 35, |
732 | | k_EButton_Axis4 = 36, |
733 | | |
734 | | // aliases for well known controllers |
735 | | k_EButton_SteamVR_Touchpad = k_EButton_Axis0, |
736 | | k_EButton_SteamVR_Trigger = k_EButton_Axis1, |
737 | | |
738 | | k_EButton_Dashboard_Back = k_EButton_Grip, |
739 | | |
740 | | k_EButton_Max = 64 |
741 | | }; |
742 | | |
743 | 0 | inline uint64_t ButtonMaskFromId( EVRButtonId id ) { return 1ull << id; } |
744 | | |
745 | | /** used for controller button events */ |
746 | | struct VREvent_Controller_t |
747 | | { |
748 | | uint32_t button; // EVRButtonId enum |
749 | | }; |
750 | | |
751 | | |
752 | | /** used for simulated mouse events in overlay space */ |
753 | | enum EVRMouseButton |
754 | | { |
755 | | VRMouseButton_Left = 0x0001, |
756 | | VRMouseButton_Right = 0x0002, |
757 | | VRMouseButton_Middle = 0x0004, |
758 | | }; |
759 | | |
760 | | |
761 | | /** used for simulated mouse events in overlay space */ |
762 | | struct VREvent_Mouse_t |
763 | | { |
764 | | float x, y; // co-ords are in GL space, bottom left of the texture is 0,0 |
765 | | uint32_t button; // EVRMouseButton enum |
766 | | }; |
767 | | |
768 | | /** used for simulated mouse wheel scroll in overlay space */ |
769 | | struct VREvent_Scroll_t |
770 | | { |
771 | | float xdelta, ydelta; // movement in fraction of the pad traversed since last delta, 1.0 for a full swipe |
772 | | uint32_t repeatCount; |
773 | | }; |
774 | | |
775 | | /** when in mouse input mode you can receive data from the touchpad, these events are only sent if the users finger |
776 | | is on the touchpad (or just released from it). These events are sent to overlays with the VROverlayFlags_SendVRTouchpadEvents |
777 | | flag set. |
778 | | **/ |
779 | | struct VREvent_TouchPadMove_t |
780 | | { |
781 | | // true if the users finger is detected on the touch pad |
782 | | bool bFingerDown; |
783 | | |
784 | | // How long the finger has been down in seconds |
785 | | float flSecondsFingerDown; |
786 | | |
787 | | // These values indicate the starting finger position (so you can do some basic swipe stuff) |
788 | | float fValueXFirst; |
789 | | float fValueYFirst; |
790 | | |
791 | | // This is the raw sampled coordinate without deadzoning |
792 | | float fValueXRaw; |
793 | | float fValueYRaw; |
794 | | }; |
795 | | |
796 | | /** notification related events. Details will still change at this point */ |
797 | | struct VREvent_Notification_t |
798 | | { |
799 | | uint64_t ulUserValue; |
800 | | uint32_t notificationId; |
801 | | }; |
802 | | |
803 | | /** Used for events about processes */ |
804 | | struct VREvent_Process_t |
805 | | { |
806 | | uint32_t pid; |
807 | | uint32_t oldPid; |
808 | | bool bForced; |
809 | | }; |
810 | | |
811 | | |
812 | | /** Used for a few events about overlays */ |
813 | | struct VREvent_Overlay_t |
814 | | { |
815 | | uint64_t overlayHandle; |
816 | | uint64_t devicePath; |
817 | | }; |
818 | | |
819 | | |
820 | | /** Used for a few events about overlays */ |
821 | | struct VREvent_Status_t |
822 | | { |
823 | | uint32_t statusState; // EVRState enum |
824 | | }; |
825 | | |
826 | | /** Used for keyboard events **/ |
827 | | struct VREvent_Keyboard_t |
828 | | { |
829 | | char cNewInput[8]; // Up to 11 bytes of new input |
830 | | uint64_t uUserValue; // Possible flags about the new input |
831 | | }; |
832 | | |
833 | | struct VREvent_Ipd_t |
834 | | { |
835 | | float ipdMeters; |
836 | | }; |
837 | | |
838 | | struct VREvent_Chaperone_t |
839 | | { |
840 | | uint64_t m_nPreviousUniverse; |
841 | | uint64_t m_nCurrentUniverse; |
842 | | }; |
843 | | |
844 | | /** Not actually used for any events */ |
845 | | struct VREvent_Reserved_t |
846 | | { |
847 | | uint64_t reserved0; |
848 | | uint64_t reserved1; |
849 | | uint64_t reserved2; |
850 | | uint64_t reserved3; |
851 | | }; |
852 | | |
853 | | struct VREvent_PerformanceTest_t |
854 | | { |
855 | | uint32_t m_nFidelityLevel; |
856 | | }; |
857 | | |
858 | | struct VREvent_SeatedZeroPoseReset_t |
859 | | { |
860 | | bool bResetBySystemMenu; |
861 | | }; |
862 | | |
863 | | struct VREvent_Screenshot_t |
864 | | { |
865 | | uint32_t handle; |
866 | | uint32_t type; |
867 | | }; |
868 | | |
869 | | struct VREvent_ScreenshotProgress_t |
870 | | { |
871 | | float progress; |
872 | | }; |
873 | | |
874 | | struct VREvent_ApplicationLaunch_t |
875 | | { |
876 | | uint32_t pid; |
877 | | uint32_t unArgsHandle; |
878 | | }; |
879 | | |
880 | | struct VREvent_EditingCameraSurface_t |
881 | | { |
882 | | uint64_t overlayHandle; |
883 | | uint32_t nVisualMode; |
884 | | }; |
885 | | |
886 | | struct VREvent_MessageOverlay_t |
887 | | { |
888 | | uint32_t unVRMessageOverlayResponse; // vr::VRMessageOverlayResponse enum |
889 | | }; |
890 | | |
891 | | struct VREvent_Property_t |
892 | | { |
893 | | PropertyContainerHandle_t container; |
894 | | ETrackedDeviceProperty prop; |
895 | | }; |
896 | | |
897 | | enum EDualAnalogWhich |
898 | | { |
899 | | k_EDualAnalog_Left = 0, |
900 | | k_EDualAnalog_Right = 1, |
901 | | }; |
902 | | |
903 | | struct VREvent_DualAnalog_t |
904 | | { |
905 | | float x, y; // coordinates are -1..1 analog values |
906 | | float transformedX, transformedY; // transformed by the center and radius numbers provided by the overlay |
907 | | EDualAnalogWhich which; |
908 | | }; |
909 | | |
910 | | struct VREvent_HapticVibration_t |
911 | | { |
912 | | uint64_t containerHandle; // property container handle of the device with the haptic component |
913 | | uint64_t componentHandle; // Which haptic component needs to vibrate |
914 | | float fDurationSeconds; |
915 | | float fFrequency; |
916 | | float fAmplitude; |
917 | | }; |
918 | | |
919 | | struct VREvent_WebConsole_t |
920 | | { |
921 | | WebConsoleHandle_t webConsoleHandle; |
922 | | }; |
923 | | |
924 | | /** NOTE!!! If you change this you MUST manually update openvr_interop.cs.py */ |
925 | | typedef union |
926 | | { |
927 | | VREvent_Reserved_t reserved; |
928 | | VREvent_Controller_t controller; |
929 | | VREvent_Mouse_t mouse; |
930 | | VREvent_Scroll_t scroll; |
931 | | VREvent_Process_t process; |
932 | | VREvent_Notification_t notification; |
933 | | VREvent_Overlay_t overlay; |
934 | | VREvent_Status_t status; |
935 | | VREvent_Keyboard_t keyboard; |
936 | | VREvent_Ipd_t ipd; |
937 | | VREvent_Chaperone_t chaperone; |
938 | | VREvent_PerformanceTest_t performanceTest; |
939 | | VREvent_TouchPadMove_t touchPadMove; |
940 | | VREvent_SeatedZeroPoseReset_t seatedZeroPoseReset; |
941 | | VREvent_Screenshot_t screenshot; |
942 | | VREvent_ScreenshotProgress_t screenshotProgress; |
943 | | VREvent_ApplicationLaunch_t applicationLaunch; |
944 | | VREvent_EditingCameraSurface_t cameraSurface; |
945 | | VREvent_MessageOverlay_t messageOverlay; |
946 | | VREvent_Property_t property; |
947 | | VREvent_DualAnalog_t dualAnalog; |
948 | | VREvent_HapticVibration_t hapticVibration; |
949 | | VREvent_WebConsole_t webConsole; |
950 | | } VREvent_Data_t; |
951 | | |
952 | | |
953 | | #if defined(__linux__) || defined(__APPLE__) |
954 | | // This structure was originally defined mis-packed on Linux, preserved for |
955 | | // compatibility. |
956 | | #pragma pack( push, 4 ) |
957 | | #endif |
958 | | |
959 | | /** An event posted by the server to all running applications */ |
960 | | struct VREvent_t |
961 | | { |
962 | | uint32_t eventType; // EVREventType enum |
963 | | TrackedDeviceIndex_t trackedDeviceIndex; |
964 | | float eventAgeSeconds; |
965 | | // event data must be the end of the struct as its size is variable |
966 | | VREvent_Data_t data; |
967 | | }; |
968 | | |
969 | | #if defined(__linux__) || defined(__APPLE__) |
970 | | #pragma pack( pop ) |
971 | | #endif |
972 | | |
973 | | enum EVRInputError |
974 | | { |
975 | | VRInputError_None = 0, |
976 | | VRInputError_NameNotFound = 1, |
977 | | VRInputError_WrongType = 2, |
978 | | VRInputError_InvalidHandle = 3, |
979 | | VRInputError_InvalidParam = 4, |
980 | | VRInputError_NoSteam = 5, |
981 | | VRInputError_MaxCapacityReached = 6, |
982 | | VRInputError_IPCError = 7, |
983 | | VRInputError_NoActiveActionSet = 8, |
984 | | VRInputError_InvalidDevice = 9, |
985 | | }; |
986 | | |
987 | | |
988 | | /** The mesh to draw into the stencil (or depth) buffer to perform |
989 | | * early stencil (or depth) kills of pixels that will never appear on the HMD. |
990 | | * This mesh draws on all the pixels that will be hidden after distortion. |
991 | | * |
992 | | * If the HMD does not provide a visible area mesh pVertexData will be |
993 | | * NULL and unTriangleCount will be 0. */ |
994 | | struct HiddenAreaMesh_t |
995 | | { |
996 | | const HmdVector2_t *pVertexData; |
997 | | uint32_t unTriangleCount; |
998 | | }; |
999 | | |
1000 | | |
1001 | | enum EHiddenAreaMeshType |
1002 | | { |
1003 | | k_eHiddenAreaMesh_Standard = 0, |
1004 | | k_eHiddenAreaMesh_Inverse = 1, |
1005 | | k_eHiddenAreaMesh_LineLoop = 2, |
1006 | | |
1007 | | k_eHiddenAreaMesh_Max = 3, |
1008 | | }; |
1009 | | |
1010 | | |
1011 | | /** Identifies what kind of axis is on the controller at index n. Read this type |
1012 | | * with pVRSystem->Get( nControllerDeviceIndex, Prop_Axis0Type_Int32 + n ); |
1013 | | */ |
1014 | | enum EVRControllerAxisType |
1015 | | { |
1016 | | k_eControllerAxis_None = 0, |
1017 | | k_eControllerAxis_TrackPad = 1, |
1018 | | k_eControllerAxis_Joystick = 2, |
1019 | | k_eControllerAxis_Trigger = 3, // Analog trigger data is in the X axis |
1020 | | }; |
1021 | | |
1022 | | |
1023 | | /** contains information about one axis on the controller */ |
1024 | | struct VRControllerAxis_t |
1025 | | { |
1026 | | float x; // Ranges from -1.0 to 1.0 for joysticks and track pads. Ranges from 0.0 to 1.0 for triggers were 0 is fully released. |
1027 | | float y; // Ranges from -1.0 to 1.0 for joysticks and track pads. Is always 0.0 for triggers. |
1028 | | }; |
1029 | | |
1030 | | |
1031 | | /** the number of axes in the controller state */ |
1032 | | static const uint32_t k_unControllerStateAxisCount = 5; |
1033 | | |
1034 | | |
1035 | | #if defined(__linux__) || defined(__APPLE__) |
1036 | | // This structure was originally defined mis-packed on Linux, preserved for |
1037 | | // compatibility. |
1038 | | #pragma pack( push, 4 ) |
1039 | | #endif |
1040 | | |
1041 | | /** Holds all the state of a controller at one moment in time. */ |
1042 | | struct VRControllerState001_t |
1043 | | { |
1044 | | // If packet num matches that on your prior call, then the controller state hasn't been changed since |
1045 | | // your last call and there is no need to process it |
1046 | | uint32_t unPacketNum; |
1047 | | |
1048 | | // bit flags for each of the buttons. Use ButtonMaskFromId to turn an ID into a mask |
1049 | | uint64_t ulButtonPressed; |
1050 | | uint64_t ulButtonTouched; |
1051 | | |
1052 | | // Axis data for the controller's analog inputs |
1053 | | VRControllerAxis_t rAxis[ k_unControllerStateAxisCount ]; |
1054 | | }; |
1055 | | #if defined(__linux__) || defined(__APPLE__) |
1056 | | #pragma pack( pop ) |
1057 | | #endif |
1058 | | |
1059 | | |
1060 | | typedef VRControllerState001_t VRControllerState_t; |
1061 | | |
1062 | | |
1063 | | /** determines how to provide output to the application of various event processing functions. */ |
1064 | | enum EVRControllerEventOutputType |
1065 | | { |
1066 | | ControllerEventOutput_OSEvents = 0, |
1067 | | ControllerEventOutput_VREvents = 1, |
1068 | | }; |
1069 | | |
1070 | | |
1071 | | |
1072 | | /** Collision Bounds Style */ |
1073 | | enum ECollisionBoundsStyle |
1074 | | { |
1075 | | COLLISION_BOUNDS_STYLE_BEGINNER = 0, |
1076 | | COLLISION_BOUNDS_STYLE_INTERMEDIATE, |
1077 | | COLLISION_BOUNDS_STYLE_SQUARES, |
1078 | | COLLISION_BOUNDS_STYLE_ADVANCED, |
1079 | | COLLISION_BOUNDS_STYLE_NONE, |
1080 | | |
1081 | | COLLISION_BOUNDS_STYLE_COUNT |
1082 | | }; |
1083 | | |
1084 | | /** Allows the application to customize how the overlay appears in the compositor */ |
1085 | | struct Compositor_OverlaySettings |
1086 | | { |
1087 | | uint32_t size; // sizeof(Compositor_OverlaySettings) |
1088 | | bool curved, antialias; |
1089 | | float scale, distance, alpha; |
1090 | | float uOffset, vOffset, uScale, vScale; |
1091 | | float gridDivs, gridWidth, gridScale; |
1092 | | HmdMatrix44_t transform; |
1093 | | }; |
1094 | | |
1095 | | /** used to refer to a single VR overlay */ |
1096 | | typedef uint64_t VROverlayHandle_t; |
1097 | | |
1098 | | static const VROverlayHandle_t k_ulOverlayHandleInvalid = 0; |
1099 | | |
1100 | | /** Errors that can occur around VR overlays */ |
1101 | | enum EVROverlayError |
1102 | | { |
1103 | | VROverlayError_None = 0, |
1104 | | |
1105 | | VROverlayError_UnknownOverlay = 10, |
1106 | | VROverlayError_InvalidHandle = 11, |
1107 | | VROverlayError_PermissionDenied = 12, |
1108 | | VROverlayError_OverlayLimitExceeded = 13, // No more overlays could be created because the maximum number already exist |
1109 | | VROverlayError_WrongVisibilityType = 14, |
1110 | | VROverlayError_KeyTooLong = 15, |
1111 | | VROverlayError_NameTooLong = 16, |
1112 | | VROverlayError_KeyInUse = 17, |
1113 | | VROverlayError_WrongTransformType = 18, |
1114 | | VROverlayError_InvalidTrackedDevice = 19, |
1115 | | VROverlayError_InvalidParameter = 20, |
1116 | | VROverlayError_ThumbnailCantBeDestroyed = 21, |
1117 | | VROverlayError_ArrayTooSmall = 22, |
1118 | | VROverlayError_RequestFailed = 23, |
1119 | | VROverlayError_InvalidTexture = 24, |
1120 | | VROverlayError_UnableToLoadFile = 25, |
1121 | | VROverlayError_KeyboardAlreadyInUse = 26, |
1122 | | VROverlayError_NoNeighbor = 27, |
1123 | | VROverlayError_TooManyMaskPrimitives = 29, |
1124 | | VROverlayError_BadMaskPrimitive = 30, |
1125 | | VROverlayError_TextureAlreadyLocked = 31, |
1126 | | VROverlayError_TextureLockCapacityReached = 32, |
1127 | | VROverlayError_TextureNotLocked = 33, |
1128 | | }; |
1129 | | |
1130 | | /** enum values to pass in to VR_Init to identify whether the application will |
1131 | | * draw a 3D scene. */ |
1132 | | enum EVRApplicationType |
1133 | | { |
1134 | | VRApplication_Other = 0, // Some other kind of application that isn't covered by the other entries |
1135 | | VRApplication_Scene = 1, // Application will submit 3D frames |
1136 | | VRApplication_Overlay = 2, // Application only interacts with overlays |
1137 | | VRApplication_Background = 3, // Application should not start SteamVR if it's not already running, and should not |
1138 | | // keep it running if everything else quits. |
1139 | | VRApplication_Utility = 4, // Init should not try to load any drivers. The application needs access to utility |
1140 | | // interfaces (like IVRSettings and IVRApplications) but not hardware. |
1141 | | VRApplication_VRMonitor = 5, // Reserved for vrmonitor |
1142 | | VRApplication_SteamWatchdog = 6,// Reserved for Steam |
1143 | | VRApplication_Bootstrapper = 7, // Start up SteamVR |
1144 | | |
1145 | | VRApplication_Max |
1146 | | }; |
1147 | | |
1148 | | |
1149 | | /** error codes for firmware */ |
1150 | | enum EVRFirmwareError |
1151 | | { |
1152 | | VRFirmwareError_None = 0, |
1153 | | VRFirmwareError_Success = 1, |
1154 | | VRFirmwareError_Fail = 2, |
1155 | | }; |
1156 | | |
1157 | | |
1158 | | /** error codes for notifications */ |
1159 | | enum EVRNotificationError |
1160 | | { |
1161 | | VRNotificationError_OK = 0, |
1162 | | VRNotificationError_InvalidNotificationId = 100, |
1163 | | VRNotificationError_NotificationQueueFull = 101, |
1164 | | VRNotificationError_InvalidOverlayHandle = 102, |
1165 | | VRNotificationError_SystemWithUserValueAlreadyExists = 103, |
1166 | | }; |
1167 | | |
1168 | | |
1169 | | /** error codes returned by Vr_Init */ |
1170 | | |
1171 | | // Please add adequate error description to https://developer.valvesoftware.com/w/index.php?title=Category:SteamVRHelp |
1172 | | enum EVRInitError |
1173 | | { |
1174 | | VRInitError_None = 0, |
1175 | | VRInitError_Unknown = 1, |
1176 | | |
1177 | | VRInitError_Init_InstallationNotFound = 100, |
1178 | | VRInitError_Init_InstallationCorrupt = 101, |
1179 | | VRInitError_Init_VRClientDLLNotFound = 102, |
1180 | | VRInitError_Init_FileNotFound = 103, |
1181 | | VRInitError_Init_FactoryNotFound = 104, |
1182 | | VRInitError_Init_InterfaceNotFound = 105, |
1183 | | VRInitError_Init_InvalidInterface = 106, |
1184 | | VRInitError_Init_UserConfigDirectoryInvalid = 107, |
1185 | | VRInitError_Init_HmdNotFound = 108, |
1186 | | VRInitError_Init_NotInitialized = 109, |
1187 | | VRInitError_Init_PathRegistryNotFound = 110, |
1188 | | VRInitError_Init_NoConfigPath = 111, |
1189 | | VRInitError_Init_NoLogPath = 112, |
1190 | | VRInitError_Init_PathRegistryNotWritable = 113, |
1191 | | VRInitError_Init_AppInfoInitFailed = 114, |
1192 | | VRInitError_Init_Retry = 115, // Used internally to cause retries to vrserver |
1193 | | VRInitError_Init_InitCanceledByUser = 116, // The calling application should silently exit. The user canceled app startup |
1194 | | VRInitError_Init_AnotherAppLaunching = 117, |
1195 | | VRInitError_Init_SettingsInitFailed = 118, |
1196 | | VRInitError_Init_ShuttingDown = 119, |
1197 | | VRInitError_Init_TooManyObjects = 120, |
1198 | | VRInitError_Init_NoServerForBackgroundApp = 121, |
1199 | | VRInitError_Init_NotSupportedWithCompositor = 122, |
1200 | | VRInitError_Init_NotAvailableToUtilityApps = 123, |
1201 | | VRInitError_Init_Internal = 124, |
1202 | | VRInitError_Init_HmdDriverIdIsNone = 125, |
1203 | | VRInitError_Init_HmdNotFoundPresenceFailed = 126, |
1204 | | VRInitError_Init_VRMonitorNotFound = 127, |
1205 | | VRInitError_Init_VRMonitorStartupFailed = 128, |
1206 | | VRInitError_Init_LowPowerWatchdogNotSupported = 129, |
1207 | | VRInitError_Init_InvalidApplicationType = 130, |
1208 | | VRInitError_Init_NotAvailableToWatchdogApps = 131, |
1209 | | VRInitError_Init_WatchdogDisabledInSettings = 132, |
1210 | | VRInitError_Init_VRDashboardNotFound = 133, |
1211 | | VRInitError_Init_VRDashboardStartupFailed = 134, |
1212 | | VRInitError_Init_VRHomeNotFound = 135, |
1213 | | VRInitError_Init_VRHomeStartupFailed = 136, |
1214 | | VRInitError_Init_RebootingBusy = 137, |
1215 | | VRInitError_Init_FirmwareUpdateBusy = 138, |
1216 | | VRInitError_Init_FirmwareRecoveryBusy = 139, |
1217 | | VRInitError_Init_USBServiceBusy = 140, |
1218 | | VRInitError_Init_VRWebHelperStartupFailed = 141, |
1219 | | |
1220 | | VRInitError_Driver_Failed = 200, |
1221 | | VRInitError_Driver_Unknown = 201, |
1222 | | VRInitError_Driver_HmdUnknown = 202, |
1223 | | VRInitError_Driver_NotLoaded = 203, |
1224 | | VRInitError_Driver_RuntimeOutOfDate = 204, |
1225 | | VRInitError_Driver_HmdInUse = 205, |
1226 | | VRInitError_Driver_NotCalibrated = 206, |
1227 | | VRInitError_Driver_CalibrationInvalid = 207, |
1228 | | VRInitError_Driver_HmdDisplayNotFound = 208, |
1229 | | VRInitError_Driver_TrackedDeviceInterfaceUnknown = 209, |
1230 | | // VRInitError_Driver_HmdDisplayNotFoundAfterFix = 210, // not needed: here for historic reasons |
1231 | | VRInitError_Driver_HmdDriverIdOutOfBounds = 211, |
1232 | | VRInitError_Driver_HmdDisplayMirrored = 212, |
1233 | | |
1234 | | VRInitError_IPC_ServerInitFailed = 300, |
1235 | | VRInitError_IPC_ConnectFailed = 301, |
1236 | | VRInitError_IPC_SharedStateInitFailed = 302, |
1237 | | VRInitError_IPC_CompositorInitFailed = 303, |
1238 | | VRInitError_IPC_MutexInitFailed = 304, |
1239 | | VRInitError_IPC_Failed = 305, |
1240 | | VRInitError_IPC_CompositorConnectFailed = 306, |
1241 | | VRInitError_IPC_CompositorInvalidConnectResponse = 307, |
1242 | | VRInitError_IPC_ConnectFailedAfterMultipleAttempts = 308, |
1243 | | |
1244 | | VRInitError_Compositor_Failed = 400, |
1245 | | VRInitError_Compositor_D3D11HardwareRequired = 401, |
1246 | | VRInitError_Compositor_FirmwareRequiresUpdate = 402, |
1247 | | VRInitError_Compositor_OverlayInitFailed = 403, |
1248 | | VRInitError_Compositor_ScreenshotsInitFailed = 404, |
1249 | | VRInitError_Compositor_UnableToCreateDevice = 405, |
1250 | | |
1251 | | VRInitError_VendorSpecific_UnableToConnectToOculusRuntime = 1000, |
1252 | | VRInitError_VendorSpecific_WindowsNotInDevMode = 1001, |
1253 | | |
1254 | | VRInitError_VendorSpecific_HmdFound_CantOpenDevice = 1101, |
1255 | | VRInitError_VendorSpecific_HmdFound_UnableToRequestConfigStart = 1102, |
1256 | | VRInitError_VendorSpecific_HmdFound_NoStoredConfig = 1103, |
1257 | | VRInitError_VendorSpecific_HmdFound_ConfigTooBig = 1104, |
1258 | | VRInitError_VendorSpecific_HmdFound_ConfigTooSmall = 1105, |
1259 | | VRInitError_VendorSpecific_HmdFound_UnableToInitZLib = 1106, |
1260 | | VRInitError_VendorSpecific_HmdFound_CantReadFirmwareVersion = 1107, |
1261 | | VRInitError_VendorSpecific_HmdFound_UnableToSendUserDataStart = 1108, |
1262 | | VRInitError_VendorSpecific_HmdFound_UnableToGetUserDataStart = 1109, |
1263 | | VRInitError_VendorSpecific_HmdFound_UnableToGetUserDataNext = 1110, |
1264 | | VRInitError_VendorSpecific_HmdFound_UserDataAddressRange = 1111, |
1265 | | VRInitError_VendorSpecific_HmdFound_UserDataError = 1112, |
1266 | | VRInitError_VendorSpecific_HmdFound_ConfigFailedSanityCheck = 1113, |
1267 | | |
1268 | | VRInitError_Steam_SteamInstallationNotFound = 2000, |
1269 | | }; |
1270 | | |
1271 | | enum EVRScreenshotType |
1272 | | { |
1273 | | VRScreenshotType_None = 0, |
1274 | | VRScreenshotType_Mono = 1, // left eye only |
1275 | | VRScreenshotType_Stereo = 2, |
1276 | | VRScreenshotType_Cubemap = 3, |
1277 | | VRScreenshotType_MonoPanorama = 4, |
1278 | | VRScreenshotType_StereoPanorama = 5 |
1279 | | }; |
1280 | | |
1281 | | enum EVRScreenshotPropertyFilenames |
1282 | | { |
1283 | | VRScreenshotPropertyFilenames_Preview = 0, |
1284 | | VRScreenshotPropertyFilenames_VR = 1, |
1285 | | }; |
1286 | | |
1287 | | enum EVRTrackedCameraError |
1288 | | { |
1289 | | VRTrackedCameraError_None = 0, |
1290 | | VRTrackedCameraError_OperationFailed = 100, |
1291 | | VRTrackedCameraError_InvalidHandle = 101, |
1292 | | VRTrackedCameraError_InvalidFrameHeaderVersion = 102, |
1293 | | VRTrackedCameraError_OutOfHandles = 103, |
1294 | | VRTrackedCameraError_IPCFailure = 104, |
1295 | | VRTrackedCameraError_NotSupportedForThisDevice = 105, |
1296 | | VRTrackedCameraError_SharedMemoryFailure = 106, |
1297 | | VRTrackedCameraError_FrameBufferingFailure = 107, |
1298 | | VRTrackedCameraError_StreamSetupFailure = 108, |
1299 | | VRTrackedCameraError_InvalidGLTextureId = 109, |
1300 | | VRTrackedCameraError_InvalidSharedTextureHandle = 110, |
1301 | | VRTrackedCameraError_FailedToGetGLTextureId = 111, |
1302 | | VRTrackedCameraError_SharedTextureFailure = 112, |
1303 | | VRTrackedCameraError_NoFrameAvailable = 113, |
1304 | | VRTrackedCameraError_InvalidArgument = 114, |
1305 | | VRTrackedCameraError_InvalidFrameBufferSize = 115, |
1306 | | }; |
1307 | | |
1308 | | enum EVRTrackedCameraFrameLayout |
1309 | | { |
1310 | | EVRTrackedCameraFrameLayout_Mono = 0x0001, |
1311 | | EVRTrackedCameraFrameLayout_Stereo = 0x0002, |
1312 | | EVRTrackedCameraFrameLayout_VerticalLayout = 0x0010, // Stereo frames are Top/Bottom (left/right) |
1313 | | EVRTrackedCameraFrameLayout_HorizontalLayout = 0x0020, // Stereo frames are Left/Right |
1314 | | }; |
1315 | | |
1316 | | enum EVRTrackedCameraFrameType |
1317 | | { |
1318 | | VRTrackedCameraFrameType_Distorted = 0, // This is the camera video frame size in pixels, still distorted. |
1319 | | VRTrackedCameraFrameType_Undistorted, // In pixels, an undistorted inscribed rectangle region without invalid regions. This size is subject to changes shortly. |
1320 | | VRTrackedCameraFrameType_MaximumUndistorted, // In pixels, maximum undistorted with invalid regions. Non zero alpha component identifies valid regions. |
1321 | | MAX_CAMERA_FRAME_TYPES |
1322 | | }; |
1323 | | |
1324 | | typedef uint64_t TrackedCameraHandle_t; |
1325 | | #define INVALID_TRACKED_CAMERA_HANDLE ((vr::TrackedCameraHandle_t)0) |
1326 | | |
1327 | | struct CameraVideoStreamFrameHeader_t |
1328 | | { |
1329 | | EVRTrackedCameraFrameType eFrameType; |
1330 | | |
1331 | | uint32_t nWidth; |
1332 | | uint32_t nHeight; |
1333 | | uint32_t nBytesPerPixel; |
1334 | | |
1335 | | uint32_t nFrameSequence; |
1336 | | |
1337 | | TrackedDevicePose_t standingTrackedDevicePose; |
1338 | | }; |
1339 | | |
1340 | | // Screenshot types |
1341 | | typedef uint32_t ScreenshotHandle_t; |
1342 | | |
1343 | | static const uint32_t k_unScreenshotHandleInvalid = 0; |
1344 | | |
1345 | | /** Frame timing data provided by direct mode drivers. */ |
1346 | | struct DriverDirectMode_FrameTiming |
1347 | | { |
1348 | | uint32_t m_nSize; // Set to sizeof( DriverDirectMode_FrameTiming ) |
1349 | | uint32_t m_nNumFramePresents; // number of times frame was presented |
1350 | | uint32_t m_nNumMisPresented; // number of times frame was presented on a vsync other than it was originally predicted to |
1351 | | uint32_t m_nNumDroppedFrames; // number of additional times previous frame was scanned out (i.e. compositor missed vsync) |
1352 | | uint32_t m_nReprojectionFlags; |
1353 | | }; |
1354 | | |
1355 | | enum EVSync |
1356 | | { |
1357 | | VSync_None, |
1358 | | VSync_WaitRender, // block following render work until vsync |
1359 | | VSync_NoWaitRender, // do not block following render work (allow to get started early) |
1360 | | }; |
1361 | | |
1362 | | #pragma pack( pop ) |
1363 | | |
1364 | | #define VR_INTERFACE |
1365 | | |
1366 | | /* |
1367 | | // figure out how to import from the VR API dll |
1368 | | #if defined(_WIN32) |
1369 | | #ifdef VR_API_EXPORT |
1370 | | #define VR_INTERFACE extern "C" __declspec( dllexport ) |
1371 | | #else |
1372 | | #define VR_INTERFACE extern "C" __declspec( dllimport ) |
1373 | | #endif |
1374 | | |
1375 | | #elif defined(__GNUC__) || defined(COMPILER_GCC) || defined(__APPLE__) |
1376 | | |
1377 | | #ifdef VR_API_EXPORT |
1378 | | #define VR_INTERFACE extern "C" __attribute__((visibility("default"))) |
1379 | | #else |
1380 | | #define VR_INTERFACE extern "C" |
1381 | | #endif |
1382 | | |
1383 | | #else |
1384 | | #error "Unsupported Platform." |
1385 | | #endif |
1386 | | */ |
1387 | | |
1388 | | |
1389 | | #if defined( _WIN32 ) |
1390 | | #define VR_CALLTYPE __cdecl |
1391 | | #else |
1392 | | #define VR_CALLTYPE |
1393 | | #endif |
1394 | | |
1395 | | } // namespace vr |
1396 | | |
1397 | | #endif // _INCLUDE_VRTYPES_H |
1398 | | |
1399 | | |
1400 | | // vrannotation.h |
1401 | | #ifdef API_GEN |
1402 | | # define VR_CLANG_ATTR(ATTR) __attribute__((annotate( ATTR ))) |
1403 | | #else |
1404 | | # define VR_CLANG_ATTR(ATTR) |
1405 | | #endif |
1406 | | |
1407 | | #define VR_METHOD_DESC(DESC) VR_CLANG_ATTR( "desc:" #DESC ";" ) |
1408 | | #define VR_IGNOREATTR() VR_CLANG_ATTR( "ignore" ) |
1409 | | #define VR_OUT_STRUCT() VR_CLANG_ATTR( "out_struct: ;" ) |
1410 | | #define VR_OUT_STRING() VR_CLANG_ATTR( "out_string: ;" ) |
1411 | | #define VR_OUT_ARRAY_CALL(COUNTER,FUNCTION,PARAMS) VR_CLANG_ATTR( "out_array_call:" #COUNTER "," #FUNCTION "," #PARAMS ";" ) |
1412 | | #define VR_OUT_ARRAY_COUNT(COUNTER) VR_CLANG_ATTR( "out_array_count:" #COUNTER ";" ) |
1413 | | #define VR_ARRAY_COUNT(COUNTER) VR_CLANG_ATTR( "array_count:" #COUNTER ";" ) |
1414 | | #define VR_ARRAY_COUNT_D(COUNTER, DESC) VR_CLANG_ATTR( "array_count:" #COUNTER ";desc:" #DESC ) |
1415 | | #define VR_BUFFER_COUNT(COUNTER) VR_CLANG_ATTR( "buffer_count:" #COUNTER ";" ) |
1416 | | #define VR_OUT_BUFFER_COUNT(COUNTER) VR_CLANG_ATTR( "out_buffer_count:" #COUNTER ";" ) |
1417 | | #define VR_OUT_STRING_COUNT(COUNTER) VR_CLANG_ATTR( "out_string_count:" #COUNTER ";" ) |
1418 | | |
1419 | | // ivrsystem.h |
1420 | | namespace vr |
1421 | | { |
1422 | | |
1423 | | class IVRSystem |
1424 | | { |
1425 | | public: |
1426 | | |
1427 | | |
1428 | | // ------------------------------------ |
1429 | | // Display Methods |
1430 | | // ------------------------------------ |
1431 | | |
1432 | | /** Suggested size for the intermediate render target that the distortion pulls from. */ |
1433 | | virtual void GetRecommendedRenderTargetSize( uint32_t *pnWidth, uint32_t *pnHeight ) = 0; |
1434 | | |
1435 | | /** The projection matrix for the specified eye */ |
1436 | | virtual HmdMatrix44_t GetProjectionMatrix( EVREye eEye, float fNearZ, float fFarZ ) = 0; |
1437 | | |
1438 | | /** The components necessary to build your own projection matrix in case your |
1439 | | * application is doing something fancy like infinite Z */ |
1440 | | virtual void GetProjectionRaw( EVREye eEye, float *pfLeft, float *pfRight, float *pfTop, float *pfBottom ) = 0; |
1441 | | |
1442 | | /** Gets the result of the distortion function for the specified eye and input UVs. UVs go from 0,0 in |
1443 | | * the upper left of that eye's viewport and 1,1 in the lower right of that eye's viewport. |
1444 | | * Returns true for success. Otherwise, returns false, and distortion coordinates are not suitable. */ |
1445 | | virtual bool ComputeDistortion( EVREye eEye, float fU, float fV, DistortionCoordinates_t *pDistortionCoordinates ) = 0; |
1446 | | |
1447 | | /** Returns the transform from eye space to the head space. Eye space is the per-eye flavor of head |
1448 | | * space that provides stereo disparity. Instead of Model * View * Projection the sequence is Model * View * Eye^-1 * Projection. |
1449 | | * Normally View and Eye^-1 will be multiplied together and treated as View in your application. |
1450 | | */ |
1451 | | virtual HmdMatrix34_t GetEyeToHeadTransform( EVREye eEye ) = 0; |
1452 | | |
1453 | | /** Returns the number of elapsed seconds since the last recorded vsync event. This |
1454 | | * will come from a vsync timer event in the timer if possible or from the application-reported |
1455 | | * time if that is not available. If no vsync times are available the function will |
1456 | | * return zero for vsync time and frame counter and return false from the method. */ |
1457 | | virtual bool GetTimeSinceLastVsync( float *pfSecondsSinceLastVsync, uint64_t *pulFrameCounter ) = 0; |
1458 | | |
1459 | | /** [D3D9 Only] |
1460 | | * Returns the adapter index that the user should pass into CreateDevice to set up D3D9 in such |
1461 | | * a way that it can go full screen exclusive on the HMD. Returns -1 if there was an error. |
1462 | | */ |
1463 | | virtual int32_t GetD3D9AdapterIndex() = 0; |
1464 | | |
1465 | | /** [D3D10/11 Only] |
1466 | | * Returns the adapter index that the user should pass into EnumAdapters to create the device |
1467 | | * and swap chain in DX10 and DX11. If an error occurs the index will be set to -1. |
1468 | | */ |
1469 | | virtual void GetDXGIOutputInfo( int32_t *pnAdapterIndex ) = 0; |
1470 | | |
1471 | | /** |
1472 | | * Returns platform- and texture-type specific adapter identification so that applications and the |
1473 | | * compositor are creating textures and swap chains on the same GPU. If an error occurs the device |
1474 | | * will be set to 0. |
1475 | | * pInstance is an optional parameter that is required only when textureType is TextureType_Vulkan. |
1476 | | * [D3D10/11/12 Only (D3D9 Not Supported)] |
1477 | | * Returns the adapter LUID that identifies the GPU attached to the HMD. The user should |
1478 | | * enumerate all adapters using IDXGIFactory::EnumAdapters and IDXGIAdapter::GetDesc to find |
1479 | | * the adapter with the matching LUID, or use IDXGIFactory4::EnumAdapterByLuid. |
1480 | | * The discovered IDXGIAdapter should be used to create the device and swap chain. |
1481 | | * [Vulkan Only] |
1482 | | * Returns the VkPhysicalDevice that should be used by the application. |
1483 | | * pInstance must be the instance the application will use to query for the VkPhysicalDevice. The application |
1484 | | * must create the VkInstance with extensions returned by IVRCompositor::GetVulkanInstanceExtensionsRequired enabled. |
1485 | | * [macOS Only] |
1486 | | * For TextureType_IOSurface returns the id<MTLDevice> that should be used by the application. |
1487 | | * On 10.13+ for TextureType_OpenGL returns the 'registryId' of the renderer which should be used |
1488 | | * by the application. See Apple Technical Q&A QA1168 for information on enumerating GL Renderers, and the |
1489 | | * new kCGLRPRegistryIDLow and kCGLRPRegistryIDHigh CGLRendererProperty values in the 10.13 SDK. |
1490 | | * Pre 10.13 for TextureType_OpenGL returns 0, as there is no dependable way to correlate the HMDs MTLDevice |
1491 | | * with a GL Renderer. |
1492 | | */ |
1493 | | virtual void GetOutputDevice( uint64_t *pnDevice, ETextureType textureType, VkInstance_T *pInstance = nullptr ) = 0; |
1494 | | |
1495 | | // ------------------------------------ |
1496 | | // Display Mode methods |
1497 | | // ------------------------------------ |
1498 | | |
1499 | | /** Use to determine if the headset display is part of the desktop (i.e. extended) or hidden (i.e. direct mode). */ |
1500 | | virtual bool IsDisplayOnDesktop() = 0; |
1501 | | |
1502 | | /** Set the display visibility (true = extended, false = direct mode). Return value of true indicates that the change was successful. */ |
1503 | | virtual bool SetDisplayVisibility( bool bIsVisibleOnDesktop ) = 0; |
1504 | | |
1505 | | // ------------------------------------ |
1506 | | // Tracking Methods |
1507 | | // ------------------------------------ |
1508 | | |
1509 | | /** The pose that the tracker thinks that the HMD will be in at the specified number of seconds into the |
1510 | | * future. Pass 0 to get the state at the instant the method is called. Most of the time the application should |
1511 | | * calculate the time until the photons will be emitted from the display and pass that time into the method. |
1512 | | * |
1513 | | * This is roughly analogous to the inverse of the view matrix in most applications, though |
1514 | | * many games will need to do some additional rotation or translation on top of the rotation |
1515 | | * and translation provided by the head pose. |
1516 | | * |
1517 | | * For devices where bPoseIsValid is true the application can use the pose to position the device |
1518 | | * in question. The provided array can be any size up to k_unMaxTrackedDeviceCount. |
1519 | | * |
1520 | | * Seated experiences should call this method with TrackingUniverseSeated and receive poses relative |
1521 | | * to the seated zero pose. Standing experiences should call this method with TrackingUniverseStanding |
1522 | | * and receive poses relative to the Chaperone Play Area. TrackingUniverseRawAndUncalibrated should |
1523 | | * probably not be used unless the application is the Chaperone calibration tool itself, but will provide |
1524 | | * poses relative to the hardware-specific coordinate system in the driver. |
1525 | | */ |
1526 | | virtual void GetDeviceToAbsoluteTrackingPose( ETrackingUniverseOrigin eOrigin, float fPredictedSecondsToPhotonsFromNow, VR_ARRAY_COUNT(unTrackedDevicePoseArrayCount) TrackedDevicePose_t *pTrackedDevicePoseArray, uint32_t unTrackedDevicePoseArrayCount ) = 0; |
1527 | | |
1528 | | /** Sets the zero pose for the seated tracker coordinate system to the current position and yaw of the HMD. After |
1529 | | * ResetSeatedZeroPose all GetDeviceToAbsoluteTrackingPose calls that pass TrackingUniverseSeated as the origin |
1530 | | * will be relative to this new zero pose. The new zero coordinate system will not change the fact that the Y axis |
1531 | | * is up in the real world, so the next pose returned from GetDeviceToAbsoluteTrackingPose after a call to |
1532 | | * ResetSeatedZeroPose may not be exactly an identity matrix. |
1533 | | * |
1534 | | * NOTE: This function overrides the user's previously saved seated zero pose and should only be called as the result of a user action. |
1535 | | * Users are also able to set their seated zero pose via the OpenVR Dashboard. |
1536 | | **/ |
1537 | | virtual void ResetSeatedZeroPose() = 0; |
1538 | | |
1539 | | /** Returns the transform from the seated zero pose to the standing absolute tracking system. This allows |
1540 | | * applications to represent the seated origin to used or transform object positions from one coordinate |
1541 | | * system to the other. |
1542 | | * |
1543 | | * The seated origin may or may not be inside the Play Area or Collision Bounds returned by IVRChaperone. Its position |
1544 | | * depends on what the user has set from the Dashboard settings and previous calls to ResetSeatedZeroPose. */ |
1545 | | virtual HmdMatrix34_t GetSeatedZeroPoseToStandingAbsoluteTrackingPose() = 0; |
1546 | | |
1547 | | /** Returns the transform from the tracking origin to the standing absolute tracking system. This allows |
1548 | | * applications to convert from raw tracking space to the calibrated standing coordinate system. */ |
1549 | | virtual HmdMatrix34_t GetRawZeroPoseToStandingAbsoluteTrackingPose() = 0; |
1550 | | |
1551 | | /** Get a sorted array of device indices of a given class of tracked devices (e.g. controllers). Devices are sorted right to left |
1552 | | * relative to the specified tracked device (default: hmd -- pass in -1 for absolute tracking space). Returns the number of devices |
1553 | | * in the list, or the size of the array needed if not large enough. */ |
1554 | | virtual uint32_t GetSortedTrackedDeviceIndicesOfClass( ETrackedDeviceClass eTrackedDeviceClass, VR_ARRAY_COUNT(unTrackedDeviceIndexArrayCount) vr::TrackedDeviceIndex_t *punTrackedDeviceIndexArray, uint32_t unTrackedDeviceIndexArrayCount, vr::TrackedDeviceIndex_t unRelativeToTrackedDeviceIndex = k_unTrackedDeviceIndex_Hmd ) = 0; |
1555 | | |
1556 | | /** Returns the level of activity on the device. */ |
1557 | | virtual EDeviceActivityLevel GetTrackedDeviceActivityLevel( vr::TrackedDeviceIndex_t unDeviceId ) = 0; |
1558 | | |
1559 | | /** Convenience utility to apply the specified transform to the specified pose. |
1560 | | * This properly transforms all pose components, including velocity and angular velocity |
1561 | | */ |
1562 | | virtual void ApplyTransform( TrackedDevicePose_t *pOutputPose, const TrackedDevicePose_t *pTrackedDevicePose, const HmdMatrix34_t *pTransform ) = 0; |
1563 | | |
1564 | | /** Returns the device index associated with a specific role, for example the left hand or the right hand. */ |
1565 | | virtual vr::TrackedDeviceIndex_t GetTrackedDeviceIndexForControllerRole( vr::ETrackedControllerRole unDeviceType ) = 0; |
1566 | | |
1567 | | /** Returns the controller type associated with a device index. */ |
1568 | | virtual vr::ETrackedControllerRole GetControllerRoleForTrackedDeviceIndex( vr::TrackedDeviceIndex_t unDeviceIndex ) = 0; |
1569 | | |
1570 | | // ------------------------------------ |
1571 | | // Property methods |
1572 | | // ------------------------------------ |
1573 | | |
1574 | | /** Returns the device class of a tracked device. If there has not been a device connected in this slot |
1575 | | * since the application started this function will return TrackedDevice_Invalid. For previous detected |
1576 | | * devices the function will return the previously observed device class. |
1577 | | * |
1578 | | * To determine which devices exist on the system, just loop from 0 to k_unMaxTrackedDeviceCount and check |
1579 | | * the device class. Every device with something other than TrackedDevice_Invalid is associated with an |
1580 | | * actual tracked device. */ |
1581 | | virtual ETrackedDeviceClass GetTrackedDeviceClass( vr::TrackedDeviceIndex_t unDeviceIndex ) = 0; |
1582 | | |
1583 | | /** Returns true if there is a device connected in this slot. */ |
1584 | | virtual bool IsTrackedDeviceConnected( vr::TrackedDeviceIndex_t unDeviceIndex ) = 0; |
1585 | | |
1586 | | /** Returns a bool property. If the device index is not valid or the property is not a bool type this function will return false. */ |
1587 | | virtual bool GetBoolTrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L ) = 0; |
1588 | | |
1589 | | /** Returns a float property. If the device index is not valid or the property is not a float type this function will return 0. */ |
1590 | | virtual float GetFloatTrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L ) = 0; |
1591 | | |
1592 | | /** Returns an int property. If the device index is not valid or the property is not a int type this function will return 0. */ |
1593 | | virtual int32_t GetInt32TrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L ) = 0; |
1594 | | |
1595 | | /** Returns a uint64 property. If the device index is not valid or the property is not a uint64 type this function will return 0. */ |
1596 | | virtual uint64_t GetUint64TrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L ) = 0; |
1597 | | |
1598 | | /** Returns a matrix property. If the device index is not valid or the property is not a matrix type, this function will return identity. */ |
1599 | | virtual HmdMatrix34_t GetMatrix34TrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L ) = 0; |
1600 | | |
1601 | | /** Returns an array of one type of property. If the device index is not valid or the property is not a single value or an array of the specified type, |
1602 | | * this function will return 0. Otherwise it returns the number of bytes necessary to hold the array of properties. If unBufferSize is |
1603 | | * greater than the returned size and pBuffer is non-NULL, pBuffer is filled with the contents of array of properties. */ |
1604 | | virtual uint32_t GetArrayTrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, PropertyTypeTag_t propType, void *pBuffer, uint32_t unBufferSize, ETrackedPropertyError *pError = 0L ) = 0; |
1605 | | |
1606 | | /** Returns a string property. If the device index is not valid or the property is not a string type this function will |
1607 | | * return 0. Otherwise it returns the length of the number of bytes necessary to hold this string including the trailing |
1608 | | * null. Strings will always fit in buffers of k_unMaxPropertyStringSize characters. */ |
1609 | | virtual uint32_t GetStringTrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize, ETrackedPropertyError *pError = 0L ) = 0; |
1610 | | |
1611 | | /** returns a string that corresponds with the specified property error. The string will be the name |
1612 | | * of the error enum value for all valid error codes */ |
1613 | | virtual const char *GetPropErrorNameFromEnum( ETrackedPropertyError error ) = 0; |
1614 | | |
1615 | | // ------------------------------------ |
1616 | | // Event methods |
1617 | | // ------------------------------------ |
1618 | | |
1619 | | /** Returns true and fills the event with the next event on the queue if there is one. If there are no events |
1620 | | * this method returns false. uncbVREvent should be the size in bytes of the VREvent_t struct */ |
1621 | | virtual bool PollNextEvent( VREvent_t *pEvent, uint32_t uncbVREvent ) = 0; |
1622 | | |
1623 | | /** Returns true and fills the event with the next event on the queue if there is one. If there are no events |
1624 | | * this method returns false. Fills in the pose of the associated tracked device in the provided pose struct. |
1625 | | * This pose will always be older than the call to this function and should not be used to render the device. |
1626 | | uncbVREvent should be the size in bytes of the VREvent_t struct */ |
1627 | | virtual bool PollNextEventWithPose( ETrackingUniverseOrigin eOrigin, VREvent_t *pEvent, uint32_t uncbVREvent, vr::TrackedDevicePose_t *pTrackedDevicePose ) = 0; |
1628 | | |
1629 | | /** returns the name of an EVREvent enum value */ |
1630 | | virtual const char *GetEventTypeNameFromEnum( EVREventType eType ) = 0; |
1631 | | |
1632 | | // ------------------------------------ |
1633 | | // Rendering helper methods |
1634 | | // ------------------------------------ |
1635 | | |
1636 | | /** Returns the hidden area mesh for the current HMD. The pixels covered by this mesh will never be seen by the user after the lens distortion is |
1637 | | * applied based on visibility to the panels. If this HMD does not have a hidden area mesh, the vertex data and count will be NULL and 0 respectively. |
1638 | | * This mesh is meant to be rendered into the stencil buffer (or into the depth buffer setting nearz) before rendering each eye's view. |
1639 | | * This will improve performance by letting the GPU early-reject pixels the user will never see before running the pixel shader. |
1640 | | * NOTE: Render this mesh with backface culling disabled since the winding order of the vertices can be different per-HMD or per-eye. |
1641 | | * Setting the bInverse argument to true will produce the visible area mesh that is commonly used in place of full-screen quads. The visible area mesh covers all of the pixels the hidden area mesh does not cover. |
1642 | | * Setting the bLineLoop argument will return a line loop of vertices in HiddenAreaMesh_t->pVertexData with HiddenAreaMesh_t->unTriangleCount set to the number of vertices. |
1643 | | */ |
1644 | | virtual HiddenAreaMesh_t GetHiddenAreaMesh( EVREye eEye, EHiddenAreaMeshType type = k_eHiddenAreaMesh_Standard ) = 0; |
1645 | | |
1646 | | // ------------------------------------ |
1647 | | // Controller methods |
1648 | | // ------------------------------------ |
1649 | | |
1650 | | /** Fills the supplied struct with the current state of the controller. Returns false if the controller index |
1651 | | * is invalid. */ |
1652 | | virtual bool GetControllerState( vr::TrackedDeviceIndex_t unControllerDeviceIndex, vr::VRControllerState_t *pControllerState, uint32_t unControllerStateSize ) = 0; |
1653 | | |
1654 | | /** fills the supplied struct with the current state of the controller and the provided pose with the pose of |
1655 | | * the controller when the controller state was updated most recently. Use this form if you need a precise controller |
1656 | | * pose as input to your application when the user presses or releases a button. */ |
1657 | | virtual bool GetControllerStateWithPose( ETrackingUniverseOrigin eOrigin, vr::TrackedDeviceIndex_t unControllerDeviceIndex, vr::VRControllerState_t *pControllerState, uint32_t unControllerStateSize, TrackedDevicePose_t *pTrackedDevicePose ) = 0; |
1658 | | |
1659 | | /** Trigger a single haptic pulse on a controller. After this call the application may not trigger another haptic pulse on this controller |
1660 | | * and axis combination for 5ms. */ |
1661 | | virtual void TriggerHapticPulse( vr::TrackedDeviceIndex_t unControllerDeviceIndex, uint32_t unAxisId, unsigned short usDurationMicroSec ) = 0; |
1662 | | |
1663 | | /** returns the name of an EVRButtonId enum value */ |
1664 | | virtual const char *GetButtonIdNameFromEnum( EVRButtonId eButtonId ) = 0; |
1665 | | |
1666 | | /** returns the name of an EVRControllerAxisType enum value */ |
1667 | | virtual const char *GetControllerAxisTypeNameFromEnum( EVRControllerAxisType eAxisType ) = 0; |
1668 | | |
1669 | | /** Returns true if this application is receiving input from the system. This would return false if |
1670 | | * system-related functionality is consuming the input stream. */ |
1671 | | virtual bool IsInputAvailable() = 0; |
1672 | | |
1673 | | /** Returns true SteamVR is drawing controllers on top of the application. Applications should consider |
1674 | | * not drawing anything attached to the user's hands in this case. */ |
1675 | | virtual bool IsSteamVRDrawingControllers() = 0; |
1676 | | |
1677 | | /** Returns true if the user has put SteamVR into a mode that is distracting them from the application. |
1678 | | * For applications where this is appropriate, the application should pause ongoing activity. */ |
1679 | | virtual bool ShouldApplicationPause() = 0; |
1680 | | |
1681 | | /** Returns true if SteamVR is doing significant rendering work and the game should do what it can to reduce |
1682 | | * its own workload. One common way to do this is to reduce the size of the render target provided for each eye. */ |
1683 | | virtual bool ShouldApplicationReduceRenderingWork() = 0; |
1684 | | |
1685 | | // ------------------------------------ |
1686 | | // Debug Methods |
1687 | | // ------------------------------------ |
1688 | | |
1689 | | /** Sends a request to the driver for the specified device and returns the response. The maximum response size is 32k, |
1690 | | * but this method can be called with a smaller buffer. If the response exceeds the size of the buffer, it is truncated. |
1691 | | * The size of the response including its terminating null is returned. */ |
1692 | | virtual uint32_t DriverDebugRequest( vr::TrackedDeviceIndex_t unDeviceIndex, const char *pchRequest, VR_OUT_STRING() char *pchResponseBuffer, uint32_t unResponseBufferSize ) = 0; |
1693 | | |
1694 | | // ------------------------------------ |
1695 | | // Firmware methods |
1696 | | // ------------------------------------ |
1697 | | |
1698 | | /** Performs the actual firmware update if applicable. |
1699 | | * The following events will be sent, if VRFirmwareError_None was returned: VREvent_FirmwareUpdateStarted, VREvent_FirmwareUpdateFinished |
1700 | | * Use the properties Prop_Firmware_UpdateAvailable_Bool, Prop_Firmware_ManualUpdate_Bool, and Prop_Firmware_ManualUpdateURL_String |
1701 | | * to figure our whether a firmware update is available, and to figure out whether its a manual update |
1702 | | * Prop_Firmware_ManualUpdateURL_String should point to an URL describing the manual update process */ |
1703 | | virtual vr::EVRFirmwareError PerformFirmwareUpdate( vr::TrackedDeviceIndex_t unDeviceIndex ) = 0; |
1704 | | |
1705 | | // ------------------------------------ |
1706 | | // Application life cycle methods |
1707 | | // ------------------------------------ |
1708 | | |
1709 | | /** Call this to acknowledge to the system that VREvent_Quit has been received and that the process is exiting. |
1710 | | * This extends the timeout until the process is killed. */ |
1711 | | virtual void AcknowledgeQuit_Exiting() = 0; |
1712 | | |
1713 | | /** Call this to tell the system that the user is being prompted to save data. This |
1714 | | * halts the timeout and dismisses the dashboard (if it was up). Applications should be sure to actually |
1715 | | * prompt the user to save and then exit afterward, otherwise the user will be left in a confusing state. */ |
1716 | | virtual void AcknowledgeQuit_UserPrompt() = 0; |
1717 | | |
1718 | | }; |
1719 | | |
1720 | | static const char * const IVRSystem_Version = "IVRSystem_019"; |
1721 | | |
1722 | | } |
1723 | | |
1724 | | |
1725 | | // ivrapplications.h |
1726 | | namespace vr |
1727 | | { |
1728 | | |
1729 | | /** Used for all errors reported by the IVRApplications interface */ |
1730 | | enum EVRApplicationError |
1731 | | { |
1732 | | VRApplicationError_None = 0, |
1733 | | |
1734 | | VRApplicationError_AppKeyAlreadyExists = 100, // Only one application can use any given key |
1735 | | VRApplicationError_NoManifest = 101, // the running application does not have a manifest |
1736 | | VRApplicationError_NoApplication = 102, // No application is running |
1737 | | VRApplicationError_InvalidIndex = 103, |
1738 | | VRApplicationError_UnknownApplication = 104, // the application could not be found |
1739 | | VRApplicationError_IPCFailed = 105, // An IPC failure caused the request to fail |
1740 | | VRApplicationError_ApplicationAlreadyRunning = 106, |
1741 | | VRApplicationError_InvalidManifest = 107, |
1742 | | VRApplicationError_InvalidApplication = 108, |
1743 | | VRApplicationError_LaunchFailed = 109, // the process didn't start |
1744 | | VRApplicationError_ApplicationAlreadyStarting = 110, // the system was already starting the same application |
1745 | | VRApplicationError_LaunchInProgress = 111, // The system was already starting a different application |
1746 | | VRApplicationError_OldApplicationQuitting = 112, |
1747 | | VRApplicationError_TransitionAborted = 113, |
1748 | | VRApplicationError_IsTemplate = 114, // error when you try to call LaunchApplication() on a template type app (use LaunchTemplateApplication) |
1749 | | VRApplicationError_SteamVRIsExiting = 115, |
1750 | | |
1751 | | VRApplicationError_BufferTooSmall = 200, // The provided buffer was too small to fit the requested data |
1752 | | VRApplicationError_PropertyNotSet = 201, // The requested property was not set |
1753 | | VRApplicationError_UnknownProperty = 202, |
1754 | | VRApplicationError_InvalidParameter = 203, |
1755 | | }; |
1756 | | |
1757 | | /** The maximum length of an application key */ |
1758 | | static const uint32_t k_unMaxApplicationKeyLength = 128; |
1759 | | |
1760 | | /** these are the properties available on applications. */ |
1761 | | enum EVRApplicationProperty |
1762 | | { |
1763 | | VRApplicationProperty_Name_String = 0, |
1764 | | |
1765 | | VRApplicationProperty_LaunchType_String = 11, |
1766 | | VRApplicationProperty_WorkingDirectory_String = 12, |
1767 | | VRApplicationProperty_BinaryPath_String = 13, |
1768 | | VRApplicationProperty_Arguments_String = 14, |
1769 | | VRApplicationProperty_URL_String = 15, |
1770 | | |
1771 | | VRApplicationProperty_Description_String = 50, |
1772 | | VRApplicationProperty_NewsURL_String = 51, |
1773 | | VRApplicationProperty_ImagePath_String = 52, |
1774 | | VRApplicationProperty_Source_String = 53, |
1775 | | VRApplicationProperty_ActionManifestURL_String = 54, |
1776 | | |
1777 | | VRApplicationProperty_IsDashboardOverlay_Bool = 60, |
1778 | | VRApplicationProperty_IsTemplate_Bool = 61, |
1779 | | VRApplicationProperty_IsInstanced_Bool = 62, |
1780 | | VRApplicationProperty_IsInternal_Bool = 63, |
1781 | | VRApplicationProperty_WantsCompositorPauseInStandby_Bool = 64, |
1782 | | |
1783 | | VRApplicationProperty_LastLaunchTime_Uint64 = 70, |
1784 | | }; |
1785 | | |
1786 | | /** These are states the scene application startup process will go through. */ |
1787 | | enum EVRApplicationTransitionState |
1788 | | { |
1789 | | VRApplicationTransition_None = 0, |
1790 | | |
1791 | | VRApplicationTransition_OldAppQuitSent = 10, |
1792 | | VRApplicationTransition_WaitingForExternalLaunch = 11, |
1793 | | |
1794 | | VRApplicationTransition_NewAppLaunched = 20, |
1795 | | }; |
1796 | | |
1797 | | struct AppOverrideKeys_t |
1798 | | { |
1799 | | const char *pchKey; |
1800 | | const char *pchValue; |
1801 | | }; |
1802 | | |
1803 | | /** Currently recognized mime types */ |
1804 | | static const char * const k_pch_MimeType_HomeApp = "vr/home"; |
1805 | | static const char * const k_pch_MimeType_GameTheater = "vr/game_theater"; |
1806 | | |
1807 | | class IVRApplications |
1808 | | { |
1809 | | public: |
1810 | | |
1811 | | // --------------- Application management --------------- // |
1812 | | |
1813 | | /** Adds an application manifest to the list to load when building the list of installed applications. |
1814 | | * Temporary manifests are not automatically loaded */ |
1815 | | virtual EVRApplicationError AddApplicationManifest( const char *pchApplicationManifestFullPath, bool bTemporary = false ) = 0; |
1816 | | |
1817 | | /** Removes an application manifest from the list to load when building the list of installed applications. */ |
1818 | | virtual EVRApplicationError RemoveApplicationManifest( const char *pchApplicationManifestFullPath ) = 0; |
1819 | | |
1820 | | /** Returns true if an application is installed */ |
1821 | | virtual bool IsApplicationInstalled( const char *pchAppKey ) = 0; |
1822 | | |
1823 | | /** Returns the number of applications available in the list */ |
1824 | | virtual uint32_t GetApplicationCount() = 0; |
1825 | | |
1826 | | /** Returns the key of the specified application. The index is at least 0 and is less than the return |
1827 | | * value of GetApplicationCount(). The buffer should be at least k_unMaxApplicationKeyLength in order to |
1828 | | * fit the key. */ |
1829 | | virtual EVRApplicationError GetApplicationKeyByIndex( uint32_t unApplicationIndex, VR_OUT_STRING() char *pchAppKeyBuffer, uint32_t unAppKeyBufferLen ) = 0; |
1830 | | |
1831 | | /** Returns the key of the application for the specified Process Id. The buffer should be at least |
1832 | | * k_unMaxApplicationKeyLength in order to fit the key. */ |
1833 | | virtual EVRApplicationError GetApplicationKeyByProcessId( uint32_t unProcessId, VR_OUT_STRING() char *pchAppKeyBuffer, uint32_t unAppKeyBufferLen ) = 0; |
1834 | | |
1835 | | /** Launches the application. The existing scene application will exit and then the new application will start. |
1836 | | * This call is not valid for dashboard overlay applications. */ |
1837 | | virtual EVRApplicationError LaunchApplication( const char *pchAppKey ) = 0; |
1838 | | |
1839 | | /** Launches an instance of an application of type template, with its app key being pchNewAppKey (which must be unique) and optionally override sections |
1840 | | * from the manifest file via AppOverrideKeys_t |
1841 | | */ |
1842 | | virtual EVRApplicationError LaunchTemplateApplication( const char *pchTemplateAppKey, const char *pchNewAppKey, VR_ARRAY_COUNT( unKeys ) const AppOverrideKeys_t *pKeys, uint32_t unKeys ) = 0; |
1843 | | |
1844 | | /** launches the application currently associated with this mime type and passes it the option args, typically the filename or object name of the item being launched */ |
1845 | | virtual vr::EVRApplicationError LaunchApplicationFromMimeType( const char *pchMimeType, const char *pchArgs ) = 0; |
1846 | | |
1847 | | /** Launches the dashboard overlay application if it is not already running. This call is only valid for |
1848 | | * dashboard overlay applications. */ |
1849 | | virtual EVRApplicationError LaunchDashboardOverlay( const char *pchAppKey ) = 0; |
1850 | | |
1851 | | /** Cancel a pending launch for an application */ |
1852 | | virtual bool CancelApplicationLaunch( const char *pchAppKey ) = 0; |
1853 | | |
1854 | | /** Identifies a running application. OpenVR can't always tell which process started in response |
1855 | | * to a URL. This function allows a URL handler (or the process itself) to identify the app key |
1856 | | * for the now running application. Passing a process ID of 0 identifies the calling process. |
1857 | | * The application must be one that's known to the system via a call to AddApplicationManifest. */ |
1858 | | virtual EVRApplicationError IdentifyApplication( uint32_t unProcessId, const char *pchAppKey ) = 0; |
1859 | | |
1860 | | /** Returns the process ID for an application. Return 0 if the application was not found or is not running. */ |
1861 | | virtual uint32_t GetApplicationProcessId( const char *pchAppKey ) = 0; |
1862 | | |
1863 | | /** Returns a string for an applications error */ |
1864 | | virtual const char *GetApplicationsErrorNameFromEnum( EVRApplicationError error ) = 0; |
1865 | | |
1866 | | // --------------- Application properties --------------- // |
1867 | | |
1868 | | /** Returns a value for an application property. The required buffer size to fit this value will be returned. */ |
1869 | | virtual uint32_t GetApplicationPropertyString( const char *pchAppKey, EVRApplicationProperty eProperty, VR_OUT_STRING() char *pchPropertyValueBuffer, uint32_t unPropertyValueBufferLen, EVRApplicationError *peError = nullptr ) = 0; |
1870 | | |
1871 | | /** Returns a bool value for an application property. Returns false in all error cases. */ |
1872 | | virtual bool GetApplicationPropertyBool( const char *pchAppKey, EVRApplicationProperty eProperty, EVRApplicationError *peError = nullptr ) = 0; |
1873 | | |
1874 | | /** Returns a uint64 value for an application property. Returns 0 in all error cases. */ |
1875 | | virtual uint64_t GetApplicationPropertyUint64( const char *pchAppKey, EVRApplicationProperty eProperty, EVRApplicationError *peError = nullptr ) = 0; |
1876 | | |
1877 | | /** Sets the application auto-launch flag. This is only valid for applications which return true for VRApplicationProperty_IsDashboardOverlay_Bool. */ |
1878 | | virtual EVRApplicationError SetApplicationAutoLaunch( const char *pchAppKey, bool bAutoLaunch ) = 0; |
1879 | | |
1880 | | /** Gets the application auto-launch flag. This is only valid for applications which return true for VRApplicationProperty_IsDashboardOverlay_Bool. */ |
1881 | | virtual bool GetApplicationAutoLaunch( const char *pchAppKey ) = 0; |
1882 | | |
1883 | | /** Adds this mime-type to the list of supported mime types for this application*/ |
1884 | | virtual EVRApplicationError SetDefaultApplicationForMimeType( const char *pchAppKey, const char *pchMimeType ) = 0; |
1885 | | |
1886 | | /** return the app key that will open this mime type */ |
1887 | | virtual bool GetDefaultApplicationForMimeType( const char *pchMimeType, VR_OUT_STRING() char *pchAppKeyBuffer, uint32_t unAppKeyBufferLen ) = 0; |
1888 | | |
1889 | | /** Get the list of supported mime types for this application, comma-delimited */ |
1890 | | virtual bool GetApplicationSupportedMimeTypes( const char *pchAppKey, VR_OUT_STRING() char *pchMimeTypesBuffer, uint32_t unMimeTypesBuffer ) = 0; |
1891 | | |
1892 | | /** Get the list of app-keys that support this mime type, comma-delimited, the return value is number of bytes you need to return the full string */ |
1893 | | virtual uint32_t GetApplicationsThatSupportMimeType( const char *pchMimeType, VR_OUT_STRING() char *pchAppKeysThatSupportBuffer, uint32_t unAppKeysThatSupportBuffer ) = 0; |
1894 | | |
1895 | | /** Get the args list from an app launch that had the process already running, you call this when you get a VREvent_ApplicationMimeTypeLoad */ |
1896 | | virtual uint32_t GetApplicationLaunchArguments( uint32_t unHandle, VR_OUT_STRING() char *pchArgs, uint32_t unArgs ) = 0; |
1897 | | |
1898 | | // --------------- Transition methods --------------- // |
1899 | | |
1900 | | /** Returns the app key for the application that is starting up */ |
1901 | | virtual EVRApplicationError GetStartingApplication( VR_OUT_STRING() char *pchAppKeyBuffer, uint32_t unAppKeyBufferLen ) = 0; |
1902 | | |
1903 | | /** Returns the application transition state */ |
1904 | | virtual EVRApplicationTransitionState GetTransitionState() = 0; |
1905 | | |
1906 | | /** Returns errors that would prevent the specified application from launching immediately. Calling this function will |
1907 | | * cause the current scene application to quit, so only call it when you are actually about to launch something else. |
1908 | | * What the caller should do about these failures depends on the failure: |
1909 | | * VRApplicationError_OldApplicationQuitting - An existing application has been told to quit. Wait for a VREvent_ProcessQuit |
1910 | | * and try again. |
1911 | | * VRApplicationError_ApplicationAlreadyStarting - This application is already starting. This is a permanent failure. |
1912 | | * VRApplicationError_LaunchInProgress - A different application is already starting. This is a permanent failure. |
1913 | | * VRApplicationError_None - Go ahead and launch. Everything is clear. |
1914 | | */ |
1915 | | virtual EVRApplicationError PerformApplicationPrelaunchCheck( const char *pchAppKey ) = 0; |
1916 | | |
1917 | | /** Returns a string for an application transition state */ |
1918 | | virtual const char *GetApplicationsTransitionStateNameFromEnum( EVRApplicationTransitionState state ) = 0; |
1919 | | |
1920 | | /** Returns true if the outgoing scene app has requested a save prompt before exiting */ |
1921 | | virtual bool IsQuitUserPromptRequested() = 0; |
1922 | | |
1923 | | /** Starts a subprocess within the calling application. This |
1924 | | * suppresses all application transition UI and automatically identifies the new executable |
1925 | | * as part of the same application. On success the calling process should exit immediately. |
1926 | | * If working directory is NULL or "" the directory portion of the binary path will be |
1927 | | * the working directory. */ |
1928 | | virtual EVRApplicationError LaunchInternalProcess( const char *pchBinaryPath, const char *pchArguments, const char *pchWorkingDirectory ) = 0; |
1929 | | |
1930 | | /** Returns the current scene process ID according to the application system. A scene process will get scene |
1931 | | * focus once it starts rendering, but it will appear here once it calls VR_Init with the Scene application |
1932 | | * type. */ |
1933 | | virtual uint32_t GetCurrentSceneProcessId() = 0; |
1934 | | }; |
1935 | | |
1936 | | static const char * const IVRApplications_Version = "IVRApplications_006"; |
1937 | | |
1938 | | } // namespace vr |
1939 | | |
1940 | | // ivrsettings.h |
1941 | | namespace vr |
1942 | | { |
1943 | | enum EVRSettingsError |
1944 | | { |
1945 | | VRSettingsError_None = 0, |
1946 | | VRSettingsError_IPCFailed = 1, |
1947 | | VRSettingsError_WriteFailed = 2, |
1948 | | VRSettingsError_ReadFailed = 3, |
1949 | | VRSettingsError_JsonParseFailed = 4, |
1950 | | VRSettingsError_UnsetSettingHasNoDefault = 5, // This will be returned if the setting does not appear in the appropriate default file and has not been set |
1951 | | }; |
1952 | | |
1953 | | // The maximum length of a settings key |
1954 | | static const uint32_t k_unMaxSettingsKeyLength = 128; |
1955 | | |
1956 | | class IVRSettings |
1957 | | { |
1958 | | public: |
1959 | | virtual const char *GetSettingsErrorNameFromEnum( EVRSettingsError eError ) = 0; |
1960 | | |
1961 | | // Returns true if file sync occurred (force or settings dirty) |
1962 | | virtual bool Sync( bool bForce = false, EVRSettingsError *peError = nullptr ) = 0; |
1963 | | |
1964 | | virtual void SetBool( const char *pchSection, const char *pchSettingsKey, bool bValue, EVRSettingsError *peError = nullptr ) = 0; |
1965 | | virtual void SetInt32( const char *pchSection, const char *pchSettingsKey, int32_t nValue, EVRSettingsError *peError = nullptr ) = 0; |
1966 | | virtual void SetFloat( const char *pchSection, const char *pchSettingsKey, float flValue, EVRSettingsError *peError = nullptr ) = 0; |
1967 | | virtual void SetString( const char *pchSection, const char *pchSettingsKey, const char *pchValue, EVRSettingsError *peError = nullptr ) = 0; |
1968 | | |
1969 | | // Users of the system need to provide a proper default in default.vrsettings in the resources/settings/ directory |
1970 | | // of either the runtime or the driver_xxx directory. Otherwise the default will be false, 0, 0.0 or "" |
1971 | | virtual bool GetBool( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) = 0; |
1972 | | virtual int32_t GetInt32( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) = 0; |
1973 | | virtual float GetFloat( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) = 0; |
1974 | | virtual void GetString( const char *pchSection, const char *pchSettingsKey, VR_OUT_STRING() char *pchValue, uint32_t unValueLen, EVRSettingsError *peError = nullptr ) = 0; |
1975 | | |
1976 | | virtual void RemoveSection( const char *pchSection, EVRSettingsError *peError = nullptr ) = 0; |
1977 | | virtual void RemoveKeyInSection( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) = 0; |
1978 | | }; |
1979 | | |
1980 | | //----------------------------------------------------------------------------- |
1981 | | static const char * const IVRSettings_Version = "IVRSettings_002"; |
1982 | | |
1983 | | //----------------------------------------------------------------------------- |
1984 | | // steamvr keys |
1985 | | static const char * const k_pch_SteamVR_Section = "steamvr"; |
1986 | | static const char * const k_pch_SteamVR_RequireHmd_String = "requireHmd"; |
1987 | | static const char * const k_pch_SteamVR_ForcedDriverKey_String = "forcedDriver"; |
1988 | | static const char * const k_pch_SteamVR_ForcedHmdKey_String = "forcedHmd"; |
1989 | | static const char * const k_pch_SteamVR_DisplayDebug_Bool = "displayDebug"; |
1990 | | static const char * const k_pch_SteamVR_DebugProcessPipe_String = "debugProcessPipe"; |
1991 | | static const char * const k_pch_SteamVR_DisplayDebugX_Int32 = "displayDebugX"; |
1992 | | static const char * const k_pch_SteamVR_DisplayDebugY_Int32 = "displayDebugY"; |
1993 | | static const char * const k_pch_SteamVR_SendSystemButtonToAllApps_Bool= "sendSystemButtonToAllApps"; |
1994 | | static const char * const k_pch_SteamVR_LogLevel_Int32 = "loglevel"; |
1995 | | static const char * const k_pch_SteamVR_IPD_Float = "ipd"; |
1996 | | static const char * const k_pch_SteamVR_Background_String = "background"; |
1997 | | static const char * const k_pch_SteamVR_BackgroundUseDomeProjection_Bool = "backgroundUseDomeProjection"; |
1998 | | static const char * const k_pch_SteamVR_BackgroundCameraHeight_Float = "backgroundCameraHeight"; |
1999 | | static const char * const k_pch_SteamVR_BackgroundDomeRadius_Float = "backgroundDomeRadius"; |
2000 | | static const char * const k_pch_SteamVR_GridColor_String = "gridColor"; |
2001 | | static const char * const k_pch_SteamVR_PlayAreaColor_String = "playAreaColor"; |
2002 | | static const char * const k_pch_SteamVR_ShowStage_Bool = "showStage"; |
2003 | | static const char * const k_pch_SteamVR_ActivateMultipleDrivers_Bool = "activateMultipleDrivers"; |
2004 | | static const char * const k_pch_SteamVR_DirectMode_Bool = "directMode"; |
2005 | | static const char * const k_pch_SteamVR_DirectModeEdidVid_Int32 = "directModeEdidVid"; |
2006 | | static const char * const k_pch_SteamVR_DirectModeEdidPid_Int32 = "directModeEdidPid"; |
2007 | | static const char * const k_pch_SteamVR_UsingSpeakers_Bool = "usingSpeakers"; |
2008 | | static const char * const k_pch_SteamVR_SpeakersForwardYawOffsetDegrees_Float = "speakersForwardYawOffsetDegrees"; |
2009 | | static const char * const k_pch_SteamVR_BaseStationPowerManagement_Bool = "basestationPowerManagement"; |
2010 | | static const char * const k_pch_SteamVR_NeverKillProcesses_Bool = "neverKillProcesses"; |
2011 | | static const char * const k_pch_SteamVR_SupersampleScale_Float = "supersampleScale"; |
2012 | | static const char * const k_pch_SteamVR_AllowAsyncReprojection_Bool = "allowAsyncReprojection"; |
2013 | | static const char * const k_pch_SteamVR_AllowReprojection_Bool = "allowInterleavedReprojection"; |
2014 | | static const char * const k_pch_SteamVR_ForceReprojection_Bool = "forceReprojection"; |
2015 | | static const char * const k_pch_SteamVR_ForceFadeOnBadTracking_Bool = "forceFadeOnBadTracking"; |
2016 | | static const char * const k_pch_SteamVR_DefaultMirrorView_Int32 = "defaultMirrorView"; |
2017 | | static const char * const k_pch_SteamVR_ShowMirrorView_Bool = "showMirrorView"; |
2018 | | static const char * const k_pch_SteamVR_MirrorViewGeometry_String = "mirrorViewGeometry"; |
2019 | | static const char * const k_pch_SteamVR_StartMonitorFromAppLaunch = "startMonitorFromAppLaunch"; |
2020 | | static const char * const k_pch_SteamVR_StartCompositorFromAppLaunch_Bool = "startCompositorFromAppLaunch"; |
2021 | | static const char * const k_pch_SteamVR_StartDashboardFromAppLaunch_Bool = "startDashboardFromAppLaunch"; |
2022 | | static const char * const k_pch_SteamVR_StartOverlayAppsFromDashboard_Bool = "startOverlayAppsFromDashboard"; |
2023 | | static const char * const k_pch_SteamVR_EnableHomeApp = "enableHomeApp"; |
2024 | | static const char * const k_pch_SteamVR_CycleBackgroundImageTimeSec_Int32 = "CycleBackgroundImageTimeSec"; |
2025 | | static const char * const k_pch_SteamVR_RetailDemo_Bool = "retailDemo"; |
2026 | | static const char * const k_pch_SteamVR_IpdOffset_Float = "ipdOffset"; |
2027 | | static const char * const k_pch_SteamVR_AllowSupersampleFiltering_Bool = "allowSupersampleFiltering"; |
2028 | | static const char * const k_pch_SteamVR_SupersampleManualOverride_Bool = "supersampleManualOverride"; |
2029 | | static const char * const k_pch_SteamVR_EnableLinuxVulkanAsync_Bool = "enableLinuxVulkanAsync"; |
2030 | | static const char * const k_pch_SteamVR_AllowDisplayLockedMode_Bool = "allowDisplayLockedMode"; |
2031 | | static const char * const k_pch_SteamVR_HaveStartedTutorialForNativeChaperoneDriver_Bool = "haveStartedTutorialForNativeChaperoneDriver"; |
2032 | | static const char * const k_pch_SteamVR_ForceWindows32bitVRMonitor = "forceWindows32BitVRMonitor"; |
2033 | | static const char * const k_pch_SteamVR_DebugInput = "debugInput"; |
2034 | | static const char * const k_pch_SteamVR_LegacyInputRebinding = "legacyInputRebinding"; |
2035 | | |
2036 | | //----------------------------------------------------------------------------- |
2037 | | // lighthouse keys |
2038 | | static const char * const k_pch_Lighthouse_Section = "driver_lighthouse"; |
2039 | | static const char * const k_pch_Lighthouse_DisableIMU_Bool = "disableimu"; |
2040 | | static const char * const k_pch_Lighthouse_DisableIMUExceptHMD_Bool = "disableimuexcepthmd"; |
2041 | | static const char * const k_pch_Lighthouse_UseDisambiguation_String = "usedisambiguation"; |
2042 | | static const char * const k_pch_Lighthouse_DisambiguationDebug_Int32 = "disambiguationdebug"; |
2043 | | static const char * const k_pch_Lighthouse_PrimaryBasestation_Int32 = "primarybasestation"; |
2044 | | static const char * const k_pch_Lighthouse_DBHistory_Bool = "dbhistory"; |
2045 | | static const char * const k_pch_Lighthouse_EnableBluetooth_Bool = "enableBluetooth"; |
2046 | | static const char * const k_pch_Lighthouse_PowerManagedBaseStations_String = "PowerManagedBaseStations"; |
2047 | | |
2048 | | //----------------------------------------------------------------------------- |
2049 | | // null keys |
2050 | | static const char * const k_pch_Null_Section = "driver_null"; |
2051 | | static const char * const k_pch_Null_SerialNumber_String = "serialNumber"; |
2052 | | static const char * const k_pch_Null_ModelNumber_String = "modelNumber"; |
2053 | | static const char * const k_pch_Null_WindowX_Int32 = "windowX"; |
2054 | | static const char * const k_pch_Null_WindowY_Int32 = "windowY"; |
2055 | | static const char * const k_pch_Null_WindowWidth_Int32 = "windowWidth"; |
2056 | | static const char * const k_pch_Null_WindowHeight_Int32 = "windowHeight"; |
2057 | | static const char * const k_pch_Null_RenderWidth_Int32 = "renderWidth"; |
2058 | | static const char * const k_pch_Null_RenderHeight_Int32 = "renderHeight"; |
2059 | | static const char * const k_pch_Null_SecondsFromVsyncToPhotons_Float = "secondsFromVsyncToPhotons"; |
2060 | | static const char * const k_pch_Null_DisplayFrequency_Float = "displayFrequency"; |
2061 | | |
2062 | | //----------------------------------------------------------------------------- |
2063 | | // user interface keys |
2064 | | static const char * const k_pch_UserInterface_Section = "userinterface"; |
2065 | | static const char * const k_pch_UserInterface_StatusAlwaysOnTop_Bool = "StatusAlwaysOnTop"; |
2066 | | static const char * const k_pch_UserInterface_MinimizeToTray_Bool = "MinimizeToTray"; |
2067 | | static const char * const k_pch_UserInterface_Screenshots_Bool = "screenshots"; |
2068 | | static const char * const k_pch_UserInterface_ScreenshotType_Int = "screenshotType"; |
2069 | | |
2070 | | //----------------------------------------------------------------------------- |
2071 | | // notification keys |
2072 | | static const char * const k_pch_Notifications_Section = "notifications"; |
2073 | | static const char * const k_pch_Notifications_DoNotDisturb_Bool = "DoNotDisturb"; |
2074 | | |
2075 | | //----------------------------------------------------------------------------- |
2076 | | // keyboard keys |
2077 | | static const char * const k_pch_Keyboard_Section = "keyboard"; |
2078 | | static const char * const k_pch_Keyboard_TutorialCompletions = "TutorialCompletions"; |
2079 | | static const char * const k_pch_Keyboard_ScaleX = "ScaleX"; |
2080 | | static const char * const k_pch_Keyboard_ScaleY = "ScaleY"; |
2081 | | static const char * const k_pch_Keyboard_OffsetLeftX = "OffsetLeftX"; |
2082 | | static const char * const k_pch_Keyboard_OffsetRightX = "OffsetRightX"; |
2083 | | static const char * const k_pch_Keyboard_OffsetY = "OffsetY"; |
2084 | | static const char * const k_pch_Keyboard_Smoothing = "Smoothing"; |
2085 | | |
2086 | | //----------------------------------------------------------------------------- |
2087 | | // perf keys |
2088 | | static const char * const k_pch_Perf_Section = "perfcheck"; |
2089 | | static const char * const k_pch_Perf_HeuristicActive_Bool = "heuristicActive"; |
2090 | | static const char * const k_pch_Perf_NotifyInHMD_Bool = "warnInHMD"; |
2091 | | static const char * const k_pch_Perf_NotifyOnlyOnce_Bool = "warnOnlyOnce"; |
2092 | | static const char * const k_pch_Perf_AllowTimingStore_Bool = "allowTimingStore"; |
2093 | | static const char * const k_pch_Perf_SaveTimingsOnExit_Bool = "saveTimingsOnExit"; |
2094 | | static const char * const k_pch_Perf_TestData_Float = "perfTestData"; |
2095 | | static const char * const k_pch_Perf_LinuxGPUProfiling_Bool = "linuxGPUProfiling"; |
2096 | | |
2097 | | //----------------------------------------------------------------------------- |
2098 | | // collision bounds keys |
2099 | | static const char * const k_pch_CollisionBounds_Section = "collisionBounds"; |
2100 | | static const char * const k_pch_CollisionBounds_Style_Int32 = "CollisionBoundsStyle"; |
2101 | | static const char * const k_pch_CollisionBounds_GroundPerimeterOn_Bool = "CollisionBoundsGroundPerimeterOn"; |
2102 | | static const char * const k_pch_CollisionBounds_CenterMarkerOn_Bool = "CollisionBoundsCenterMarkerOn"; |
2103 | | static const char * const k_pch_CollisionBounds_PlaySpaceOn_Bool = "CollisionBoundsPlaySpaceOn"; |
2104 | | static const char * const k_pch_CollisionBounds_FadeDistance_Float = "CollisionBoundsFadeDistance"; |
2105 | | static const char * const k_pch_CollisionBounds_ColorGammaR_Int32 = "CollisionBoundsColorGammaR"; |
2106 | | static const char * const k_pch_CollisionBounds_ColorGammaG_Int32 = "CollisionBoundsColorGammaG"; |
2107 | | static const char * const k_pch_CollisionBounds_ColorGammaB_Int32 = "CollisionBoundsColorGammaB"; |
2108 | | static const char * const k_pch_CollisionBounds_ColorGammaA_Int32 = "CollisionBoundsColorGammaA"; |
2109 | | |
2110 | | //----------------------------------------------------------------------------- |
2111 | | // camera keys |
2112 | | static const char * const k_pch_Camera_Section = "camera"; |
2113 | | static const char * const k_pch_Camera_EnableCamera_Bool = "enableCamera"; |
2114 | | static const char * const k_pch_Camera_EnableCameraInDashboard_Bool = "enableCameraInDashboard"; |
2115 | | static const char * const k_pch_Camera_EnableCameraForCollisionBounds_Bool = "enableCameraForCollisionBounds"; |
2116 | | static const char * const k_pch_Camera_EnableCameraForRoomView_Bool = "enableCameraForRoomView"; |
2117 | | static const char * const k_pch_Camera_BoundsColorGammaR_Int32 = "cameraBoundsColorGammaR"; |
2118 | | static const char * const k_pch_Camera_BoundsColorGammaG_Int32 = "cameraBoundsColorGammaG"; |
2119 | | static const char * const k_pch_Camera_BoundsColorGammaB_Int32 = "cameraBoundsColorGammaB"; |
2120 | | static const char * const k_pch_Camera_BoundsColorGammaA_Int32 = "cameraBoundsColorGammaA"; |
2121 | | static const char * const k_pch_Camera_BoundsStrength_Int32 = "cameraBoundsStrength"; |
2122 | | static const char * const k_pch_Camera_RoomViewMode_Int32 = "cameraRoomViewMode"; |
2123 | | |
2124 | | //----------------------------------------------------------------------------- |
2125 | | // audio keys |
2126 | | static const char * const k_pch_audio_Section = "audio"; |
2127 | | static const char * const k_pch_audio_OnPlaybackDevice_String = "onPlaybackDevice"; |
2128 | | static const char * const k_pch_audio_OnRecordDevice_String = "onRecordDevice"; |
2129 | | static const char * const k_pch_audio_OnPlaybackMirrorDevice_String = "onPlaybackMirrorDevice"; |
2130 | | static const char * const k_pch_audio_OffPlaybackDevice_String = "offPlaybackDevice"; |
2131 | | static const char * const k_pch_audio_OffRecordDevice_String = "offRecordDevice"; |
2132 | | static const char * const k_pch_audio_VIVEHDMIGain = "viveHDMIGain"; |
2133 | | |
2134 | | //----------------------------------------------------------------------------- |
2135 | | // power management keys |
2136 | | static const char * const k_pch_Power_Section = "power"; |
2137 | | static const char * const k_pch_Power_PowerOffOnExit_Bool = "powerOffOnExit"; |
2138 | | static const char * const k_pch_Power_TurnOffScreensTimeout_Float = "turnOffScreensTimeout"; |
2139 | | static const char * const k_pch_Power_TurnOffControllersTimeout_Float = "turnOffControllersTimeout"; |
2140 | | static const char * const k_pch_Power_ReturnToWatchdogTimeout_Float = "returnToWatchdogTimeout"; |
2141 | | static const char * const k_pch_Power_AutoLaunchSteamVROnButtonPress = "autoLaunchSteamVROnButtonPress"; |
2142 | | static const char * const k_pch_Power_PauseCompositorOnStandby_Bool = "pauseCompositorOnStandby"; |
2143 | | |
2144 | | //----------------------------------------------------------------------------- |
2145 | | // dashboard keys |
2146 | | static const char * const k_pch_Dashboard_Section = "dashboard"; |
2147 | | static const char * const k_pch_Dashboard_EnableDashboard_Bool = "enableDashboard"; |
2148 | | static const char * const k_pch_Dashboard_ArcadeMode_Bool = "arcadeMode"; |
2149 | | static const char * const k_pch_Dashboard_EnableWebUI = "webUI"; |
2150 | | static const char * const k_pch_Dashboard_EnableWebUIDevTools = "webUIDevTools"; |
2151 | | |
2152 | | //----------------------------------------------------------------------------- |
2153 | | // model skin keys |
2154 | | static const char * const k_pch_modelskin_Section = "modelskins"; |
2155 | | |
2156 | | //----------------------------------------------------------------------------- |
2157 | | // driver keys - These could be checked in any driver_<name> section |
2158 | | static const char * const k_pch_Driver_Enable_Bool = "enable"; |
2159 | | |
2160 | | //----------------------------------------------------------------------------- |
2161 | | // web interface keys |
2162 | | static const char* const k_pch_WebInterface_Section = "WebInterface"; |
2163 | | static const char* const k_pch_WebInterface_WebPort_String = "WebPort"; |
2164 | | |
2165 | | } // namespace vr |
2166 | | |
2167 | | // ivrchaperone.h |
2168 | | namespace vr |
2169 | | { |
2170 | | |
2171 | | #pragma pack( push, 8 ) |
2172 | | |
2173 | | enum ChaperoneCalibrationState |
2174 | | { |
2175 | | // OK! |
2176 | | ChaperoneCalibrationState_OK = 1, // Chaperone is fully calibrated and working correctly |
2177 | | |
2178 | | // Warnings |
2179 | | ChaperoneCalibrationState_Warning = 100, |
2180 | | ChaperoneCalibrationState_Warning_BaseStationMayHaveMoved = 101, // A base station thinks that it might have moved |
2181 | | ChaperoneCalibrationState_Warning_BaseStationRemoved = 102, // There are less base stations than when calibrated |
2182 | | ChaperoneCalibrationState_Warning_SeatedBoundsInvalid = 103, // Seated bounds haven't been calibrated for the current tracking center |
2183 | | |
2184 | | // Errors |
2185 | | ChaperoneCalibrationState_Error = 200, // The UniverseID is invalid |
2186 | | ChaperoneCalibrationState_Error_BaseStationUninitialized = 201, // Tracking center hasn't be calibrated for at least one of the base stations |
2187 | | ChaperoneCalibrationState_Error_BaseStationConflict = 202, // Tracking center is calibrated, but base stations disagree on the tracking space |
2188 | | ChaperoneCalibrationState_Error_PlayAreaInvalid = 203, // Play Area hasn't been calibrated for the current tracking center |
2189 | | ChaperoneCalibrationState_Error_CollisionBoundsInvalid = 204, // Collision Bounds haven't been calibrated for the current tracking center |
2190 | | }; |
2191 | | |
2192 | | |
2193 | | /** HIGH LEVEL TRACKING SPACE ASSUMPTIONS: |
2194 | | * 0,0,0 is the preferred standing area center. |
2195 | | * 0Y is the floor height. |
2196 | | * -Z is the preferred forward facing direction. */ |
2197 | | class IVRChaperone |
2198 | | { |
2199 | | public: |
2200 | | |
2201 | | /** Get the current state of Chaperone calibration. This state can change at any time during a session due to physical base station changes. **/ |
2202 | | virtual ChaperoneCalibrationState GetCalibrationState() = 0; |
2203 | | |
2204 | | /** Returns the width and depth of the Play Area (formerly named Soft Bounds) in X and Z. |
2205 | | * Tracking space center (0,0,0) is the center of the Play Area. **/ |
2206 | | virtual bool GetPlayAreaSize( float *pSizeX, float *pSizeZ ) = 0; |
2207 | | |
2208 | | /** Returns the 4 corner positions of the Play Area (formerly named Soft Bounds). |
2209 | | * Corners are in counter-clockwise order. |
2210 | | * Standing center (0,0,0) is the center of the Play Area. |
2211 | | * It's a rectangle. |
2212 | | * 2 sides are parallel to the X axis and 2 sides are parallel to the Z axis. |
2213 | | * Height of every corner is 0Y (on the floor). **/ |
2214 | | virtual bool GetPlayAreaRect( HmdQuad_t *rect ) = 0; |
2215 | | |
2216 | | /** Reload Chaperone data from the .vrchap file on disk. */ |
2217 | | virtual void ReloadInfo( void ) = 0; |
2218 | | |
2219 | | /** Optionally give the chaperone system a hit about the color and brightness in the scene **/ |
2220 | | virtual void SetSceneColor( HmdColor_t color ) = 0; |
2221 | | |
2222 | | /** Get the current chaperone bounds draw color and brightness **/ |
2223 | | virtual void GetBoundsColor( HmdColor_t *pOutputColorArray, int nNumOutputColors, float flCollisionBoundsFadeDistance, HmdColor_t *pOutputCameraColor ) = 0; |
2224 | | |
2225 | | /** Determine whether the bounds are showing right now **/ |
2226 | | virtual bool AreBoundsVisible() = 0; |
2227 | | |
2228 | | /** Force the bounds to show, mostly for utilities **/ |
2229 | | virtual void ForceBoundsVisible( bool bForce ) = 0; |
2230 | | }; |
2231 | | |
2232 | | static const char * const IVRChaperone_Version = "IVRChaperone_003"; |
2233 | | |
2234 | | #pragma pack( pop ) |
2235 | | |
2236 | | } |
2237 | | |
2238 | | // ivrchaperonesetup.h |
2239 | | namespace vr |
2240 | | { |
2241 | | |
2242 | | enum EChaperoneConfigFile |
2243 | | { |
2244 | | EChaperoneConfigFile_Live = 1, // The live chaperone config, used by most applications and games |
2245 | | EChaperoneConfigFile_Temp = 2, // The temporary chaperone config, used to live-preview collision bounds in room setup |
2246 | | }; |
2247 | | |
2248 | | enum EChaperoneImportFlags |
2249 | | { |
2250 | | EChaperoneImport_BoundsOnly = 0x0001, |
2251 | | }; |
2252 | | |
2253 | | /** Manages the working copy of the chaperone info. By default this will be the same as the |
2254 | | * live copy. Any changes made with this interface will stay in the working copy until |
2255 | | * CommitWorkingCopy() is called, at which point the working copy and the live copy will be |
2256 | | * the same again. */ |
2257 | | class IVRChaperoneSetup |
2258 | | { |
2259 | | public: |
2260 | | |
2261 | | /** Saves the current working copy to disk */ |
2262 | | virtual bool CommitWorkingCopy( EChaperoneConfigFile configFile ) = 0; |
2263 | | |
2264 | | /** Reverts the working copy to match the live chaperone calibration. |
2265 | | * To modify existing data this MUST be do WHILE getting a non-error ChaperoneCalibrationStatus. |
2266 | | * Only after this should you do gets and sets on the existing data. */ |
2267 | | virtual void RevertWorkingCopy() = 0; |
2268 | | |
2269 | | /** Returns the width and depth of the Play Area (formerly named Soft Bounds) in X and Z from the working copy. |
2270 | | * Tracking space center (0,0,0) is the center of the Play Area. */ |
2271 | | virtual bool GetWorkingPlayAreaSize( float *pSizeX, float *pSizeZ ) = 0; |
2272 | | |
2273 | | /** Returns the 4 corner positions of the Play Area (formerly named Soft Bounds) from the working copy. |
2274 | | * Corners are in clockwise order. |
2275 | | * Tracking space center (0,0,0) is the center of the Play Area. |
2276 | | * It's a rectangle. |
2277 | | * 2 sides are parallel to the X axis and 2 sides are parallel to the Z axis. |
2278 | | * Height of every corner is 0Y (on the floor). **/ |
2279 | | virtual bool GetWorkingPlayAreaRect( HmdQuad_t *rect ) = 0; |
2280 | | |
2281 | | /** Returns the number of Quads if the buffer points to null. Otherwise it returns Quads |
2282 | | * into the buffer up to the max specified from the working copy. */ |
2283 | | virtual bool GetWorkingCollisionBoundsInfo( VR_OUT_ARRAY_COUNT(punQuadsCount) HmdQuad_t *pQuadsBuffer, uint32_t* punQuadsCount ) = 0; |
2284 | | |
2285 | | /** Returns the number of Quads if the buffer points to null. Otherwise it returns Quads |
2286 | | * into the buffer up to the max specified. */ |
2287 | | virtual bool GetLiveCollisionBoundsInfo( VR_OUT_ARRAY_COUNT(punQuadsCount) HmdQuad_t *pQuadsBuffer, uint32_t* punQuadsCount ) = 0; |
2288 | | |
2289 | | /** Returns the preferred seated position from the working copy. */ |
2290 | | virtual bool GetWorkingSeatedZeroPoseToRawTrackingPose( HmdMatrix34_t *pmatSeatedZeroPoseToRawTrackingPose ) = 0; |
2291 | | |
2292 | | /** Returns the standing origin from the working copy. */ |
2293 | | virtual bool GetWorkingStandingZeroPoseToRawTrackingPose( HmdMatrix34_t *pmatStandingZeroPoseToRawTrackingPose ) = 0; |
2294 | | |
2295 | | /** Sets the Play Area in the working copy. */ |
2296 | | virtual void SetWorkingPlayAreaSize( float sizeX, float sizeZ ) = 0; |
2297 | | |
2298 | | /** Sets the Collision Bounds in the working copy. */ |
2299 | | virtual void SetWorkingCollisionBoundsInfo( VR_ARRAY_COUNT(unQuadsCount) HmdQuad_t *pQuadsBuffer, uint32_t unQuadsCount ) = 0; |
2300 | | |
2301 | | /** Sets the preferred seated position in the working copy. */ |
2302 | | virtual void SetWorkingSeatedZeroPoseToRawTrackingPose( const HmdMatrix34_t *pMatSeatedZeroPoseToRawTrackingPose ) = 0; |
2303 | | |
2304 | | /** Sets the preferred standing position in the working copy. */ |
2305 | | virtual void SetWorkingStandingZeroPoseToRawTrackingPose( const HmdMatrix34_t *pMatStandingZeroPoseToRawTrackingPose ) = 0; |
2306 | | |
2307 | | /** Tear everything down and reload it from the file on disk */ |
2308 | | virtual void ReloadFromDisk( EChaperoneConfigFile configFile ) = 0; |
2309 | | |
2310 | | /** Returns the preferred seated position. */ |
2311 | | virtual bool GetLiveSeatedZeroPoseToRawTrackingPose( HmdMatrix34_t *pmatSeatedZeroPoseToRawTrackingPose ) = 0; |
2312 | | |
2313 | | virtual void SetWorkingCollisionBoundsTagsInfo( VR_ARRAY_COUNT(unTagCount) uint8_t *pTagsBuffer, uint32_t unTagCount ) = 0; |
2314 | | virtual bool GetLiveCollisionBoundsTagsInfo( VR_OUT_ARRAY_COUNT(punTagCount) uint8_t *pTagsBuffer, uint32_t *punTagCount ) = 0; |
2315 | | |
2316 | | virtual bool SetWorkingPhysicalBoundsInfo( VR_ARRAY_COUNT(unQuadsCount) HmdQuad_t *pQuadsBuffer, uint32_t unQuadsCount ) = 0; |
2317 | | virtual bool GetLivePhysicalBoundsInfo( VR_OUT_ARRAY_COUNT(punQuadsCount) HmdQuad_t *pQuadsBuffer, uint32_t* punQuadsCount ) = 0; |
2318 | | |
2319 | | virtual bool ExportLiveToBuffer( VR_OUT_STRING() char *pBuffer, uint32_t *pnBufferLength ) = 0; |
2320 | | virtual bool ImportFromBufferToWorking( const char *pBuffer, uint32_t nImportFlags ) = 0; |
2321 | | }; |
2322 | | |
2323 | | static const char * const IVRChaperoneSetup_Version = "IVRChaperoneSetup_005"; |
2324 | | |
2325 | | |
2326 | | } |
2327 | | |
2328 | | // ivrcompositor.h |
2329 | | namespace vr |
2330 | | { |
2331 | | |
2332 | | #pragma pack( push, 8 ) |
2333 | | |
2334 | | /** Errors that can occur with the VR compositor */ |
2335 | | enum EVRCompositorError |
2336 | | { |
2337 | | VRCompositorError_None = 0, |
2338 | | VRCompositorError_RequestFailed = 1, |
2339 | | VRCompositorError_IncompatibleVersion = 100, |
2340 | | VRCompositorError_DoNotHaveFocus = 101, |
2341 | | VRCompositorError_InvalidTexture = 102, |
2342 | | VRCompositorError_IsNotSceneApplication = 103, |
2343 | | VRCompositorError_TextureIsOnWrongDevice = 104, |
2344 | | VRCompositorError_TextureUsesUnsupportedFormat = 105, |
2345 | | VRCompositorError_SharedTexturesNotSupported = 106, |
2346 | | VRCompositorError_IndexOutOfRange = 107, |
2347 | | VRCompositorError_AlreadySubmitted = 108, |
2348 | | VRCompositorError_InvalidBounds = 109, |
2349 | | }; |
2350 | | |
2351 | | /** Timing mode passed to SetExplicitTimingMode(); see that function for documentation */ |
2352 | | enum EVRCompositorTimingMode |
2353 | | { |
2354 | | VRCompositorTimingMode_Implicit = 0, |
2355 | | VRCompositorTimingMode_Explicit_RuntimePerformsPostPresentHandoff = 1, |
2356 | | VRCompositorTimingMode_Explicit_ApplicationPerformsPostPresentHandoff = 2, |
2357 | | }; |
2358 | | |
2359 | | const uint32_t VRCompositor_ReprojectionReason_Cpu = 0x01; |
2360 | | const uint32_t VRCompositor_ReprojectionReason_Gpu = 0x02; |
2361 | | const uint32_t VRCompositor_ReprojectionAsync = 0x04; // This flag indicates the async reprojection mode is active, |
2362 | | // but does not indicate if reprojection actually happened or not. |
2363 | | // Use the ReprojectionReason flags above to check if reprojection |
2364 | | // was actually applied (i.e. scene texture was reused). |
2365 | | // NumFramePresents > 1 also indicates the scene texture was reused, |
2366 | | // and also the number of times that it was presented in total. |
2367 | | |
2368 | | /** Provides a single frame's timing information to the app */ |
2369 | | struct Compositor_FrameTiming |
2370 | | { |
2371 | | uint32_t m_nSize; // Set to sizeof( Compositor_FrameTiming ) |
2372 | | uint32_t m_nFrameIndex; |
2373 | | uint32_t m_nNumFramePresents; // number of times this frame was presented |
2374 | | uint32_t m_nNumMisPresented; // number of times this frame was presented on a vsync other than it was originally predicted to |
2375 | | uint32_t m_nNumDroppedFrames; // number of additional times previous frame was scanned out |
2376 | | uint32_t m_nReprojectionFlags; |
2377 | | |
2378 | | /** Absolute time reference for comparing frames. This aligns with the vsync that running start is relative to. */ |
2379 | | double m_flSystemTimeInSeconds; |
2380 | | |
2381 | | /** These times may include work from other processes due to OS scheduling. |
2382 | | * The fewer packets of work these are broken up into, the less likely this will happen. |
2383 | | * GPU work can be broken up by calling Flush. This can sometimes be useful to get the GPU started |
2384 | | * processing that work earlier in the frame. */ |
2385 | | float m_flPreSubmitGpuMs; // time spent rendering the scene (gpu work submitted between WaitGetPoses and second Submit) |
2386 | | float m_flPostSubmitGpuMs; // additional time spent rendering by application (e.g. companion window) |
2387 | | float m_flTotalRenderGpuMs; // time between work submitted immediately after present (ideally vsync) until the end of compositor submitted work |
2388 | | float m_flCompositorRenderGpuMs; // time spend performing distortion correction, rendering chaperone, overlays, etc. |
2389 | | float m_flCompositorRenderCpuMs; // time spent on cpu submitting the above work for this frame |
2390 | | float m_flCompositorIdleCpuMs; // time spent waiting for running start (application could have used this much more time) |
2391 | | |
2392 | | /** Miscellaneous measured intervals. */ |
2393 | | float m_flClientFrameIntervalMs; // time between calls to WaitGetPoses |
2394 | | float m_flPresentCallCpuMs; // time blocked on call to present (usually 0.0, but can go long) |
2395 | | float m_flWaitForPresentCpuMs; // time spent spin-waiting for frame index to change (not near-zero indicates wait object failure) |
2396 | | float m_flSubmitFrameMs; // time spent in IVRCompositor::Submit (not near-zero indicates driver issue) |
2397 | | |
2398 | | /** The following are all relative to this frame's SystemTimeInSeconds */ |
2399 | | float m_flWaitGetPosesCalledMs; |
2400 | | float m_flNewPosesReadyMs; |
2401 | | float m_flNewFrameReadyMs; // second call to IVRCompositor::Submit |
2402 | | float m_flCompositorUpdateStartMs; |
2403 | | float m_flCompositorUpdateEndMs; |
2404 | | float m_flCompositorRenderStartMs; |
2405 | | |
2406 | | vr::TrackedDevicePose_t m_HmdPose; // pose used by app to render this frame |
2407 | | }; |
2408 | | |
2409 | | /** Cumulative stats for current application. These are not cleared until a new app connects, |
2410 | | * but they do stop accumulating once the associated app disconnects. */ |
2411 | | struct Compositor_CumulativeStats |
2412 | | { |
2413 | | uint32_t m_nPid; // Process id associated with these stats (may no longer be running). |
2414 | | uint32_t m_nNumFramePresents; // total number of times we called present (includes reprojected frames) |
2415 | | uint32_t m_nNumDroppedFrames; // total number of times an old frame was re-scanned out (without reprojection) |
2416 | | uint32_t m_nNumReprojectedFrames; // total number of times a frame was scanned out a second time (with reprojection) |
2417 | | |
2418 | | /** Values recorded at startup before application has fully faded in the first time. */ |
2419 | | uint32_t m_nNumFramePresentsOnStartup; |
2420 | | uint32_t m_nNumDroppedFramesOnStartup; |
2421 | | uint32_t m_nNumReprojectedFramesOnStartup; |
2422 | | |
2423 | | /** Applications may explicitly fade to the compositor. This is usually to handle level transitions, and loading often causes |
2424 | | * system wide hitches. The following stats are collected during this period. Does not include values recorded during startup. */ |
2425 | | uint32_t m_nNumLoading; |
2426 | | uint32_t m_nNumFramePresentsLoading; |
2427 | | uint32_t m_nNumDroppedFramesLoading; |
2428 | | uint32_t m_nNumReprojectedFramesLoading; |
2429 | | |
2430 | | /** If we don't get a new frame from the app in less than 2.5 frames, then we assume the app has hung and start |
2431 | | * fading back to the compositor. The following stats are a result of this, and are a subset of those recorded above. |
2432 | | * Does not include values recorded during start up or loading. */ |
2433 | | uint32_t m_nNumTimedOut; |
2434 | | uint32_t m_nNumFramePresentsTimedOut; |
2435 | | uint32_t m_nNumDroppedFramesTimedOut; |
2436 | | uint32_t m_nNumReprojectedFramesTimedOut; |
2437 | | }; |
2438 | | |
2439 | | #pragma pack( pop ) |
2440 | | |
2441 | | /** Allows the application to interact with the compositor */ |
2442 | | class IVRCompositor |
2443 | | { |
2444 | | public: |
2445 | | /** Sets tracking space returned by WaitGetPoses */ |
2446 | | virtual void SetTrackingSpace( ETrackingUniverseOrigin eOrigin ) = 0; |
2447 | | |
2448 | | /** Gets current tracking space returned by WaitGetPoses */ |
2449 | | virtual ETrackingUniverseOrigin GetTrackingSpace() = 0; |
2450 | | |
2451 | | /** Scene applications should call this function to get poses to render with (and optionally poses predicted an additional frame out to use for gameplay). |
2452 | | * This function will block until "running start" milliseconds before the start of the frame, and should be called at the last moment before needing to |
2453 | | * start rendering. |
2454 | | * |
2455 | | * Return codes: |
2456 | | * - IsNotSceneApplication (make sure to call VR_Init with VRApplicaiton_Scene) |
2457 | | * - DoNotHaveFocus (some other app has taken focus - this will throttle the call to 10hz to reduce the impact on that app) |
2458 | | */ |
2459 | | virtual EVRCompositorError WaitGetPoses( VR_ARRAY_COUNT(unRenderPoseArrayCount) TrackedDevicePose_t* pRenderPoseArray, uint32_t unRenderPoseArrayCount, |
2460 | | VR_ARRAY_COUNT(unGamePoseArrayCount) TrackedDevicePose_t* pGamePoseArray, uint32_t unGamePoseArrayCount ) = 0; |
2461 | | |
2462 | | /** Get the last set of poses returned by WaitGetPoses. */ |
2463 | | virtual EVRCompositorError GetLastPoses( VR_ARRAY_COUNT( unRenderPoseArrayCount ) TrackedDevicePose_t* pRenderPoseArray, uint32_t unRenderPoseArrayCount, |
2464 | | VR_ARRAY_COUNT( unGamePoseArrayCount ) TrackedDevicePose_t* pGamePoseArray, uint32_t unGamePoseArrayCount ) = 0; |
2465 | | |
2466 | | /** Interface for accessing last set of poses returned by WaitGetPoses one at a time. |
2467 | | * Returns VRCompositorError_IndexOutOfRange if unDeviceIndex not less than k_unMaxTrackedDeviceCount otherwise VRCompositorError_None. |
2468 | | * It is okay to pass NULL for either pose if you only want one of the values. */ |
2469 | | virtual EVRCompositorError GetLastPoseForTrackedDeviceIndex( TrackedDeviceIndex_t unDeviceIndex, TrackedDevicePose_t *pOutputPose, TrackedDevicePose_t *pOutputGamePose ) = 0; |
2470 | | |
2471 | | /** Updated scene texture to display. If pBounds is NULL the entire texture will be used. If called from an OpenGL app, consider adding a glFlush after |
2472 | | * Submitting both frames to signal the driver to start processing, otherwise it may wait until the command buffer fills up, causing the app to miss frames. |
2473 | | * |
2474 | | * OpenGL dirty state: |
2475 | | * glBindTexture |
2476 | | * |
2477 | | * Return codes: |
2478 | | * - IsNotSceneApplication (make sure to call VR_Init with VRApplicaiton_Scene) |
2479 | | * - DoNotHaveFocus (some other app has taken focus) |
2480 | | * - TextureIsOnWrongDevice (application did not use proper AdapterIndex - see IVRSystem.GetDXGIOutputInfo) |
2481 | | * - SharedTexturesNotSupported (application needs to call CreateDXGIFactory1 or later before creating DX device) |
2482 | | * - TextureUsesUnsupportedFormat (scene textures must be compatible with DXGI sharing rules - e.g. uncompressed, no mips, etc.) |
2483 | | * - InvalidTexture (usually means bad arguments passed in) |
2484 | | * - AlreadySubmitted (app has submitted two left textures or two right textures in a single frame - i.e. before calling WaitGetPoses again) |
2485 | | */ |
2486 | | virtual EVRCompositorError Submit( EVREye eEye, const Texture_t *pTexture, const VRTextureBounds_t* pBounds = 0, EVRSubmitFlags nSubmitFlags = Submit_Default ) = 0; |
2487 | | |
2488 | | /** Clears the frame that was sent with the last call to Submit. This will cause the |
2489 | | * compositor to show the grid until Submit is called again. */ |
2490 | | virtual void ClearLastSubmittedFrame() = 0; |
2491 | | |
2492 | | /** Call immediately after presenting your app's window (i.e. companion window) to unblock the compositor. |
2493 | | * This is an optional call, which only needs to be used if you can't instead call WaitGetPoses immediately after Present. |
2494 | | * For example, if your engine's render and game loop are not on separate threads, or blocking the render thread until 3ms before the next vsync would |
2495 | | * introduce a deadlock of some sort. This function tells the compositor that you have finished all rendering after having Submitted buffers for both |
2496 | | * eyes, and it is free to start its rendering work. This should only be called from the same thread you are rendering on. */ |
2497 | | virtual void PostPresentHandoff() = 0; |
2498 | | |
2499 | | /** Returns true if timing data is filled it. Sets oldest timing info if nFramesAgo is larger than the stored history. |
2500 | | * Be sure to set timing.size = sizeof(Compositor_FrameTiming) on struct passed in before calling this function. */ |
2501 | | virtual bool GetFrameTiming( Compositor_FrameTiming *pTiming, uint32_t unFramesAgo = 0 ) = 0; |
2502 | | |
2503 | | /** Interface for copying a range of timing data. Frames are returned in ascending order (oldest to newest) with the last being the most recent frame. |
2504 | | * Only the first entry's m_nSize needs to be set, as the rest will be inferred from that. Returns total number of entries filled out. */ |
2505 | | virtual uint32_t GetFrameTimings( Compositor_FrameTiming *pTiming, uint32_t nFrames ) = 0; |
2506 | | |
2507 | | /** Returns the time in seconds left in the current (as identified by FrameTiming's frameIndex) frame. |
2508 | | * Due to "running start", this value may roll over to the next frame before ever reaching 0.0. */ |
2509 | | virtual float GetFrameTimeRemaining() = 0; |
2510 | | |
2511 | | /** Fills out stats accumulated for the last connected application. Pass in sizeof( Compositor_CumulativeStats ) as second parameter. */ |
2512 | | virtual void GetCumulativeStats( Compositor_CumulativeStats *pStats, uint32_t nStatsSizeInBytes ) = 0; |
2513 | | |
2514 | | /** Fades the view on the HMD to the specified color. The fade will take fSeconds, and the color values are between |
2515 | | * 0.0 and 1.0. This color is faded on top of the scene based on the alpha parameter. Removing the fade color instantly |
2516 | | * would be FadeToColor( 0.0, 0.0, 0.0, 0.0, 0.0 ). Values are in un-premultiplied alpha space. */ |
2517 | | virtual void FadeToColor( float fSeconds, float fRed, float fGreen, float fBlue, float fAlpha, bool bBackground = false ) = 0; |
2518 | | |
2519 | | /** Get current fade color value. */ |
2520 | | virtual HmdColor_t GetCurrentFadeColor( bool bBackground = false ) = 0; |
2521 | | |
2522 | | /** Fading the Grid in or out in fSeconds */ |
2523 | | virtual void FadeGrid( float fSeconds, bool bFadeIn ) = 0; |
2524 | | |
2525 | | /** Get current alpha value of grid. */ |
2526 | | virtual float GetCurrentGridAlpha() = 0; |
2527 | | |
2528 | | /** Override the skybox used in the compositor (e.g. for during level loads when the app can't feed scene images fast enough) |
2529 | | * Order is Front, Back, Left, Right, Top, Bottom. If only a single texture is passed, it is assumed in lat-long format. |
2530 | | * If two are passed, it is assumed a lat-long stereo pair. */ |
2531 | | virtual EVRCompositorError SetSkyboxOverride( VR_ARRAY_COUNT( unTextureCount ) const Texture_t *pTextures, uint32_t unTextureCount ) = 0; |
2532 | | |
2533 | | /** Resets compositor skybox back to defaults. */ |
2534 | | virtual void ClearSkyboxOverride() = 0; |
2535 | | |
2536 | | /** Brings the compositor window to the front. This is useful for covering any other window that may be on the HMD |
2537 | | * and is obscuring the compositor window. */ |
2538 | | virtual void CompositorBringToFront() = 0; |
2539 | | |
2540 | | /** Pushes the compositor window to the back. This is useful for allowing other applications to draw directly to the HMD. */ |
2541 | | virtual void CompositorGoToBack() = 0; |
2542 | | |
2543 | | /** Tells the compositor process to clean up and exit. You do not need to call this function at shutdown. Under normal |
2544 | | * circumstances the compositor will manage its own life cycle based on what applications are running. */ |
2545 | | virtual void CompositorQuit() = 0; |
2546 | | |
2547 | | /** Return whether the compositor is fullscreen */ |
2548 | | virtual bool IsFullscreen() = 0; |
2549 | | |
2550 | | /** Returns the process ID of the process that is currently rendering the scene */ |
2551 | | virtual uint32_t GetCurrentSceneFocusProcess() = 0; |
2552 | | |
2553 | | /** Returns the process ID of the process that rendered the last frame (or 0 if the compositor itself rendered the frame.) |
2554 | | * Returns 0 when fading out from an app and the app's process Id when fading into an app. */ |
2555 | | virtual uint32_t GetLastFrameRenderer() = 0; |
2556 | | |
2557 | | /** Returns true if the current process has the scene focus */ |
2558 | | virtual bool CanRenderScene() = 0; |
2559 | | |
2560 | | /** Creates a window on the primary monitor to display what is being shown in the headset. */ |
2561 | | virtual void ShowMirrorWindow() = 0; |
2562 | | |
2563 | | /** Closes the mirror window. */ |
2564 | | virtual void HideMirrorWindow() = 0; |
2565 | | |
2566 | | /** Returns true if the mirror window is shown. */ |
2567 | | virtual bool IsMirrorWindowVisible() = 0; |
2568 | | |
2569 | | /** Writes all images that the compositor knows about (including overlays) to a 'screenshots' folder in the SteamVR runtime root. */ |
2570 | | virtual void CompositorDumpImages() = 0; |
2571 | | |
2572 | | /** Let an app know it should be rendering with low resources. */ |
2573 | | virtual bool ShouldAppRenderWithLowResources() = 0; |
2574 | | |
2575 | | /** Override interleaved reprojection logic to force on. */ |
2576 | | virtual void ForceInterleavedReprojectionOn( bool bOverride ) = 0; |
2577 | | |
2578 | | /** Force reconnecting to the compositor process. */ |
2579 | | virtual void ForceReconnectProcess() = 0; |
2580 | | |
2581 | | /** Temporarily suspends rendering (useful for finer control over scene transitions). */ |
2582 | | virtual void SuspendRendering( bool bSuspend ) = 0; |
2583 | | |
2584 | | /** Opens a shared D3D11 texture with the undistorted composited image for each eye. Use ReleaseMirrorTextureD3D11 when finished |
2585 | | * instead of calling Release on the resource itself. */ |
2586 | | virtual vr::EVRCompositorError GetMirrorTextureD3D11( vr::EVREye eEye, void *pD3D11DeviceOrResource, void **ppD3D11ShaderResourceView ) = 0; |
2587 | | virtual void ReleaseMirrorTextureD3D11( void *pD3D11ShaderResourceView ) = 0; |
2588 | | |
2589 | | /** Access to mirror textures from OpenGL. */ |
2590 | | virtual vr::EVRCompositorError GetMirrorTextureGL( vr::EVREye eEye, vr::glUInt_t *pglTextureId, vr::glSharedTextureHandle_t *pglSharedTextureHandle ) = 0; |
2591 | | virtual bool ReleaseSharedGLTexture( vr::glUInt_t glTextureId, vr::glSharedTextureHandle_t glSharedTextureHandle ) = 0; |
2592 | | virtual void LockGLSharedTextureForAccess( vr::glSharedTextureHandle_t glSharedTextureHandle ) = 0; |
2593 | | virtual void UnlockGLSharedTextureForAccess( vr::glSharedTextureHandle_t glSharedTextureHandle ) = 0; |
2594 | | |
2595 | | /** [Vulkan Only] |
2596 | | * return 0. Otherwise it returns the length of the number of bytes necessary to hold this string including the trailing |
2597 | | * null. The string will be a space separated list of-required instance extensions to enable in VkCreateInstance */ |
2598 | | virtual uint32_t GetVulkanInstanceExtensionsRequired( VR_OUT_STRING() char *pchValue, uint32_t unBufferSize ) = 0; |
2599 | | |
2600 | | /** [Vulkan only] |
2601 | | * return 0. Otherwise it returns the length of the number of bytes necessary to hold this string including the trailing |
2602 | | * null. The string will be a space separated list of required device extensions to enable in VkCreateDevice */ |
2603 | | virtual uint32_t GetVulkanDeviceExtensionsRequired( VkPhysicalDevice_T *pPhysicalDevice, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize ) = 0; |
2604 | | |
2605 | | /** [ Vulkan/D3D12 Only ] |
2606 | | * There are two purposes for SetExplicitTimingMode: |
2607 | | * 1. To get a more accurate GPU timestamp for when the frame begins in Vulkan/D3D12 applications. |
2608 | | * 2. (Optional) To avoid having WaitGetPoses access the Vulkan queue so that the queue can be accessed from |
2609 | | * another thread while WaitGetPoses is executing. |
2610 | | * |
2611 | | * More accurate GPU timestamp for the start of the frame is achieved by the application calling |
2612 | | * SubmitExplicitTimingData immediately before its first submission to the Vulkan/D3D12 queue. |
2613 | | * This is more accurate because normally this GPU timestamp is recorded during WaitGetPoses. In D3D11, |
2614 | | * WaitGetPoses queues a GPU timestamp write, but it does not actually get submitted to the GPU until the |
2615 | | * application flushes. By using SubmitExplicitTimingData, the timestamp is recorded at the same place for |
2616 | | * Vulkan/D3D12 as it is for D3D11, resulting in a more accurate GPU time measurement for the frame. |
2617 | | * |
2618 | | * Avoiding WaitGetPoses accessing the Vulkan queue can be achieved using SetExplicitTimingMode as well. If this is desired, |
2619 | | * the application should set the timing mode to Explicit_ApplicationPerformsPostPresentHandoff and *MUST* call PostPresentHandoff |
2620 | | * itself. If these conditions are met, then WaitGetPoses is guaranteed not to access the queue. Note that PostPresentHandoff |
2621 | | * and SubmitExplicitTimingData will access the queue, so only WaitGetPoses becomes safe for accessing the queue from another |
2622 | | * thread. */ |
2623 | | virtual void SetExplicitTimingMode( EVRCompositorTimingMode eTimingMode ) = 0; |
2624 | | |
2625 | | /** [ Vulkan/D3D12 Only ] |
2626 | | * Submit explicit timing data. When SetExplicitTimingMode is true, this must be called immediately before |
2627 | | * the application's first vkQueueSubmit (Vulkan) or ID3D12CommandQueue::ExecuteCommandLists (D3D12) of each frame. |
2628 | | * This function will insert a GPU timestamp write just before the application starts its rendering. This function |
2629 | | * will perform a vkQueueSubmit on Vulkan so must not be done simultaneously with VkQueue operations on another thread. |
2630 | | * Returns VRCompositorError_RequestFailed if SetExplicitTimingMode is not enabled. */ |
2631 | | virtual EVRCompositorError SubmitExplicitTimingData() = 0; |
2632 | | }; |
2633 | | |
2634 | | static const char * const IVRCompositor_Version = "IVRCompositor_022"; |
2635 | | |
2636 | | } // namespace vr |
2637 | | |
2638 | | |
2639 | | |
2640 | | // ivrnotifications.h |
2641 | | namespace vr |
2642 | | { |
2643 | | |
2644 | | #pragma pack( push, 8 ) |
2645 | | |
2646 | | // Used for passing graphic data |
2647 | | struct NotificationBitmap_t |
2648 | | { |
2649 | | NotificationBitmap_t() |
2650 | | : m_pImageData( nullptr ) |
2651 | | , m_nWidth( 0 ) |
2652 | | , m_nHeight( 0 ) |
2653 | | , m_nBytesPerPixel( 0 ) |
2654 | 0 | { |
2655 | 0 | }; |
2656 | | |
2657 | | void *m_pImageData; |
2658 | | int32_t m_nWidth; |
2659 | | int32_t m_nHeight; |
2660 | | int32_t m_nBytesPerPixel; |
2661 | | }; |
2662 | | |
2663 | | |
2664 | | /** Be aware that the notification type is used as 'priority' to pick the next notification */ |
2665 | | enum EVRNotificationType |
2666 | | { |
2667 | | /** Transient notifications are automatically hidden after a period of time set by the user. |
2668 | | * They are used for things like information and chat messages that do not require user interaction. */ |
2669 | | EVRNotificationType_Transient = 0, |
2670 | | |
2671 | | /** Persistent notifications are shown to the user until they are hidden by calling RemoveNotification(). |
2672 | | * They are used for things like phone calls and alarms that require user interaction. */ |
2673 | | EVRNotificationType_Persistent = 1, |
2674 | | |
2675 | | /** System notifications are shown no matter what. It is expected, that the ulUserValue is used as ID. |
2676 | | * If there is already a system notification in the queue with that ID it is not accepted into the queue |
2677 | | * to prevent spamming with system notification */ |
2678 | | EVRNotificationType_Transient_SystemWithUserValue = 2, |
2679 | | }; |
2680 | | |
2681 | | enum EVRNotificationStyle |
2682 | | { |
2683 | | /** Creates a notification with minimal external styling. */ |
2684 | | EVRNotificationStyle_None = 0, |
2685 | | |
2686 | | /** Used for notifications about overlay-level status. In Steam this is used for events like downloads completing. */ |
2687 | | EVRNotificationStyle_Application = 100, |
2688 | | |
2689 | | /** Used for notifications about contacts that are unknown or not available. In Steam this is used for friend invitations and offline friends. */ |
2690 | | EVRNotificationStyle_Contact_Disabled = 200, |
2691 | | |
2692 | | /** Used for notifications about contacts that are available but inactive. In Steam this is used for friends that are online but not playing a game. */ |
2693 | | EVRNotificationStyle_Contact_Enabled = 201, |
2694 | | |
2695 | | /** Used for notifications about contacts that are available and active. In Steam this is used for friends that are online and currently running a game. */ |
2696 | | EVRNotificationStyle_Contact_Active = 202, |
2697 | | }; |
2698 | | |
2699 | | static const uint32_t k_unNotificationTextMaxSize = 256; |
2700 | | |
2701 | | typedef uint32_t VRNotificationId; |
2702 | | |
2703 | | |
2704 | | |
2705 | | #pragma pack( pop ) |
2706 | | |
2707 | | /** Allows notification sources to interact with the VR system |
2708 | | This current interface is not yet implemented. Do not use yet. */ |
2709 | | class IVRNotifications |
2710 | | { |
2711 | | public: |
2712 | | /** Create a notification and enqueue it to be shown to the user. |
2713 | | * An overlay handle is required to create a notification, as otherwise it would be impossible for a user to act on it. |
2714 | | * To create a two-line notification, use a line break ('\n') to split the text into two lines. |
2715 | | * The pImage argument may be NULL, in which case the specified overlay's icon will be used instead. */ |
2716 | | virtual EVRNotificationError CreateNotification( VROverlayHandle_t ulOverlayHandle, uint64_t ulUserValue, EVRNotificationType type, const char *pchText, EVRNotificationStyle style, const NotificationBitmap_t *pImage, /* out */ VRNotificationId *pNotificationId ) = 0; |
2717 | | |
2718 | | /** Destroy a notification, hiding it first if it currently shown to the user. */ |
2719 | | virtual EVRNotificationError RemoveNotification( VRNotificationId notificationId ) = 0; |
2720 | | |
2721 | | }; |
2722 | | |
2723 | | static const char * const IVRNotifications_Version = "IVRNotifications_002"; |
2724 | | |
2725 | | } // namespace vr |
2726 | | |
2727 | | |
2728 | | |
2729 | | // ivroverlay.h |
2730 | | namespace vr |
2731 | | { |
2732 | | |
2733 | | /** The maximum length of an overlay key in bytes, counting the terminating null character. */ |
2734 | | static const uint32_t k_unVROverlayMaxKeyLength = 128; |
2735 | | |
2736 | | /** The maximum length of an overlay name in bytes, counting the terminating null character. */ |
2737 | | static const uint32_t k_unVROverlayMaxNameLength = 128; |
2738 | | |
2739 | | /** The maximum number of overlays that can exist in the system at one time. */ |
2740 | | static const uint32_t k_unMaxOverlayCount = 64; |
2741 | | |
2742 | | /** The maximum number of overlay intersection mask primitives per overlay */ |
2743 | | static const uint32_t k_unMaxOverlayIntersectionMaskPrimitivesCount = 32; |
2744 | | |
2745 | | /** Types of input supported by VR Overlays */ |
2746 | | enum VROverlayInputMethod |
2747 | | { |
2748 | | VROverlayInputMethod_None = 0, // No input events will be generated automatically for this overlay |
2749 | | VROverlayInputMethod_Mouse = 1, // Tracked controllers will get mouse events automatically |
2750 | | VROverlayInputMethod_DualAnalog = 2, // Analog inputs from tracked controllers are turned into DualAnalog events |
2751 | | }; |
2752 | | |
2753 | | /** Allows the caller to figure out which overlay transform getter to call. */ |
2754 | | enum VROverlayTransformType |
2755 | | { |
2756 | | VROverlayTransform_Absolute = 0, |
2757 | | VROverlayTransform_TrackedDeviceRelative = 1, |
2758 | | VROverlayTransform_SystemOverlay = 2, |
2759 | | VROverlayTransform_TrackedComponent = 3, |
2760 | | }; |
2761 | | |
2762 | | /** Overlay control settings */ |
2763 | | enum VROverlayFlags |
2764 | | { |
2765 | | VROverlayFlags_None = 0, |
2766 | | |
2767 | | // The following only take effect when rendered using the high quality render path (see SetHighQualityOverlay). |
2768 | | VROverlayFlags_Curved = 1, |
2769 | | VROverlayFlags_RGSS4X = 2, |
2770 | | |
2771 | | // Set this flag on a dashboard overlay to prevent a tab from showing up for that overlay |
2772 | | VROverlayFlags_NoDashboardTab = 3, |
2773 | | |
2774 | | // Set this flag on a dashboard that is able to deal with gamepad focus events |
2775 | | VROverlayFlags_AcceptsGamepadEvents = 4, |
2776 | | |
2777 | | // Indicates that the overlay should dim/brighten to show gamepad focus |
2778 | | VROverlayFlags_ShowGamepadFocus = 5, |
2779 | | |
2780 | | // When in VROverlayInputMethod_Mouse you can optionally enable sending VRScroll_t |
2781 | | VROverlayFlags_SendVRScrollEvents = 6, |
2782 | | VROverlayFlags_SendVRTouchpadEvents = 7, |
2783 | | |
2784 | | // If set this will render a vertical scroll wheel on the primary controller, |
2785 | | // only needed if not using VROverlayFlags_SendVRScrollEvents but you still want to represent a scroll wheel |
2786 | | VROverlayFlags_ShowTouchPadScrollWheel = 8, |
2787 | | |
2788 | | // If this is set ownership and render access to the overlay are transferred |
2789 | | // to the new scene process on a call to IVRApplications::LaunchInternalProcess |
2790 | | VROverlayFlags_TransferOwnershipToInternalProcess = 9, |
2791 | | |
2792 | | // If set, renders 50% of the texture in each eye, side by side |
2793 | | VROverlayFlags_SideBySide_Parallel = 10, // Texture is left/right |
2794 | | VROverlayFlags_SideBySide_Crossed = 11, // Texture is crossed and right/left |
2795 | | |
2796 | | VROverlayFlags_Panorama = 12, // Texture is a panorama |
2797 | | VROverlayFlags_StereoPanorama = 13, // Texture is a stereo panorama |
2798 | | |
2799 | | // If this is set on an overlay owned by the scene application that overlay |
2800 | | // will be sorted with the "Other" overlays on top of all other scene overlays |
2801 | | VROverlayFlags_SortWithNonSceneOverlays = 14, |
2802 | | |
2803 | | // If set, the overlay will be shown in the dashboard, otherwise it will be hidden. |
2804 | | VROverlayFlags_VisibleInDashboard = 15, |
2805 | | }; |
2806 | | |
2807 | | enum VRMessageOverlayResponse |
2808 | | { |
2809 | | VRMessageOverlayResponse_ButtonPress_0 = 0, |
2810 | | VRMessageOverlayResponse_ButtonPress_1 = 1, |
2811 | | VRMessageOverlayResponse_ButtonPress_2 = 2, |
2812 | | VRMessageOverlayResponse_ButtonPress_3 = 3, |
2813 | | VRMessageOverlayResponse_CouldntFindSystemOverlay = 4, |
2814 | | VRMessageOverlayResponse_CouldntFindOrCreateClientOverlay= 5, |
2815 | | VRMessageOverlayResponse_ApplicationQuit = 6 |
2816 | | }; |
2817 | | |
2818 | | struct VROverlayIntersectionParams_t |
2819 | | { |
2820 | | HmdVector3_t vSource; |
2821 | | HmdVector3_t vDirection; |
2822 | | ETrackingUniverseOrigin eOrigin; |
2823 | | }; |
2824 | | |
2825 | | struct VROverlayIntersectionResults_t |
2826 | | { |
2827 | | HmdVector3_t vPoint; |
2828 | | HmdVector3_t vNormal; |
2829 | | HmdVector2_t vUVs; |
2830 | | float fDistance; |
2831 | | }; |
2832 | | |
2833 | | // Input modes for the Big Picture gamepad text entry |
2834 | | enum EGamepadTextInputMode |
2835 | | { |
2836 | | k_EGamepadTextInputModeNormal = 0, |
2837 | | k_EGamepadTextInputModePassword = 1, |
2838 | | k_EGamepadTextInputModeSubmit = 2, |
2839 | | }; |
2840 | | |
2841 | | // Controls number of allowed lines for the Big Picture gamepad text entry |
2842 | | enum EGamepadTextInputLineMode |
2843 | | { |
2844 | | k_EGamepadTextInputLineModeSingleLine = 0, |
2845 | | k_EGamepadTextInputLineModeMultipleLines = 1 |
2846 | | }; |
2847 | | |
2848 | | /** Directions for changing focus between overlays with the gamepad */ |
2849 | | enum EOverlayDirection |
2850 | | { |
2851 | | OverlayDirection_Up = 0, |
2852 | | OverlayDirection_Down = 1, |
2853 | | OverlayDirection_Left = 2, |
2854 | | OverlayDirection_Right = 3, |
2855 | | |
2856 | | OverlayDirection_Count = 4, |
2857 | | }; |
2858 | | |
2859 | | enum EVROverlayIntersectionMaskPrimitiveType |
2860 | | { |
2861 | | OverlayIntersectionPrimitiveType_Rectangle, |
2862 | | OverlayIntersectionPrimitiveType_Circle, |
2863 | | }; |
2864 | | |
2865 | | struct IntersectionMaskRectangle_t |
2866 | | { |
2867 | | float m_flTopLeftX; |
2868 | | float m_flTopLeftY; |
2869 | | float m_flWidth; |
2870 | | float m_flHeight; |
2871 | | }; |
2872 | | |
2873 | | struct IntersectionMaskCircle_t |
2874 | | { |
2875 | | float m_flCenterX; |
2876 | | float m_flCenterY; |
2877 | | float m_flRadius; |
2878 | | }; |
2879 | | |
2880 | | /** NOTE!!! If you change this you MUST manually update openvr_interop.cs.py and openvr_api_flat.h.py */ |
2881 | | typedef union |
2882 | | { |
2883 | | IntersectionMaskRectangle_t m_Rectangle; |
2884 | | IntersectionMaskCircle_t m_Circle; |
2885 | | } VROverlayIntersectionMaskPrimitive_Data_t; |
2886 | | |
2887 | | struct VROverlayIntersectionMaskPrimitive_t |
2888 | | { |
2889 | | EVROverlayIntersectionMaskPrimitiveType m_nPrimitiveType; |
2890 | | VROverlayIntersectionMaskPrimitive_Data_t m_Primitive; |
2891 | | }; |
2892 | | |
2893 | | class IVROverlay |
2894 | | { |
2895 | | public: |
2896 | | |
2897 | | // --------------------------------------------- |
2898 | | // Overlay management methods |
2899 | | // --------------------------------------------- |
2900 | | |
2901 | | /** Finds an existing overlay with the specified key. */ |
2902 | | virtual EVROverlayError FindOverlay( const char *pchOverlayKey, VROverlayHandle_t * pOverlayHandle ) = 0; |
2903 | | |
2904 | | /** Creates a new named overlay. All overlays start hidden and with default settings. */ |
2905 | | virtual EVROverlayError CreateOverlay( const char *pchOverlayKey, const char *pchOverlayName, VROverlayHandle_t * pOverlayHandle ) = 0; |
2906 | | |
2907 | | /** Destroys the specified overlay. When an application calls VR_Shutdown all overlays created by that app are |
2908 | | * automatically destroyed. */ |
2909 | | virtual EVROverlayError DestroyOverlay( VROverlayHandle_t ulOverlayHandle ) = 0; |
2910 | | |
2911 | | /** Specify which overlay to use the high quality render path. This overlay will be composited in during the distortion pass which |
2912 | | * results in it drawing on top of everything else, but also at a higher quality as it samples the source texture directly rather than |
2913 | | * rasterizing into each eye's render texture first. Because if this, only one of these is supported at any given time. It is most useful |
2914 | | * for overlays that are expected to take up most of the user's view (e.g. streaming video). |
2915 | | * This mode does not support mouse input to your overlay. */ |
2916 | | virtual EVROverlayError SetHighQualityOverlay( VROverlayHandle_t ulOverlayHandle ) = 0; |
2917 | | |
2918 | | /** Returns the overlay handle of the current overlay being rendered using the single high quality overlay render path. |
2919 | | * Otherwise it will return k_ulOverlayHandleInvalid. */ |
2920 | | virtual vr::VROverlayHandle_t GetHighQualityOverlay() = 0; |
2921 | | |
2922 | | /** Fills the provided buffer with the string key of the overlay. Returns the size of buffer required to store the key, including |
2923 | | * the terminating null character. k_unVROverlayMaxKeyLength will be enough bytes to fit the string. */ |
2924 | | virtual uint32_t GetOverlayKey( VROverlayHandle_t ulOverlayHandle, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize, EVROverlayError *pError = 0L ) = 0; |
2925 | | |
2926 | | /** Fills the provided buffer with the friendly name of the overlay. Returns the size of buffer required to store the key, including |
2927 | | * the terminating null character. k_unVROverlayMaxNameLength will be enough bytes to fit the string. */ |
2928 | | virtual uint32_t GetOverlayName( VROverlayHandle_t ulOverlayHandle, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize, EVROverlayError *pError = 0L ) = 0; |
2929 | | |
2930 | | /** set the name to use for this overlay */ |
2931 | | virtual EVROverlayError SetOverlayName( VROverlayHandle_t ulOverlayHandle, const char *pchName ) = 0; |
2932 | | |
2933 | | /** Gets the raw image data from an overlay. Overlay image data is always returned as RGBA data, 4 bytes per pixel. If the buffer is not large enough, width and height |
2934 | | * will be set and VROverlayError_ArrayTooSmall is returned. */ |
2935 | | virtual EVROverlayError GetOverlayImageData( VROverlayHandle_t ulOverlayHandle, void *pvBuffer, uint32_t unBufferSize, uint32_t *punWidth, uint32_t *punHeight ) = 0; |
2936 | | |
2937 | | /** returns a string that corresponds with the specified overlay error. The string will be the name |
2938 | | * of the error enum value for all valid error codes */ |
2939 | | virtual const char *GetOverlayErrorNameFromEnum( EVROverlayError error ) = 0; |
2940 | | |
2941 | | // --------------------------------------------- |
2942 | | // Overlay rendering methods |
2943 | | // --------------------------------------------- |
2944 | | |
2945 | | /** Sets the pid that is allowed to render to this overlay (the creator pid is always allow to render), |
2946 | | * by default this is the pid of the process that made the overlay */ |
2947 | | virtual EVROverlayError SetOverlayRenderingPid( VROverlayHandle_t ulOverlayHandle, uint32_t unPID ) = 0; |
2948 | | |
2949 | | /** Gets the pid that is allowed to render to this overlay */ |
2950 | | virtual uint32_t GetOverlayRenderingPid( VROverlayHandle_t ulOverlayHandle ) = 0; |
2951 | | |
2952 | | /** Specify flag setting for a given overlay */ |
2953 | | virtual EVROverlayError SetOverlayFlag( VROverlayHandle_t ulOverlayHandle, VROverlayFlags eOverlayFlag, bool bEnabled ) = 0; |
2954 | | |
2955 | | /** Sets flag setting for a given overlay */ |
2956 | | virtual EVROverlayError GetOverlayFlag( VROverlayHandle_t ulOverlayHandle, VROverlayFlags eOverlayFlag, bool *pbEnabled ) = 0; |
2957 | | |
2958 | | /** Sets the color tint of the overlay quad. Use 0.0 to 1.0 per channel. */ |
2959 | | virtual EVROverlayError SetOverlayColor( VROverlayHandle_t ulOverlayHandle, float fRed, float fGreen, float fBlue ) = 0; |
2960 | | |
2961 | | /** Gets the color tint of the overlay quad. */ |
2962 | | virtual EVROverlayError GetOverlayColor( VROverlayHandle_t ulOverlayHandle, float *pfRed, float *pfGreen, float *pfBlue ) = 0; |
2963 | | |
2964 | | /** Sets the alpha of the overlay quad. Use 1.0 for 100 percent opacity to 0.0 for 0 percent opacity. */ |
2965 | | virtual EVROverlayError SetOverlayAlpha( VROverlayHandle_t ulOverlayHandle, float fAlpha ) = 0; |
2966 | | |
2967 | | /** Gets the alpha of the overlay quad. By default overlays are rendering at 100 percent alpha (1.0). */ |
2968 | | virtual EVROverlayError GetOverlayAlpha( VROverlayHandle_t ulOverlayHandle, float *pfAlpha ) = 0; |
2969 | | |
2970 | | /** Sets the aspect ratio of the texels in the overlay. 1.0 means the texels are square. 2.0 means the texels |
2971 | | * are twice as wide as they are tall. Defaults to 1.0. */ |
2972 | | virtual EVROverlayError SetOverlayTexelAspect( VROverlayHandle_t ulOverlayHandle, float fTexelAspect ) = 0; |
2973 | | |
2974 | | /** Gets the aspect ratio of the texels in the overlay. Defaults to 1.0 */ |
2975 | | virtual EVROverlayError GetOverlayTexelAspect( VROverlayHandle_t ulOverlayHandle, float *pfTexelAspect ) = 0; |
2976 | | |
2977 | | /** Sets the rendering sort order for the overlay. Overlays are rendered this order: |
2978 | | * Overlays owned by the scene application |
2979 | | * Overlays owned by some other application |
2980 | | * |
2981 | | * Within a category overlays are rendered lowest sort order to highest sort order. Overlays with the same |
2982 | | * sort order are rendered back to front base on distance from the HMD. |
2983 | | * |
2984 | | * Sort order defaults to 0. */ |
2985 | | virtual EVROverlayError SetOverlaySortOrder( VROverlayHandle_t ulOverlayHandle, uint32_t unSortOrder ) = 0; |
2986 | | |
2987 | | /** Gets the sort order of the overlay. See SetOverlaySortOrder for how this works. */ |
2988 | | virtual EVROverlayError GetOverlaySortOrder( VROverlayHandle_t ulOverlayHandle, uint32_t *punSortOrder ) = 0; |
2989 | | |
2990 | | /** Sets the width of the overlay quad in meters. By default overlays are rendered on a quad that is 1 meter across */ |
2991 | | virtual EVROverlayError SetOverlayWidthInMeters( VROverlayHandle_t ulOverlayHandle, float fWidthInMeters ) = 0; |
2992 | | |
2993 | | /** Returns the width of the overlay quad in meters. By default overlays are rendered on a quad that is 1 meter across */ |
2994 | | virtual EVROverlayError GetOverlayWidthInMeters( VROverlayHandle_t ulOverlayHandle, float *pfWidthInMeters ) = 0; |
2995 | | |
2996 | | /** For high-quality curved overlays only, sets the distance range in meters from the overlay used to automatically curve |
2997 | | * the surface around the viewer. Min is distance is when the surface will be most curved. Max is when least curved. */ |
2998 | | virtual EVROverlayError SetOverlayAutoCurveDistanceRangeInMeters( VROverlayHandle_t ulOverlayHandle, float fMinDistanceInMeters, float fMaxDistanceInMeters ) = 0; |
2999 | | |
3000 | | /** For high-quality curved overlays only, gets the distance range in meters from the overlay used to automatically curve |
3001 | | * the surface around the viewer. Min is distance is when the surface will be most curved. Max is when least curved. */ |
3002 | | virtual EVROverlayError GetOverlayAutoCurveDistanceRangeInMeters( VROverlayHandle_t ulOverlayHandle, float *pfMinDistanceInMeters, float *pfMaxDistanceInMeters ) = 0; |
3003 | | |
3004 | | /** Sets the colorspace the overlay texture's data is in. Defaults to 'auto'. |
3005 | | * If the texture needs to be resolved, you should call SetOverlayTexture with the appropriate colorspace instead. */ |
3006 | | virtual EVROverlayError SetOverlayTextureColorSpace( VROverlayHandle_t ulOverlayHandle, EColorSpace eTextureColorSpace ) = 0; |
3007 | | |
3008 | | /** Gets the overlay's current colorspace setting. */ |
3009 | | virtual EVROverlayError GetOverlayTextureColorSpace( VROverlayHandle_t ulOverlayHandle, EColorSpace *peTextureColorSpace ) = 0; |
3010 | | |
3011 | | /** Sets the part of the texture to use for the overlay. UV Min is the upper left corner and UV Max is the lower right corner. */ |
3012 | | virtual EVROverlayError SetOverlayTextureBounds( VROverlayHandle_t ulOverlayHandle, const VRTextureBounds_t *pOverlayTextureBounds ) = 0; |
3013 | | |
3014 | | /** Gets the part of the texture to use for the overlay. UV Min is the upper left corner and UV Max is the lower right corner. */ |
3015 | | virtual EVROverlayError GetOverlayTextureBounds( VROverlayHandle_t ulOverlayHandle, VRTextureBounds_t *pOverlayTextureBounds ) = 0; |
3016 | | |
3017 | | /** Gets render model to draw behind this overlay */ |
3018 | | virtual uint32_t GetOverlayRenderModel( vr::VROverlayHandle_t ulOverlayHandle, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize, HmdColor_t *pColor, vr::EVROverlayError *pError ) = 0; |
3019 | | |
3020 | | /** Sets render model to draw behind this overlay and the vertex color to use, pass null for pColor to match the overlays vertex color. |
3021 | | The model is scaled by the same amount as the overlay, with a default of 1m. */ |
3022 | | virtual vr::EVROverlayError SetOverlayRenderModel( vr::VROverlayHandle_t ulOverlayHandle, const char *pchRenderModel, const HmdColor_t *pColor ) = 0; |
3023 | | |
3024 | | /** Returns the transform type of this overlay. */ |
3025 | | virtual EVROverlayError GetOverlayTransformType( VROverlayHandle_t ulOverlayHandle, VROverlayTransformType *peTransformType ) = 0; |
3026 | | |
3027 | | /** Sets the transform to absolute tracking origin. */ |
3028 | | virtual EVROverlayError SetOverlayTransformAbsolute( VROverlayHandle_t ulOverlayHandle, ETrackingUniverseOrigin eTrackingOrigin, const HmdMatrix34_t *pmatTrackingOriginToOverlayTransform ) = 0; |
3029 | | |
3030 | | /** Gets the transform if it is absolute. Returns an error if the transform is some other type. */ |
3031 | | virtual EVROverlayError GetOverlayTransformAbsolute( VROverlayHandle_t ulOverlayHandle, ETrackingUniverseOrigin *peTrackingOrigin, HmdMatrix34_t *pmatTrackingOriginToOverlayTransform ) = 0; |
3032 | | |
3033 | | /** Sets the transform to relative to the transform of the specified tracked device. */ |
3034 | | virtual EVROverlayError SetOverlayTransformTrackedDeviceRelative( VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t unTrackedDevice, const HmdMatrix34_t *pmatTrackedDeviceToOverlayTransform ) = 0; |
3035 | | |
3036 | | /** Gets the transform if it is relative to a tracked device. Returns an error if the transform is some other type. */ |
3037 | | virtual EVROverlayError GetOverlayTransformTrackedDeviceRelative( VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t *punTrackedDevice, HmdMatrix34_t *pmatTrackedDeviceToOverlayTransform ) = 0; |
3038 | | |
3039 | | /** Sets the transform to draw the overlay on a rendermodel component mesh instead of a quad. This will only draw when the system is |
3040 | | * drawing the device. Overlays with this transform type cannot receive mouse events. */ |
3041 | | virtual EVROverlayError SetOverlayTransformTrackedDeviceComponent( VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t unDeviceIndex, const char *pchComponentName ) = 0; |
3042 | | |
3043 | | /** Gets the transform information when the overlay is rendering on a component. */ |
3044 | | virtual EVROverlayError GetOverlayTransformTrackedDeviceComponent( VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t *punDeviceIndex, VR_OUT_STRING() char *pchComponentName, uint32_t unComponentNameSize ) = 0; |
3045 | | |
3046 | | /** Gets the transform if it is relative to another overlay. Returns an error if the transform is some other type. */ |
3047 | | virtual vr::EVROverlayError GetOverlayTransformOverlayRelative( VROverlayHandle_t ulOverlayHandle, VROverlayHandle_t *ulOverlayHandleParent, HmdMatrix34_t *pmatParentOverlayToOverlayTransform ) = 0; |
3048 | | |
3049 | | /** Sets the transform to relative to the transform of the specified overlay. This overlays visibility will also track the parents visibility */ |
3050 | | virtual vr::EVROverlayError SetOverlayTransformOverlayRelative( VROverlayHandle_t ulOverlayHandle, VROverlayHandle_t ulOverlayHandleParent, const HmdMatrix34_t *pmatParentOverlayToOverlayTransform ) = 0; |
3051 | | |
3052 | | /** Shows the VR overlay. For dashboard overlays, only the Dashboard Manager is allowed to call this. */ |
3053 | | virtual EVROverlayError ShowOverlay( VROverlayHandle_t ulOverlayHandle ) = 0; |
3054 | | |
3055 | | /** Hides the VR overlay. For dashboard overlays, only the Dashboard Manager is allowed to call this. */ |
3056 | | virtual EVROverlayError HideOverlay( VROverlayHandle_t ulOverlayHandle ) = 0; |
3057 | | |
3058 | | /** Returns true if the overlay is visible. */ |
3059 | | virtual bool IsOverlayVisible( VROverlayHandle_t ulOverlayHandle ) = 0; |
3060 | | |
3061 | | /** Get the transform in 3d space associated with a specific 2d point in the overlay's coordinate space (where 0,0 is the lower left). -Z points out of the overlay */ |
3062 | | virtual EVROverlayError GetTransformForOverlayCoordinates( VROverlayHandle_t ulOverlayHandle, ETrackingUniverseOrigin eTrackingOrigin, HmdVector2_t coordinatesInOverlay, HmdMatrix34_t *pmatTransform ) = 0; |
3063 | | |
3064 | | // --------------------------------------------- |
3065 | | // Overlay input methods |
3066 | | // --------------------------------------------- |
3067 | | |
3068 | | /** Returns true and fills the event with the next event on the overlay's event queue, if there is one. |
3069 | | * If there are no events this method returns false. uncbVREvent should be the size in bytes of the VREvent_t struct */ |
3070 | | virtual bool PollNextOverlayEvent( VROverlayHandle_t ulOverlayHandle, VREvent_t *pEvent, uint32_t uncbVREvent ) = 0; |
3071 | | |
3072 | | /** Returns the current input settings for the specified overlay. */ |
3073 | | virtual EVROverlayError GetOverlayInputMethod( VROverlayHandle_t ulOverlayHandle, VROverlayInputMethod *peInputMethod ) = 0; |
3074 | | |
3075 | | /** Sets the input settings for the specified overlay. */ |
3076 | | virtual EVROverlayError SetOverlayInputMethod( VROverlayHandle_t ulOverlayHandle, VROverlayInputMethod eInputMethod ) = 0; |
3077 | | |
3078 | | /** Gets the mouse scaling factor that is used for mouse events. The actual texture may be a different size, but this is |
3079 | | * typically the size of the underlying UI in pixels. */ |
3080 | | virtual EVROverlayError GetOverlayMouseScale( VROverlayHandle_t ulOverlayHandle, HmdVector2_t *pvecMouseScale ) = 0; |
3081 | | |
3082 | | /** Sets the mouse scaling factor that is used for mouse events. The actual texture may be a different size, but this is |
3083 | | * typically the size of the underlying UI in pixels (not in world space). */ |
3084 | | virtual EVROverlayError SetOverlayMouseScale( VROverlayHandle_t ulOverlayHandle, const HmdVector2_t *pvecMouseScale ) = 0; |
3085 | | |
3086 | | /** Computes the overlay-space pixel coordinates of where the ray intersects the overlay with the |
3087 | | * specified settings. Returns false if there is no intersection. */ |
3088 | | virtual bool ComputeOverlayIntersection( VROverlayHandle_t ulOverlayHandle, const VROverlayIntersectionParams_t *pParams, VROverlayIntersectionResults_t *pResults ) = 0; |
3089 | | |
3090 | | /** Returns true if the specified overlay is the hover target. An overlay is the hover target when it is the last overlay "moused over" |
3091 | | * by the virtual mouse pointer */ |
3092 | | virtual bool IsHoverTargetOverlay( VROverlayHandle_t ulOverlayHandle ) = 0; |
3093 | | |
3094 | | /** Returns the current Gamepad focus overlay */ |
3095 | | virtual vr::VROverlayHandle_t GetGamepadFocusOverlay() = 0; |
3096 | | |
3097 | | /** Sets the current Gamepad focus overlay */ |
3098 | | virtual EVROverlayError SetGamepadFocusOverlay( VROverlayHandle_t ulNewFocusOverlay ) = 0; |
3099 | | |
3100 | | /** Sets an overlay's neighbor. This will also set the neighbor of the "to" overlay |
3101 | | * to point back to the "from" overlay. If an overlay's neighbor is set to invalid both |
3102 | | * ends will be cleared */ |
3103 | | virtual EVROverlayError SetOverlayNeighbor( EOverlayDirection eDirection, VROverlayHandle_t ulFrom, VROverlayHandle_t ulTo ) = 0; |
3104 | | |
3105 | | /** Changes the Gamepad focus from one overlay to one of its neighbors. Returns VROverlayError_NoNeighbor if there is no |
3106 | | * neighbor in that direction */ |
3107 | | virtual EVROverlayError MoveGamepadFocusToNeighbor( EOverlayDirection eDirection, VROverlayHandle_t ulFrom ) = 0; |
3108 | | |
3109 | | /** Sets the analog input to Dual Analog coordinate scale for the specified overlay. */ |
3110 | | virtual EVROverlayError SetOverlayDualAnalogTransform( VROverlayHandle_t ulOverlay, EDualAnalogWhich eWhich, const HmdVector2_t & vCenter, float fRadius ) = 0; |
3111 | | |
3112 | | /** Gets the analog input to Dual Analog coordinate scale for the specified overlay. */ |
3113 | | virtual EVROverlayError GetOverlayDualAnalogTransform( VROverlayHandle_t ulOverlay, EDualAnalogWhich eWhich, HmdVector2_t *pvCenter, float *pfRadius ) = 0; |
3114 | | |
3115 | | // --------------------------------------------- |
3116 | | // Overlay texture methods |
3117 | | // --------------------------------------------- |
3118 | | |
3119 | | /** Texture to draw for the overlay. This function can only be called by the overlay's creator or renderer process (see SetOverlayRenderingPid) . |
3120 | | * |
3121 | | * OpenGL dirty state: |
3122 | | * glBindTexture |
3123 | | */ |
3124 | | virtual EVROverlayError SetOverlayTexture( VROverlayHandle_t ulOverlayHandle, const Texture_t *pTexture ) = 0; |
3125 | | |
3126 | | /** Use this to tell the overlay system to release the texture set for this overlay. */ |
3127 | | virtual EVROverlayError ClearOverlayTexture( VROverlayHandle_t ulOverlayHandle ) = 0; |
3128 | | |
3129 | | /** Separate interface for providing the data as a stream of bytes, but there is an upper bound on data |
3130 | | * that can be sent. This function can only be called by the overlay's renderer process. */ |
3131 | | virtual EVROverlayError SetOverlayRaw( VROverlayHandle_t ulOverlayHandle, void *pvBuffer, uint32_t unWidth, uint32_t unHeight, uint32_t unDepth ) = 0; |
3132 | | |
3133 | | /** Separate interface for providing the image through a filename: can be png or jpg, and should not be bigger than 1920x1080. |
3134 | | * This function can only be called by the overlay's renderer process */ |
3135 | | virtual EVROverlayError SetOverlayFromFile( VROverlayHandle_t ulOverlayHandle, const char *pchFilePath ) = 0; |
3136 | | |
3137 | | /** Get the native texture handle/device for an overlay you have created. |
3138 | | * On windows this handle will be a ID3D11ShaderResourceView with a ID3D11Texture2D bound. |
3139 | | * |
3140 | | * The texture will always be sized to match the backing texture you supplied in SetOverlayTexture above. |
3141 | | * |
3142 | | * You MUST call ReleaseNativeOverlayHandle() with pNativeTextureHandle once you are done with this texture. |
3143 | | * |
3144 | | * pNativeTextureHandle is an OUTPUT, it will be a pointer to a ID3D11ShaderResourceView *. |
3145 | | * pNativeTextureRef is an INPUT and should be a ID3D11Resource *. The device used by pNativeTextureRef will be used to bind pNativeTextureHandle. |
3146 | | */ |
3147 | | virtual EVROverlayError GetOverlayTexture( VROverlayHandle_t ulOverlayHandle, void **pNativeTextureHandle, void *pNativeTextureRef, uint32_t *pWidth, uint32_t *pHeight, uint32_t *pNativeFormat, ETextureType *pAPIType, EColorSpace *pColorSpace, VRTextureBounds_t *pTextureBounds ) = 0; |
3148 | | |
3149 | | /** Release the pNativeTextureHandle provided from the GetOverlayTexture call, this allows the system to free the underlying GPU resources for this object, |
3150 | | * so only do it once you stop rendering this texture. |
3151 | | */ |
3152 | | virtual EVROverlayError ReleaseNativeOverlayHandle( VROverlayHandle_t ulOverlayHandle, void *pNativeTextureHandle ) = 0; |
3153 | | |
3154 | | /** Get the size of the overlay texture */ |
3155 | | virtual EVROverlayError GetOverlayTextureSize( VROverlayHandle_t ulOverlayHandle, uint32_t *pWidth, uint32_t *pHeight ) = 0; |
3156 | | |
3157 | | // ---------------------------------------------- |
3158 | | // Dashboard Overlay Methods |
3159 | | // ---------------------------------------------- |
3160 | | |
3161 | | /** Creates a dashboard overlay and returns its handle */ |
3162 | | virtual EVROverlayError CreateDashboardOverlay( const char *pchOverlayKey, const char *pchOverlayFriendlyName, VROverlayHandle_t * pMainHandle, VROverlayHandle_t *pThumbnailHandle ) = 0; |
3163 | | |
3164 | | /** Returns true if the dashboard is visible */ |
3165 | | virtual bool IsDashboardVisible() = 0; |
3166 | | |
3167 | | /** returns true if the dashboard is visible and the specified overlay is the active system Overlay */ |
3168 | | virtual bool IsActiveDashboardOverlay( VROverlayHandle_t ulOverlayHandle ) = 0; |
3169 | | |
3170 | | /** Sets the dashboard overlay to only appear when the specified process ID has scene focus */ |
3171 | | virtual EVROverlayError SetDashboardOverlaySceneProcess( VROverlayHandle_t ulOverlayHandle, uint32_t unProcessId ) = 0; |
3172 | | |
3173 | | /** Gets the process ID that this dashboard overlay requires to have scene focus */ |
3174 | | virtual EVROverlayError GetDashboardOverlaySceneProcess( VROverlayHandle_t ulOverlayHandle, uint32_t *punProcessId ) = 0; |
3175 | | |
3176 | | /** Shows the dashboard. */ |
3177 | | virtual void ShowDashboard( const char *pchOverlayToShow ) = 0; |
3178 | | |
3179 | | /** Returns the tracked device that has the laser pointer in the dashboard */ |
3180 | | virtual vr::TrackedDeviceIndex_t GetPrimaryDashboardDevice() = 0; |
3181 | | |
3182 | | // --------------------------------------------- |
3183 | | // Keyboard methods |
3184 | | // --------------------------------------------- |
3185 | | |
3186 | | /** Show the virtual keyboard to accept input **/ |
3187 | | virtual EVROverlayError ShowKeyboard( EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char *pchDescription, uint32_t unCharMax, const char *pchExistingText, bool bUseMinimalMode, uint64_t uUserValue ) = 0; |
3188 | | |
3189 | | virtual EVROverlayError ShowKeyboardForOverlay( VROverlayHandle_t ulOverlayHandle, EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char *pchDescription, uint32_t unCharMax, const char *pchExistingText, bool bUseMinimalMode, uint64_t uUserValue ) = 0; |
3190 | | |
3191 | | /** Get the text that was entered into the text input **/ |
3192 | | virtual uint32_t GetKeyboardText( VR_OUT_STRING() char *pchText, uint32_t cchText ) = 0; |
3193 | | |
3194 | | /** Hide the virtual keyboard **/ |
3195 | | virtual void HideKeyboard() = 0; |
3196 | | |
3197 | | /** Set the position of the keyboard in world space **/ |
3198 | | virtual void SetKeyboardTransformAbsolute( ETrackingUniverseOrigin eTrackingOrigin, const HmdMatrix34_t *pmatTrackingOriginToKeyboardTransform ) = 0; |
3199 | | |
3200 | | /** Set the position of the keyboard in overlay space by telling it to avoid a rectangle in the overlay. Rectangle coords have (0,0) in the bottom left **/ |
3201 | | virtual void SetKeyboardPositionForOverlay( VROverlayHandle_t ulOverlayHandle, HmdRect2_t avoidRect ) = 0; |
3202 | | |
3203 | | // --------------------------------------------- |
3204 | | // Overlay input methods |
3205 | | // --------------------------------------------- |
3206 | | |
3207 | | /** Sets a list of primitives to be used for controller ray intersection |
3208 | | * typically the size of the underlying UI in pixels (not in world space). */ |
3209 | | virtual EVROverlayError SetOverlayIntersectionMask( VROverlayHandle_t ulOverlayHandle, VROverlayIntersectionMaskPrimitive_t *pMaskPrimitives, uint32_t unNumMaskPrimitives, uint32_t unPrimitiveSize = sizeof( VROverlayIntersectionMaskPrimitive_t ) ) = 0; |
3210 | | |
3211 | | virtual EVROverlayError GetOverlayFlags( VROverlayHandle_t ulOverlayHandle, uint32_t *pFlags ) = 0; |
3212 | | |
3213 | | // --------------------------------------------- |
3214 | | // Message box methods |
3215 | | // --------------------------------------------- |
3216 | | |
3217 | | /** Show the message overlay. This will block and return you a result. **/ |
3218 | | virtual VRMessageOverlayResponse ShowMessageOverlay( const char* pchText, const char* pchCaption, const char* pchButton0Text, const char* pchButton1Text = nullptr, const char* pchButton2Text = nullptr, const char* pchButton3Text = nullptr ) = 0; |
3219 | | |
3220 | | /** If the calling process owns the overlay and it's open, this will close it. **/ |
3221 | | virtual void CloseMessageOverlay() = 0; |
3222 | | }; |
3223 | | |
3224 | | static const char * const IVROverlay_Version = "IVROverlay_018"; |
3225 | | |
3226 | | } // namespace vr |
3227 | | |
3228 | | // ivrrendermodels.h |
3229 | | namespace vr |
3230 | | { |
3231 | | |
3232 | | static const char * const k_pch_Controller_Component_GDC2015 = "gdc2015"; // Canonical coordinate system of the gdc 2015 wired controller, provided for backwards compatibility |
3233 | | static const char * const k_pch_Controller_Component_Base = "base"; // For controllers with an unambiguous 'base'. |
3234 | | static const char * const k_pch_Controller_Component_Tip = "tip"; // For controllers with an unambiguous 'tip' (used for 'laser-pointing') |
3235 | | static const char * const k_pch_Controller_Component_HandGrip = "handgrip"; // Neutral, ambidextrous hand-pose when holding controller. On plane between neutrally posed index finger and thumb |
3236 | | static const char * const k_pch_Controller_Component_Status = "status"; // 1:1 aspect ratio status area, with canonical [0,1] uv mapping |
3237 | | |
3238 | | #pragma pack( push, 8 ) |
3239 | | |
3240 | | /** Errors that can occur with the VR compositor */ |
3241 | | enum EVRRenderModelError |
3242 | | { |
3243 | | VRRenderModelError_None = 0, |
3244 | | VRRenderModelError_Loading = 100, |
3245 | | VRRenderModelError_NotSupported = 200, |
3246 | | VRRenderModelError_InvalidArg = 300, |
3247 | | VRRenderModelError_InvalidModel = 301, |
3248 | | VRRenderModelError_NoShapes = 302, |
3249 | | VRRenderModelError_MultipleShapes = 303, |
3250 | | VRRenderModelError_TooManyVertices = 304, |
3251 | | VRRenderModelError_MultipleTextures = 305, |
3252 | | VRRenderModelError_BufferTooSmall = 306, |
3253 | | VRRenderModelError_NotEnoughNormals = 307, |
3254 | | VRRenderModelError_NotEnoughTexCoords = 308, |
3255 | | |
3256 | | VRRenderModelError_InvalidTexture = 400, |
3257 | | }; |
3258 | | |
3259 | | typedef uint32_t VRComponentProperties; |
3260 | | |
3261 | | enum EVRComponentProperty |
3262 | | { |
3263 | | VRComponentProperty_IsStatic = (1 << 0), |
3264 | | VRComponentProperty_IsVisible = (1 << 1), |
3265 | | VRComponentProperty_IsTouched = (1 << 2), |
3266 | | VRComponentProperty_IsPressed = (1 << 3), |
3267 | | VRComponentProperty_IsScrolled = (1 << 4), |
3268 | | }; |
3269 | | |
3270 | | /** Describes state information about a render-model component, including transforms and other dynamic properties */ |
3271 | | struct RenderModel_ComponentState_t |
3272 | | { |
3273 | | HmdMatrix34_t mTrackingToComponentRenderModel; // Transform required when drawing the component render model |
3274 | | HmdMatrix34_t mTrackingToComponentLocal; // Transform available for attaching to a local component coordinate system (-Z out from surface ) |
3275 | | VRComponentProperties uProperties; |
3276 | | }; |
3277 | | |
3278 | | /** A single vertex in a render model */ |
3279 | | struct RenderModel_Vertex_t |
3280 | | { |
3281 | | HmdVector3_t vPosition; // position in meters in device space |
3282 | | HmdVector3_t vNormal; |
3283 | | float rfTextureCoord[2]; |
3284 | | }; |
3285 | | |
3286 | | /** A texture map for use on a render model */ |
3287 | | #if defined(__linux__) || defined(__APPLE__) |
3288 | | // This structure was originally defined mis-packed on Linux, preserved for |
3289 | | // compatibility. |
3290 | | #pragma pack( push, 4 ) |
3291 | | #endif |
3292 | | |
3293 | | struct RenderModel_TextureMap_t |
3294 | | { |
3295 | | uint16_t unWidth, unHeight; // width and height of the texture map in pixels |
3296 | | const uint8_t *rubTextureMapData; // Map texture data. All textures are RGBA with 8 bits per channel per pixel. Data size is width * height * 4ub |
3297 | | }; |
3298 | | #if defined(__linux__) || defined(__APPLE__) |
3299 | | #pragma pack( pop ) |
3300 | | #endif |
3301 | | |
3302 | | /** Session unique texture identifier. Rendermodels which share the same texture will have the same id. |
3303 | | IDs <0 denote the texture is not present */ |
3304 | | |
3305 | | typedef int32_t TextureID_t; |
3306 | | |
3307 | | const TextureID_t INVALID_TEXTURE_ID = -1; |
3308 | | |
3309 | | #if defined(__linux__) || defined(__APPLE__) |
3310 | | // This structure was originally defined mis-packed on Linux, preserved for |
3311 | | // compatibility. |
3312 | | #pragma pack( push, 4 ) |
3313 | | #endif |
3314 | | |
3315 | | struct RenderModel_t |
3316 | | { |
3317 | | const RenderModel_Vertex_t *rVertexData; // Vertex data for the mesh |
3318 | | uint32_t unVertexCount; // Number of vertices in the vertex data |
3319 | | const uint16_t *rIndexData; // Indices into the vertex data for each triangle |
3320 | | uint32_t unTriangleCount; // Number of triangles in the mesh. Index count is 3 * TriangleCount |
3321 | | TextureID_t diffuseTextureId; // Session unique texture identifier. Rendermodels which share the same texture will have the same id. <0 == texture not present |
3322 | | }; |
3323 | | #if defined(__linux__) || defined(__APPLE__) |
3324 | | #pragma pack( pop ) |
3325 | | #endif |
3326 | | |
3327 | | |
3328 | | struct RenderModel_ControllerMode_State_t |
3329 | | { |
3330 | | bool bScrollWheelVisible; // is this controller currently set to be in a scroll wheel mode |
3331 | | }; |
3332 | | |
3333 | | #pragma pack( pop ) |
3334 | | |
3335 | | class IVRRenderModels |
3336 | | { |
3337 | | public: |
3338 | | |
3339 | | /** Loads and returns a render model for use in the application. pchRenderModelName should be a render model name |
3340 | | * from the Prop_RenderModelName_String property or an absolute path name to a render model on disk. |
3341 | | * |
3342 | | * The resulting render model is valid until VR_Shutdown() is called or until FreeRenderModel() is called. When the |
3343 | | * application is finished with the render model it should call FreeRenderModel() to free the memory associated |
3344 | | * with the model. |
3345 | | * |
3346 | | * The method returns VRRenderModelError_Loading while the render model is still being loaded. |
3347 | | * The method returns VRRenderModelError_None once loaded successfully, otherwise will return an error. */ |
3348 | | virtual EVRRenderModelError LoadRenderModel_Async( const char *pchRenderModelName, RenderModel_t **ppRenderModel ) = 0; |
3349 | | |
3350 | | /** Frees a previously returned render model |
3351 | | * It is safe to call this on a null ptr. */ |
3352 | | virtual void FreeRenderModel( RenderModel_t *pRenderModel ) = 0; |
3353 | | |
3354 | | /** Loads and returns a texture for use in the application. */ |
3355 | | virtual EVRRenderModelError LoadTexture_Async( TextureID_t textureId, RenderModel_TextureMap_t **ppTexture ) = 0; |
3356 | | |
3357 | | /** Frees a previously returned texture |
3358 | | * It is safe to call this on a null ptr. */ |
3359 | | virtual void FreeTexture( RenderModel_TextureMap_t *pTexture ) = 0; |
3360 | | |
3361 | | /** Creates a D3D11 texture and loads data into it. */ |
3362 | | virtual EVRRenderModelError LoadTextureD3D11_Async( TextureID_t textureId, void *pD3D11Device, void **ppD3D11Texture2D ) = 0; |
3363 | | |
3364 | | /** Helper function to copy the bits into an existing texture. */ |
3365 | | virtual EVRRenderModelError LoadIntoTextureD3D11_Async( TextureID_t textureId, void *pDstTexture ) = 0; |
3366 | | |
3367 | | /** Use this to free textures created with LoadTextureD3D11_Async instead of calling Release on them. */ |
3368 | | virtual void FreeTextureD3D11( void *pD3D11Texture2D ) = 0; |
3369 | | |
3370 | | /** Use this to get the names of available render models. Index does not correlate to a tracked device index, but |
3371 | | * is only used for iterating over all available render models. If the index is out of range, this function will return 0. |
3372 | | * Otherwise, it will return the size of the buffer required for the name. */ |
3373 | | virtual uint32_t GetRenderModelName( uint32_t unRenderModelIndex, VR_OUT_STRING() char *pchRenderModelName, uint32_t unRenderModelNameLen ) = 0; |
3374 | | |
3375 | | /** Returns the number of available render models. */ |
3376 | | virtual uint32_t GetRenderModelCount() = 0; |
3377 | | |
3378 | | |
3379 | | /** Returns the number of components of the specified render model. |
3380 | | * Components are useful when client application wish to draw, label, or otherwise interact with components of tracked objects. |
3381 | | * Examples controller components: |
3382 | | * renderable things such as triggers, buttons |
3383 | | * non-renderable things which include coordinate systems such as 'tip', 'base', a neutral controller agnostic hand-pose |
3384 | | * If all controller components are enumerated and rendered, it will be equivalent to drawing the traditional render model |
3385 | | * Returns 0 if components not supported, >0 otherwise */ |
3386 | | virtual uint32_t GetComponentCount( const char *pchRenderModelName ) = 0; |
3387 | | |
3388 | | /** Use this to get the names of available components. Index does not correlate to a tracked device index, but |
3389 | | * is only used for iterating over all available components. If the index is out of range, this function will return 0. |
3390 | | * Otherwise, it will return the size of the buffer required for the name. */ |
3391 | | virtual uint32_t GetComponentName( const char *pchRenderModelName, uint32_t unComponentIndex, VR_OUT_STRING( ) char *pchComponentName, uint32_t unComponentNameLen ) = 0; |
3392 | | |
3393 | | /** Get the button mask for all buttons associated with this component |
3394 | | * If no buttons (or axes) are associated with this component, return 0 |
3395 | | * Note: multiple components may be associated with the same button. Ex: two grip buttons on a single controller. |
3396 | | * Note: A single component may be associated with multiple buttons. Ex: A trackpad which also provides "D-pad" functionality */ |
3397 | | virtual uint64_t GetComponentButtonMask( const char *pchRenderModelName, const char *pchComponentName ) = 0; |
3398 | | |
3399 | | /** Use this to get the render model name for the specified rendermode/component combination, to be passed to LoadRenderModel. |
3400 | | * If the component name is out of range, this function will return 0. |
3401 | | * Otherwise, it will return the size of the buffer required for the name. */ |
3402 | | virtual uint32_t GetComponentRenderModelName( const char *pchRenderModelName, const char *pchComponentName, VR_OUT_STRING( ) char *pchComponentRenderModelName, uint32_t unComponentRenderModelNameLen ) = 0; |
3403 | | |
3404 | | /** Use this to query information about the component, as a function of the controller state. |
3405 | | * |
3406 | | * For dynamic controller components (ex: trigger) values will reflect component motions |
3407 | | * For static components this will return a consistent value independent of the VRControllerState_t |
3408 | | * |
3409 | | * If the pchRenderModelName or pchComponentName is invalid, this will return false (and transforms will be set to identity). |
3410 | | * Otherwise, return true |
3411 | | * Note: For dynamic objects, visibility may be dynamic. (I.e., true/false will be returned based on controller state and controller mode state ) */ |
3412 | | virtual bool GetComponentState( const char *pchRenderModelName, const char *pchComponentName, const vr::VRControllerState_t *pControllerState, const RenderModel_ControllerMode_State_t *pState, RenderModel_ComponentState_t *pComponentState ) = 0; |
3413 | | |
3414 | | /** Returns true if the render model has a component with the specified name */ |
3415 | | virtual bool RenderModelHasComponent( const char *pchRenderModelName, const char *pchComponentName ) = 0; |
3416 | | |
3417 | | /** Returns the URL of the thumbnail image for this rendermodel */ |
3418 | | virtual uint32_t GetRenderModelThumbnailURL( const char *pchRenderModelName, VR_OUT_STRING() char *pchThumbnailURL, uint32_t unThumbnailURLLen, vr::EVRRenderModelError *peError ) = 0; |
3419 | | |
3420 | | /** Provides a render model path that will load the unskinned model if the model name provided has been replace by the user. If the model |
3421 | | * hasn't been replaced the path value will still be a valid path to load the model. Pass this to LoadRenderModel_Async, etc. to load the |
3422 | | * model. */ |
3423 | | virtual uint32_t GetRenderModelOriginalPath( const char *pchRenderModelName, VR_OUT_STRING() char *pchOriginalPath, uint32_t unOriginalPathLen, vr::EVRRenderModelError *peError ) = 0; |
3424 | | |
3425 | | /** Returns a string for a render model error */ |
3426 | | virtual const char *GetRenderModelErrorNameFromEnum( vr::EVRRenderModelError error ) = 0; |
3427 | | }; |
3428 | | |
3429 | | static const char * const IVRRenderModels_Version = "IVRRenderModels_005"; |
3430 | | |
3431 | | } |
3432 | | |
3433 | | |
3434 | | // ivrextendeddisplay.h |
3435 | | namespace vr |
3436 | | { |
3437 | | |
3438 | | /** NOTE: Use of this interface is not recommended in production applications. It will not work for displays which use |
3439 | | * direct-to-display mode. Creating our own window is also incompatible with the VR compositor and is not available when the compositor is running. */ |
3440 | | class IVRExtendedDisplay |
3441 | | { |
3442 | | public: |
3443 | | |
3444 | | /** Size and position that the window needs to be on the VR display. */ |
3445 | | virtual void GetWindowBounds( int32_t *pnX, int32_t *pnY, uint32_t *pnWidth, uint32_t *pnHeight ) = 0; |
3446 | | |
3447 | | /** Gets the viewport in the frame buffer to draw the output of the distortion into */ |
3448 | | virtual void GetEyeOutputViewport( EVREye eEye, uint32_t *pnX, uint32_t *pnY, uint32_t *pnWidth, uint32_t *pnHeight ) = 0; |
3449 | | |
3450 | | /** [D3D10/11 Only] |
3451 | | * Returns the adapter index and output index that the user should pass into EnumAdapters and EnumOutputs |
3452 | | * to create the device and swap chain in DX10 and DX11. If an error occurs both indices will be set to -1. |
3453 | | */ |
3454 | | virtual void GetDXGIOutputInfo( int32_t *pnAdapterIndex, int32_t *pnAdapterOutputIndex ) = 0; |
3455 | | |
3456 | | }; |
3457 | | |
3458 | | static const char * const IVRExtendedDisplay_Version = "IVRExtendedDisplay_001"; |
3459 | | |
3460 | | } |
3461 | | |
3462 | | |
3463 | | // ivrtrackedcamera.h |
3464 | | namespace vr |
3465 | | { |
3466 | | |
3467 | | class IVRTrackedCamera |
3468 | | { |
3469 | | public: |
3470 | | /** Returns a string for an error */ |
3471 | | virtual const char *GetCameraErrorNameFromEnum( vr::EVRTrackedCameraError eCameraError ) = 0; |
3472 | | |
3473 | | /** For convenience, same as tracked property request Prop_HasCamera_Bool */ |
3474 | | virtual vr::EVRTrackedCameraError HasCamera( vr::TrackedDeviceIndex_t nDeviceIndex, bool *pHasCamera ) = 0; |
3475 | | |
3476 | | /** Gets size of the image frame. */ |
3477 | | virtual vr::EVRTrackedCameraError GetCameraFrameSize( vr::TrackedDeviceIndex_t nDeviceIndex, vr::EVRTrackedCameraFrameType eFrameType, uint32_t *pnWidth, uint32_t *pnHeight, uint32_t *pnFrameBufferSize ) = 0; |
3478 | | |
3479 | | virtual vr::EVRTrackedCameraError GetCameraIntrinsics( vr::TrackedDeviceIndex_t nDeviceIndex, vr::EVRTrackedCameraFrameType eFrameType, vr::HmdVector2_t *pFocalLength, vr::HmdVector2_t *pCenter ) = 0; |
3480 | | |
3481 | | virtual vr::EVRTrackedCameraError GetCameraProjection( vr::TrackedDeviceIndex_t nDeviceIndex, vr::EVRTrackedCameraFrameType eFrameType, float flZNear, float flZFar, vr::HmdMatrix44_t *pProjection ) = 0; |
3482 | | |
3483 | | /** Acquiring streaming service permits video streaming for the caller. Releasing hints the system that video services do not need to be maintained for this client. |
3484 | | * If the camera has not already been activated, a one time spin up may incur some auto exposure as well as initial streaming frame delays. |
3485 | | * The camera should be considered a global resource accessible for shared consumption but not exclusive to any caller. |
3486 | | * The camera may go inactive due to lack of active consumers or headset idleness. */ |
3487 | | virtual vr::EVRTrackedCameraError AcquireVideoStreamingService( vr::TrackedDeviceIndex_t nDeviceIndex, vr::TrackedCameraHandle_t *pHandle ) = 0; |
3488 | | virtual vr::EVRTrackedCameraError ReleaseVideoStreamingService( vr::TrackedCameraHandle_t hTrackedCamera ) = 0; |
3489 | | |
3490 | | /** Copies the image frame into a caller's provided buffer. The image data is currently provided as RGBA data, 4 bytes per pixel. |
3491 | | * A caller can provide null for the framebuffer or frameheader if not desired. Requesting the frame header first, followed by the frame buffer allows |
3492 | | * the caller to determine if the frame as advanced per the frame header sequence. |
3493 | | * If there is no frame available yet, due to initial camera spinup or re-activation, the error will be VRTrackedCameraError_NoFrameAvailable. |
3494 | | * Ideally a caller should be polling at ~16ms intervals */ |
3495 | | virtual vr::EVRTrackedCameraError GetVideoStreamFrameBuffer( vr::TrackedCameraHandle_t hTrackedCamera, vr::EVRTrackedCameraFrameType eFrameType, void *pFrameBuffer, uint32_t nFrameBufferSize, vr::CameraVideoStreamFrameHeader_t *pFrameHeader, uint32_t nFrameHeaderSize ) = 0; |
3496 | | |
3497 | | /** Gets size of the image frame. */ |
3498 | | virtual vr::EVRTrackedCameraError GetVideoStreamTextureSize( vr::TrackedDeviceIndex_t nDeviceIndex, vr::EVRTrackedCameraFrameType eFrameType, vr::VRTextureBounds_t *pTextureBounds, uint32_t *pnWidth, uint32_t *pnHeight ) = 0; |
3499 | | |
3500 | | /** Access a shared D3D11 texture for the specified tracked camera stream. |
3501 | | * The camera frame type VRTrackedCameraFrameType_Undistorted is not supported directly as a shared texture. It is an interior subregion of the shared texture VRTrackedCameraFrameType_MaximumUndistorted. |
3502 | | * Instead, use GetVideoStreamTextureSize() with VRTrackedCameraFrameType_Undistorted to determine the proper interior subregion bounds along with GetVideoStreamTextureD3D11() with |
3503 | | * VRTrackedCameraFrameType_MaximumUndistorted to provide the texture. The VRTrackedCameraFrameType_MaximumUndistorted will yield an image where the invalid regions are decoded |
3504 | | * by the alpha channel having a zero component. The valid regions all have a non-zero alpha component. The subregion as described by VRTrackedCameraFrameType_Undistorted |
3505 | | * guarantees a rectangle where all pixels are valid. */ |
3506 | | virtual vr::EVRTrackedCameraError GetVideoStreamTextureD3D11( vr::TrackedCameraHandle_t hTrackedCamera, vr::EVRTrackedCameraFrameType eFrameType, void *pD3D11DeviceOrResource, void **ppD3D11ShaderResourceView, vr::CameraVideoStreamFrameHeader_t *pFrameHeader, uint32_t nFrameHeaderSize ) = 0; |
3507 | | |
3508 | | /** Access a shared GL texture for the specified tracked camera stream */ |
3509 | | virtual vr::EVRTrackedCameraError GetVideoStreamTextureGL( vr::TrackedCameraHandle_t hTrackedCamera, vr::EVRTrackedCameraFrameType eFrameType, vr::glUInt_t *pglTextureId, vr::CameraVideoStreamFrameHeader_t *pFrameHeader, uint32_t nFrameHeaderSize ) = 0; |
3510 | | virtual vr::EVRTrackedCameraError ReleaseVideoStreamTextureGL( vr::TrackedCameraHandle_t hTrackedCamera, vr::glUInt_t glTextureId ) = 0; |
3511 | | }; |
3512 | | |
3513 | | static const char * const IVRTrackedCamera_Version = "IVRTrackedCamera_003"; |
3514 | | |
3515 | | } // namespace vr |
3516 | | |
3517 | | |
3518 | | // ivrscreenshots.h |
3519 | | namespace vr |
3520 | | { |
3521 | | |
3522 | | /** Errors that can occur with the VR compositor */ |
3523 | | enum EVRScreenshotError |
3524 | | { |
3525 | | VRScreenshotError_None = 0, |
3526 | | VRScreenshotError_RequestFailed = 1, |
3527 | | VRScreenshotError_IncompatibleVersion = 100, |
3528 | | VRScreenshotError_NotFound = 101, |
3529 | | VRScreenshotError_BufferTooSmall = 102, |
3530 | | VRScreenshotError_ScreenshotAlreadyInProgress = 108, |
3531 | | }; |
3532 | | |
3533 | | /** Allows the application to generate screenshots */ |
3534 | | class IVRScreenshots |
3535 | | { |
3536 | | public: |
3537 | | /** Request a screenshot of the requested type. |
3538 | | * A request of the VRScreenshotType_Stereo type will always |
3539 | | * work. Other types will depend on the underlying application |
3540 | | * support. |
3541 | | * The first file name is for the preview image and should be a |
3542 | | * regular screenshot (ideally from the left eye). The second |
3543 | | * is the VR screenshot in the correct format. They should be |
3544 | | * in the same aspect ratio. Formats per type: |
3545 | | * VRScreenshotType_Mono: the VR filename is ignored (can be |
3546 | | * nullptr), this is a normal flat single shot. |
3547 | | * VRScreenshotType_Stereo: The VR image should be a |
3548 | | * side-by-side with the left eye image on the left. |
3549 | | * VRScreenshotType_Cubemap: The VR image should be six square |
3550 | | * images composited horizontally. |
3551 | | * VRScreenshotType_StereoPanorama: above/below with left eye |
3552 | | * panorama being the above image. Image is typically square |
3553 | | * with the panorama being 2x horizontal. |
3554 | | * |
3555 | | * Note that the VR dashboard will call this function when |
3556 | | * the user presses the screenshot binding (currently System |
3557 | | * Button + Trigger). If Steam is running, the destination |
3558 | | * file names will be in %TEMP% and will be copied into |
3559 | | * Steam's screenshot library for the running application |
3560 | | * once SubmitScreenshot() is called. |
3561 | | * If Steam is not running, the paths will be in the user's |
3562 | | * documents folder under Documents\SteamVR\Screenshots. |
3563 | | * Other VR applications can call this to initiate a |
3564 | | * screenshot outside of user control. |
3565 | | * The destination file names do not need an extension, |
3566 | | * will be replaced with the correct one for the format |
3567 | | * which is currently .png. */ |
3568 | | virtual vr::EVRScreenshotError RequestScreenshot( vr::ScreenshotHandle_t *pOutScreenshotHandle, vr::EVRScreenshotType type, const char *pchPreviewFilename, const char *pchVRFilename ) = 0; |
3569 | | |
3570 | | /** Called by the running VR application to indicate that it |
3571 | | * wishes to be in charge of screenshots. If the |
3572 | | * application does not call this, the Compositor will only |
3573 | | * support VRScreenshotType_Stereo screenshots that will be |
3574 | | * captured without notification to the running app. |
3575 | | * Once hooked your application will receive a |
3576 | | * VREvent_RequestScreenshot event when the user presses the |
3577 | | * buttons to take a screenshot. */ |
3578 | | virtual vr::EVRScreenshotError HookScreenshot( VR_ARRAY_COUNT( numTypes ) const vr::EVRScreenshotType *pSupportedTypes, int numTypes ) = 0; |
3579 | | |
3580 | | /** When your application receives a |
3581 | | * VREvent_RequestScreenshot event, call these functions to get |
3582 | | * the details of the screenshot request. */ |
3583 | | virtual vr::EVRScreenshotType GetScreenshotPropertyType( vr::ScreenshotHandle_t screenshotHandle, vr::EVRScreenshotError *pError ) = 0; |
3584 | | |
3585 | | /** Get the filename for the preview or vr image (see |
3586 | | * vr::EScreenshotPropertyFilenames). The return value is |
3587 | | * the size of the string. */ |
3588 | | virtual uint32_t GetScreenshotPropertyFilename( vr::ScreenshotHandle_t screenshotHandle, vr::EVRScreenshotPropertyFilenames filenameType, VR_OUT_STRING() char *pchFilename, uint32_t cchFilename, vr::EVRScreenshotError *pError ) = 0; |
3589 | | |
3590 | | /** Call this if the application is taking the screen shot |
3591 | | * will take more than a few ms processing. This will result |
3592 | | * in an overlay being presented that shows a completion |
3593 | | * bar. */ |
3594 | | virtual vr::EVRScreenshotError UpdateScreenshotProgress( vr::ScreenshotHandle_t screenshotHandle, float flProgress ) = 0; |
3595 | | |
3596 | | /** Tells the compositor to take an internal screenshot of |
3597 | | * type VRScreenshotType_Stereo. It will take the current |
3598 | | * submitted scene textures of the running application and |
3599 | | * write them into the preview image and a side-by-side file |
3600 | | * for the VR image. |
3601 | | * This is similar to request screenshot, but doesn't ever |
3602 | | * talk to the application, just takes the shot and submits. */ |
3603 | | virtual vr::EVRScreenshotError TakeStereoScreenshot( vr::ScreenshotHandle_t *pOutScreenshotHandle, const char *pchPreviewFilename, const char *pchVRFilename ) = 0; |
3604 | | |
3605 | | /** Submit the completed screenshot. If Steam is running |
3606 | | * this will call into the Steam client and upload the |
3607 | | * screenshot to the screenshots section of the library for |
3608 | | * the running application. If Steam is not running, this |
3609 | | * function will display a notification to the user that the |
3610 | | * screenshot was taken. The paths should be full paths with |
3611 | | * extensions. |
3612 | | * File paths should be absolute including extensions. |
3613 | | * screenshotHandle can be k_unScreenshotHandleInvalid if this |
3614 | | * was a new shot taking by the app to be saved and not |
3615 | | * initiated by a user (achievement earned or something) */ |
3616 | | virtual vr::EVRScreenshotError SubmitScreenshot( vr::ScreenshotHandle_t screenshotHandle, vr::EVRScreenshotType type, const char *pchSourcePreviewFilename, const char *pchSourceVRFilename ) = 0; |
3617 | | }; |
3618 | | |
3619 | | static const char * const IVRScreenshots_Version = "IVRScreenshots_001"; |
3620 | | |
3621 | | } // namespace vr |
3622 | | |
3623 | | |
3624 | | |
3625 | | // ivrresources.h |
3626 | | namespace vr |
3627 | | { |
3628 | | |
3629 | | class IVRResources |
3630 | | { |
3631 | | public: |
3632 | | |
3633 | | // ------------------------------------ |
3634 | | // Shared Resource Methods |
3635 | | // ------------------------------------ |
3636 | | |
3637 | | /** Loads the specified resource into the provided buffer if large enough. |
3638 | | * Returns the size in bytes of the buffer required to hold the specified resource. */ |
3639 | | virtual uint32_t LoadSharedResource( const char *pchResourceName, char *pchBuffer, uint32_t unBufferLen ) = 0; |
3640 | | |
3641 | | /** Provides the full path to the specified resource. Resource names can include named directories for |
3642 | | * drivers and other things, and this resolves all of those and returns the actual physical path. |
3643 | | * pchResourceTypeDirectory is the subdirectory of resources to look in. */ |
3644 | | virtual uint32_t GetResourceFullPath( const char *pchResourceName, const char *pchResourceTypeDirectory, VR_OUT_STRING() char *pchPathBuffer, uint32_t unBufferLen ) = 0; |
3645 | | }; |
3646 | | |
3647 | | static const char * const IVRResources_Version = "IVRResources_001"; |
3648 | | |
3649 | | |
3650 | | } |
3651 | | // ivrdrivermanager.h |
3652 | | namespace vr |
3653 | | { |
3654 | | |
3655 | | class IVRDriverManager |
3656 | | { |
3657 | | public: |
3658 | | virtual uint32_t GetDriverCount() const = 0; |
3659 | | |
3660 | | /** Returns the length of the number of bytes necessary to hold this string including the trailing null. */ |
3661 | | virtual uint32_t GetDriverName( vr::DriverId_t nDriver, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize ) = 0; |
3662 | | |
3663 | | virtual DriverHandle_t GetDriverHandle( const char *pchDriverName ) = 0; |
3664 | | }; |
3665 | | |
3666 | | static const char * const IVRDriverManager_Version = "IVRDriverManager_001"; |
3667 | | |
3668 | | } // namespace vr |
3669 | | |
3670 | | |
3671 | | // End |
3672 | | |
3673 | | #endif // _OPENVR_API |
3674 | | |
3675 | | |
3676 | | namespace vr |
3677 | | { |
3678 | | /** Finds the active installation of the VR API and initializes it. The provided path must be absolute |
3679 | | * or relative to the current working directory. These are the local install versions of the equivalent |
3680 | | * functions in steamvr.h and will work without a local Steam install. |
3681 | | * |
3682 | | * This path is to the "root" of the VR API install. That's the directory with |
3683 | | * the "drivers" directory and a platform (i.e. "win32") directory in it, not the directory with the DLL itself. |
3684 | | * |
3685 | | * pStartupInfo is reserved for future use. |
3686 | | */ |
3687 | | inline IVRSystem *VR_Init( EVRInitError *peError, EVRApplicationType eApplicationType, const char *pStartupInfo = nullptr ); |
3688 | | |
3689 | | /** unloads vrclient.dll. Any interface pointers from the interface are |
3690 | | * invalid after this point */ |
3691 | | inline void VR_Shutdown(); |
3692 | | |
3693 | | /** Returns true if there is an HMD attached. This check is as lightweight as possible and |
3694 | | * can be called outside of VR_Init/VR_Shutdown. It should be used when an application wants |
3695 | | * to know if initializing VR is a possibility but isn't ready to take that step yet. |
3696 | | */ |
3697 | | VR_INTERFACE bool VR_CALLTYPE VR_IsHmdPresent(); |
3698 | | |
3699 | | /** Returns true if the OpenVR runtime is installed. */ |
3700 | | VR_INTERFACE bool VR_CALLTYPE VR_IsRuntimeInstalled(); |
3701 | | |
3702 | | /** Returns where the OpenVR runtime is installed. */ |
3703 | | VR_INTERFACE const char *VR_CALLTYPE VR_RuntimePath(); |
3704 | | |
3705 | | /** Returns the name of the enum value for an EVRInitError. This function may be called outside of VR_Init()/VR_Shutdown(). */ |
3706 | | VR_INTERFACE const char *VR_CALLTYPE VR_GetVRInitErrorAsSymbol( EVRInitError error ); |
3707 | | |
3708 | | /** Returns an English string for an EVRInitError. Applications should call VR_GetVRInitErrorAsSymbol instead and |
3709 | | * use that as a key to look up their own localized error message. This function may be called outside of VR_Init()/VR_Shutdown(). */ |
3710 | | VR_INTERFACE const char *VR_CALLTYPE VR_GetVRInitErrorAsEnglishDescription( EVRInitError error ); |
3711 | | |
3712 | | /** Returns the interface of the specified version. This method must be called after VR_Init. The |
3713 | | * pointer returned is valid until VR_Shutdown is called. |
3714 | | */ |
3715 | | VR_INTERFACE void *VR_CALLTYPE VR_GetGenericInterface( const char *pchInterfaceVersion, EVRInitError *peError ); |
3716 | | |
3717 | | /** Returns whether the interface of the specified version exists. |
3718 | | */ |
3719 | | VR_INTERFACE bool VR_CALLTYPE VR_IsInterfaceVersionValid( const char *pchInterfaceVersion ); |
3720 | | |
3721 | | /** Returns a token that represents whether the VR interface handles need to be reloaded */ |
3722 | | VR_INTERFACE uint32_t VR_CALLTYPE VR_GetInitToken(); |
3723 | | |
3724 | | // These typedefs allow old enum names from SDK 0.9.11 to be used in applications. |
3725 | | // They will go away in the future. |
3726 | | typedef EVRInitError HmdError; |
3727 | | typedef EVREye Hmd_Eye; |
3728 | | typedef EColorSpace ColorSpace; |
3729 | | typedef ETrackingResult HmdTrackingResult; |
3730 | | typedef ETrackedDeviceClass TrackedDeviceClass; |
3731 | | typedef ETrackingUniverseOrigin TrackingUniverseOrigin; |
3732 | | typedef ETrackedDeviceProperty TrackedDeviceProperty; |
3733 | | typedef ETrackedPropertyError TrackedPropertyError; |
3734 | | typedef EVRSubmitFlags VRSubmitFlags_t; |
3735 | | typedef EVRState VRState_t; |
3736 | | typedef ECollisionBoundsStyle CollisionBoundsStyle_t; |
3737 | | typedef EVROverlayError VROverlayError; |
3738 | | typedef EVRFirmwareError VRFirmwareError; |
3739 | | typedef EVRCompositorError VRCompositorError; |
3740 | | typedef EVRScreenshotError VRScreenshotsError; |
3741 | | |
3742 | | inline uint32_t &VRToken() |
3743 | 0 | { |
3744 | 0 | static uint32_t token; |
3745 | 0 | return token; |
3746 | 0 | } |
3747 | | |
3748 | | class COpenVRContext |
3749 | | { |
3750 | | public: |
3751 | 0 | COpenVRContext() { Clear(); } |
3752 | | void Clear(); |
3753 | | |
3754 | | inline void CheckClear() |
3755 | 0 | { |
3756 | 0 | if ( VRToken() != VR_GetInitToken() ) |
3757 | 0 | { |
3758 | 0 | Clear(); |
3759 | 0 | VRToken() = VR_GetInitToken(); |
3760 | 0 | } |
3761 | 0 | } |
3762 | | |
3763 | | IVRSystem *VRSystem() |
3764 | 0 | { |
3765 | 0 | CheckClear(); |
3766 | 0 | if ( m_pVRSystem == nullptr ) |
3767 | 0 | { |
3768 | 0 | EVRInitError eError; |
3769 | 0 | m_pVRSystem = ( IVRSystem * )VR_GetGenericInterface( IVRSystem_Version, &eError ); |
3770 | 0 | } |
3771 | 0 | return m_pVRSystem; |
3772 | 0 | } |
3773 | | IVRChaperone *VRChaperone() |
3774 | 0 | { |
3775 | 0 | CheckClear(); |
3776 | 0 | if ( m_pVRChaperone == nullptr ) |
3777 | 0 | { |
3778 | 0 | EVRInitError eError; |
3779 | 0 | m_pVRChaperone = ( IVRChaperone * )VR_GetGenericInterface( IVRChaperone_Version, &eError ); |
3780 | 0 | } |
3781 | 0 | return m_pVRChaperone; |
3782 | 0 | } |
3783 | | |
3784 | | IVRChaperoneSetup *VRChaperoneSetup() |
3785 | 0 | { |
3786 | 0 | CheckClear(); |
3787 | 0 | if ( m_pVRChaperoneSetup == nullptr ) |
3788 | 0 | { |
3789 | 0 | EVRInitError eError; |
3790 | 0 | m_pVRChaperoneSetup = ( IVRChaperoneSetup * )VR_GetGenericInterface( IVRChaperoneSetup_Version, &eError ); |
3791 | 0 | } |
3792 | 0 | return m_pVRChaperoneSetup; |
3793 | 0 | } |
3794 | | |
3795 | | IVRCompositor *VRCompositor() |
3796 | 0 | { |
3797 | 0 | CheckClear(); |
3798 | 0 | if ( m_pVRCompositor == nullptr ) |
3799 | 0 | { |
3800 | 0 | EVRInitError eError; |
3801 | 0 | m_pVRCompositor = ( IVRCompositor * )VR_GetGenericInterface( IVRCompositor_Version, &eError ); |
3802 | 0 | } |
3803 | 0 | return m_pVRCompositor; |
3804 | 0 | } |
3805 | | |
3806 | | IVROverlay *VROverlay() |
3807 | 0 | { |
3808 | 0 | CheckClear(); |
3809 | 0 | if ( m_pVROverlay == nullptr ) |
3810 | 0 | { |
3811 | 0 | EVRInitError eError; |
3812 | 0 | m_pVROverlay = ( IVROverlay * )VR_GetGenericInterface( IVROverlay_Version, &eError ); |
3813 | 0 | } |
3814 | 0 | return m_pVROverlay; |
3815 | 0 | } |
3816 | | |
3817 | | IVRResources *VRResources() |
3818 | 0 | { |
3819 | 0 | CheckClear(); |
3820 | 0 | if ( m_pVRResources == nullptr ) |
3821 | 0 | { |
3822 | 0 | EVRInitError eError; |
3823 | 0 | m_pVRResources = (IVRResources *)VR_GetGenericInterface( IVRResources_Version, &eError ); |
3824 | 0 | } |
3825 | 0 | return m_pVRResources; |
3826 | 0 | } |
3827 | | |
3828 | | IVRScreenshots *VRScreenshots() |
3829 | 0 | { |
3830 | 0 | CheckClear(); |
3831 | 0 | if ( m_pVRScreenshots == nullptr ) |
3832 | 0 | { |
3833 | 0 | EVRInitError eError; |
3834 | 0 | m_pVRScreenshots = ( IVRScreenshots * )VR_GetGenericInterface( IVRScreenshots_Version, &eError ); |
3835 | 0 | } |
3836 | 0 | return m_pVRScreenshots; |
3837 | 0 | } |
3838 | | |
3839 | | IVRRenderModels *VRRenderModels() |
3840 | 0 | { |
3841 | 0 | CheckClear(); |
3842 | 0 | if ( m_pVRRenderModels == nullptr ) |
3843 | 0 | { |
3844 | 0 | EVRInitError eError; |
3845 | 0 | m_pVRRenderModels = ( IVRRenderModels * )VR_GetGenericInterface( IVRRenderModels_Version, &eError ); |
3846 | 0 | } |
3847 | 0 | return m_pVRRenderModels; |
3848 | 0 | } |
3849 | | |
3850 | | IVRExtendedDisplay *VRExtendedDisplay() |
3851 | 0 | { |
3852 | 0 | CheckClear(); |
3853 | 0 | if ( m_pVRExtendedDisplay == nullptr ) |
3854 | 0 | { |
3855 | 0 | EVRInitError eError; |
3856 | 0 | m_pVRExtendedDisplay = ( IVRExtendedDisplay * )VR_GetGenericInterface( IVRExtendedDisplay_Version, &eError ); |
3857 | 0 | } |
3858 | 0 | return m_pVRExtendedDisplay; |
3859 | 0 | } |
3860 | | |
3861 | | IVRSettings *VRSettings() |
3862 | 0 | { |
3863 | 0 | CheckClear(); |
3864 | 0 | if ( m_pVRSettings == nullptr ) |
3865 | 0 | { |
3866 | 0 | EVRInitError eError; |
3867 | 0 | m_pVRSettings = ( IVRSettings * )VR_GetGenericInterface( IVRSettings_Version, &eError ); |
3868 | 0 | } |
3869 | 0 | return m_pVRSettings; |
3870 | 0 | } |
3871 | | |
3872 | | IVRApplications *VRApplications() |
3873 | 0 | { |
3874 | 0 | CheckClear(); |
3875 | 0 | if ( m_pVRApplications == nullptr ) |
3876 | 0 | { |
3877 | 0 | EVRInitError eError; |
3878 | 0 | m_pVRApplications = ( IVRApplications * )VR_GetGenericInterface( IVRApplications_Version, &eError ); |
3879 | 0 | } |
3880 | 0 | return m_pVRApplications; |
3881 | 0 | } |
3882 | | |
3883 | | IVRTrackedCamera *VRTrackedCamera() |
3884 | 0 | { |
3885 | 0 | CheckClear(); |
3886 | 0 | if ( m_pVRTrackedCamera == nullptr ) |
3887 | 0 | { |
3888 | 0 | EVRInitError eError; |
3889 | 0 | m_pVRTrackedCamera = ( IVRTrackedCamera * )VR_GetGenericInterface( IVRTrackedCamera_Version, &eError ); |
3890 | 0 | } |
3891 | 0 | return m_pVRTrackedCamera; |
3892 | 0 | } |
3893 | | |
3894 | | IVRDriverManager *VRDriverManager() |
3895 | 0 | { |
3896 | 0 | CheckClear(); |
3897 | 0 | if ( !m_pVRDriverManager ) |
3898 | 0 | { |
3899 | 0 | EVRInitError eError; |
3900 | 0 | m_pVRDriverManager = ( IVRDriverManager * )VR_GetGenericInterface( IVRDriverManager_Version, &eError ); |
3901 | 0 | } |
3902 | 0 | return m_pVRDriverManager; |
3903 | 0 | } |
3904 | | |
3905 | | private: |
3906 | | IVRSystem *m_pVRSystem; |
3907 | | IVRChaperone *m_pVRChaperone; |
3908 | | IVRChaperoneSetup *m_pVRChaperoneSetup; |
3909 | | IVRCompositor *m_pVRCompositor; |
3910 | | IVROverlay *m_pVROverlay; |
3911 | | IVRResources *m_pVRResources; |
3912 | | IVRRenderModels *m_pVRRenderModels; |
3913 | | IVRExtendedDisplay *m_pVRExtendedDisplay; |
3914 | | IVRSettings *m_pVRSettings; |
3915 | | IVRApplications *m_pVRApplications; |
3916 | | IVRTrackedCamera *m_pVRTrackedCamera; |
3917 | | IVRScreenshots *m_pVRScreenshots; |
3918 | | IVRDriverManager *m_pVRDriverManager; |
3919 | | }; |
3920 | | |
3921 | | inline COpenVRContext &OpenVRInternal_ModuleContext() |
3922 | 0 | { |
3923 | 0 | static void *ctx[ sizeof( COpenVRContext ) / sizeof( void * ) ]; |
3924 | 0 | return *( COpenVRContext * )ctx; // bypass zero-init constructor |
3925 | 0 | } |
3926 | | |
3927 | 0 | inline IVRSystem *VR_CALLTYPE VRSystem() { return OpenVRInternal_ModuleContext().VRSystem(); } |
3928 | 0 | inline IVRChaperone *VR_CALLTYPE VRChaperone() { return OpenVRInternal_ModuleContext().VRChaperone(); } |
3929 | 0 | inline IVRChaperoneSetup *VR_CALLTYPE VRChaperoneSetup() { return OpenVRInternal_ModuleContext().VRChaperoneSetup(); } |
3930 | 0 | inline IVRCompositor *VR_CALLTYPE VRCompositor() { return OpenVRInternal_ModuleContext().VRCompositor(); } |
3931 | 0 | inline IVROverlay *VR_CALLTYPE VROverlay() { return OpenVRInternal_ModuleContext().VROverlay(); } |
3932 | 0 | inline IVRScreenshots *VR_CALLTYPE VRScreenshots() { return OpenVRInternal_ModuleContext().VRScreenshots(); } |
3933 | 0 | inline IVRRenderModels *VR_CALLTYPE VRRenderModels() { return OpenVRInternal_ModuleContext().VRRenderModels(); } |
3934 | 0 | inline IVRApplications *VR_CALLTYPE VRApplications() { return OpenVRInternal_ModuleContext().VRApplications(); } |
3935 | 0 | inline IVRSettings *VR_CALLTYPE VRSettings() { return OpenVRInternal_ModuleContext().VRSettings(); } |
3936 | 0 | inline IVRResources *VR_CALLTYPE VRResources() { return OpenVRInternal_ModuleContext().VRResources(); } |
3937 | 0 | inline IVRExtendedDisplay *VR_CALLTYPE VRExtendedDisplay() { return OpenVRInternal_ModuleContext().VRExtendedDisplay(); } |
3938 | 0 | inline IVRTrackedCamera *VR_CALLTYPE VRTrackedCamera() { return OpenVRInternal_ModuleContext().VRTrackedCamera(); } |
3939 | 0 | inline IVRDriverManager *VR_CALLTYPE VRDriverManager() { return OpenVRInternal_ModuleContext().VRDriverManager(); } |
3940 | | |
3941 | | inline void COpenVRContext::Clear() |
3942 | 0 | { |
3943 | 0 | m_pVRSystem = nullptr; |
3944 | 0 | m_pVRChaperone = nullptr; |
3945 | 0 | m_pVRChaperoneSetup = nullptr; |
3946 | 0 | m_pVRCompositor = nullptr; |
3947 | 0 | m_pVROverlay = nullptr; |
3948 | 0 | m_pVRRenderModels = nullptr; |
3949 | 0 | m_pVRExtendedDisplay = nullptr; |
3950 | 0 | m_pVRSettings = nullptr; |
3951 | 0 | m_pVRApplications = nullptr; |
3952 | 0 | m_pVRTrackedCamera = nullptr; |
3953 | 0 | m_pVRResources = nullptr; |
3954 | 0 | m_pVRScreenshots = nullptr; |
3955 | 0 | m_pVRDriverManager = nullptr; |
3956 | 0 | } |
3957 | | |
3958 | | VR_INTERFACE uint32_t VR_CALLTYPE VR_InitInternal2( EVRInitError *peError, EVRApplicationType eApplicationType, const char *pStartupInfo ); |
3959 | | VR_INTERFACE void VR_CALLTYPE VR_ShutdownInternal(); |
3960 | | |
3961 | | /** Finds the active installation of vrclient.dll and initializes it */ |
3962 | | inline IVRSystem *VR_Init( EVRInitError *peError, EVRApplicationType eApplicationType, const char *pStartupInfo ) |
3963 | 0 | { |
3964 | 0 | IVRSystem *pVRSystem = nullptr; |
3965 | 0 |
|
3966 | 0 | EVRInitError eError; |
3967 | 0 | VRToken() = VR_InitInternal2( &eError, eApplicationType, pStartupInfo ); |
3968 | 0 | COpenVRContext &ctx = OpenVRInternal_ModuleContext(); |
3969 | 0 | ctx.Clear(); |
3970 | 0 |
|
3971 | 0 | if ( eError == VRInitError_None ) |
3972 | 0 | { |
3973 | 0 | if ( VR_IsInterfaceVersionValid( IVRSystem_Version ) ) |
3974 | 0 | { |
3975 | 0 | pVRSystem = VRSystem(); |
3976 | 0 | } |
3977 | 0 | else |
3978 | 0 | { |
3979 | 0 | VR_ShutdownInternal(); |
3980 | 0 | eError = VRInitError_Init_InterfaceNotFound; |
3981 | 0 | } |
3982 | 0 | } |
3983 | 0 |
|
3984 | 0 | if ( peError ) |
3985 | 0 | *peError = eError; |
3986 | 0 | return pVRSystem; |
3987 | 0 | } |
3988 | | |
3989 | | /** unloads vrclient.dll. Any interface pointers from the interface are |
3990 | | * invalid after this point */ |
3991 | | inline void VR_Shutdown() |
3992 | 0 | { |
3993 | 0 | VR_ShutdownInternal(); |
3994 | 0 | } |
3995 | | } |