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