The open source OpenXR runtime

t/openvr: Add openvr tracker for recording lighthouse groundtruth

With the SLAM_OPENVR_GROUNDTRUTH_DEVICE we can select a device (HMD, right/left
controller, vive tracker) to use as the groundtruth provider for a SLAM tracker.
This is useful to record euroc datasets with lighthouse groundtruth.

authored by

Mateo de Mayo and committed by
Jakob Bornecrantz
24de185b 95512594

+5903 -3
+12
CMakeLists.txt
··· 189 189 endif() 190 190 endforeach() 191 191 192 + # Find openvr library 193 + find_library(OPENVR_LIBRARIES NAMES openvr_api) 194 + if(OPENVR_LIBRARIES) 195 + set(OPENVR_FOUND on) 196 + message("Found OpenVR: " ${OPENVR_LIBRARIES}) 197 + else() 198 + set(OPENVR_FOUND off) 199 + message("OpenVR not found") 200 + endif() 201 + 192 202 # ILLIXR 193 203 set(ILLIXR_PATH 194 204 "" ··· 296 306 option_with_deps(XRT_HAVE_LIBUSB "Enable libusb (used for most drivers)" DEPENDS LIBUSB1_FOUND) 297 307 option_with_deps(XRT_HAVE_LIBUVC "Enable libuvc video driver" DEPENDS LIBUVC_FOUND XRT_HAVE_LIBUSB) 298 308 option_with_deps(XRT_HAVE_REALSENSE "Enable RealSense support" DEPENDS realsense2_FOUND) 309 + option_with_deps(XRT_HAVE_OPENVR "Enable OpenVR support" DEPENDS OPENVR_FOUND) 299 310 300 311 # Drivers to build (sorted) 301 312 option_with_deps(XRT_BUILD_DRIVER_ANDROID "Enable Android sensors driver" DEPENDS ANDROID) ··· 507 518 message(STATUS "# OPENGL_GLX: ${XRT_HAVE_OPENGL_GLX}") 508 519 message(STATUS "# PERCETTO: ${XRT_HAVE_PERCETTO}") 509 520 message(STATUS "# REALSENSE: ${XRT_HAVE_REALSENSE}") 521 + message(STATUS "# OPENVR: ${XRT_HAVE_OPENVR}") 510 522 message(STATUS "# SDL2: ${XRT_HAVE_SDL2}") 511 523 message(STATUS "# SYSTEM_CJSON: ${XRT_HAVE_SYSTEM_CJSON}") 512 524 message(STATUS "# SYSTEMD: ${XRT_HAVE_SYSTEMD}")
+5624
src/external/openvr_includes/openvr.h
··· 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 + // version.h 15 + 16 + namespace vr 17 + { 18 + static const uint32_t k_nSteamVRVersionMajor = 1; 19 + static const uint32_t k_nSteamVRVersionMinor = 16; 20 + static const uint32_t k_nSteamVRVersionBuild = 8; 21 + } // namespace vr 22 + 23 + // public_vrtypes.h 24 + 25 + #ifndef _INCLUDE_CORE_VRTYPES_PUBLIC_H 26 + #define _INCLUDE_CORE_VRTYPES_PUBLIC_H 27 + 28 + namespace vr 29 + { 30 + #pragma pack( push, 8 ) 31 + 32 + // right-handed system 33 + // +y is up 34 + // +x is to the right 35 + // -z is forward 36 + // Distance unit is meters 37 + struct HmdMatrix34_t 38 + { 39 + float m[3][4]; 40 + }; 41 + 42 + struct HmdMatrix33_t 43 + { 44 + float m[3][3]; 45 + }; 46 + 47 + struct HmdMatrix44_t 48 + { 49 + float m[4][4]; 50 + }; 51 + 52 + struct HmdVector3_t 53 + { 54 + float v[3]; 55 + }; 56 + 57 + struct HmdVector4_t 58 + { 59 + float v[4]; 60 + }; 61 + 62 + struct HmdVector3d_t 63 + { 64 + double v[3]; 65 + }; 66 + 67 + struct HmdVector2_t 68 + { 69 + float v[2]; 70 + }; 71 + 72 + struct HmdQuaternion_t 73 + { 74 + double w, x, y, z; 75 + }; 76 + 77 + struct HmdQuaternionf_t 78 + { 79 + float w, x, y, z; 80 + }; 81 + 82 + struct HmdColor_t 83 + { 84 + float r, g, b, a; 85 + }; 86 + 87 + struct HmdQuad_t 88 + { 89 + HmdVector3_t vCorners[ 4 ]; 90 + }; 91 + 92 + struct HmdRect2_t 93 + { 94 + HmdVector2_t vTopLeft; 95 + HmdVector2_t vBottomRight; 96 + }; 97 + 98 + /** Holds the transform for a single bone */ 99 + struct VRBoneTransform_t 100 + { 101 + HmdVector4_t position; 102 + HmdQuaternionf_t orientation; 103 + }; 104 + 105 + #pragma pack( pop ) 106 + 107 + } // namespace vr 108 + 109 + #endif 110 + 111 + // vrtypes.h 112 + 113 + #ifndef _INCLUDE_VRTYPES_H 114 + #define _INCLUDE_VRTYPES_H 115 + 116 + // Forward declarations to avoid requiring vulkan.h 117 + struct VkDevice_T; 118 + struct VkPhysicalDevice_T; 119 + struct VkInstance_T; 120 + struct VkQueue_T; 121 + 122 + // Forward declarations to avoid requiring d3d12.h 123 + struct ID3D12Resource; 124 + struct ID3D12CommandQueue; 125 + 126 + namespace vr 127 + { 128 + #pragma pack( push, 8 ) 129 + 130 + /** A handle for a spatial anchor. This handle is only valid during the session it was created in. 131 + * Anchors that live beyond one session should be saved by their string descriptors. */ 132 + typedef uint32_t SpatialAnchorHandle_t; 133 + 134 + typedef void* glSharedTextureHandle_t; 135 + typedef int32_t glInt_t; 136 + typedef uint32_t glUInt_t; 137 + 138 + 139 + /** Used to return the post-distortion UVs for each color channel. 140 + * UVs range from 0 to 1 with 0,0 in the upper left corner of the 141 + * source render target. The 0,0 to 1,1 range covers a single eye. */ 142 + struct DistortionCoordinates_t 143 + { 144 + float rfRed[2]; 145 + float rfGreen[2]; 146 + float rfBlue[2]; 147 + }; 148 + 149 + enum EVREye 150 + { 151 + Eye_Left = 0, 152 + Eye_Right = 1 153 + }; 154 + 155 + enum ETextureType 156 + { 157 + TextureType_Invalid = -1, // Handle has been invalidated 158 + TextureType_DirectX = 0, // Handle is an ID3D11Texture 159 + TextureType_OpenGL = 1, // Handle is an OpenGL texture name or an OpenGL render buffer name, depending on submit flags 160 + TextureType_Vulkan = 2, // Handle is a pointer to a VRVulkanTextureData_t structure 161 + TextureType_IOSurface = 3, // Handle is a macOS cross-process-sharable IOSurfaceRef, deprecated in favor of TextureType_Metal on supported platforms 162 + TextureType_DirectX12 = 4, // Handle is a pointer to a D3D12TextureData_t structure 163 + TextureType_DXGISharedHandle = 5, // Handle is a HANDLE DXGI share handle, only supported for Overlay render targets. 164 + // this texture is used directly by our renderer, so only perform atomic (copyresource or resolve) on it 165 + TextureType_Metal = 6, // Handle is a MTLTexture conforming to the MTLSharedTexture protocol. Textures submitted to IVRCompositor::Submit which 166 + // are of type MTLTextureType2DArray assume layer 0 is the left eye texture (vr::EVREye::Eye_left), layer 1 is the right 167 + // eye texture (vr::EVREye::Eye_Right) 168 + }; 169 + 170 + enum EColorSpace 171 + { 172 + ColorSpace_Auto = 0, // Assumes 'gamma' for 8-bit per component formats, otherwise 'linear'. This mirrors the DXGI formats which have _SRGB variants. 173 + ColorSpace_Gamma = 1, // Texture data can be displayed directly on the display without any conversion (a.k.a. display native format). 174 + ColorSpace_Linear = 2, // Same as gamma but has been converted to a linear representation using DXGI's sRGB conversion algorithm. 175 + }; 176 + 177 + struct Texture_t 178 + { 179 + void* handle; // See ETextureType definition above 180 + ETextureType eType; 181 + EColorSpace eColorSpace; 182 + }; 183 + 184 + // Handle to a shared texture (HANDLE on Windows obtained using OpenSharedResource). 185 + typedef uint64_t SharedTextureHandle_t; 186 + #define INVALID_SHARED_TEXTURE_HANDLE ((vr::SharedTextureHandle_t)0) 187 + 188 + enum ETrackingResult 189 + { 190 + TrackingResult_Uninitialized = 1, 191 + 192 + TrackingResult_Calibrating_InProgress = 100, 193 + TrackingResult_Calibrating_OutOfRange = 101, 194 + 195 + TrackingResult_Running_OK = 200, 196 + TrackingResult_Running_OutOfRange = 201, 197 + 198 + TrackingResult_Fallback_RotationOnly = 300, 199 + }; 200 + 201 + typedef uint32_t DriverId_t; 202 + static const uint32_t k_nDriverNone = 0xFFFFFFFF; 203 + 204 + static const uint32_t k_unMaxDriverDebugResponseSize = 32768; 205 + 206 + /** Used to pass device IDs to API calls */ 207 + typedef uint32_t TrackedDeviceIndex_t; 208 + static const uint32_t k_unTrackedDeviceIndex_Hmd = 0; 209 + static const uint32_t k_unMaxTrackedDeviceCount = 64; 210 + static const uint32_t k_unTrackedDeviceIndexOther = 0xFFFFFFFE; 211 + static const uint32_t k_unTrackedDeviceIndexInvalid = 0xFFFFFFFF; 212 + 213 + /** Describes what kind of object is being tracked at a given ID */ 214 + enum ETrackedDeviceClass 215 + { 216 + TrackedDeviceClass_Invalid = 0, // the ID was not valid. 217 + TrackedDeviceClass_HMD = 1, // Head-Mounted Displays 218 + TrackedDeviceClass_Controller = 2, // Tracked controllers 219 + TrackedDeviceClass_GenericTracker = 3, // Generic trackers, similar to controllers 220 + TrackedDeviceClass_TrackingReference = 4, // Camera and base stations that serve as tracking reference points 221 + TrackedDeviceClass_DisplayRedirect = 5, // Accessories that aren't necessarily tracked themselves, but may redirect video output from other tracked devices 222 + 223 + TrackedDeviceClass_Max 224 + }; 225 + 226 + 227 + /** Describes what specific role associated with a tracked device */ 228 + enum ETrackedControllerRole 229 + { 230 + TrackedControllerRole_Invalid = 0, // Invalid value for controller type 231 + TrackedControllerRole_LeftHand = 1, // Tracked device associated with the left hand 232 + TrackedControllerRole_RightHand = 2, // Tracked device associated with the right hand 233 + TrackedControllerRole_OptOut = 3, // Tracked device is opting out of left/right hand selection 234 + TrackedControllerRole_Treadmill = 4, // Tracked device is a treadmill or other locomotion device 235 + TrackedControllerRole_Stylus = 5, // Tracked device is a stylus 236 + TrackedControllerRole_Max = 5 237 + }; 238 + 239 + 240 + /** Returns true if the tracked controller role is allowed to be a hand */ 241 + inline bool IsRoleAllowedAsHand( ETrackedControllerRole eRole ) 242 + { 243 + switch ( eRole ) 244 + { 245 + case TrackedControllerRole_Invalid: 246 + case TrackedControllerRole_LeftHand: 247 + case TrackedControllerRole_RightHand: 248 + return true; 249 + default: 250 + return false; 251 + } 252 + } 253 + 254 + 255 + /** describes a single pose for a tracked object */ 256 + struct TrackedDevicePose_t 257 + { 258 + HmdMatrix34_t mDeviceToAbsoluteTracking; 259 + HmdVector3_t vVelocity; // velocity in tracker space in m/s 260 + HmdVector3_t vAngularVelocity; // angular velocity in radians/s (?) 261 + ETrackingResult eTrackingResult; 262 + bool bPoseIsValid; 263 + 264 + // This indicates that there is a device connected for this spot in the pose array. 265 + // It could go from true to false if the user unplugs the device. 266 + bool bDeviceIsConnected; 267 + }; 268 + 269 + /** Identifies which style of tracking origin the application wants to use 270 + * for the poses it is requesting */ 271 + enum ETrackingUniverseOrigin 272 + { 273 + TrackingUniverseSeated = 0, // Poses are provided relative to the seated zero pose 274 + TrackingUniverseStanding = 1, // Poses are provided relative to the safe bounds configured by the user 275 + 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. 276 + }; 277 + 278 + enum EAdditionalRadioFeatures 279 + { 280 + AdditionalRadioFeatures_None = 0x00000000, 281 + AdditionalRadioFeatures_HTCLinkBox = 0x00000001, 282 + AdditionalRadioFeatures_InternalDongle = 0x00000002, 283 + AdditionalRadioFeatures_ExternalDongle = 0x00000004, 284 + }; 285 + 286 + typedef uint64_t WebConsoleHandle_t; 287 + #define INVALID_WEB_CONSOLE_HANDLE ((vr::WebConsoleHandle_t)0) 288 + 289 + // Refers to a single container of properties 290 + typedef uint64_t PropertyContainerHandle_t; 291 + typedef uint32_t PropertyTypeTag_t; 292 + 293 + static const PropertyContainerHandle_t k_ulInvalidPropertyContainer = 0; 294 + static const PropertyTypeTag_t k_unInvalidPropertyTag = 0; 295 + 296 + typedef PropertyContainerHandle_t DriverHandle_t; 297 + static const PropertyContainerHandle_t k_ulInvalidDriverHandle = 0; 298 + 299 + // Use these tags to set/get common types as struct properties 300 + static const PropertyTypeTag_t k_unFloatPropertyTag = 1; 301 + static const PropertyTypeTag_t k_unInt32PropertyTag = 2; 302 + static const PropertyTypeTag_t k_unUint64PropertyTag = 3; 303 + static const PropertyTypeTag_t k_unBoolPropertyTag = 4; 304 + static const PropertyTypeTag_t k_unStringPropertyTag = 5; 305 + static const PropertyTypeTag_t k_unErrorPropertyTag = 6; 306 + static const PropertyTypeTag_t k_unDoublePropertyTag = 7; 307 + 308 + static const PropertyTypeTag_t k_unHmdMatrix34PropertyTag = 20; 309 + static const PropertyTypeTag_t k_unHmdMatrix44PropertyTag = 21; 310 + static const PropertyTypeTag_t k_unHmdVector3PropertyTag = 22; 311 + static const PropertyTypeTag_t k_unHmdVector4PropertyTag = 23; 312 + static const PropertyTypeTag_t k_unHmdVector2PropertyTag = 24; 313 + static const PropertyTypeTag_t k_unHmdQuadPropertyTag = 25; 314 + 315 + static const PropertyTypeTag_t k_unHiddenAreaPropertyTag = 30; 316 + static const PropertyTypeTag_t k_unPathHandleInfoTag = 31; 317 + static const PropertyTypeTag_t k_unActionPropertyTag = 32; 318 + static const PropertyTypeTag_t k_unInputValuePropertyTag = 33; 319 + static const PropertyTypeTag_t k_unWildcardPropertyTag = 34; 320 + static const PropertyTypeTag_t k_unHapticVibrationPropertyTag = 35; 321 + static const PropertyTypeTag_t k_unSkeletonPropertyTag = 36; 322 + 323 + static const PropertyTypeTag_t k_unSpatialAnchorPosePropertyTag = 40; 324 + static const PropertyTypeTag_t k_unJsonPropertyTag = 41; 325 + static const PropertyTypeTag_t k_unActiveActionSetPropertyTag = 42; 326 + 327 + static const PropertyTypeTag_t k_unOpenVRInternalReserved_Start = 1000; 328 + static const PropertyTypeTag_t k_unOpenVRInternalReserved_End = 10000; 329 + 330 + 331 + /** Each entry in this enum represents a property that can be retrieved about a 332 + * tracked device. Many fields are only valid for one ETrackedDeviceClass. */ 333 + enum ETrackedDeviceProperty 334 + { 335 + Prop_Invalid = 0, 336 + 337 + // general properties that apply to all device classes 338 + Prop_TrackingSystemName_String = 1000, 339 + Prop_ModelNumber_String = 1001, 340 + Prop_SerialNumber_String = 1002, 341 + Prop_RenderModelName_String = 1003, 342 + Prop_WillDriftInYaw_Bool = 1004, 343 + Prop_ManufacturerName_String = 1005, 344 + Prop_TrackingFirmwareVersion_String = 1006, 345 + Prop_HardwareRevision_String = 1007, 346 + Prop_AllWirelessDongleDescriptions_String = 1008, 347 + Prop_ConnectedWirelessDongle_String = 1009, 348 + Prop_DeviceIsWireless_Bool = 1010, 349 + Prop_DeviceIsCharging_Bool = 1011, 350 + Prop_DeviceBatteryPercentage_Float = 1012, // 0 is empty, 1 is full 351 + Prop_StatusDisplayTransform_Matrix34 = 1013, 352 + Prop_Firmware_UpdateAvailable_Bool = 1014, 353 + Prop_Firmware_ManualUpdate_Bool = 1015, 354 + Prop_Firmware_ManualUpdateURL_String = 1016, 355 + Prop_HardwareRevision_Uint64 = 1017, 356 + Prop_FirmwareVersion_Uint64 = 1018, 357 + Prop_FPGAVersion_Uint64 = 1019, 358 + Prop_VRCVersion_Uint64 = 1020, 359 + Prop_RadioVersion_Uint64 = 1021, 360 + Prop_DongleVersion_Uint64 = 1022, 361 + Prop_BlockServerShutdown_Bool = 1023, 362 + Prop_CanUnifyCoordinateSystemWithHmd_Bool = 1024, 363 + Prop_ContainsProximitySensor_Bool = 1025, 364 + Prop_DeviceProvidesBatteryStatus_Bool = 1026, 365 + Prop_DeviceCanPowerOff_Bool = 1027, 366 + Prop_Firmware_ProgrammingTarget_String = 1028, 367 + Prop_DeviceClass_Int32 = 1029, 368 + Prop_HasCamera_Bool = 1030, 369 + Prop_DriverVersion_String = 1031, 370 + Prop_Firmware_ForceUpdateRequired_Bool = 1032, 371 + Prop_ViveSystemButtonFixRequired_Bool = 1033, 372 + Prop_ParentDriver_Uint64 = 1034, 373 + Prop_ResourceRoot_String = 1035, 374 + Prop_RegisteredDeviceType_String = 1036, 375 + 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 376 + Prop_NeverTracked_Bool = 1038, // Used for devices that will never have a valid pose by design 377 + Prop_NumCameras_Int32 = 1039, 378 + Prop_CameraFrameLayout_Int32 = 1040, // EVRTrackedCameraFrameLayout value 379 + Prop_CameraStreamFormat_Int32 = 1041, // ECameraVideoStreamFormat value 380 + Prop_AdditionalDeviceSettingsPath_String = 1042, // driver-relative path to additional device and global configuration settings 381 + Prop_Identifiable_Bool = 1043, // Whether device supports being identified from vrmonitor (e.g. blink LED, vibrate haptics, etc) 382 + Prop_BootloaderVersion_Uint64 = 1044, 383 + Prop_AdditionalSystemReportData_String = 1045, // additional string to include in system reports about a tracked device 384 + Prop_CompositeFirmwareVersion_String = 1046, // additional FW components from a device that gets propagated into reports 385 + Prop_Firmware_RemindUpdate_Bool = 1047, 386 + Prop_PeripheralApplicationVersion_Uint64 = 1048, 387 + Prop_ManufacturerSerialNumber_String = 1049, 388 + Prop_ComputedSerialNumber_String = 1050, 389 + Prop_EstimatedDeviceFirstUseTime_Int32 = 1051, 390 + 391 + // Properties that are unique to TrackedDeviceClass_HMD 392 + Prop_ReportsTimeSinceVSync_Bool = 2000, 393 + Prop_SecondsFromVsyncToPhotons_Float = 2001, 394 + Prop_DisplayFrequency_Float = 2002, 395 + Prop_UserIpdMeters_Float = 2003, 396 + Prop_CurrentUniverseId_Uint64 = 2004, 397 + Prop_PreviousUniverseId_Uint64 = 2005, 398 + Prop_DisplayFirmwareVersion_Uint64 = 2006, 399 + Prop_IsOnDesktop_Bool = 2007, 400 + Prop_DisplayMCType_Int32 = 2008, 401 + Prop_DisplayMCOffset_Float = 2009, 402 + Prop_DisplayMCScale_Float = 2010, 403 + Prop_EdidVendorID_Int32 = 2011, 404 + Prop_DisplayMCImageLeft_String = 2012, 405 + Prop_DisplayMCImageRight_String = 2013, 406 + Prop_DisplayGCBlackClamp_Float = 2014, 407 + Prop_EdidProductID_Int32 = 2015, 408 + Prop_CameraToHeadTransform_Matrix34 = 2016, 409 + Prop_DisplayGCType_Int32 = 2017, 410 + Prop_DisplayGCOffset_Float = 2018, 411 + Prop_DisplayGCScale_Float = 2019, 412 + Prop_DisplayGCPrescale_Float = 2020, 413 + Prop_DisplayGCImage_String = 2021, 414 + Prop_LensCenterLeftU_Float = 2022, 415 + Prop_LensCenterLeftV_Float = 2023, 416 + Prop_LensCenterRightU_Float = 2024, 417 + Prop_LensCenterRightV_Float = 2025, 418 + Prop_UserHeadToEyeDepthMeters_Float = 2026, 419 + Prop_CameraFirmwareVersion_Uint64 = 2027, 420 + Prop_CameraFirmwareDescription_String = 2028, 421 + Prop_DisplayFPGAVersion_Uint64 = 2029, 422 + Prop_DisplayBootloaderVersion_Uint64 = 2030, 423 + Prop_DisplayHardwareVersion_Uint64 = 2031, 424 + Prop_AudioFirmwareVersion_Uint64 = 2032, 425 + Prop_CameraCompatibilityMode_Int32 = 2033, 426 + Prop_ScreenshotHorizontalFieldOfViewDegrees_Float = 2034, 427 + Prop_ScreenshotVerticalFieldOfViewDegrees_Float = 2035, 428 + Prop_DisplaySuppressed_Bool = 2036, 429 + Prop_DisplayAllowNightMode_Bool = 2037, 430 + Prop_DisplayMCImageWidth_Int32 = 2038, 431 + Prop_DisplayMCImageHeight_Int32 = 2039, 432 + Prop_DisplayMCImageNumChannels_Int32 = 2040, 433 + Prop_DisplayMCImageData_Binary = 2041, 434 + Prop_SecondsFromPhotonsToVblank_Float = 2042, 435 + Prop_DriverDirectModeSendsVsyncEvents_Bool = 2043, 436 + Prop_DisplayDebugMode_Bool = 2044, 437 + Prop_GraphicsAdapterLuid_Uint64 = 2045, 438 + Prop_DriverProvidedChaperonePath_String = 2048, 439 + Prop_ExpectedTrackingReferenceCount_Int32 = 2049, // expected number of sensors or basestations to reserve UI space for 440 + Prop_ExpectedControllerCount_Int32 = 2050, // expected number of tracked controllers to reserve UI space for 441 + Prop_NamedIconPathControllerLeftDeviceOff_String = 2051, // placeholder icon for "left" controller if not yet detected/loaded 442 + Prop_NamedIconPathControllerRightDeviceOff_String = 2052, // placeholder icon for "right" controller if not yet detected/loaded 443 + Prop_NamedIconPathTrackingReferenceDeviceOff_String = 2053, // placeholder icon for sensor/base if not yet detected/loaded 444 + Prop_DoNotApplyPrediction_Bool = 2054, // currently no effect. was used to disable HMD pose prediction on MR, which is now done by MR driver setting velocity=0 445 + Prop_CameraToHeadTransforms_Matrix34_Array = 2055, 446 + Prop_DistortionMeshResolution_Int32 = 2056, // custom resolution of compositor calls to IVRSystem::ComputeDistortion 447 + Prop_DriverIsDrawingControllers_Bool = 2057, 448 + Prop_DriverRequestsApplicationPause_Bool = 2058, 449 + Prop_DriverRequestsReducedRendering_Bool = 2059, 450 + Prop_MinimumIpdStepMeters_Float = 2060, 451 + Prop_AudioBridgeFirmwareVersion_Uint64 = 2061, 452 + Prop_ImageBridgeFirmwareVersion_Uint64 = 2062, 453 + Prop_ImuToHeadTransform_Matrix34 = 2063, 454 + Prop_ImuFactoryGyroBias_Vector3 = 2064, 455 + Prop_ImuFactoryGyroScale_Vector3 = 2065, 456 + Prop_ImuFactoryAccelerometerBias_Vector3 = 2066, 457 + Prop_ImuFactoryAccelerometerScale_Vector3 = 2067, 458 + // reserved 2068 459 + Prop_ConfigurationIncludesLighthouse20Features_Bool = 2069, 460 + Prop_AdditionalRadioFeatures_Uint64 = 2070, 461 + Prop_CameraWhiteBalance_Vector4_Array = 2071, // Prop_NumCameras_Int32-sized array of float[4] RGBG white balance calibration data (max size is vr::k_unMaxCameras) 462 + Prop_CameraDistortionFunction_Int32_Array = 2072, // Prop_NumCameras_Int32-sized array of vr::EVRDistortionFunctionType values (max size is vr::k_unMaxCameras) 463 + Prop_CameraDistortionCoefficients_Float_Array = 2073, // Prop_NumCameras_Int32-sized array of double[vr::k_unMaxDistortionFunctionParameters] (max size is vr::k_unMaxCameras) 464 + Prop_ExpectedControllerType_String = 2074, 465 + Prop_HmdTrackingStyle_Int32 = 2075, // one of EHmdTrackingStyle 466 + Prop_DriverProvidedChaperoneVisibility_Bool = 2076, 467 + Prop_HmdColumnCorrectionSettingPrefix_String = 2077, 468 + Prop_CameraSupportsCompatibilityModes_Bool = 2078, 469 + Prop_SupportsRoomViewDepthProjection_Bool = 2079, 470 + Prop_DisplayAvailableFrameRates_Float_Array = 2080, // populated by compositor from actual EDID list when available from GPU driver 471 + Prop_DisplaySupportsMultipleFramerates_Bool = 2081, // if this is true but Prop_DisplayAvailableFrameRates_Float_Array is empty, explain to user 472 + Prop_DisplayColorMultLeft_Vector3 = 2082, 473 + Prop_DisplayColorMultRight_Vector3 = 2083, 474 + Prop_DisplaySupportsRuntimeFramerateChange_Bool = 2084, 475 + Prop_DisplaySupportsAnalogGain_Bool = 2085, 476 + Prop_DisplayMinAnalogGain_Float = 2086, 477 + Prop_DisplayMaxAnalogGain_Float = 2087, 478 + Prop_CameraExposureTime_Float = 2088, 479 + Prop_CameraGlobalGain_Float = 2089, 480 + // Prop_DashboardLayoutPathName_String = 2090, // DELETED 481 + Prop_DashboardScale_Float = 2091, 482 + Prop_IpdUIRangeMinMeters_Float = 2100, 483 + Prop_IpdUIRangeMaxMeters_Float = 2101, 484 + Prop_Hmd_SupportsHDCP14LegacyCompat_Bool = 2102, 485 + Prop_Hmd_SupportsMicMonitoring_Bool = 2103, 486 + 487 + // Driver requested mura correction properties 488 + Prop_DriverRequestedMuraCorrectionMode_Int32 = 2200, 489 + Prop_DriverRequestedMuraFeather_InnerLeft_Int32 = 2201, 490 + Prop_DriverRequestedMuraFeather_InnerRight_Int32 = 2202, 491 + Prop_DriverRequestedMuraFeather_InnerTop_Int32 = 2203, 492 + Prop_DriverRequestedMuraFeather_InnerBottom_Int32 = 2204, 493 + Prop_DriverRequestedMuraFeather_OuterLeft_Int32 = 2205, 494 + Prop_DriverRequestedMuraFeather_OuterRight_Int32 = 2206, 495 + Prop_DriverRequestedMuraFeather_OuterTop_Int32 = 2207, 496 + Prop_DriverRequestedMuraFeather_OuterBottom_Int32 = 2208, 497 + 498 + Prop_Audio_DefaultPlaybackDeviceId_String = 2300, 499 + Prop_Audio_DefaultRecordingDeviceId_String = 2301, 500 + Prop_Audio_DefaultPlaybackDeviceVolume_Float = 2302, 501 + Prop_Audio_SupportsDualSpeakerAndJackOutput_Bool = 2303, 502 + 503 + // Properties that are unique to TrackedDeviceClass_Controller 504 + Prop_AttachedDeviceId_String = 3000, 505 + Prop_SupportedButtons_Uint64 = 3001, 506 + Prop_Axis0Type_Int32 = 3002, // Return value is of type EVRControllerAxisType 507 + Prop_Axis1Type_Int32 = 3003, // Return value is of type EVRControllerAxisType 508 + Prop_Axis2Type_Int32 = 3004, // Return value is of type EVRControllerAxisType 509 + Prop_Axis3Type_Int32 = 3005, // Return value is of type EVRControllerAxisType 510 + Prop_Axis4Type_Int32 = 3006, // Return value is of type EVRControllerAxisType 511 + Prop_ControllerRoleHint_Int32 = 3007, // Return value is of type ETrackedControllerRole 512 + 513 + // Properties that are unique to TrackedDeviceClass_TrackingReference 514 + Prop_FieldOfViewLeftDegrees_Float = 4000, 515 + Prop_FieldOfViewRightDegrees_Float = 4001, 516 + Prop_FieldOfViewTopDegrees_Float = 4002, 517 + Prop_FieldOfViewBottomDegrees_Float = 4003, 518 + Prop_TrackingRangeMinimumMeters_Float = 4004, 519 + Prop_TrackingRangeMaximumMeters_Float = 4005, 520 + Prop_ModeLabel_String = 4006, 521 + Prop_CanWirelessIdentify_Bool = 4007, // volatile, based on radio presence and fw discovery 522 + Prop_Nonce_Int32 = 4008, 523 + 524 + // Properties that are used for user interface like icons names 525 + Prop_IconPathName_String = 5000, // DEPRECATED. Value not referenced. Now expected to be part of icon path properties. 526 + Prop_NamedIconPathDeviceOff_String = 5001, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others 527 + Prop_NamedIconPathDeviceSearching_String = 5002, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others 528 + Prop_NamedIconPathDeviceSearchingAlert_String = 5003, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others 529 + Prop_NamedIconPathDeviceReady_String = 5004, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others 530 + Prop_NamedIconPathDeviceReadyAlert_String = 5005, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others 531 + Prop_NamedIconPathDeviceNotReady_String = 5006, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others 532 + Prop_NamedIconPathDeviceStandby_String = 5007, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others 533 + Prop_NamedIconPathDeviceAlertLow_String = 5008, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others 534 + Prop_NamedIconPathDeviceStandbyAlert_String = 5009, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others 535 + 536 + // Properties that are used by helpers, but are opaque to applications 537 + Prop_DisplayHiddenArea_Binary_Start = 5100, 538 + Prop_DisplayHiddenArea_Binary_End = 5150, 539 + Prop_ParentContainer = 5151, 540 + Prop_OverrideContainer_Uint64 = 5152, 541 + 542 + // Properties that are unique to drivers 543 + Prop_UserConfigPath_String = 6000, 544 + Prop_InstallPath_String = 6001, 545 + Prop_HasDisplayComponent_Bool = 6002, 546 + Prop_HasControllerComponent_Bool = 6003, 547 + Prop_HasCameraComponent_Bool = 6004, 548 + Prop_HasDriverDirectModeComponent_Bool = 6005, 549 + Prop_HasVirtualDisplayComponent_Bool = 6006, 550 + Prop_HasSpatialAnchorsSupport_Bool = 6007, 551 + 552 + // Properties that are set internally based on other information provided by drivers 553 + Prop_ControllerType_String = 7000, 554 + //Prop_LegacyInputProfile_String = 7001, // This is no longer used. See "legacy_binding" in the input profile instead. 555 + Prop_ControllerHandSelectionPriority_Int32 = 7002, // Allows hand assignments to prefer some controllers over others. High numbers are selected over low numbers 556 + 557 + // Vendors are free to expose private debug data in this reserved region 558 + Prop_VendorSpecific_Reserved_Start = 10000, 559 + Prop_VendorSpecific_Reserved_End = 10999, 560 + 561 + Prop_TrackedDeviceProperty_Max = 1000000, 562 + }; 563 + 564 + /** No string property will ever be longer than this length */ 565 + static const uint32_t k_unMaxPropertyStringSize = 32 * 1024; 566 + 567 + /** Used to return errors that occur when reading properties. */ 568 + enum ETrackedPropertyError 569 + { 570 + TrackedProp_Success = 0, 571 + TrackedProp_WrongDataType = 1, 572 + TrackedProp_WrongDeviceClass = 2, 573 + TrackedProp_BufferTooSmall = 3, 574 + TrackedProp_UnknownProperty = 4, // Driver has not set the property (and may not ever). 575 + TrackedProp_InvalidDevice = 5, 576 + TrackedProp_CouldNotContactServer = 6, 577 + TrackedProp_ValueNotProvidedByDevice = 7, 578 + TrackedProp_StringExceedsMaximumLength = 8, 579 + TrackedProp_NotYetAvailable = 9, // The property value isn't known yet, but is expected soon. Call again later. 580 + TrackedProp_PermissionDenied = 10, 581 + TrackedProp_InvalidOperation = 11, 582 + TrackedProp_CannotWriteToWildcards = 12, 583 + TrackedProp_IPCReadFailure = 13, 584 + TrackedProp_OutOfMemory = 14, 585 + TrackedProp_InvalidContainer = 15, 586 + }; 587 + 588 + /** Used to drive certain text in the UI when talking about the tracking system for the HMD */ 589 + enum EHmdTrackingStyle 590 + { 591 + HmdTrackingStyle_Unknown = 0, 592 + 593 + HmdTrackingStyle_Lighthouse = 1, // base stations and lasers 594 + HmdTrackingStyle_OutsideInCameras = 2, // Cameras and LED, Rift 1 style 595 + HmdTrackingStyle_InsideOutCameras = 3, // Cameras on HMD looking at the world 596 + }; 597 + 598 + typedef uint64_t VRActionHandle_t; 599 + typedef uint64_t VRActionSetHandle_t; 600 + typedef uint64_t VRInputValueHandle_t; 601 + 602 + static const VRActionHandle_t k_ulInvalidActionHandle = 0; 603 + static const VRActionSetHandle_t k_ulInvalidActionSetHandle = 0; 604 + static const VRInputValueHandle_t k_ulInvalidInputValueHandle = 0; 605 + 606 + 607 + /** Allows the application to control what part of the provided texture will be used in the 608 + * frame buffer. */ 609 + struct VRTextureBounds_t 610 + { 611 + float uMin, vMin; 612 + float uMax, vMax; 613 + }; 614 + 615 + /** Allows specifying pose used to render provided scene texture (if different from value returned by WaitGetPoses). */ 616 + struct VRTextureWithPose_t : public Texture_t 617 + { 618 + HmdMatrix34_t mDeviceToAbsoluteTracking; // Actual pose used to render scene textures. 619 + }; 620 + 621 + struct VRTextureDepthInfo_t 622 + { 623 + void* handle; // See ETextureType definition above 624 + HmdMatrix44_t mProjection; 625 + HmdVector2_t vRange; // 0..1 626 + }; 627 + 628 + struct VRTextureWithDepth_t : public Texture_t 629 + { 630 + VRTextureDepthInfo_t depth; 631 + }; 632 + 633 + struct VRTextureWithPoseAndDepth_t : public VRTextureWithPose_t 634 + { 635 + VRTextureDepthInfo_t depth; 636 + }; 637 + 638 + /** Allows the application to control how scene textures are used by the compositor when calling Submit. */ 639 + enum EVRSubmitFlags 640 + { 641 + // Simple render path. App submits rendered left and right eye images with no lens distortion correction applied. 642 + Submit_Default = 0x00, 643 + 644 + // App submits final left and right eye images with lens distortion already applied (lens distortion makes the images appear 645 + // barrel distorted with chromatic aberration correction applied). The app would have used the data returned by 646 + // vr::IVRSystem::ComputeDistortion() to apply the correct distortion to the rendered images before calling Submit(). 647 + Submit_LensDistortionAlreadyApplied = 0x01, 648 + 649 + // If the texture pointer passed in is actually a renderbuffer (e.g. for MSAA in OpenGL) then set this flag. 650 + Submit_GlRenderBuffer = 0x02, 651 + 652 + // Do not use 653 + Submit_Reserved = 0x04, 654 + 655 + // Set to indicate that pTexture is a pointer to a VRTextureWithPose_t. 656 + // This flag can be combined with Submit_TextureWithDepth to pass a VRTextureWithPoseAndDepth_t. 657 + Submit_TextureWithPose = 0x08, 658 + 659 + // Set to indicate that pTexture is a pointer to a VRTextureWithDepth_t. 660 + // This flag can be combined with Submit_TextureWithPose to pass a VRTextureWithPoseAndDepth_t. 661 + Submit_TextureWithDepth = 0x10, 662 + 663 + // Set to indicate a discontinuity between this and the last frame. 664 + // This will prevent motion smoothing from attempting to extrapolate using the pair. 665 + Submit_FrameDiscontinuty = 0x20, 666 + 667 + // Set to indicate that pTexture->handle is a contains VRVulkanTextureArrayData_t 668 + Submit_VulkanTextureWithArrayData = 0x40, 669 + 670 + // If the texture pointer passed in is an OpenGL Array texture, set this flag 671 + Submit_GlArrayTexture = 0x80, 672 + 673 + // Do not use 674 + Submit_Reserved2 = 0x8000, 675 + 676 + 677 + }; 678 + 679 + /** Data required for passing Vulkan textures to IVRCompositor::Submit. 680 + * Be sure to call OpenVR_Shutdown before destroying these resources. 681 + * Please see https://github.com/ValveSoftware/openvr/wiki/Vulkan for Vulkan-specific documentation */ 682 + struct VRVulkanTextureData_t 683 + { 684 + uint64_t m_nImage; // VkImage 685 + VkDevice_T *m_pDevice; 686 + VkPhysicalDevice_T *m_pPhysicalDevice; 687 + VkInstance_T *m_pInstance; 688 + VkQueue_T *m_pQueue; 689 + uint32_t m_nQueueFamilyIndex; 690 + uint32_t m_nWidth, m_nHeight, m_nFormat, m_nSampleCount; 691 + }; 692 + 693 + /** Data required for passing Vulkan texture arrays to IVRCompositor::Submit. 694 + * Be sure to call OpenVR_Shutdown before destroying these resources. 695 + * Please see https://github.com/ValveSoftware/openvr/wiki/Vulkan for Vulkan-specific documentation */ 696 + struct VRVulkanTextureArrayData_t : public VRVulkanTextureData_t 697 + { 698 + uint32_t m_unArrayIndex; 699 + uint32_t m_unArraySize; 700 + }; 701 + 702 + /** Data required for passing D3D12 textures to IVRCompositor::Submit. 703 + * Be sure to call OpenVR_Shutdown before destroying these resources. */ 704 + struct D3D12TextureData_t 705 + { 706 + ID3D12Resource *m_pResource; 707 + ID3D12CommandQueue *m_pCommandQueue; 708 + uint32_t m_nNodeMask; 709 + }; 710 + 711 + /** Status of the overall system or tracked objects */ 712 + enum EVRState 713 + { 714 + VRState_Undefined = -1, 715 + VRState_Off = 0, 716 + VRState_Searching = 1, 717 + VRState_Searching_Alert = 2, 718 + VRState_Ready = 3, 719 + VRState_Ready_Alert = 4, 720 + VRState_NotReady = 5, 721 + VRState_Standby = 6, 722 + VRState_Ready_Alert_Low = 7, 723 + }; 724 + 725 + /** The types of events that could be posted (and what the parameters mean for each event type) */ 726 + enum EVREventType 727 + { 728 + VREvent_None = 0, 729 + 730 + VREvent_TrackedDeviceActivated = 100, 731 + VREvent_TrackedDeviceDeactivated = 101, 732 + VREvent_TrackedDeviceUpdated = 102, 733 + VREvent_TrackedDeviceUserInteractionStarted = 103, 734 + VREvent_TrackedDeviceUserInteractionEnded = 104, 735 + VREvent_IpdChanged = 105, 736 + VREvent_EnterStandbyMode = 106, 737 + VREvent_LeaveStandbyMode = 107, 738 + VREvent_TrackedDeviceRoleChanged = 108, 739 + VREvent_WatchdogWakeUpRequested = 109, 740 + VREvent_LensDistortionChanged = 110, 741 + VREvent_PropertyChanged = 111, 742 + VREvent_WirelessDisconnect = 112, 743 + VREvent_WirelessReconnect = 113, 744 + 745 + VREvent_ButtonPress = 200, // data is controller 746 + VREvent_ButtonUnpress = 201, // data is controller 747 + VREvent_ButtonTouch = 202, // data is controller 748 + VREvent_ButtonUntouch = 203, // data is controller 749 + 750 + // VREvent_DualAnalog_Press = 250, // No longer sent 751 + // VREvent_DualAnalog_Unpress = 251, // No longer sent 752 + // VREvent_DualAnalog_Touch = 252, // No longer sent 753 + // VREvent_DualAnalog_Untouch = 253, // No longer sent 754 + // VREvent_DualAnalog_Move = 254, // No longer sent 755 + // VREvent_DualAnalog_ModeSwitch1 = 255, // No longer sent 756 + // VREvent_DualAnalog_ModeSwitch2 = 256, // No longer sent 757 + VREvent_Modal_Cancel = 257, // Sent to overlays with the 758 + 759 + VREvent_MouseMove = 300, // data is mouse 760 + VREvent_MouseButtonDown = 301, // data is mouse 761 + VREvent_MouseButtonUp = 302, // data is mouse 762 + VREvent_FocusEnter = 303, // data is overlay 763 + VREvent_FocusLeave = 304, // data is overlay 764 + VREvent_ScrollDiscrete = 305, // data is scroll 765 + VREvent_TouchPadMove = 306, // data is mouse 766 + VREvent_OverlayFocusChanged = 307, // data is overlay, global event 767 + VREvent_ReloadOverlays = 308, 768 + VREvent_ScrollSmooth = 309, // data is scroll 769 + VREvent_LockMousePosition = 310, 770 + VREvent_UnlockMousePosition = 311, 771 + 772 + VREvent_InputFocusCaptured = 400, // data is process DEPRECATED 773 + VREvent_InputFocusReleased = 401, // data is process DEPRECATED 774 + // VREvent_SceneFocusLost = 402, // data is process 775 + // VREvent_SceneFocusGained = 403, // data is process 776 + VREvent_SceneApplicationChanged = 404, // data is process - The App actually drawing the scene changed (usually to or from the compositor) 777 + VREvent_SceneFocusChanged = 405, // data is process - New app got access to draw the scene 778 + VREvent_InputFocusChanged = 406, // data is process 779 + // VREvent_SceneApplicationSecondaryRenderingStarted = 407, 780 + VREvent_SceneApplicationUsingWrongGraphicsAdapter = 408, // data is process 781 + VREvent_ActionBindingReloaded = 409, // data is process - The App that action binds reloaded for 782 + 783 + VREvent_HideRenderModels = 410, // Sent to the scene application to request hiding render models temporarily 784 + VREvent_ShowRenderModels = 411, // Sent to the scene application to request restoring render model visibility 785 + 786 + VREvent_SceneApplicationStateChanged = 412, // No data; but query VRApplications()->GetSceneApplicationState(); 787 + 788 + VREvent_ConsoleOpened = 420, 789 + VREvent_ConsoleClosed = 421, 790 + 791 + VREvent_OverlayShown = 500, 792 + VREvent_OverlayHidden = 501, 793 + VREvent_DashboardActivated = 502, 794 + VREvent_DashboardDeactivated = 503, 795 + //VREvent_DashboardThumbSelected = 504, // Sent to the overlay manager - data is overlay - No longer sent 796 + VREvent_DashboardRequested = 505, // Sent to the overlay manager - data is overlay 797 + VREvent_ResetDashboard = 506, // Send to the overlay manager 798 + //VREvent_RenderToast = 507, // Send to the dashboard to render a toast - data is the notification ID -- no longer sent 799 + VREvent_ImageLoaded = 508, // Sent to overlays when a SetOverlayRaw or SetOverlayFromFile call finishes loading 800 + VREvent_ShowKeyboard = 509, // Sent to keyboard renderer in the dashboard to invoke it 801 + VREvent_HideKeyboard = 510, // Sent to keyboard renderer in the dashboard to hide it 802 + VREvent_OverlayGamepadFocusGained = 511, // Sent to an overlay when IVROverlay::SetFocusOverlay is called on it 803 + VREvent_OverlayGamepadFocusLost = 512, // Send to an overlay when it previously had focus and IVROverlay::SetFocusOverlay is called on something else 804 + VREvent_OverlaySharedTextureChanged = 513, 805 + //VREvent_DashboardGuideButtonDown = 514, // These are no longer sent 806 + //VREvent_DashboardGuideButtonUp = 515, 807 + VREvent_ScreenshotTriggered = 516, // Screenshot button combo was pressed, Dashboard should request a screenshot 808 + VREvent_ImageFailed = 517, // Sent to overlays when a SetOverlayRaw or SetOverlayfromFail fails to load 809 + VREvent_DashboardOverlayCreated = 518, 810 + VREvent_SwitchGamepadFocus = 519, 811 + 812 + // Screenshot API 813 + VREvent_RequestScreenshot = 520, // Sent by vrclient application to compositor to take a screenshot 814 + VREvent_ScreenshotTaken = 521, // Sent by compositor to the application that the screenshot has been taken 815 + VREvent_ScreenshotFailed = 522, // Sent by compositor to the application that the screenshot failed to be taken 816 + VREvent_SubmitScreenshotToDashboard = 523, // Sent by compositor to the dashboard that a completed screenshot was submitted 817 + VREvent_ScreenshotProgressToDashboard = 524, // Sent by compositor to the dashboard that a completed screenshot was submitted 818 + 819 + VREvent_PrimaryDashboardDeviceChanged = 525, 820 + VREvent_RoomViewShown = 526, // Sent by compositor whenever room-view is enabled 821 + VREvent_RoomViewHidden = 527, // Sent by compositor whenever room-view is disabled 822 + VREvent_ShowUI = 528, // data is showUi 823 + VREvent_ShowDevTools = 529, // data is showDevTools 824 + VREvent_DesktopViewUpdating = 530, 825 + VREvent_DesktopViewReady = 531, 826 + 827 + VREvent_Notification_Shown = 600, 828 + VREvent_Notification_Hidden = 601, 829 + VREvent_Notification_BeginInteraction = 602, 830 + VREvent_Notification_Destroyed = 603, 831 + 832 + VREvent_Quit = 700, // data is process 833 + VREvent_ProcessQuit = 701, // data is process 834 + //VREvent_QuitAborted_UserPrompt = 702, // data is process 835 + VREvent_QuitAcknowledged = 703, // data is process 836 + VREvent_DriverRequestedQuit = 704, // The driver has requested that SteamVR shut down 837 + VREvent_RestartRequested = 705, // A driver or other component wants the user to restart SteamVR 838 + 839 + VREvent_ChaperoneDataHasChanged = 800, // this will never happen with the new chaperone system 840 + VREvent_ChaperoneUniverseHasChanged = 801, 841 + VREvent_ChaperoneTempDataHasChanged = 802, // this will never happen with the new chaperone system 842 + VREvent_ChaperoneSettingsHaveChanged = 803, 843 + VREvent_SeatedZeroPoseReset = 804, 844 + VREvent_ChaperoneFlushCache = 805, // Sent when the process needs to reload any cached data it retrieved from VRChaperone() 845 + VREvent_ChaperoneRoomSetupStarting = 806, // Triggered by CVRChaperoneClient::RoomSetupStarting 846 + VREvent_ChaperoneRoomSetupFinished = 807, // Triggered by CVRChaperoneClient::CommitWorkingCopy 847 + VREvent_StandingZeroPoseReset = 808, 848 + 849 + VREvent_AudioSettingsHaveChanged = 820, 850 + 851 + VREvent_BackgroundSettingHasChanged = 850, 852 + VREvent_CameraSettingsHaveChanged = 851, 853 + VREvent_ReprojectionSettingHasChanged = 852, 854 + VREvent_ModelSkinSettingsHaveChanged = 853, 855 + VREvent_EnvironmentSettingsHaveChanged = 854, 856 + VREvent_PowerSettingsHaveChanged = 855, 857 + VREvent_EnableHomeAppSettingsHaveChanged = 856, 858 + VREvent_SteamVRSectionSettingChanged = 857, 859 + VREvent_LighthouseSectionSettingChanged = 858, 860 + VREvent_NullSectionSettingChanged = 859, 861 + VREvent_UserInterfaceSectionSettingChanged = 860, 862 + VREvent_NotificationsSectionSettingChanged = 861, 863 + VREvent_KeyboardSectionSettingChanged = 862, 864 + VREvent_PerfSectionSettingChanged = 863, 865 + VREvent_DashboardSectionSettingChanged = 864, 866 + VREvent_WebInterfaceSectionSettingChanged = 865, 867 + VREvent_TrackersSectionSettingChanged = 866, 868 + VREvent_LastKnownSectionSettingChanged = 867, 869 + VREvent_DismissedWarningsSectionSettingChanged = 868, 870 + VREvent_GpuSpeedSectionSettingChanged = 869, 871 + VREvent_WindowsMRSectionSettingChanged = 870, 872 + VREvent_OtherSectionSettingChanged = 871, 873 + 874 + VREvent_StatusUpdate = 900, 875 + 876 + VREvent_WebInterface_InstallDriverCompleted = 950, 877 + 878 + VREvent_MCImageUpdated = 1000, 879 + 880 + VREvent_FirmwareUpdateStarted = 1100, 881 + VREvent_FirmwareUpdateFinished = 1101, 882 + 883 + VREvent_KeyboardClosed = 1200, 884 + VREvent_KeyboardCharInput = 1201, 885 + VREvent_KeyboardDone = 1202, // Sent when DONE button clicked on keyboard 886 + 887 + //VREvent_ApplicationTransitionStarted = 1300, 888 + //VREvent_ApplicationTransitionAborted = 1301, 889 + //VREvent_ApplicationTransitionNewAppStarted = 1302, 890 + VREvent_ApplicationListUpdated = 1303, 891 + VREvent_ApplicationMimeTypeLoad = 1304, 892 + // VREvent_ApplicationTransitionNewAppLaunchComplete = 1305, 893 + VREvent_ProcessConnected = 1306, 894 + VREvent_ProcessDisconnected = 1307, 895 + 896 + //VREvent_Compositor_MirrorWindowShown = 1400, // DEPRECATED 897 + //VREvent_Compositor_MirrorWindowHidden = 1401, // DEPRECATED 898 + VREvent_Compositor_ChaperoneBoundsShown = 1410, 899 + VREvent_Compositor_ChaperoneBoundsHidden = 1411, 900 + VREvent_Compositor_DisplayDisconnected = 1412, 901 + VREvent_Compositor_DisplayReconnected = 1413, 902 + VREvent_Compositor_HDCPError = 1414, // data is hdcpError 903 + VREvent_Compositor_ApplicationNotResponding = 1415, 904 + VREvent_Compositor_ApplicationResumed = 1416, 905 + VREvent_Compositor_OutOfVideoMemory = 1417, 906 + VREvent_Compositor_DisplayModeNotSupported = 1418, // k_pch_SteamVR_PreferredRefreshRate 907 + VREvent_Compositor_StageOverrideReady = 1419, 908 + 909 + VREvent_TrackedCamera_StartVideoStream = 1500, 910 + VREvent_TrackedCamera_StopVideoStream = 1501, 911 + VREvent_TrackedCamera_PauseVideoStream = 1502, 912 + VREvent_TrackedCamera_ResumeVideoStream = 1503, 913 + VREvent_TrackedCamera_EditingSurface = 1550, 914 + 915 + VREvent_PerformanceTest_EnableCapture = 1600, 916 + VREvent_PerformanceTest_DisableCapture = 1601, 917 + VREvent_PerformanceTest_FidelityLevel = 1602, 918 + 919 + VREvent_MessageOverlay_Closed = 1650, 920 + VREvent_MessageOverlayCloseRequested = 1651, 921 + 922 + VREvent_Input_HapticVibration = 1700, // data is hapticVibration 923 + VREvent_Input_BindingLoadFailed = 1701, // data is inputBinding 924 + VREvent_Input_BindingLoadSuccessful = 1702, // data is inputBinding 925 + VREvent_Input_ActionManifestReloaded = 1703, // no data 926 + VREvent_Input_ActionManifestLoadFailed = 1704, // data is actionManifest 927 + VREvent_Input_ProgressUpdate = 1705, // data is progressUpdate 928 + VREvent_Input_TrackerActivated = 1706, 929 + VREvent_Input_BindingsUpdated = 1707, 930 + VREvent_Input_BindingSubscriptionChanged = 1708, 931 + 932 + VREvent_SpatialAnchors_PoseUpdated = 1800, // data is spatialAnchor. broadcast 933 + VREvent_SpatialAnchors_DescriptorUpdated = 1801, // data is spatialAnchor. broadcast 934 + VREvent_SpatialAnchors_RequestPoseUpdate = 1802, // data is spatialAnchor. sent to specific driver 935 + VREvent_SpatialAnchors_RequestDescriptorUpdate = 1803, // data is spatialAnchor. sent to specific driver 936 + 937 + VREvent_SystemReport_Started = 1900, // user or system initiated generation of a system report. broadcast 938 + 939 + VREvent_Monitor_ShowHeadsetView = 2000, // data is process 940 + VREvent_Monitor_HideHeadsetView = 2001, // data is process 941 + 942 + // Vendors are free to expose private events in this reserved region 943 + VREvent_VendorSpecific_Reserved_Start = 10000, 944 + VREvent_VendorSpecific_Reserved_End = 19999, 945 + }; 946 + 947 + 948 + /** Level of Hmd activity */ 949 + // UserInteraction_Timeout means the device is in the process of timing out. 950 + // InUse = ( k_EDeviceActivityLevel_UserInteraction || k_EDeviceActivityLevel_UserInteraction_Timeout ) 951 + // VREvent_TrackedDeviceUserInteractionStarted fires when the devices transitions from Standby -> UserInteraction or Idle -> UserInteraction. 952 + // VREvent_TrackedDeviceUserInteractionEnded fires when the devices transitions from UserInteraction_Timeout -> Idle 953 + enum EDeviceActivityLevel 954 + { 955 + k_EDeviceActivityLevel_Unknown = -1, 956 + k_EDeviceActivityLevel_Idle = 0, // No activity for the last 10 seconds 957 + k_EDeviceActivityLevel_UserInteraction = 1, // Activity (movement or prox sensor) is happening now 958 + k_EDeviceActivityLevel_UserInteraction_Timeout = 2, // No activity for the last 0.5 seconds 959 + k_EDeviceActivityLevel_Standby = 3, // Idle for at least 5 seconds (configurable in Settings -> Power Management) 960 + k_EDeviceActivityLevel_Idle_Timeout = 4, 961 + }; 962 + 963 + 964 + /** VR controller button and axis IDs */ 965 + enum EVRButtonId 966 + { 967 + k_EButton_System = 0, 968 + k_EButton_ApplicationMenu = 1, 969 + k_EButton_Grip = 2, 970 + k_EButton_DPad_Left = 3, 971 + k_EButton_DPad_Up = 4, 972 + k_EButton_DPad_Right = 5, 973 + k_EButton_DPad_Down = 6, 974 + k_EButton_A = 7, 975 + 976 + k_EButton_ProximitySensor = 31, 977 + 978 + k_EButton_Axis0 = 32, 979 + k_EButton_Axis1 = 33, 980 + k_EButton_Axis2 = 34, 981 + k_EButton_Axis3 = 35, 982 + k_EButton_Axis4 = 36, 983 + 984 + // aliases for well known controllers 985 + k_EButton_SteamVR_Touchpad = k_EButton_Axis0, 986 + k_EButton_SteamVR_Trigger = k_EButton_Axis1, 987 + 988 + k_EButton_Dashboard_Back = k_EButton_Grip, 989 + 990 + k_EButton_IndexController_A = k_EButton_Grip, 991 + k_EButton_IndexController_B = k_EButton_ApplicationMenu, 992 + k_EButton_IndexController_JoyStick = k_EButton_Axis3, 993 + 994 + k_EButton_Max = 64 995 + }; 996 + 997 + inline uint64_t ButtonMaskFromId( EVRButtonId id ) { return 1ull << id; } 998 + 999 + /** used for controller button events */ 1000 + struct VREvent_Controller_t 1001 + { 1002 + uint32_t button; // EVRButtonId enum 1003 + }; 1004 + 1005 + 1006 + /** used for simulated mouse events in overlay space */ 1007 + enum EVRMouseButton 1008 + { 1009 + VRMouseButton_Left = 0x0001, 1010 + VRMouseButton_Right = 0x0002, 1011 + VRMouseButton_Middle = 0x0004, 1012 + }; 1013 + 1014 + 1015 + /** used for simulated mouse events in overlay space */ 1016 + struct VREvent_Mouse_t 1017 + { 1018 + float x, y; // co-ords are in GL space, bottom left of the texture is 0,0 1019 + uint32_t button; // EVRMouseButton enum 1020 + }; 1021 + 1022 + /** used for simulated mouse wheel scroll */ 1023 + struct VREvent_Scroll_t 1024 + { 1025 + float xdelta, ydelta; 1026 + uint32_t unused; 1027 + float viewportscale; // For scrolling on an overlay with laser mouse, this is the overlay's vertical size relative to the overlay height. Range: [0,1] 1028 + }; 1029 + 1030 + /** when in mouse input mode you can receive data from the touchpad, these events are only sent if the users finger 1031 + is on the touchpad (or just released from it). These events are sent to overlays with the VROverlayFlags_SendVRTouchpadEvents 1032 + flag set. 1033 + **/ 1034 + struct VREvent_TouchPadMove_t 1035 + { 1036 + // true if the users finger is detected on the touch pad 1037 + bool bFingerDown; 1038 + 1039 + // How long the finger has been down in seconds 1040 + float flSecondsFingerDown; 1041 + 1042 + // These values indicate the starting finger position (so you can do some basic swipe stuff) 1043 + float fValueXFirst; 1044 + float fValueYFirst; 1045 + 1046 + // This is the raw sampled coordinate without deadzoning 1047 + float fValueXRaw; 1048 + float fValueYRaw; 1049 + }; 1050 + 1051 + /** notification related events. Details will still change at this point */ 1052 + struct VREvent_Notification_t 1053 + { 1054 + uint64_t ulUserValue; 1055 + uint32_t notificationId; 1056 + }; 1057 + 1058 + /** Used for events about processes */ 1059 + struct VREvent_Process_t 1060 + { 1061 + uint32_t pid; 1062 + uint32_t oldPid; 1063 + bool bForced; 1064 + // If the associated event was triggered by a connection loss 1065 + bool bConnectionLost; 1066 + }; 1067 + 1068 + 1069 + /** Used for a few events about overlays */ 1070 + struct VREvent_Overlay_t 1071 + { 1072 + uint64_t overlayHandle; 1073 + uint64_t devicePath; 1074 + uint64_t memoryBlockId; 1075 + }; 1076 + 1077 + 1078 + /** Used for a few events about overlays */ 1079 + struct VREvent_Status_t 1080 + { 1081 + uint32_t statusState; // EVRState enum 1082 + }; 1083 + 1084 + /** Used for keyboard events **/ 1085 + struct VREvent_Keyboard_t 1086 + { 1087 + char cNewInput[8]; // Up to 11 bytes of new input 1088 + uint64_t uUserValue; // Possible flags about the new input 1089 + }; 1090 + 1091 + struct VREvent_Ipd_t 1092 + { 1093 + float ipdMeters; 1094 + }; 1095 + 1096 + struct VREvent_Chaperone_t 1097 + { 1098 + uint64_t m_nPreviousUniverse; 1099 + uint64_t m_nCurrentUniverse; 1100 + }; 1101 + 1102 + /** Not actually used for any events */ 1103 + struct VREvent_Reserved_t 1104 + { 1105 + uint64_t reserved0; 1106 + uint64_t reserved1; 1107 + uint64_t reserved2; 1108 + uint64_t reserved3; 1109 + uint64_t reserved4; 1110 + uint64_t reserved5; 1111 + }; 1112 + 1113 + struct VREvent_PerformanceTest_t 1114 + { 1115 + uint32_t m_nFidelityLevel; 1116 + }; 1117 + 1118 + struct VREvent_SeatedZeroPoseReset_t 1119 + { 1120 + bool bResetBySystemMenu; 1121 + }; 1122 + 1123 + struct VREvent_Screenshot_t 1124 + { 1125 + uint32_t handle; 1126 + uint32_t type; 1127 + }; 1128 + 1129 + struct VREvent_ScreenshotProgress_t 1130 + { 1131 + float progress; 1132 + }; 1133 + 1134 + struct VREvent_ApplicationLaunch_t 1135 + { 1136 + uint32_t pid; 1137 + uint32_t unArgsHandle; 1138 + }; 1139 + 1140 + struct VREvent_EditingCameraSurface_t 1141 + { 1142 + uint64_t overlayHandle; 1143 + uint32_t nVisualMode; 1144 + }; 1145 + 1146 + struct VREvent_MessageOverlay_t 1147 + { 1148 + uint32_t unVRMessageOverlayResponse; // vr::VRMessageOverlayResponse enum 1149 + }; 1150 + 1151 + struct VREvent_Property_t 1152 + { 1153 + PropertyContainerHandle_t container; 1154 + ETrackedDeviceProperty prop; 1155 + }; 1156 + 1157 + struct VREvent_HapticVibration_t 1158 + { 1159 + uint64_t containerHandle; // property container handle of the device with the haptic component 1160 + uint64_t componentHandle; // Which haptic component needs to vibrate 1161 + float fDurationSeconds; 1162 + float fFrequency; 1163 + float fAmplitude; 1164 + }; 1165 + 1166 + struct VREvent_WebConsole_t 1167 + { 1168 + WebConsoleHandle_t webConsoleHandle; 1169 + }; 1170 + 1171 + struct VREvent_InputBindingLoad_t 1172 + { 1173 + vr::PropertyContainerHandle_t ulAppContainer; 1174 + uint64_t pathMessage; 1175 + uint64_t pathUrl; 1176 + uint64_t pathControllerType; 1177 + }; 1178 + 1179 + struct VREvent_InputActionManifestLoad_t 1180 + { 1181 + uint64_t pathAppKey; 1182 + uint64_t pathMessage; 1183 + uint64_t pathMessageParam; 1184 + uint64_t pathManifestPath; 1185 + }; 1186 + 1187 + struct VREvent_SpatialAnchor_t 1188 + { 1189 + SpatialAnchorHandle_t unHandle; 1190 + }; 1191 + 1192 + struct VREvent_ProgressUpdate_t 1193 + { 1194 + uint64_t ulApplicationPropertyContainer; 1195 + uint64_t pathDevice; 1196 + uint64_t pathInputSource; 1197 + uint64_t pathProgressAction; 1198 + uint64_t pathIcon; 1199 + float fProgress; 1200 + }; 1201 + 1202 + enum EShowUIType 1203 + { 1204 + ShowUI_ControllerBinding = 0, 1205 + ShowUI_ManageTrackers = 1, 1206 + // ShowUI_QuickStart = 2, // Deprecated 1207 + ShowUI_Pairing = 3, 1208 + ShowUI_Settings = 4, 1209 + ShowUI_DebugCommands = 5, 1210 + ShowUI_FullControllerBinding = 6, 1211 + ShowUI_ManageDrivers = 7, 1212 + }; 1213 + 1214 + struct VREvent_ShowUI_t 1215 + { 1216 + EShowUIType eType; 1217 + }; 1218 + 1219 + struct VREvent_ShowDevTools_t 1220 + { 1221 + int32_t nBrowserIdentifier; 1222 + }; 1223 + 1224 + enum EHDCPError 1225 + { 1226 + HDCPError_None = 0, 1227 + HDCPError_LinkLost = 1, 1228 + HDCPError_Tampered = 2, 1229 + HDCPError_DeviceRevoked = 3, 1230 + HDCPError_Unknown = 4 1231 + }; 1232 + 1233 + struct VREvent_HDCPError_t 1234 + { 1235 + EHDCPError eCode; 1236 + }; 1237 + 1238 + typedef union 1239 + { 1240 + VREvent_Reserved_t reserved; 1241 + VREvent_Controller_t controller; 1242 + VREvent_Mouse_t mouse; 1243 + VREvent_Scroll_t scroll; 1244 + VREvent_Process_t process; 1245 + VREvent_Notification_t notification; 1246 + VREvent_Overlay_t overlay; 1247 + VREvent_Status_t status; 1248 + VREvent_Keyboard_t keyboard; 1249 + VREvent_Ipd_t ipd; 1250 + VREvent_Chaperone_t chaperone; 1251 + VREvent_PerformanceTest_t performanceTest; 1252 + VREvent_TouchPadMove_t touchPadMove; 1253 + VREvent_SeatedZeroPoseReset_t seatedZeroPoseReset; 1254 + VREvent_Screenshot_t screenshot; 1255 + VREvent_ScreenshotProgress_t screenshotProgress; 1256 + VREvent_ApplicationLaunch_t applicationLaunch; 1257 + VREvent_EditingCameraSurface_t cameraSurface; 1258 + VREvent_MessageOverlay_t messageOverlay; 1259 + VREvent_Property_t property; 1260 + VREvent_HapticVibration_t hapticVibration; 1261 + VREvent_WebConsole_t webConsole; 1262 + VREvent_InputBindingLoad_t inputBinding; 1263 + VREvent_InputActionManifestLoad_t actionManifest; 1264 + VREvent_SpatialAnchor_t spatialAnchor; 1265 + VREvent_ProgressUpdate_t progressUpdate; 1266 + VREvent_ShowUI_t showUi; 1267 + VREvent_ShowDevTools_t showDevTools; 1268 + VREvent_HDCPError_t hdcpError; 1269 + /** NOTE!!! If you change this you MUST manually update openvr_interop.cs.py */ 1270 + } VREvent_Data_t; 1271 + 1272 + 1273 + #if defined(__linux__) || defined(__APPLE__) 1274 + // This structure was originally defined mis-packed on Linux, preserved for 1275 + // compatibility. 1276 + #pragma pack( push, 4 ) 1277 + #endif 1278 + 1279 + /** An event posted by the server to all running applications */ 1280 + struct VREvent_t 1281 + { 1282 + uint32_t eventType; // EVREventType enum 1283 + TrackedDeviceIndex_t trackedDeviceIndex; 1284 + float eventAgeSeconds; 1285 + // event data must be the end of the struct as its size is variable 1286 + VREvent_Data_t data; 1287 + }; 1288 + 1289 + #if defined(__linux__) || defined(__APPLE__) 1290 + #pragma pack( pop ) 1291 + #endif 1292 + 1293 + typedef uint32_t VRComponentProperties; 1294 + 1295 + enum EVRComponentProperty 1296 + { 1297 + VRComponentProperty_IsStatic = (1 << 0), 1298 + VRComponentProperty_IsVisible = (1 << 1), 1299 + VRComponentProperty_IsTouched = (1 << 2), 1300 + VRComponentProperty_IsPressed = (1 << 3), 1301 + VRComponentProperty_IsScrolled = (1 << 4), 1302 + VRComponentProperty_IsHighlighted = (1 << 5), 1303 + }; 1304 + 1305 + 1306 + /** Describes state information about a render-model component, including transforms and other dynamic properties */ 1307 + struct RenderModel_ComponentState_t 1308 + { 1309 + HmdMatrix34_t mTrackingToComponentRenderModel; // Transform required when drawing the component render model 1310 + HmdMatrix34_t mTrackingToComponentLocal; // Transform available for attaching to a local component coordinate system (-Z out from surface ) 1311 + VRComponentProperties uProperties; 1312 + }; 1313 + 1314 + 1315 + enum EVRInputError 1316 + { 1317 + VRInputError_None = 0, 1318 + VRInputError_NameNotFound = 1, 1319 + VRInputError_WrongType = 2, 1320 + VRInputError_InvalidHandle = 3, 1321 + VRInputError_InvalidParam = 4, 1322 + VRInputError_NoSteam = 5, 1323 + VRInputError_MaxCapacityReached = 6, 1324 + VRInputError_IPCError = 7, 1325 + VRInputError_NoActiveActionSet = 8, 1326 + VRInputError_InvalidDevice = 9, 1327 + VRInputError_InvalidSkeleton = 10, 1328 + VRInputError_InvalidBoneCount = 11, 1329 + VRInputError_InvalidCompressedData = 12, 1330 + VRInputError_NoData = 13, 1331 + VRInputError_BufferTooSmall = 14, 1332 + VRInputError_MismatchedActionManifest = 15, 1333 + VRInputError_MissingSkeletonData = 16, 1334 + VRInputError_InvalidBoneIndex = 17, 1335 + VRInputError_InvalidPriority = 18, 1336 + VRInputError_PermissionDenied = 19, 1337 + VRInputError_InvalidRenderModel = 20, 1338 + }; 1339 + 1340 + enum EVRSpatialAnchorError 1341 + { 1342 + VRSpatialAnchorError_Success = 0, 1343 + VRSpatialAnchorError_Internal = 1, 1344 + VRSpatialAnchorError_UnknownHandle = 2, 1345 + VRSpatialAnchorError_ArrayTooSmall = 3, 1346 + VRSpatialAnchorError_InvalidDescriptorChar = 4, 1347 + VRSpatialAnchorError_NotYetAvailable = 5, 1348 + VRSpatialAnchorError_NotAvailableInThisUniverse = 6, 1349 + VRSpatialAnchorError_PermanentlyUnavailable = 7, 1350 + VRSpatialAnchorError_WrongDriver = 8, 1351 + VRSpatialAnchorError_DescriptorTooLong = 9, 1352 + VRSpatialAnchorError_Unknown = 10, 1353 + VRSpatialAnchorError_NoRoomCalibration = 11, 1354 + VRSpatialAnchorError_InvalidArgument = 12, 1355 + VRSpatialAnchorError_UnknownDriver = 13, 1356 + }; 1357 + 1358 + /** The mesh to draw into the stencil (or depth) buffer to perform 1359 + * early stencil (or depth) kills of pixels that will never appear on the HMD. 1360 + * This mesh draws on all the pixels that will be hidden after distortion. 1361 + * 1362 + * If the HMD does not provide a visible area mesh pVertexData will be 1363 + * NULL and unTriangleCount will be 0. */ 1364 + struct HiddenAreaMesh_t 1365 + { 1366 + const HmdVector2_t *pVertexData; 1367 + uint32_t unTriangleCount; 1368 + }; 1369 + 1370 + 1371 + enum EHiddenAreaMeshType 1372 + { 1373 + k_eHiddenAreaMesh_Standard = 0, 1374 + k_eHiddenAreaMesh_Inverse = 1, 1375 + k_eHiddenAreaMesh_LineLoop = 2, 1376 + 1377 + k_eHiddenAreaMesh_Max = 3, 1378 + }; 1379 + 1380 + 1381 + /** Identifies what kind of axis is on the controller at index n. Read this type 1382 + * with pVRSystem->Get( nControllerDeviceIndex, Prop_Axis0Type_Int32 + n ); 1383 + */ 1384 + enum EVRControllerAxisType 1385 + { 1386 + k_eControllerAxis_None = 0, 1387 + k_eControllerAxis_TrackPad = 1, 1388 + k_eControllerAxis_Joystick = 2, 1389 + k_eControllerAxis_Trigger = 3, // Analog trigger data is in the X axis 1390 + }; 1391 + 1392 + 1393 + /** contains information about one axis on the controller */ 1394 + struct VRControllerAxis_t 1395 + { 1396 + 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. 1397 + float y; // Ranges from -1.0 to 1.0 for joysticks and track pads. Is always 0.0 for triggers. 1398 + }; 1399 + 1400 + 1401 + /** the number of axes in the controller state */ 1402 + static const uint32_t k_unControllerStateAxisCount = 5; 1403 + 1404 + 1405 + #if defined(__linux__) || defined(__APPLE__) 1406 + // This structure was originally defined mis-packed on Linux, preserved for 1407 + // compatibility. 1408 + #pragma pack( push, 4 ) 1409 + #endif 1410 + 1411 + /** Holds all the state of a controller at one moment in time. */ 1412 + struct VRControllerState001_t 1413 + { 1414 + // If packet num matches that on your prior call, then the controller state hasn't been changed since 1415 + // your last call and there is no need to process it 1416 + uint32_t unPacketNum; 1417 + 1418 + // bit flags for each of the buttons. Use ButtonMaskFromId to turn an ID into a mask 1419 + uint64_t ulButtonPressed; 1420 + uint64_t ulButtonTouched; 1421 + 1422 + // Axis data for the controller's analog inputs 1423 + VRControllerAxis_t rAxis[ k_unControllerStateAxisCount ]; 1424 + }; 1425 + #if defined(__linux__) || defined(__APPLE__) 1426 + #pragma pack( pop ) 1427 + #endif 1428 + 1429 + 1430 + typedef VRControllerState001_t VRControllerState_t; 1431 + 1432 + 1433 + /** determines how to provide output to the application of various event processing functions. */ 1434 + enum EVRControllerEventOutputType 1435 + { 1436 + ControllerEventOutput_OSEvents = 0, 1437 + ControllerEventOutput_VREvents = 1, 1438 + }; 1439 + 1440 + 1441 + 1442 + /** Collision Bounds Style */ 1443 + enum ECollisionBoundsStyle 1444 + { 1445 + COLLISION_BOUNDS_STYLE_BEGINNER = 0, 1446 + COLLISION_BOUNDS_STYLE_INTERMEDIATE, 1447 + COLLISION_BOUNDS_STYLE_SQUARES, 1448 + COLLISION_BOUNDS_STYLE_ADVANCED, 1449 + COLLISION_BOUNDS_STYLE_NONE, 1450 + 1451 + COLLISION_BOUNDS_STYLE_COUNT 1452 + }; 1453 + 1454 + /** used to refer to a single VR overlay */ 1455 + typedef uint64_t VROverlayHandle_t; 1456 + 1457 + static const VROverlayHandle_t k_ulOverlayHandleInvalid = 0; 1458 + 1459 + /** Errors that can occur around VR overlays */ 1460 + enum EVROverlayError 1461 + { 1462 + VROverlayError_None = 0, 1463 + 1464 + VROverlayError_UnknownOverlay = 10, 1465 + VROverlayError_InvalidHandle = 11, 1466 + VROverlayError_PermissionDenied = 12, 1467 + VROverlayError_OverlayLimitExceeded = 13, // No more overlays could be created because the maximum number already exist 1468 + VROverlayError_WrongVisibilityType = 14, 1469 + VROverlayError_KeyTooLong = 15, 1470 + VROverlayError_NameTooLong = 16, 1471 + VROverlayError_KeyInUse = 17, 1472 + VROverlayError_WrongTransformType = 18, 1473 + VROverlayError_InvalidTrackedDevice = 19, 1474 + VROverlayError_InvalidParameter = 20, 1475 + VROverlayError_ThumbnailCantBeDestroyed = 21, 1476 + VROverlayError_ArrayTooSmall = 22, 1477 + VROverlayError_RequestFailed = 23, 1478 + VROverlayError_InvalidTexture = 24, 1479 + VROverlayError_UnableToLoadFile = 25, 1480 + VROverlayError_KeyboardAlreadyInUse = 26, 1481 + VROverlayError_NoNeighbor = 27, 1482 + VROverlayError_TooManyMaskPrimitives = 29, 1483 + VROverlayError_BadMaskPrimitive = 30, 1484 + VROverlayError_TextureAlreadyLocked = 31, 1485 + VROverlayError_TextureLockCapacityReached = 32, 1486 + VROverlayError_TextureNotLocked = 33, 1487 + }; 1488 + 1489 + /** enum values to pass in to VR_Init to identify whether the application will 1490 + * draw a 3D scene. */ 1491 + enum EVRApplicationType 1492 + { 1493 + VRApplication_Other = 0, // Some other kind of application that isn't covered by the other entries 1494 + VRApplication_Scene = 1, // Application will submit 3D frames 1495 + VRApplication_Overlay = 2, // Application only interacts with overlays 1496 + VRApplication_Background = 3, // Application should not start SteamVR if it's not already running, and should not 1497 + // keep it running if everything else quits. 1498 + VRApplication_Utility = 4, // Init should not try to load any drivers. The application needs access to utility 1499 + // interfaces (like IVRSettings and IVRApplications) but not hardware. 1500 + VRApplication_VRMonitor = 5, // Reserved for vrmonitor 1501 + VRApplication_SteamWatchdog = 6,// Reserved for Steam 1502 + VRApplication_Bootstrapper = 7, // reserved for vrstartup 1503 + VRApplication_WebHelper = 8, // reserved for vrwebhelper 1504 + VRApplication_OpenXRInstance = 9, // reserved for openxr (created instance, but not session yet) 1505 + VRApplication_OpenXRScene = 10, // reserved for openxr (started session) 1506 + VRApplication_OpenXROverlay = 11, // reserved for openxr (started overlay session) 1507 + VRApplication_Prism = 12, // reserved for the vrprismhost process 1508 + 1509 + VRApplication_Max 1510 + }; 1511 + 1512 + 1513 + /** returns true if the specified application type is one of the 1514 + * OpenXR types */ 1515 + inline bool IsOpenXRAppType( EVRApplicationType eType ) 1516 + { 1517 + return eType == VRApplication_OpenXRInstance 1518 + || eType == VRApplication_OpenXRScene 1519 + || eType == VRApplication_OpenXROverlay; 1520 + } 1521 + 1522 + 1523 + /** error codes for firmware */ 1524 + enum EVRFirmwareError 1525 + { 1526 + VRFirmwareError_None = 0, 1527 + VRFirmwareError_Success = 1, 1528 + VRFirmwareError_Fail = 2, 1529 + }; 1530 + 1531 + 1532 + /** error codes for notifications */ 1533 + enum EVRNotificationError 1534 + { 1535 + VRNotificationError_OK = 0, 1536 + VRNotificationError_InvalidNotificationId = 100, 1537 + VRNotificationError_NotificationQueueFull = 101, 1538 + VRNotificationError_InvalidOverlayHandle = 102, 1539 + VRNotificationError_SystemWithUserValueAlreadyExists = 103, 1540 + }; 1541 + 1542 + 1543 + enum EVRSkeletalMotionRange 1544 + { 1545 + // The range of motion of the skeleton takes into account any physical limits imposed by 1546 + // the controller itself. This will tend to be the most accurate pose compared to the user's 1547 + // actual hand pose, but might not allow a closed fist for example 1548 + VRSkeletalMotionRange_WithController = 0, 1549 + 1550 + // Retarget the range of motion provided by the input device to make the hand appear to move 1551 + // as if it was not holding a controller. eg: map "hand grasping controller" to "closed fist" 1552 + VRSkeletalMotionRange_WithoutController = 1, 1553 + }; 1554 + 1555 + enum EVRSkeletalTrackingLevel 1556 + { 1557 + // body part location can't be directly determined by the device. Any skeletal pose provided by 1558 + // the device is estimated by assuming the position required to active buttons, triggers, joysticks, 1559 + // or other input sensors. 1560 + // E.g. Vive Controller, Gamepad 1561 + VRSkeletalTracking_Estimated = 0, 1562 + 1563 + // body part location can be measured directly but with fewer degrees of freedom than the actual body 1564 + // part. Certain body part positions may be unmeasured by the device and estimated from other input data. 1565 + // E.g. Index Controllers, gloves that only measure finger curl 1566 + VRSkeletalTracking_Partial = 1, 1567 + 1568 + // Body part location can be measured directly throughout the entire range of motion of the body part. 1569 + // E.g. Mocap suit for the full body, gloves that measure rotation of each finger segment 1570 + VRSkeletalTracking_Full = 2, 1571 + 1572 + VRSkeletalTrackingLevel_Count, 1573 + VRSkeletalTrackingLevel_Max = VRSkeletalTrackingLevel_Count - 1 1574 + }; 1575 + 1576 + 1577 + /** Type used for referring to bones by their index */ 1578 + typedef int32_t BoneIndex_t; 1579 + const BoneIndex_t k_unInvalidBoneIndex = -1; 1580 + 1581 + 1582 + /** error codes returned by Vr_Init */ 1583 + 1584 + // Please add adequate error description to https://developer.valvesoftware.com/w/index.php?title=Category:SteamVRHelp 1585 + enum EVRInitError 1586 + { 1587 + VRInitError_None = 0, 1588 + VRInitError_Unknown = 1, 1589 + 1590 + VRInitError_Init_InstallationNotFound = 100, 1591 + VRInitError_Init_InstallationCorrupt = 101, 1592 + VRInitError_Init_VRClientDLLNotFound = 102, 1593 + VRInitError_Init_FileNotFound = 103, 1594 + VRInitError_Init_FactoryNotFound = 104, 1595 + VRInitError_Init_InterfaceNotFound = 105, 1596 + VRInitError_Init_InvalidInterface = 106, 1597 + VRInitError_Init_UserConfigDirectoryInvalid = 107, 1598 + VRInitError_Init_HmdNotFound = 108, 1599 + VRInitError_Init_NotInitialized = 109, 1600 + VRInitError_Init_PathRegistryNotFound = 110, 1601 + VRInitError_Init_NoConfigPath = 111, 1602 + VRInitError_Init_NoLogPath = 112, 1603 + VRInitError_Init_PathRegistryNotWritable = 113, 1604 + VRInitError_Init_AppInfoInitFailed = 114, 1605 + VRInitError_Init_Retry = 115, // Used internally to cause retries to vrserver 1606 + VRInitError_Init_InitCanceledByUser = 116, // The calling application should silently exit. The user canceled app startup 1607 + VRInitError_Init_AnotherAppLaunching = 117, 1608 + VRInitError_Init_SettingsInitFailed = 118, 1609 + VRInitError_Init_ShuttingDown = 119, 1610 + VRInitError_Init_TooManyObjects = 120, 1611 + VRInitError_Init_NoServerForBackgroundApp = 121, 1612 + VRInitError_Init_NotSupportedWithCompositor = 122, 1613 + VRInitError_Init_NotAvailableToUtilityApps = 123, 1614 + VRInitError_Init_Internal = 124, 1615 + VRInitError_Init_HmdDriverIdIsNone = 125, 1616 + VRInitError_Init_HmdNotFoundPresenceFailed = 126, 1617 + VRInitError_Init_VRMonitorNotFound = 127, 1618 + VRInitError_Init_VRMonitorStartupFailed = 128, 1619 + VRInitError_Init_LowPowerWatchdogNotSupported = 129, 1620 + VRInitError_Init_InvalidApplicationType = 130, 1621 + VRInitError_Init_NotAvailableToWatchdogApps = 131, 1622 + VRInitError_Init_WatchdogDisabledInSettings = 132, 1623 + VRInitError_Init_VRDashboardNotFound = 133, 1624 + VRInitError_Init_VRDashboardStartupFailed = 134, 1625 + VRInitError_Init_VRHomeNotFound = 135, 1626 + VRInitError_Init_VRHomeStartupFailed = 136, 1627 + VRInitError_Init_RebootingBusy = 137, 1628 + VRInitError_Init_FirmwareUpdateBusy = 138, 1629 + VRInitError_Init_FirmwareRecoveryBusy = 139, 1630 + VRInitError_Init_USBServiceBusy = 140, 1631 + VRInitError_Init_VRWebHelperStartupFailed = 141, 1632 + VRInitError_Init_TrackerManagerInitFailed = 142, 1633 + VRInitError_Init_AlreadyRunning = 143, 1634 + VRInitError_Init_FailedForVrMonitor = 144, 1635 + VRInitError_Init_PropertyManagerInitFailed = 145, 1636 + VRInitError_Init_WebServerFailed = 146, 1637 + VRInitError_Init_IllegalTypeTransition = 147, 1638 + VRInitError_Init_MismatchedRuntimes = 148, 1639 + VRInitError_Init_InvalidProcessId = 149, 1640 + VRInitError_Init_VRServiceStartupFailed = 150, 1641 + VRInitError_Init_PrismNeedsNewDrivers = 151, 1642 + VRInitError_Init_PrismStartupTimedOut = 152, 1643 + VRInitError_Init_CouldNotStartPrism = 153, 1644 + VRInitError_Init_CreateDriverDirectDeviceFailed = 154, 1645 + VRInitError_Init_PrismExitedUnexpectedly = 155, 1646 + 1647 + VRInitError_Driver_Failed = 200, 1648 + VRInitError_Driver_Unknown = 201, 1649 + VRInitError_Driver_HmdUnknown = 202, 1650 + VRInitError_Driver_NotLoaded = 203, 1651 + VRInitError_Driver_RuntimeOutOfDate = 204, 1652 + VRInitError_Driver_HmdInUse = 205, 1653 + VRInitError_Driver_NotCalibrated = 206, 1654 + VRInitError_Driver_CalibrationInvalid = 207, 1655 + VRInitError_Driver_HmdDisplayNotFound = 208, 1656 + VRInitError_Driver_TrackedDeviceInterfaceUnknown = 209, 1657 + // VRInitError_Driver_HmdDisplayNotFoundAfterFix = 210, // not needed: here for historic reasons 1658 + VRInitError_Driver_HmdDriverIdOutOfBounds = 211, 1659 + VRInitError_Driver_HmdDisplayMirrored = 212, 1660 + VRInitError_Driver_HmdDisplayNotFoundLaptop = 213, 1661 + // Never make error 259 because we return it from main and it would conflict with STILL_ACTIVE 1662 + 1663 + VRInitError_IPC_ServerInitFailed = 300, 1664 + VRInitError_IPC_ConnectFailed = 301, 1665 + VRInitError_IPC_SharedStateInitFailed = 302, 1666 + VRInitError_IPC_CompositorInitFailed = 303, 1667 + VRInitError_IPC_MutexInitFailed = 304, 1668 + VRInitError_IPC_Failed = 305, 1669 + VRInitError_IPC_CompositorConnectFailed = 306, 1670 + VRInitError_IPC_CompositorInvalidConnectResponse = 307, 1671 + VRInitError_IPC_ConnectFailedAfterMultipleAttempts = 308, 1672 + VRInitError_IPC_ConnectFailedAfterTargetExited = 309, 1673 + VRInitError_IPC_NamespaceUnavailable = 310, 1674 + 1675 + VRInitError_Compositor_Failed = 400, 1676 + VRInitError_Compositor_D3D11HardwareRequired = 401, 1677 + VRInitError_Compositor_FirmwareRequiresUpdate = 402, 1678 + VRInitError_Compositor_OverlayInitFailed = 403, 1679 + VRInitError_Compositor_ScreenshotsInitFailed = 404, 1680 + VRInitError_Compositor_UnableToCreateDevice = 405, 1681 + VRInitError_Compositor_SharedStateIsNull = 406, 1682 + VRInitError_Compositor_NotificationManagerIsNull = 407, 1683 + VRInitError_Compositor_ResourceManagerClientIsNull = 408, 1684 + VRInitError_Compositor_MessageOverlaySharedStateInitFailure = 409, 1685 + VRInitError_Compositor_PropertiesInterfaceIsNull = 410, 1686 + VRInitError_Compositor_CreateFullscreenWindowFailed = 411, 1687 + VRInitError_Compositor_SettingsInterfaceIsNull = 412, 1688 + VRInitError_Compositor_FailedToShowWindow = 413, 1689 + VRInitError_Compositor_DistortInterfaceIsNull = 414, 1690 + VRInitError_Compositor_DisplayFrequencyFailure = 415, 1691 + VRInitError_Compositor_RendererInitializationFailed = 416, 1692 + VRInitError_Compositor_DXGIFactoryInterfaceIsNull = 417, 1693 + VRInitError_Compositor_DXGIFactoryCreateFailed = 418, 1694 + VRInitError_Compositor_DXGIFactoryQueryFailed = 419, 1695 + VRInitError_Compositor_InvalidAdapterDesktop = 420, 1696 + VRInitError_Compositor_InvalidHmdAttachment = 421, 1697 + VRInitError_Compositor_InvalidOutputDesktop = 422, 1698 + VRInitError_Compositor_InvalidDeviceProvided = 423, 1699 + VRInitError_Compositor_D3D11RendererInitializationFailed = 424, 1700 + VRInitError_Compositor_FailedToFindDisplayMode = 425, 1701 + VRInitError_Compositor_FailedToCreateSwapChain = 426, 1702 + VRInitError_Compositor_FailedToGetBackBuffer = 427, 1703 + VRInitError_Compositor_FailedToCreateRenderTarget = 428, 1704 + VRInitError_Compositor_FailedToCreateDXGI2SwapChain = 429, 1705 + VRInitError_Compositor_FailedtoGetDXGI2BackBuffer = 430, 1706 + VRInitError_Compositor_FailedToCreateDXGI2RenderTarget = 431, 1707 + VRInitError_Compositor_FailedToGetDXGIDeviceInterface = 432, 1708 + VRInitError_Compositor_SelectDisplayMode = 433, 1709 + VRInitError_Compositor_FailedToCreateNvAPIRenderTargets = 434, 1710 + VRInitError_Compositor_NvAPISetDisplayMode = 435, 1711 + VRInitError_Compositor_FailedToCreateDirectModeDisplay = 436, 1712 + VRInitError_Compositor_InvalidHmdPropertyContainer = 437, 1713 + VRInitError_Compositor_UpdateDisplayFrequency = 438, 1714 + VRInitError_Compositor_CreateRasterizerState = 439, 1715 + VRInitError_Compositor_CreateWireframeRasterizerState = 440, 1716 + VRInitError_Compositor_CreateSamplerState = 441, 1717 + VRInitError_Compositor_CreateClampToBorderSamplerState = 442, 1718 + VRInitError_Compositor_CreateAnisoSamplerState = 443, 1719 + VRInitError_Compositor_CreateOverlaySamplerState = 444, 1720 + VRInitError_Compositor_CreatePanoramaSamplerState = 445, 1721 + VRInitError_Compositor_CreateFontSamplerState = 446, 1722 + VRInitError_Compositor_CreateNoBlendState = 447, 1723 + VRInitError_Compositor_CreateBlendState = 448, 1724 + VRInitError_Compositor_CreateAlphaBlendState = 449, 1725 + VRInitError_Compositor_CreateBlendStateMaskR = 450, 1726 + VRInitError_Compositor_CreateBlendStateMaskG = 451, 1727 + VRInitError_Compositor_CreateBlendStateMaskB = 452, 1728 + VRInitError_Compositor_CreateDepthStencilState = 453, 1729 + VRInitError_Compositor_CreateDepthStencilStateNoWrite = 454, 1730 + VRInitError_Compositor_CreateDepthStencilStateNoDepth = 455, 1731 + VRInitError_Compositor_CreateFlushTexture = 456, 1732 + VRInitError_Compositor_CreateDistortionSurfaces = 457, 1733 + VRInitError_Compositor_CreateConstantBuffer = 458, 1734 + VRInitError_Compositor_CreateHmdPoseConstantBuffer = 459, 1735 + VRInitError_Compositor_CreateHmdPoseStagingConstantBuffer = 460, 1736 + VRInitError_Compositor_CreateSharedFrameInfoConstantBuffer = 461, 1737 + VRInitError_Compositor_CreateOverlayConstantBuffer = 462, 1738 + VRInitError_Compositor_CreateSceneTextureIndexConstantBuffer = 463, 1739 + VRInitError_Compositor_CreateReadableSceneTextureIndexConstantBuffer = 464, 1740 + VRInitError_Compositor_CreateLayerGraphicsTextureIndexConstantBuffer = 465, 1741 + VRInitError_Compositor_CreateLayerComputeTextureIndexConstantBuffer = 466, 1742 + VRInitError_Compositor_CreateLayerComputeSceneTextureIndexConstantBuffer = 467, 1743 + VRInitError_Compositor_CreateComputeHmdPoseConstantBuffer = 468, 1744 + VRInitError_Compositor_CreateGeomConstantBuffer = 469, 1745 + VRInitError_Compositor_CreatePanelMaskConstantBuffer = 470, 1746 + VRInitError_Compositor_CreatePixelSimUBO = 471, 1747 + VRInitError_Compositor_CreateMSAARenderTextures = 472, 1748 + VRInitError_Compositor_CreateResolveRenderTextures = 473, 1749 + VRInitError_Compositor_CreateComputeResolveRenderTextures = 474, 1750 + VRInitError_Compositor_CreateDriverDirectModeResolveTextures = 475, 1751 + VRInitError_Compositor_OpenDriverDirectModeResolveTextures = 476, 1752 + VRInitError_Compositor_CreateFallbackSyncTexture = 477, 1753 + VRInitError_Compositor_ShareFallbackSyncTexture = 478, 1754 + VRInitError_Compositor_CreateOverlayIndexBuffer = 479, 1755 + VRInitError_Compositor_CreateOverlayVertexBuffer = 480, 1756 + VRInitError_Compositor_CreateTextVertexBuffer = 481, 1757 + VRInitError_Compositor_CreateTextIndexBuffer = 482, 1758 + VRInitError_Compositor_CreateMirrorTextures = 483, 1759 + VRInitError_Compositor_CreateLastFrameRenderTexture = 484, 1760 + VRInitError_Compositor_CreateMirrorOverlay = 485, 1761 + VRInitError_Compositor_FailedToCreateVirtualDisplayBackbuffer = 486, 1762 + VRInitError_Compositor_DisplayModeNotSupported = 487, 1763 + VRInitError_Compositor_CreateOverlayInvalidCall = 488, 1764 + VRInitError_Compositor_CreateOverlayAlreadyInitialized = 489, 1765 + VRInitError_Compositor_FailedToCreateMailbox = 490, 1766 + VRInitError_Compositor_WindowInterfaceIsNull = 491, 1767 + VRInitError_Compositor_SystemLayerCreateInstance = 492, 1768 + VRInitError_Compositor_SystemLayerCreateSession = 493, 1769 + 1770 + VRInitError_VendorSpecific_UnableToConnectToOculusRuntime = 1000, 1771 + VRInitError_VendorSpecific_WindowsNotInDevMode = 1001, 1772 + 1773 + VRInitError_VendorSpecific_HmdFound_CantOpenDevice = 1101, 1774 + VRInitError_VendorSpecific_HmdFound_UnableToRequestConfigStart = 1102, 1775 + VRInitError_VendorSpecific_HmdFound_NoStoredConfig = 1103, 1776 + VRInitError_VendorSpecific_HmdFound_ConfigTooBig = 1104, 1777 + VRInitError_VendorSpecific_HmdFound_ConfigTooSmall = 1105, 1778 + VRInitError_VendorSpecific_HmdFound_UnableToInitZLib = 1106, 1779 + VRInitError_VendorSpecific_HmdFound_CantReadFirmwareVersion = 1107, 1780 + VRInitError_VendorSpecific_HmdFound_UnableToSendUserDataStart = 1108, 1781 + VRInitError_VendorSpecific_HmdFound_UnableToGetUserDataStart = 1109, 1782 + VRInitError_VendorSpecific_HmdFound_UnableToGetUserDataNext = 1110, 1783 + VRInitError_VendorSpecific_HmdFound_UserDataAddressRange = 1111, 1784 + VRInitError_VendorSpecific_HmdFound_UserDataError = 1112, 1785 + VRInitError_VendorSpecific_HmdFound_ConfigFailedSanityCheck = 1113, 1786 + VRInitError_VendorSpecific_OculusRuntimeBadInstall = 1114, 1787 + 1788 + VRInitError_Steam_SteamInstallationNotFound = 2000, 1789 + 1790 + // Strictly a placeholder 1791 + VRInitError_LastError 1792 + }; 1793 + 1794 + enum EVRScreenshotType 1795 + { 1796 + VRScreenshotType_None = 0, 1797 + VRScreenshotType_Mono = 1, // left eye only 1798 + VRScreenshotType_Stereo = 2, 1799 + VRScreenshotType_Cubemap = 3, 1800 + VRScreenshotType_MonoPanorama = 4, 1801 + VRScreenshotType_StereoPanorama = 5 1802 + }; 1803 + 1804 + enum EVRScreenshotPropertyFilenames 1805 + { 1806 + VRScreenshotPropertyFilenames_Preview = 0, 1807 + VRScreenshotPropertyFilenames_VR = 1, 1808 + }; 1809 + 1810 + enum EVRTrackedCameraError 1811 + { 1812 + VRTrackedCameraError_None = 0, 1813 + VRTrackedCameraError_OperationFailed = 100, 1814 + VRTrackedCameraError_InvalidHandle = 101, 1815 + VRTrackedCameraError_InvalidFrameHeaderVersion = 102, 1816 + VRTrackedCameraError_OutOfHandles = 103, 1817 + VRTrackedCameraError_IPCFailure = 104, 1818 + VRTrackedCameraError_NotSupportedForThisDevice = 105, 1819 + VRTrackedCameraError_SharedMemoryFailure = 106, 1820 + VRTrackedCameraError_FrameBufferingFailure = 107, 1821 + VRTrackedCameraError_StreamSetupFailure = 108, 1822 + VRTrackedCameraError_InvalidGLTextureId = 109, 1823 + VRTrackedCameraError_InvalidSharedTextureHandle = 110, 1824 + VRTrackedCameraError_FailedToGetGLTextureId = 111, 1825 + VRTrackedCameraError_SharedTextureFailure = 112, 1826 + VRTrackedCameraError_NoFrameAvailable = 113, 1827 + VRTrackedCameraError_InvalidArgument = 114, 1828 + VRTrackedCameraError_InvalidFrameBufferSize = 115, 1829 + }; 1830 + 1831 + enum EVRTrackedCameraFrameLayout 1832 + { 1833 + EVRTrackedCameraFrameLayout_Mono = 0x0001, 1834 + EVRTrackedCameraFrameLayout_Stereo = 0x0002, 1835 + EVRTrackedCameraFrameLayout_VerticalLayout = 0x0010, // Stereo frames are Top/Bottom (left/right) 1836 + EVRTrackedCameraFrameLayout_HorizontalLayout = 0x0020, // Stereo frames are Left/Right 1837 + }; 1838 + 1839 + enum EVRTrackedCameraFrameType 1840 + { 1841 + VRTrackedCameraFrameType_Distorted = 0, // This is the camera video frame size in pixels, still distorted. 1842 + VRTrackedCameraFrameType_Undistorted, // In pixels, an undistorted inscribed rectangle region without invalid regions. This size is subject to changes shortly. 1843 + VRTrackedCameraFrameType_MaximumUndistorted, // In pixels, maximum undistorted with invalid regions. Non zero alpha component identifies valid regions. 1844 + MAX_CAMERA_FRAME_TYPES 1845 + }; 1846 + 1847 + enum EVRDistortionFunctionType 1848 + { 1849 + VRDistortionFunctionType_None, 1850 + VRDistortionFunctionType_FTheta, 1851 + VRDistortionFunctionType_Extended_FTheta, 1852 + MAX_DISTORTION_FUNCTION_TYPES, 1853 + }; 1854 + 1855 + static const uint32_t k_unMaxDistortionFunctionParameters = 8; 1856 + 1857 + typedef uint64_t TrackedCameraHandle_t; 1858 + #define INVALID_TRACKED_CAMERA_HANDLE ((vr::TrackedCameraHandle_t)0) 1859 + 1860 + struct CameraVideoStreamFrameHeader_t 1861 + { 1862 + EVRTrackedCameraFrameType eFrameType; 1863 + 1864 + uint32_t nWidth; 1865 + uint32_t nHeight; 1866 + uint32_t nBytesPerPixel; 1867 + 1868 + uint32_t nFrameSequence; 1869 + 1870 + TrackedDevicePose_t trackedDevicePose; 1871 + 1872 + uint64_t ulFrameExposureTime; // mid-point of the exposure of the image in host system ticks 1873 + }; 1874 + 1875 + // Screenshot types 1876 + typedef uint32_t ScreenshotHandle_t; 1877 + 1878 + static const uint32_t k_unScreenshotHandleInvalid = 0; 1879 + 1880 + /** Compositor frame timing reprojection flags. */ 1881 + const uint32_t VRCompositor_ReprojectionReason_Cpu = 0x01; 1882 + const uint32_t VRCompositor_ReprojectionReason_Gpu = 0x02; 1883 + const uint32_t VRCompositor_ReprojectionAsync = 0x04; // This flag indicates the async reprojection mode is active, 1884 + // but does not indicate if reprojection actually happened or not. 1885 + // Use the ReprojectionReason flags above to check if reprojection 1886 + // was actually applied (i.e. scene texture was reused). 1887 + // NumFramePresents > 1 also indicates the scene texture was reused, 1888 + // and also the number of times that it was presented in total. 1889 + 1890 + const uint32_t VRCompositor_ReprojectionMotion = 0x08; // This flag indicates whether or not motion smoothing was triggered for this frame 1891 + 1892 + const uint32_t VRCompositor_PredictionMask = 0xF0; // The runtime may predict more than one frame (up to four) ahead if 1893 + // it detects the application is taking too long to render. These two 1894 + // bits will contain the count of additional frames (normally zero). 1895 + // Use the VR_COMPOSITOR_ADDITIONAL_PREDICTED_FRAMES macro to read from 1896 + // the latest frame timing entry. 1897 + 1898 + const uint32_t VRCompositor_ThrottleMask = 0xF00; // Number of frames the compositor is throttling the application. 1899 + // Use the VR_COMPOSITOR_NUMBER_OF_THROTTLED_FRAMES macro to read from 1900 + // the latest frame timing entry. 1901 + 1902 + #define VR_COMPOSITOR_ADDITIONAL_PREDICTED_FRAMES( timing ) ( ( ( timing ).m_nReprojectionFlags & vr::VRCompositor_PredictionMask ) >> 4 ) 1903 + #define VR_COMPOSITOR_NUMBER_OF_THROTTLED_FRAMES( timing ) ( ( ( timing ).m_nReprojectionFlags & vr::VRCompositor_ThrottleMask ) >> 8 ) 1904 + 1905 + /** Provides a single frame's timing information to the app */ 1906 + struct Compositor_FrameTiming 1907 + { 1908 + uint32_t m_nSize; // Set to sizeof( Compositor_FrameTiming ) 1909 + uint32_t m_nFrameIndex; 1910 + uint32_t m_nNumFramePresents; // number of times this frame was presented 1911 + uint32_t m_nNumMisPresented; // number of times this frame was presented on a vsync other than it was originally predicted to 1912 + uint32_t m_nNumDroppedFrames; // number of additional times previous frame was scanned out 1913 + uint32_t m_nReprojectionFlags; 1914 + 1915 + /** Absolute time reference for comparing frames. This aligns with the vsync that running start is relative to. */ 1916 + double m_flSystemTimeInSeconds; 1917 + 1918 + /** These times may include work from other processes due to OS scheduling. 1919 + * The fewer packets of work these are broken up into, the less likely this will happen. 1920 + * GPU work can be broken up by calling Flush. This can sometimes be useful to get the GPU started 1921 + * processing that work earlier in the frame. */ 1922 + float m_flPreSubmitGpuMs; // time spent rendering the scene (gpu work submitted between WaitGetPoses and second Submit) 1923 + float m_flPostSubmitGpuMs; // additional time spent rendering by application (e.g. companion window) 1924 + float m_flTotalRenderGpuMs; // time between work submitted immediately after present (ideally vsync) until the end of compositor submitted work 1925 + float m_flCompositorRenderGpuMs; // time spend performing distortion correction, rendering chaperone, overlays, etc. 1926 + float m_flCompositorRenderCpuMs; // time spent on cpu submitting the above work for this frame 1927 + float m_flCompositorIdleCpuMs; // time spent waiting for running start (application could have used this much more time) 1928 + 1929 + /** Miscellaneous measured intervals. */ 1930 + float m_flClientFrameIntervalMs; // time between calls to WaitGetPoses 1931 + float m_flPresentCallCpuMs; // time blocked on call to present (usually 0.0, but can go long) 1932 + float m_flWaitForPresentCpuMs; // time spent spin-waiting for frame index to change (not near-zero indicates wait object failure) 1933 + float m_flSubmitFrameMs; // time spent in IVRCompositor::Submit (not near-zero indicates driver issue) 1934 + 1935 + /** The following are all relative to this frame's SystemTimeInSeconds */ 1936 + float m_flWaitGetPosesCalledMs; 1937 + float m_flNewPosesReadyMs; 1938 + float m_flNewFrameReadyMs; // second call to IVRCompositor::Submit 1939 + float m_flCompositorUpdateStartMs; 1940 + float m_flCompositorUpdateEndMs; 1941 + float m_flCompositorRenderStartMs; 1942 + 1943 + vr::TrackedDevicePose_t m_HmdPose; // pose used by app to render this frame 1944 + 1945 + uint32_t m_nNumVSyncsReadyForUse; 1946 + uint32_t m_nNumVSyncsToFirstView; 1947 + }; 1948 + 1949 + /** Provides compositor benchmark results to the app */ 1950 + struct Compositor_BenchmarkResults 1951 + { 1952 + float m_flMegaPixelsPerSecond; // Measurement of GPU MP/s performed by compositor benchmark 1953 + float m_flHmdRecommendedMegaPixelsPerSecond; // Recommended default MP/s given the HMD resolution, refresh, and panel mask. 1954 + }; 1955 + 1956 + /** Frame timing data provided by direct mode drivers. */ 1957 + struct DriverDirectMode_FrameTiming 1958 + { 1959 + uint32_t m_nSize; // Set to sizeof( DriverDirectMode_FrameTiming ) 1960 + uint32_t m_nNumFramePresents; // number of times frame was presented 1961 + uint32_t m_nNumMisPresented; // number of times frame was presented on a vsync other than it was originally predicted to 1962 + uint32_t m_nNumDroppedFrames; // number of additional times previous frame was scanned out (i.e. compositor missed vsync) 1963 + uint32_t m_nReprojectionFlags; 1964 + }; 1965 + 1966 + /** These flags will be set on DriverDirectMode_FrameTiming::m_nReprojectionFlags when IVRDriverDirectModeComponent::GetFrameTiming is called for drivers to optionally respond to. */ 1967 + const uint32_t VRCompositor_ReprojectionMotion_Enabled = 0x100; // Motion Smoothing is enabled in the UI for the currently running application 1968 + const uint32_t VRCompositor_ReprojectionMotion_ForcedOn = 0x200; // Motion Smoothing is forced on in the UI for the currently running application 1969 + const uint32_t VRCompositor_ReprojectionMotion_AppThrottled = 0x400; // Application is requesting throttling via ForceInterleavedReprojectionOn 1970 + 1971 + 1972 + enum EVSync 1973 + { 1974 + VSync_None, 1975 + VSync_WaitRender, // block following render work until vsync 1976 + VSync_NoWaitRender, // do not block following render work (allow to get started early) 1977 + }; 1978 + 1979 + enum EVRMuraCorrectionMode 1980 + { 1981 + EVRMuraCorrectionMode_Default = 0, 1982 + EVRMuraCorrectionMode_NoCorrection 1983 + }; 1984 + 1985 + /** raw IMU data provided by IVRIOBuffer from paths to tracked devices with IMUs */ 1986 + enum Imu_OffScaleFlags 1987 + { 1988 + OffScale_AccelX = 0x01, 1989 + OffScale_AccelY = 0x02, 1990 + OffScale_AccelZ = 0x04, 1991 + OffScale_GyroX = 0x08, 1992 + OffScale_GyroY = 0x10, 1993 + OffScale_GyroZ = 0x20, 1994 + }; 1995 + 1996 + struct ImuSample_t 1997 + { 1998 + double fSampleTime; 1999 + HmdVector3d_t vAccel; 2000 + HmdVector3d_t vGyro; 2001 + uint32_t unOffScaleFlags; 2002 + }; 2003 + 2004 + #pragma pack( pop ) 2005 + 2006 + // figure out how to import from the VR API dll 2007 + #if defined(_WIN32) 2008 + 2009 + #if !defined(OPENVR_BUILD_STATIC) 2010 + #ifdef VR_API_EXPORT 2011 + #define VR_INTERFACE extern "C" __declspec( dllexport ) 2012 + #else 2013 + #define VR_INTERFACE extern "C" __declspec( dllimport ) 2014 + #endif 2015 + #else 2016 + #define VR_INTERFACE extern "C" 2017 + #endif 2018 + 2019 + #elif defined(__GNUC__) || defined(COMPILER_GCC) || defined(__APPLE__) 2020 + 2021 + #ifdef VR_API_EXPORT 2022 + #define VR_INTERFACE extern "C" __attribute__((visibility("default"))) 2023 + #else 2024 + #define VR_INTERFACE extern "C" 2025 + #endif 2026 + 2027 + #else 2028 + #error "Unsupported Platform." 2029 + #endif 2030 + 2031 + 2032 + #if defined( _WIN32 ) 2033 + #define VR_CALLTYPE __cdecl 2034 + #else 2035 + #define VR_CALLTYPE 2036 + #endif 2037 + 2038 + } // namespace vr 2039 + #endif // _INCLUDE_VRTYPES_H 2040 + 2041 + // vrannotation.h 2042 + 2043 + #ifdef API_GEN 2044 + # define VR_CLANG_ATTR(ATTR) __attribute__((annotate( ATTR ))) 2045 + #else 2046 + # define VR_CLANG_ATTR(ATTR) 2047 + #endif 2048 + 2049 + #define VR_METHOD_DESC(DESC) VR_CLANG_ATTR( "desc:" #DESC ";" ) 2050 + #define VR_IGNOREATTR() VR_CLANG_ATTR( "ignore" ) 2051 + #define VR_OUT_STRUCT() VR_CLANG_ATTR( "out_struct: ;" ) 2052 + #define VR_OUT_STRING() VR_CLANG_ATTR( "out_string: ;" ) 2053 + #define VR_OUT_ARRAY_CALL(COUNTER,FUNCTION,PARAMS) VR_CLANG_ATTR( "out_array_call:" #COUNTER "," #FUNCTION "," #PARAMS ";" ) 2054 + #define VR_OUT_ARRAY_COUNT(COUNTER) VR_CLANG_ATTR( "out_array_count:" #COUNTER ";" ) 2055 + #define VR_ARRAY_COUNT(COUNTER) VR_CLANG_ATTR( "array_count:" #COUNTER ";" ) 2056 + #define VR_ARRAY_COUNT_D(COUNTER, DESC) VR_CLANG_ATTR( "array_count:" #COUNTER ";desc:" #DESC ) 2057 + #define VR_BUFFER_COUNT(COUNTER) VR_CLANG_ATTR( "buffer_count:" #COUNTER ";" ) 2058 + #define VR_OUT_BUFFER_COUNT(COUNTER) VR_CLANG_ATTR( "out_buffer_count:" #COUNTER ";" ) 2059 + #define VR_OUT_STRING_COUNT(COUNTER) VR_CLANG_ATTR( "out_string_count:" #COUNTER ";" ) 2060 + 2061 + // ivrsystem.h 2062 + 2063 + namespace vr 2064 + { 2065 + 2066 + class IVRSystem 2067 + { 2068 + public: 2069 + 2070 + 2071 + // ------------------------------------ 2072 + // Display Methods 2073 + // ------------------------------------ 2074 + 2075 + /** Suggested size for the intermediate render target that the distortion pulls from. */ 2076 + virtual void GetRecommendedRenderTargetSize( uint32_t *pnWidth, uint32_t *pnHeight ) = 0; 2077 + 2078 + /** The projection matrix for the specified eye */ 2079 + virtual HmdMatrix44_t GetProjectionMatrix( EVREye eEye, float fNearZ, float fFarZ ) = 0; 2080 + 2081 + /** The components necessary to build your own projection matrix in case your 2082 + * application is doing something fancy like infinite Z */ 2083 + virtual void GetProjectionRaw( EVREye eEye, float *pfLeft, float *pfRight, float *pfTop, float *pfBottom ) = 0; 2084 + 2085 + /** Gets the result of the distortion function for the specified eye and input UVs. UVs go from 0,0 in 2086 + * the upper left of that eye's viewport and 1,1 in the lower right of that eye's viewport. 2087 + * Returns true for success. Otherwise, returns false, and distortion coordinates are not suitable. */ 2088 + virtual bool ComputeDistortion( EVREye eEye, float fU, float fV, DistortionCoordinates_t *pDistortionCoordinates ) = 0; 2089 + 2090 + /** Returns the transform from eye space to the head space. Eye space is the per-eye flavor of head 2091 + * space that provides stereo disparity. Instead of Model * View * Projection the sequence is Model * View * Eye^-1 * Projection. 2092 + * Normally View and Eye^-1 will be multiplied together and treated as View in your application. 2093 + */ 2094 + virtual HmdMatrix34_t GetEyeToHeadTransform( EVREye eEye ) = 0; 2095 + 2096 + /** Returns the number of elapsed seconds since the last recorded vsync event. This 2097 + * will come from a vsync timer event in the timer if possible or from the application-reported 2098 + * time if that is not available. If no vsync times are available the function will 2099 + * return zero for vsync time and frame counter and return false from the method. */ 2100 + virtual bool GetTimeSinceLastVsync( float *pfSecondsSinceLastVsync, uint64_t *pulFrameCounter ) = 0; 2101 + 2102 + /** [D3D9 Only] 2103 + * Returns the adapter index that the user should pass into CreateDevice to set up D3D9 in such 2104 + * a way that it can go full screen exclusive on the HMD. Returns -1 if there was an error. 2105 + */ 2106 + virtual int32_t GetD3D9AdapterIndex() = 0; 2107 + 2108 + /** [D3D10/11 Only] 2109 + * Returns the adapter index that the user should pass into EnumAdapters to create the device 2110 + * and swap chain in DX10 and DX11. If an error occurs the index will be set to -1. 2111 + */ 2112 + virtual void GetDXGIOutputInfo( int32_t *pnAdapterIndex ) = 0; 2113 + 2114 + /** 2115 + * Returns platform- and texture-type specific adapter identification so that applications and the 2116 + * compositor are creating textures and swap chains on the same GPU. If an error occurs the device 2117 + * will be set to 0. 2118 + * pInstance is an optional parameter that is required only when textureType is TextureType_Vulkan. 2119 + * [D3D10/11/12 Only (D3D9 Not Supported)] 2120 + * Returns the adapter LUID that identifies the GPU attached to the HMD. The user should 2121 + * enumerate all adapters using IDXGIFactory::EnumAdapters and IDXGIAdapter::GetDesc to find 2122 + * the adapter with the matching LUID, or use IDXGIFactory4::EnumAdapterByLuid. 2123 + * The discovered IDXGIAdapter should be used to create the device and swap chain. 2124 + * [Vulkan Only] 2125 + * Returns the VkPhysicalDevice that should be used by the application. 2126 + * pInstance must be the instance the application will use to query for the VkPhysicalDevice. The application 2127 + * must create the VkInstance with extensions returned by IVRCompositor::GetVulkanInstanceExtensionsRequired enabled. 2128 + * [macOS Only] 2129 + * For TextureType_IOSurface returns the id<MTLDevice> that should be used by the application. 2130 + * On 10.13+ for TextureType_OpenGL returns the 'registryId' of the renderer which should be used 2131 + * by the application. See Apple Technical Q&A QA1168 for information on enumerating GL Renderers, and the 2132 + * new kCGLRPRegistryIDLow and kCGLRPRegistryIDHigh CGLRendererProperty values in the 10.13 SDK. 2133 + * Pre 10.13 for TextureType_OpenGL returns 0, as there is no dependable way to correlate the HMDs MTLDevice 2134 + * with a GL Renderer. 2135 + */ 2136 + virtual void GetOutputDevice( uint64_t *pnDevice, ETextureType textureType, VkInstance_T *pInstance = nullptr ) = 0; 2137 + 2138 + // ------------------------------------ 2139 + // Display Mode methods 2140 + // ------------------------------------ 2141 + 2142 + /** Use to determine if the headset display is part of the desktop (i.e. extended) or hidden (i.e. direct mode). */ 2143 + virtual bool IsDisplayOnDesktop() = 0; 2144 + 2145 + /** Set the display visibility (true = extended, false = direct mode). Return value of true indicates that the change was successful. */ 2146 + virtual bool SetDisplayVisibility( bool bIsVisibleOnDesktop ) = 0; 2147 + 2148 + // ------------------------------------ 2149 + // Tracking Methods 2150 + // ------------------------------------ 2151 + 2152 + /** The pose that the tracker thinks that the HMD will be in at the specified number of seconds into the 2153 + * future. Pass 0 to get the state at the instant the method is called. Most of the time the application should 2154 + * calculate the time until the photons will be emitted from the display and pass that time into the method. 2155 + * 2156 + * This is roughly analogous to the inverse of the view matrix in most applications, though 2157 + * many games will need to do some additional rotation or translation on top of the rotation 2158 + * and translation provided by the head pose. 2159 + * 2160 + * For devices where bPoseIsValid is true the application can use the pose to position the device 2161 + * in question. The provided array can be any size up to k_unMaxTrackedDeviceCount. 2162 + * 2163 + * Seated experiences should call this method with TrackingUniverseSeated and receive poses relative 2164 + * to the seated zero pose. Standing experiences should call this method with TrackingUniverseStanding 2165 + * and receive poses relative to the Chaperone Play Area. TrackingUniverseRawAndUncalibrated should 2166 + * probably not be used unless the application is the Chaperone calibration tool itself, but will provide 2167 + * poses relative to the hardware-specific coordinate system in the driver. 2168 + */ 2169 + virtual void GetDeviceToAbsoluteTrackingPose( ETrackingUniverseOrigin eOrigin, float fPredictedSecondsToPhotonsFromNow, VR_ARRAY_COUNT(unTrackedDevicePoseArrayCount) TrackedDevicePose_t *pTrackedDevicePoseArray, uint32_t unTrackedDevicePoseArrayCount ) = 0; 2170 + 2171 + /** Returns the transform from the seated zero pose to the standing absolute tracking system. This allows 2172 + * applications to represent the seated origin to used or transform object positions from one coordinate 2173 + * system to the other. 2174 + * 2175 + * The seated origin may or may not be inside the Play Area or Collision Bounds returned by IVRChaperone. Its position 2176 + * depends on what the user has set from the Dashboard settings and previous calls to ResetSeatedZeroPose. */ 2177 + virtual HmdMatrix34_t GetSeatedZeroPoseToStandingAbsoluteTrackingPose() = 0; 2178 + 2179 + /** Returns the transform from the tracking origin to the standing absolute tracking system. This allows 2180 + * applications to convert from raw tracking space to the calibrated standing coordinate system. */ 2181 + virtual HmdMatrix34_t GetRawZeroPoseToStandingAbsoluteTrackingPose() = 0; 2182 + 2183 + /** Get a sorted array of device indices of a given class of tracked devices (e.g. controllers). Devices are sorted right to left 2184 + * relative to the specified tracked device (default: hmd -- pass in -1 for absolute tracking space). Returns the number of devices 2185 + * in the list, or the size of the array needed if not large enough. */ 2186 + 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; 2187 + 2188 + /** Returns the level of activity on the device. */ 2189 + virtual EDeviceActivityLevel GetTrackedDeviceActivityLevel( vr::TrackedDeviceIndex_t unDeviceId ) = 0; 2190 + 2191 + /** Convenience utility to apply the specified transform to the specified pose. 2192 + * This properly transforms all pose components, including velocity and angular velocity 2193 + */ 2194 + virtual void ApplyTransform( TrackedDevicePose_t *pOutputPose, const TrackedDevicePose_t *pTrackedDevicePose, const HmdMatrix34_t *pTransform ) = 0; 2195 + 2196 + /** Returns the device index associated with a specific role, for example the left hand or the right hand. This function is deprecated in favor of the new IVRInput system. */ 2197 + virtual vr::TrackedDeviceIndex_t GetTrackedDeviceIndexForControllerRole( vr::ETrackedControllerRole unDeviceType ) = 0; 2198 + 2199 + /** Returns the controller type associated with a device index. This function is deprecated in favor of the new IVRInput system. */ 2200 + virtual vr::ETrackedControllerRole GetControllerRoleForTrackedDeviceIndex( vr::TrackedDeviceIndex_t unDeviceIndex ) = 0; 2201 + 2202 + // ------------------------------------ 2203 + // Property methods 2204 + // ------------------------------------ 2205 + 2206 + /** Returns the device class of a tracked device. If there has not been a device connected in this slot 2207 + * since the application started this function will return TrackedDevice_Invalid. For previous detected 2208 + * devices the function will return the previously observed device class. 2209 + * 2210 + * To determine which devices exist on the system, just loop from 0 to k_unMaxTrackedDeviceCount and check 2211 + * the device class. Every device with something other than TrackedDevice_Invalid is associated with an 2212 + * actual tracked device. */ 2213 + virtual ETrackedDeviceClass GetTrackedDeviceClass( vr::TrackedDeviceIndex_t unDeviceIndex ) = 0; 2214 + 2215 + /** Returns true if there is a device connected in this slot. */ 2216 + virtual bool IsTrackedDeviceConnected( vr::TrackedDeviceIndex_t unDeviceIndex ) = 0; 2217 + 2218 + /** Returns a bool property. If the device index is not valid or the property is not a bool type this function will return false. */ 2219 + virtual bool GetBoolTrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L ) = 0; 2220 + 2221 + /** Returns a float property. If the device index is not valid or the property is not a float type this function will return 0. */ 2222 + virtual float GetFloatTrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L ) = 0; 2223 + 2224 + /** Returns an int property. If the device index is not valid or the property is not a int type this function will return 0. */ 2225 + virtual int32_t GetInt32TrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L ) = 0; 2226 + 2227 + /** Returns a uint64 property. If the device index is not valid or the property is not a uint64 type this function will return 0. */ 2228 + virtual uint64_t GetUint64TrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L ) = 0; 2229 + 2230 + /** Returns a matrix property. If the device index is not valid or the property is not a matrix type, this function will return identity. */ 2231 + virtual HmdMatrix34_t GetMatrix34TrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L ) = 0; 2232 + 2233 + /** 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, 2234 + * this function will return 0. Otherwise it returns the number of bytes necessary to hold the array of properties. If unBufferSize is 2235 + * greater than the returned size and pBuffer is non-NULL, pBuffer is filled with the contents of array of properties. */ 2236 + virtual uint32_t GetArrayTrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, PropertyTypeTag_t propType, void *pBuffer, uint32_t unBufferSize, ETrackedPropertyError *pError = 0L ) = 0; 2237 + 2238 + /** Returns a string property. If the device index is not valid or the property is not a string type this function will 2239 + * return 0. Otherwise it returns the length of the number of bytes necessary to hold this string including the trailing 2240 + * null. Strings will always fit in buffers of k_unMaxPropertyStringSize characters. */ 2241 + virtual uint32_t GetStringTrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize, ETrackedPropertyError *pError = 0L ) = 0; 2242 + 2243 + /** returns a string that corresponds with the specified property error. The string will be the name 2244 + * of the error enum value for all valid error codes */ 2245 + virtual const char *GetPropErrorNameFromEnum( ETrackedPropertyError error ) = 0; 2246 + 2247 + // ------------------------------------ 2248 + // Event methods 2249 + // ------------------------------------ 2250 + 2251 + /** Returns true and fills the event with the next event on the queue if there is one. If there are no events 2252 + * this method returns false. uncbVREvent should be the size in bytes of the VREvent_t struct */ 2253 + virtual bool PollNextEvent( VREvent_t *pEvent, uint32_t uncbVREvent ) = 0; 2254 + 2255 + /** Returns true and fills the event with the next event on the queue if there is one. If there are no events 2256 + * this method returns false. Fills in the pose of the associated tracked device in the provided pose struct. 2257 + * This pose will always be older than the call to this function and should not be used to render the device. 2258 + uncbVREvent should be the size in bytes of the VREvent_t struct */ 2259 + virtual bool PollNextEventWithPose( ETrackingUniverseOrigin eOrigin, VREvent_t *pEvent, uint32_t uncbVREvent, vr::TrackedDevicePose_t *pTrackedDevicePose ) = 0; 2260 + 2261 + /** returns the name of an EVREvent enum value */ 2262 + virtual const char *GetEventTypeNameFromEnum( EVREventType eType ) = 0; 2263 + 2264 + // ------------------------------------ 2265 + // Rendering helper methods 2266 + // ------------------------------------ 2267 + 2268 + /** 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 2269 + * 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. 2270 + * This mesh is meant to be rendered into the stencil buffer (or into the depth buffer setting nearz) before rendering each eye's view. 2271 + * This will improve performance by letting the GPU early-reject pixels the user will never see before running the pixel shader. 2272 + * NOTE: Render this mesh with backface culling disabled since the winding order of the vertices can be different per-HMD or per-eye. 2273 + * 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. 2274 + * 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. 2275 + */ 2276 + virtual HiddenAreaMesh_t GetHiddenAreaMesh( EVREye eEye, EHiddenAreaMeshType type = k_eHiddenAreaMesh_Standard ) = 0; 2277 + 2278 + // ------------------------------------ 2279 + // Controller methods 2280 + // ------------------------------------ 2281 + 2282 + /** Fills the supplied struct with the current state of the controller. Returns false if the controller index 2283 + * is invalid. This function is deprecated in favor of the new IVRInput system. */ 2284 + virtual bool GetControllerState( vr::TrackedDeviceIndex_t unControllerDeviceIndex, vr::VRControllerState_t *pControllerState, uint32_t unControllerStateSize ) = 0; 2285 + 2286 + /** fills the supplied struct with the current state of the controller and the provided pose with the pose of 2287 + * the controller when the controller state was updated most recently. Use this form if you need a precise controller 2288 + * pose as input to your application when the user presses or releases a button. This function is deprecated in favor of the new IVRInput system. */ 2289 + virtual bool GetControllerStateWithPose( ETrackingUniverseOrigin eOrigin, vr::TrackedDeviceIndex_t unControllerDeviceIndex, vr::VRControllerState_t *pControllerState, uint32_t unControllerStateSize, TrackedDevicePose_t *pTrackedDevicePose ) = 0; 2290 + 2291 + /** Trigger a single haptic pulse on a controller. After this call the application may not trigger another haptic pulse on this controller 2292 + * and axis combination for 5ms. This function is deprecated in favor of the new IVRInput system. */ 2293 + virtual void TriggerHapticPulse( vr::TrackedDeviceIndex_t unControllerDeviceIndex, uint32_t unAxisId, unsigned short usDurationMicroSec ) = 0; 2294 + 2295 + /** returns the name of an EVRButtonId enum value. This function is deprecated in favor of the new IVRInput system. */ 2296 + virtual const char *GetButtonIdNameFromEnum( EVRButtonId eButtonId ) = 0; 2297 + 2298 + /** returns the name of an EVRControllerAxisType enum value. This function is deprecated in favor of the new IVRInput system. */ 2299 + virtual const char *GetControllerAxisTypeNameFromEnum( EVRControllerAxisType eAxisType ) = 0; 2300 + 2301 + /** Returns true if this application is receiving input from the system. This would return false if 2302 + * system-related functionality is consuming the input stream. */ 2303 + virtual bool IsInputAvailable() = 0; 2304 + 2305 + /** Returns true SteamVR is drawing controllers on top of the application. Applications should consider 2306 + * not drawing anything attached to the user's hands in this case. */ 2307 + virtual bool IsSteamVRDrawingControllers() = 0; 2308 + 2309 + /** Returns true if the user has put SteamVR into a mode that is distracting them from the application. 2310 + * For applications where this is appropriate, the application should pause ongoing activity. */ 2311 + virtual bool ShouldApplicationPause() = 0; 2312 + 2313 + /** Returns true if SteamVR is doing significant rendering work and the game should do what it can to reduce 2314 + * its own workload. One common way to do this is to reduce the size of the render target provided for each eye. */ 2315 + virtual bool ShouldApplicationReduceRenderingWork() = 0; 2316 + 2317 + // ------------------------------------ 2318 + // Firmware methods 2319 + // ------------------------------------ 2320 + 2321 + /** Performs the actual firmware update if applicable. 2322 + * The following events will be sent, if VRFirmwareError_None was returned: VREvent_FirmwareUpdateStarted, VREvent_FirmwareUpdateFinished 2323 + * Use the properties Prop_Firmware_UpdateAvailable_Bool, Prop_Firmware_ManualUpdate_Bool, and Prop_Firmware_ManualUpdateURL_String 2324 + * to figure our whether a firmware update is available, and to figure out whether its a manual update 2325 + * Prop_Firmware_ManualUpdateURL_String should point to an URL describing the manual update process */ 2326 + virtual vr::EVRFirmwareError PerformFirmwareUpdate( vr::TrackedDeviceIndex_t unDeviceIndex ) = 0; 2327 + 2328 + // ------------------------------------ 2329 + // Application life cycle methods 2330 + // ------------------------------------ 2331 + 2332 + /** Call this to acknowledge to the system that VREvent_Quit has been received and that the process is exiting. 2333 + * This extends the timeout until the process is killed. */ 2334 + virtual void AcknowledgeQuit_Exiting() = 0; 2335 + 2336 + // ------------------------------------- 2337 + // App container sandbox methods 2338 + // ------------------------------------- 2339 + 2340 + /** Retrieves a null-terminated, semicolon-delimited list of UTF8 file paths that an application 2341 + * must have read access to when running inside of an app container. Returns the number of bytes 2342 + * needed to hold the list. */ 2343 + virtual uint32_t GetAppContainerFilePaths( VR_OUT_STRING() char *pchBuffer, uint32_t unBufferSize ) = 0; 2344 + 2345 + // ------------------------------------- 2346 + // System methods 2347 + // ------------------------------------- 2348 + 2349 + /** Returns the current version of the SteamVR runtime. The returned string will remain valid until VR_Shutdown is called. 2350 + * 2351 + * NOTE: Is it not appropriate to use this version to test for the presence of any SteamVR feature. Only use this version 2352 + * number for logging or showing to a user, and not to try to detect anything at runtime. When appropriate, feature-specific 2353 + * presence information is provided by other APIs. */ 2354 + virtual const char *GetRuntimeVersion() = 0; 2355 + 2356 + }; 2357 + 2358 + static const char * const IVRSystem_Version = "IVRSystem_022"; 2359 + 2360 + } 2361 + 2362 + 2363 + // ivrapplications.h 2364 + 2365 + namespace vr 2366 + { 2367 + 2368 + /** Used for all errors reported by the IVRApplications interface */ 2369 + enum EVRApplicationError 2370 + { 2371 + VRApplicationError_None = 0, 2372 + 2373 + VRApplicationError_AppKeyAlreadyExists = 100, // Only one application can use any given key 2374 + VRApplicationError_NoManifest = 101, // the running application does not have a manifest 2375 + VRApplicationError_NoApplication = 102, // No application is running 2376 + VRApplicationError_InvalidIndex = 103, 2377 + VRApplicationError_UnknownApplication = 104, // the application could not be found 2378 + VRApplicationError_IPCFailed = 105, // An IPC failure caused the request to fail 2379 + VRApplicationError_ApplicationAlreadyRunning = 106, 2380 + VRApplicationError_InvalidManifest = 107, 2381 + VRApplicationError_InvalidApplication = 108, 2382 + VRApplicationError_LaunchFailed = 109, // the process didn't start 2383 + VRApplicationError_ApplicationAlreadyStarting = 110, // the system was already starting the same application 2384 + VRApplicationError_LaunchInProgress = 111, // The system was already starting a different application 2385 + VRApplicationError_OldApplicationQuitting = 112, 2386 + VRApplicationError_TransitionAborted = 113, 2387 + VRApplicationError_IsTemplate = 114, // error when you try to call LaunchApplication() on a template type app (use LaunchTemplateApplication) 2388 + VRApplicationError_SteamVRIsExiting = 115, 2389 + 2390 + VRApplicationError_BufferTooSmall = 200, // The provided buffer was too small to fit the requested data 2391 + VRApplicationError_PropertyNotSet = 201, // The requested property was not set 2392 + VRApplicationError_UnknownProperty = 202, 2393 + VRApplicationError_InvalidParameter = 203, 2394 + 2395 + VRApplicationError_NotImplemented = 300, // Fcn is not implemented in current interface 2396 + }; 2397 + 2398 + /** The maximum length of an application key */ 2399 + static const uint32_t k_unMaxApplicationKeyLength = 128; 2400 + 2401 + /** these are the properties available on applications. */ 2402 + enum EVRApplicationProperty 2403 + { 2404 + VRApplicationProperty_Name_String = 0, 2405 + 2406 + VRApplicationProperty_LaunchType_String = 11, 2407 + VRApplicationProperty_WorkingDirectory_String = 12, 2408 + VRApplicationProperty_BinaryPath_String = 13, 2409 + VRApplicationProperty_Arguments_String = 14, 2410 + VRApplicationProperty_URL_String = 15, 2411 + 2412 + VRApplicationProperty_Description_String = 50, 2413 + VRApplicationProperty_NewsURL_String = 51, 2414 + VRApplicationProperty_ImagePath_String = 52, 2415 + VRApplicationProperty_Source_String = 53, 2416 + VRApplicationProperty_ActionManifestURL_String = 54, 2417 + 2418 + VRApplicationProperty_IsDashboardOverlay_Bool = 60, 2419 + VRApplicationProperty_IsTemplate_Bool = 61, 2420 + VRApplicationProperty_IsInstanced_Bool = 62, 2421 + VRApplicationProperty_IsInternal_Bool = 63, 2422 + VRApplicationProperty_WantsCompositorPauseInStandby_Bool = 64, 2423 + VRApplicationProperty_IsHidden_Bool = 65, 2424 + 2425 + VRApplicationProperty_LastLaunchTime_Uint64 = 70, 2426 + }; 2427 + 2428 + enum EVRSceneApplicationState 2429 + { 2430 + EVRSceneApplicationState_None = 0, // Scene Application is not running 2431 + EVRSceneApplicationState_Starting = 1, // Scene Application is starting 2432 + EVRSceneApplicationState_Quitting = 2, // Scene Application is quitting 2433 + EVRSceneApplicationState_Running = 3, // Scene Application is running, and submitting frames, a custom skybox, or a visible overlay 2434 + EVRSceneApplicationState_Waiting = 4, // Scene Application is running, but not drawing anything 2435 + }; 2436 + 2437 + struct AppOverrideKeys_t 2438 + { 2439 + const char *pchKey; 2440 + const char *pchValue; 2441 + }; 2442 + 2443 + /** Currently recognized mime types */ 2444 + static const char * const k_pch_MimeType_HomeApp = "vr/home"; 2445 + static const char * const k_pch_MimeType_GameTheater = "vr/game_theater"; 2446 + 2447 + class IVRApplications 2448 + { 2449 + public: 2450 + 2451 + // --------------- Application management --------------- // 2452 + 2453 + /** Adds an application manifest to the list to load when building the list of installed applications. 2454 + * Temporary manifests are not automatically loaded */ 2455 + virtual EVRApplicationError AddApplicationManifest( const char *pchApplicationManifestFullPath, bool bTemporary = false ) = 0; 2456 + 2457 + /** Removes an application manifest from the list to load when building the list of installed applications. */ 2458 + virtual EVRApplicationError RemoveApplicationManifest( const char *pchApplicationManifestFullPath ) = 0; 2459 + 2460 + /** Returns true if an application is installed */ 2461 + virtual bool IsApplicationInstalled( const char *pchAppKey ) = 0; 2462 + 2463 + /** Returns the number of applications available in the list */ 2464 + virtual uint32_t GetApplicationCount() = 0; 2465 + 2466 + /** Returns the key of the specified application. The index is at least 0 and is less than the return 2467 + * value of GetApplicationCount(). The buffer should be at least k_unMaxApplicationKeyLength in order to 2468 + * fit the key. */ 2469 + virtual EVRApplicationError GetApplicationKeyByIndex( uint32_t unApplicationIndex, VR_OUT_STRING() char *pchAppKeyBuffer, uint32_t unAppKeyBufferLen ) = 0; 2470 + 2471 + /** Returns the key of the application for the specified Process Id. The buffer should be at least 2472 + * k_unMaxApplicationKeyLength in order to fit the key. */ 2473 + virtual EVRApplicationError GetApplicationKeyByProcessId( uint32_t unProcessId, VR_OUT_STRING() char *pchAppKeyBuffer, uint32_t unAppKeyBufferLen ) = 0; 2474 + 2475 + /** Launches the application. The existing scene application will exit and then the new application will start. 2476 + * This call is not valid for dashboard overlay applications. */ 2477 + virtual EVRApplicationError LaunchApplication( const char *pchAppKey ) = 0; 2478 + 2479 + /** Launches an instance of an application of type template, with its app key being pchNewAppKey (which must be unique) and optionally override sections 2480 + * from the manifest file via AppOverrideKeys_t 2481 + */ 2482 + virtual EVRApplicationError LaunchTemplateApplication( const char *pchTemplateAppKey, const char *pchNewAppKey, VR_ARRAY_COUNT( unKeys ) const AppOverrideKeys_t *pKeys, uint32_t unKeys ) = 0; 2483 + 2484 + /** 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 */ 2485 + virtual vr::EVRApplicationError LaunchApplicationFromMimeType( const char *pchMimeType, const char *pchArgs ) = 0; 2486 + 2487 + /** Launches the dashboard overlay application if it is not already running. This call is only valid for 2488 + * dashboard overlay applications. */ 2489 + virtual EVRApplicationError LaunchDashboardOverlay( const char *pchAppKey ) = 0; 2490 + 2491 + /** Cancel a pending launch for an application */ 2492 + virtual bool CancelApplicationLaunch( const char *pchAppKey ) = 0; 2493 + 2494 + /** Identifies a running application. OpenVR can't always tell which process started in response 2495 + * to a URL. This function allows a URL handler (or the process itself) to identify the app key 2496 + * for the now running application. Passing a process ID of 0 identifies the calling process. 2497 + * The application must be one that's known to the system via a call to AddApplicationManifest. */ 2498 + virtual EVRApplicationError IdentifyApplication( uint32_t unProcessId, const char *pchAppKey ) = 0; 2499 + 2500 + /** Returns the process ID for an application. Return 0 if the application was not found or is not running. */ 2501 + virtual uint32_t GetApplicationProcessId( const char *pchAppKey ) = 0; 2502 + 2503 + /** Returns a string for an applications error */ 2504 + virtual const char *GetApplicationsErrorNameFromEnum( EVRApplicationError error ) = 0; 2505 + 2506 + // --------------- Application properties --------------- // 2507 + 2508 + /** Returns a value for an application property. The required buffer size to fit this value will be returned. */ 2509 + virtual uint32_t GetApplicationPropertyString( const char *pchAppKey, EVRApplicationProperty eProperty, VR_OUT_STRING() char *pchPropertyValueBuffer, uint32_t unPropertyValueBufferLen, EVRApplicationError *peError = nullptr ) = 0; 2510 + 2511 + /** Returns a bool value for an application property. Returns false in all error cases. */ 2512 + virtual bool GetApplicationPropertyBool( const char *pchAppKey, EVRApplicationProperty eProperty, EVRApplicationError *peError = nullptr ) = 0; 2513 + 2514 + /** Returns a uint64 value for an application property. Returns 0 in all error cases. */ 2515 + virtual uint64_t GetApplicationPropertyUint64( const char *pchAppKey, EVRApplicationProperty eProperty, EVRApplicationError *peError = nullptr ) = 0; 2516 + 2517 + /** Sets the application auto-launch flag. This is only valid for applications which return true for VRApplicationProperty_IsDashboardOverlay_Bool. */ 2518 + virtual EVRApplicationError SetApplicationAutoLaunch( const char *pchAppKey, bool bAutoLaunch ) = 0; 2519 + 2520 + /** Gets the application auto-launch flag. This is only valid for applications which return true for VRApplicationProperty_IsDashboardOverlay_Bool. */ 2521 + virtual bool GetApplicationAutoLaunch( const char *pchAppKey ) = 0; 2522 + 2523 + /** Adds this mime-type to the list of supported mime types for this application*/ 2524 + virtual EVRApplicationError SetDefaultApplicationForMimeType( const char *pchAppKey, const char *pchMimeType ) = 0; 2525 + 2526 + /** return the app key that will open this mime type */ 2527 + virtual bool GetDefaultApplicationForMimeType( const char *pchMimeType, VR_OUT_STRING() char *pchAppKeyBuffer, uint32_t unAppKeyBufferLen ) = 0; 2528 + 2529 + /** Get the list of supported mime types for this application, comma-delimited */ 2530 + virtual bool GetApplicationSupportedMimeTypes( const char *pchAppKey, VR_OUT_STRING() char *pchMimeTypesBuffer, uint32_t unMimeTypesBuffer ) = 0; 2531 + 2532 + /** 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 */ 2533 + virtual uint32_t GetApplicationsThatSupportMimeType( const char *pchMimeType, VR_OUT_STRING() char *pchAppKeysThatSupportBuffer, uint32_t unAppKeysThatSupportBuffer ) = 0; 2534 + 2535 + /** Get the args list from an app launch that had the process already running, you call this when you get a VREvent_ApplicationMimeTypeLoad */ 2536 + virtual uint32_t GetApplicationLaunchArguments( uint32_t unHandle, VR_OUT_STRING() char *pchArgs, uint32_t unArgs ) = 0; 2537 + 2538 + // --------------- Transition methods --------------- // 2539 + 2540 + /** Returns the app key for the application that is starting up */ 2541 + virtual EVRApplicationError GetStartingApplication( VR_OUT_STRING() char *pchAppKeyBuffer, uint32_t unAppKeyBufferLen ) = 0; 2542 + 2543 + /** Returns the application transition state */ 2544 + virtual EVRSceneApplicationState GetSceneApplicationState() = 0; 2545 + 2546 + /** Returns errors that would prevent the specified application from launching immediately. Calling this function will 2547 + * cause the current scene application to quit, so only call it when you are actually about to launch something else. 2548 + * What the caller should do about these failures depends on the failure: 2549 + * VRApplicationError_OldApplicationQuitting - An existing application has been told to quit. Wait for a VREvent_ProcessQuit 2550 + * and try again. 2551 + * VRApplicationError_ApplicationAlreadyStarting - This application is already starting. This is a permanent failure. 2552 + * VRApplicationError_LaunchInProgress - A different application is already starting. This is a permanent failure. 2553 + * VRApplicationError_None - Go ahead and launch. Everything is clear. 2554 + */ 2555 + virtual EVRApplicationError PerformApplicationPrelaunchCheck( const char *pchAppKey ) = 0; 2556 + 2557 + /** Returns a string for an application transition state */ 2558 + virtual const char *GetSceneApplicationStateNameFromEnum( EVRSceneApplicationState state ) = 0; 2559 + 2560 + /** Starts a subprocess within the calling application. This 2561 + * suppresses all application transition UI and automatically identifies the new executable 2562 + * as part of the same application. On success the calling process should exit immediately. 2563 + * If working directory is NULL or "" the directory portion of the binary path will be 2564 + * the working directory. */ 2565 + virtual EVRApplicationError LaunchInternalProcess( const char *pchBinaryPath, const char *pchArguments, const char *pchWorkingDirectory ) = 0; 2566 + 2567 + /** Returns the current scene process ID according to the application system. A scene process will get scene 2568 + * focus once it starts rendering, but it will appear here once it calls VR_Init with the Scene application 2569 + * type. */ 2570 + virtual uint32_t GetCurrentSceneProcessId() = 0; 2571 + }; 2572 + 2573 + static const char * const IVRApplications_Version = "IVRApplications_007"; 2574 + 2575 + } // namespace vr 2576 + 2577 + // ivrsettings.h 2578 + 2579 + #include <string> 2580 + 2581 + namespace vr 2582 + { 2583 + enum EVRSettingsError 2584 + { 2585 + VRSettingsError_None = 0, 2586 + VRSettingsError_IPCFailed = 1, 2587 + VRSettingsError_WriteFailed = 2, 2588 + VRSettingsError_ReadFailed = 3, 2589 + VRSettingsError_JsonParseFailed = 4, 2590 + VRSettingsError_UnsetSettingHasNoDefault = 5, // This will be returned if the setting does not appear in the appropriate default file and has not been set 2591 + }; 2592 + 2593 + // The maximum length of a settings key 2594 + static const uint32_t k_unMaxSettingsKeyLength = 128; 2595 + 2596 + class IVRSettings 2597 + { 2598 + public: 2599 + virtual const char *GetSettingsErrorNameFromEnum( EVRSettingsError eError ) = 0; 2600 + 2601 + virtual void SetBool( const char *pchSection, const char *pchSettingsKey, bool bValue, EVRSettingsError *peError = nullptr ) = 0; 2602 + virtual void SetInt32( const char *pchSection, const char *pchSettingsKey, int32_t nValue, EVRSettingsError *peError = nullptr ) = 0; 2603 + virtual void SetFloat( const char *pchSection, const char *pchSettingsKey, float flValue, EVRSettingsError *peError = nullptr ) = 0; 2604 + virtual void SetString( const char *pchSection, const char *pchSettingsKey, const char *pchValue, EVRSettingsError *peError = nullptr ) = 0; 2605 + 2606 + // Users of the system need to provide a proper default in default.vrsettings in the resources/settings/ directory 2607 + // of either the runtime or the driver_xxx directory. Otherwise the default will be false, 0, 0.0 or "" 2608 + virtual bool GetBool( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) = 0; 2609 + virtual int32_t GetInt32( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) = 0; 2610 + virtual float GetFloat( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) = 0; 2611 + virtual void GetString( const char *pchSection, const char *pchSettingsKey, VR_OUT_STRING() char *pchValue, uint32_t unValueLen, EVRSettingsError *peError = nullptr ) = 0; 2612 + 2613 + virtual void RemoveSection( const char *pchSection, EVRSettingsError *peError = nullptr ) = 0; 2614 + virtual void RemoveKeyInSection( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) = 0; 2615 + }; 2616 + 2617 + //----------------------------------------------------------------------------- 2618 + static const char * const IVRSettings_Version = "IVRSettings_003"; 2619 + 2620 + class CVRSettingHelper 2621 + { 2622 + IVRSettings *m_pSettings; 2623 + public: 2624 + CVRSettingHelper( IVRSettings *pSettings ) 2625 + { 2626 + m_pSettings = pSettings; 2627 + } 2628 + 2629 + const char *GetSettingsErrorNameFromEnum( EVRSettingsError eError ) 2630 + { 2631 + return m_pSettings->GetSettingsErrorNameFromEnum( eError ); 2632 + } 2633 + 2634 + void SetBool( const char *pchSection, const char *pchSettingsKey, bool bValue, EVRSettingsError *peError = nullptr ) 2635 + { 2636 + m_pSettings->SetBool( pchSection, pchSettingsKey, bValue, peError ); 2637 + } 2638 + 2639 + void SetInt32( const char *pchSection, const char *pchSettingsKey, int32_t nValue, EVRSettingsError *peError = nullptr ) 2640 + { 2641 + m_pSettings->SetInt32( pchSection, pchSettingsKey, nValue, peError ); 2642 + } 2643 + void SetFloat( const char *pchSection, const char *pchSettingsKey, float flValue, EVRSettingsError *peError = nullptr ) 2644 + { 2645 + m_pSettings->SetFloat( pchSection, pchSettingsKey, flValue, peError ); 2646 + } 2647 + void SetString( const char *pchSection, const char *pchSettingsKey, const char *pchValue, EVRSettingsError *peError = nullptr ) 2648 + { 2649 + m_pSettings->SetString( pchSection, pchSettingsKey, pchValue, peError ); 2650 + } 2651 + void SetString( const std::string & sSection, const std::string & sSettingsKey, const std::string & sValue, EVRSettingsError *peError = nullptr ) 2652 + { 2653 + m_pSettings->SetString( sSection.c_str(), sSettingsKey.c_str(), sValue.c_str(), peError ); 2654 + } 2655 + 2656 + bool GetBool( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) 2657 + { 2658 + return m_pSettings->GetBool( pchSection, pchSettingsKey, peError ); 2659 + } 2660 + int32_t GetInt32( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) 2661 + { 2662 + return m_pSettings->GetInt32( pchSection, pchSettingsKey, peError ); 2663 + } 2664 + float GetFloat( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) 2665 + { 2666 + return m_pSettings->GetFloat( pchSection, pchSettingsKey, peError ); 2667 + } 2668 + void GetString( const char *pchSection, const char *pchSettingsKey, VR_OUT_STRING() char *pchValue, uint32_t unValueLen, EVRSettingsError *peError = nullptr ) 2669 + { 2670 + m_pSettings->GetString( pchSection, pchSettingsKey, pchValue, unValueLen, peError ); 2671 + } 2672 + std::string GetString( const std::string & sSection, const std::string & sSettingsKey, EVRSettingsError *peError = nullptr ) 2673 + { 2674 + char buf[4096]; 2675 + vr::EVRSettingsError eError; 2676 + m_pSettings->GetString( sSection.c_str(), sSettingsKey.c_str(), buf, sizeof( buf ), &eError ); 2677 + if ( peError ) 2678 + *peError = eError; 2679 + if ( eError == vr::VRSettingsError_None ) 2680 + return buf; 2681 + else 2682 + return ""; 2683 + } 2684 + 2685 + void RemoveSection( const char *pchSection, EVRSettingsError *peError = nullptr ) 2686 + { 2687 + m_pSettings->RemoveSection( pchSection, peError ); 2688 + } 2689 + void RemoveKeyInSection( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) 2690 + { 2691 + m_pSettings->RemoveKeyInSection( pchSection, pchSettingsKey, peError ); 2692 + } 2693 + }; 2694 + 2695 + 2696 + //----------------------------------------------------------------------------- 2697 + // steamvr keys 2698 + static const char * const k_pch_SteamVR_Section = "steamvr"; 2699 + static const char * const k_pch_SteamVR_RequireHmd_String = "requireHmd"; 2700 + static const char * const k_pch_SteamVR_ForcedDriverKey_String = "forcedDriver"; 2701 + static const char * const k_pch_SteamVR_ForcedHmdKey_String = "forcedHmd"; 2702 + static const char * const k_pch_SteamVR_DisplayDebug_Bool = "displayDebug"; 2703 + static const char * const k_pch_SteamVR_DebugProcessPipe_String = "debugProcessPipe"; 2704 + static const char * const k_pch_SteamVR_DisplayDebugX_Int32 = "displayDebugX"; 2705 + static const char * const k_pch_SteamVR_DisplayDebugY_Int32 = "displayDebugY"; 2706 + static const char * const k_pch_SteamVR_SendSystemButtonToAllApps_Bool= "sendSystemButtonToAllApps"; 2707 + static const char * const k_pch_SteamVR_LogLevel_Int32 = "loglevel"; 2708 + static const char * const k_pch_SteamVR_IPD_Float = "ipd"; 2709 + static const char * const k_pch_SteamVR_Background_String = "background"; 2710 + static const char * const k_pch_SteamVR_BackgroundUseDomeProjection_Bool = "backgroundUseDomeProjection"; 2711 + static const char * const k_pch_SteamVR_BackgroundCameraHeight_Float = "backgroundCameraHeight"; 2712 + static const char * const k_pch_SteamVR_BackgroundDomeRadius_Float = "backgroundDomeRadius"; 2713 + static const char * const k_pch_SteamVR_GridColor_String = "gridColor"; 2714 + static const char * const k_pch_SteamVR_PlayAreaColor_String = "playAreaColor"; 2715 + static const char * const k_pch_SteamVR_TrackingLossColor_String = "trackingLossColor"; 2716 + static const char * const k_pch_SteamVR_ShowStage_Bool = "showStage"; 2717 + static const char * const k_pch_SteamVR_DrawTrackingReferences_Bool = "drawTrackingReferences"; 2718 + static const char * const k_pch_SteamVR_ActivateMultipleDrivers_Bool = "activateMultipleDrivers"; 2719 + static const char * const k_pch_SteamVR_UsingSpeakers_Bool = "usingSpeakers"; 2720 + static const char * const k_pch_SteamVR_SpeakersForwardYawOffsetDegrees_Float = "speakersForwardYawOffsetDegrees"; 2721 + static const char * const k_pch_SteamVR_BaseStationPowerManagement_Int32 = "basestationPowerManagement"; 2722 + static const char * const k_pch_SteamVR_ShowBaseStationPowerManagementTip_Int32 = "ShowBaseStationPowerManagementTip"; 2723 + static const char * const k_pch_SteamVR_NeverKillProcesses_Bool = "neverKillProcesses"; 2724 + static const char * const k_pch_SteamVR_SupersampleScale_Float = "supersampleScale"; 2725 + static const char * const k_pch_SteamVR_MaxRecommendedResolution_Int32 = "maxRecommendedResolution"; 2726 + static const char * const k_pch_SteamVR_MotionSmoothing_Bool = "motionSmoothing"; 2727 + static const char * const k_pch_SteamVR_MotionSmoothingOverride_Int32 = "motionSmoothingOverride"; 2728 + static const char * const k_pch_SteamVR_FramesToThrottle_Int32 = "framesToThrottle"; 2729 + static const char * const k_pch_SteamVR_AdditionalFramesToPredict_Int32 = "additionalFramesToPredict"; 2730 + static const char * const k_pch_SteamVR_DisableAsyncReprojection_Bool = "disableAsync"; 2731 + static const char * const k_pch_SteamVR_ForceFadeOnBadTracking_Bool = "forceFadeOnBadTracking"; 2732 + static const char * const k_pch_SteamVR_DefaultMirrorView_Int32 = "mirrorView"; 2733 + static const char * const k_pch_SteamVR_ShowLegacyMirrorView_Bool = "showLegacyMirrorView"; 2734 + static const char * const k_pch_SteamVR_MirrorViewVisibility_Bool = "showMirrorView"; 2735 + static const char * const k_pch_SteamVR_MirrorViewDisplayMode_Int32 = "mirrorViewDisplayMode"; 2736 + static const char * const k_pch_SteamVR_MirrorViewEye_Int32 = "mirrorViewEye"; 2737 + static const char * const k_pch_SteamVR_MirrorViewGeometry_String = "mirrorViewGeometry"; 2738 + static const char * const k_pch_SteamVR_MirrorViewGeometryMaximized_String = "mirrorViewGeometryMaximized"; 2739 + static const char * const k_pch_SteamVR_PerfGraphVisibility_Bool = "showPerfGraph"; 2740 + static const char * const k_pch_SteamVR_StartMonitorFromAppLaunch = "startMonitorFromAppLaunch"; 2741 + static const char * const k_pch_SteamVR_StartCompositorFromAppLaunch_Bool = "startCompositorFromAppLaunch"; 2742 + static const char * const k_pch_SteamVR_StartDashboardFromAppLaunch_Bool = "startDashboardFromAppLaunch"; 2743 + static const char * const k_pch_SteamVR_StartOverlayAppsFromDashboard_Bool = "startOverlayAppsFromDashboard"; 2744 + static const char * const k_pch_SteamVR_EnableHomeApp = "enableHomeApp"; 2745 + static const char * const k_pch_SteamVR_CycleBackgroundImageTimeSec_Int32 = "CycleBackgroundImageTimeSec"; 2746 + static const char * const k_pch_SteamVR_RetailDemo_Bool = "retailDemo"; 2747 + static const char * const k_pch_SteamVR_IpdOffset_Float = "ipdOffset"; 2748 + static const char * const k_pch_SteamVR_AllowSupersampleFiltering_Bool = "allowSupersampleFiltering"; 2749 + static const char * const k_pch_SteamVR_SupersampleManualOverride_Bool = "supersampleManualOverride"; 2750 + static const char * const k_pch_SteamVR_EnableLinuxVulkanAsync_Bool = "enableLinuxVulkanAsync"; 2751 + static const char * const k_pch_SteamVR_AllowDisplayLockedMode_Bool = "allowDisplayLockedMode"; 2752 + static const char * const k_pch_SteamVR_HaveStartedTutorialForNativeChaperoneDriver_Bool = "haveStartedTutorialForNativeChaperoneDriver"; 2753 + static const char * const k_pch_SteamVR_ForceWindows32bitVRMonitor = "forceWindows32BitVRMonitor"; 2754 + static const char * const k_pch_SteamVR_DebugInputBinding = "debugInputBinding"; 2755 + static const char * const k_pch_SteamVR_DoNotFadeToGrid = "doNotFadeToGrid"; 2756 + static const char * const k_pch_SteamVR_RenderCameraMode = "renderCameraMode"; 2757 + static const char * const k_pch_SteamVR_EnableSharedResourceJournaling = "enableSharedResourceJournaling"; 2758 + static const char * const k_pch_SteamVR_EnableSafeMode = "enableSafeMode"; 2759 + static const char * const k_pch_SteamVR_PreferredRefreshRate = "preferredRefreshRate"; 2760 + static const char * const k_pch_SteamVR_LastVersionNotice = "lastVersionNotice"; 2761 + static const char * const k_pch_SteamVR_LastVersionNoticeDate = "lastVersionNoticeDate"; 2762 + static const char * const k_pch_SteamVR_HmdDisplayColorGainR_Float = "hmdDisplayColorGainR"; 2763 + static const char * const k_pch_SteamVR_HmdDisplayColorGainG_Float = "hmdDisplayColorGainG"; 2764 + static const char * const k_pch_SteamVR_HmdDisplayColorGainB_Float = "hmdDisplayColorGainB"; 2765 + static const char * const k_pch_SteamVR_CustomIconStyle_String = "customIconStyle"; 2766 + static const char * const k_pch_SteamVR_CustomOffIconStyle_String = "customOffIconStyle"; 2767 + static const char * const k_pch_SteamVR_CustomIconForceUpdate_String = "customIconForceUpdate"; 2768 + static const char * const k_pch_SteamVR_AllowGlobalActionSetPriority = "globalActionSetPriority"; 2769 + static const char * const k_pch_SteamVR_OverlayRenderQuality = "overlayRenderQuality_2"; 2770 + static const char * const k_pch_SteamVR_BlockOculusSDKOnOpenVRLaunchOption_Bool = "blockOculusSDKOnOpenVRLaunchOption"; 2771 + static const char * const k_pch_SteamVR_BlockOculusSDKOnAllLaunches_Bool = "blockOculusSDKOnAllLaunches"; 2772 + static const char * const k_pch_SteamVR_HDCPLegacyCompatibility_Bool = "hdcp14legacyCompatibility"; 2773 + static const char * const k_pch_SteamVR_UsePrism_Bool = "usePrism"; 2774 + 2775 + //----------------------------------------------------------------------------- 2776 + // direct mode keys 2777 + static const char * const k_pch_DirectMode_Section = "direct_mode"; 2778 + static const char * const k_pch_DirectMode_Enable_Bool = "enable"; 2779 + static const char * const k_pch_DirectMode_Count_Int32 = "count"; 2780 + static const char * const k_pch_DirectMode_EdidVid_Int32 = "edidVid"; 2781 + static const char * const k_pch_DirectMode_EdidPid_Int32 = "edidPid"; 2782 + 2783 + //----------------------------------------------------------------------------- 2784 + // lighthouse keys 2785 + static const char * const k_pch_Lighthouse_Section = "driver_lighthouse"; 2786 + static const char * const k_pch_Lighthouse_DisableIMU_Bool = "disableimu"; 2787 + static const char * const k_pch_Lighthouse_DisableIMUExceptHMD_Bool = "disableimuexcepthmd"; 2788 + static const char * const k_pch_Lighthouse_UseDisambiguation_String = "usedisambiguation"; 2789 + static const char * const k_pch_Lighthouse_DisambiguationDebug_Int32 = "disambiguationdebug"; 2790 + static const char * const k_pch_Lighthouse_PrimaryBasestation_Int32 = "primarybasestation"; 2791 + static const char * const k_pch_Lighthouse_DBHistory_Bool = "dbhistory"; 2792 + static const char * const k_pch_Lighthouse_EnableBluetooth_Bool = "enableBluetooth"; 2793 + static const char * const k_pch_Lighthouse_PowerManagedBaseStations_String = "PowerManagedBaseStations"; 2794 + static const char * const k_pch_Lighthouse_PowerManagedBaseStations2_String = "PowerManagedBaseStations2"; 2795 + static const char * const k_pch_Lighthouse_InactivityTimeoutForBaseStations_Int32 = "InactivityTimeoutForBaseStations"; 2796 + static const char * const k_pch_Lighthouse_EnableImuFallback_Bool = "enableImuFallback"; 2797 + 2798 + //----------------------------------------------------------------------------- 2799 + // null keys 2800 + static const char * const k_pch_Null_Section = "driver_null"; 2801 + static const char * const k_pch_Null_SerialNumber_String = "serialNumber"; 2802 + static const char * const k_pch_Null_ModelNumber_String = "modelNumber"; 2803 + static const char * const k_pch_Null_WindowX_Int32 = "windowX"; 2804 + static const char * const k_pch_Null_WindowY_Int32 = "windowY"; 2805 + static const char * const k_pch_Null_WindowWidth_Int32 = "windowWidth"; 2806 + static const char * const k_pch_Null_WindowHeight_Int32 = "windowHeight"; 2807 + static const char * const k_pch_Null_RenderWidth_Int32 = "renderWidth"; 2808 + static const char * const k_pch_Null_RenderHeight_Int32 = "renderHeight"; 2809 + static const char * const k_pch_Null_SecondsFromVsyncToPhotons_Float = "secondsFromVsyncToPhotons"; 2810 + static const char * const k_pch_Null_DisplayFrequency_Float = "displayFrequency"; 2811 + 2812 + //----------------------------------------------------------------------------- 2813 + // Windows MR keys 2814 + static const char * const k_pch_WindowsMR_Section = "driver_holographic"; 2815 + 2816 + //----------------------------------------------------------------------------- 2817 + // user interface keys 2818 + static const char * const k_pch_UserInterface_Section = "userinterface"; 2819 + static const char * const k_pch_UserInterface_StatusAlwaysOnTop_Bool = "StatusAlwaysOnTop"; 2820 + static const char * const k_pch_UserInterface_MinimizeToTray_Bool = "MinimizeToTray"; 2821 + static const char * const k_pch_UserInterface_HidePopupsWhenStatusMinimized_Bool = "HidePopupsWhenStatusMinimized"; 2822 + static const char * const k_pch_UserInterface_Screenshots_Bool = "screenshots"; 2823 + static const char * const k_pch_UserInterface_ScreenshotType_Int = "screenshotType"; 2824 + 2825 + //----------------------------------------------------------------------------- 2826 + // notification keys 2827 + static const char * const k_pch_Notifications_Section = "notifications"; 2828 + static const char * const k_pch_Notifications_DoNotDisturb_Bool = "DoNotDisturb"; 2829 + 2830 + //----------------------------------------------------------------------------- 2831 + // keyboard keys 2832 + static const char * const k_pch_Keyboard_Section = "keyboard"; 2833 + static const char * const k_pch_Keyboard_TutorialCompletions = "TutorialCompletions"; 2834 + static const char * const k_pch_Keyboard_ScaleX = "ScaleX"; 2835 + static const char * const k_pch_Keyboard_ScaleY = "ScaleY"; 2836 + static const char * const k_pch_Keyboard_OffsetLeftX = "OffsetLeftX"; 2837 + static const char * const k_pch_Keyboard_OffsetRightX = "OffsetRightX"; 2838 + static const char * const k_pch_Keyboard_OffsetY = "OffsetY"; 2839 + static const char * const k_pch_Keyboard_Smoothing = "Smoothing"; 2840 + 2841 + //----------------------------------------------------------------------------- 2842 + // perf keys 2843 + static const char * const k_pch_Perf_Section = "perfcheck"; 2844 + static const char * const k_pch_Perf_PerfGraphInHMD_Bool = "perfGraphInHMD"; 2845 + static const char * const k_pch_Perf_AllowTimingStore_Bool = "allowTimingStore"; 2846 + static const char * const k_pch_Perf_SaveTimingsOnExit_Bool = "saveTimingsOnExit"; 2847 + static const char * const k_pch_Perf_TestData_Float = "perfTestData"; 2848 + static const char * const k_pch_Perf_GPUProfiling_Bool = "GPUProfiling"; 2849 + 2850 + //----------------------------------------------------------------------------- 2851 + // collision bounds keys 2852 + static const char * const k_pch_CollisionBounds_Section = "collisionBounds"; 2853 + static const char * const k_pch_CollisionBounds_Style_Int32 = "CollisionBoundsStyle"; 2854 + static const char * const k_pch_CollisionBounds_GroundPerimeterOn_Bool = "CollisionBoundsGroundPerimeterOn"; 2855 + static const char * const k_pch_CollisionBounds_CenterMarkerOn_Bool = "CollisionBoundsCenterMarkerOn"; 2856 + static const char * const k_pch_CollisionBounds_PlaySpaceOn_Bool = "CollisionBoundsPlaySpaceOn"; 2857 + static const char * const k_pch_CollisionBounds_FadeDistance_Float = "CollisionBoundsFadeDistance"; 2858 + static const char * const k_pch_CollisionBounds_WallHeight_Float = "CollisionBoundsWallHeight"; 2859 + static const char * const k_pch_CollisionBounds_ColorGammaR_Int32 = "CollisionBoundsColorGammaR"; 2860 + static const char * const k_pch_CollisionBounds_ColorGammaG_Int32 = "CollisionBoundsColorGammaG"; 2861 + static const char * const k_pch_CollisionBounds_ColorGammaB_Int32 = "CollisionBoundsColorGammaB"; 2862 + static const char * const k_pch_CollisionBounds_ColorGammaA_Int32 = "CollisionBoundsColorGammaA"; 2863 + static const char * const k_pch_CollisionBounds_EnableDriverImport = "enableDriverBoundsImport"; 2864 + 2865 + //----------------------------------------------------------------------------- 2866 + // camera keys 2867 + static const char * const k_pch_Camera_Section = "camera"; 2868 + static const char * const k_pch_Camera_EnableCamera_Bool = "enableCamera"; 2869 + static const char * const k_pch_Camera_ShowOnController_Bool = "showOnController"; 2870 + static const char * const k_pch_Camera_EnableCameraForCollisionBounds_Bool = "enableCameraForCollisionBounds"; 2871 + static const char * const k_pch_Camera_RoomView_Int32 = "roomView"; 2872 + static const char * const k_pch_Camera_BoundsColorGammaR_Int32 = "cameraBoundsColorGammaR"; 2873 + static const char * const k_pch_Camera_BoundsColorGammaG_Int32 = "cameraBoundsColorGammaG"; 2874 + static const char * const k_pch_Camera_BoundsColorGammaB_Int32 = "cameraBoundsColorGammaB"; 2875 + static const char * const k_pch_Camera_BoundsColorGammaA_Int32 = "cameraBoundsColorGammaA"; 2876 + static const char * const k_pch_Camera_BoundsStrength_Int32 = "cameraBoundsStrength"; 2877 + static const char * const k_pch_Camera_RoomViewStyle_Int32 = "roomViewStyle"; 2878 + 2879 + //----------------------------------------------------------------------------- 2880 + // audio keys 2881 + static const char * const k_pch_audio_Section = "audio"; 2882 + static const char * const k_pch_audio_SetOsDefaultPlaybackDevice_Bool = "setOsDefaultPlaybackDevice"; 2883 + static const char * const k_pch_audio_EnablePlaybackDeviceOverride_Bool = "enablePlaybackDeviceOverride"; 2884 + static const char * const k_pch_audio_PlaybackDeviceOverride_String = "playbackDeviceOverride"; 2885 + static const char * const k_pch_audio_PlaybackDeviceOverrideName_String = "playbackDeviceOverrideName"; 2886 + static const char * const k_pch_audio_SetOsDefaultRecordingDevice_Bool = "setOsDefaultRecordingDevice"; 2887 + static const char * const k_pch_audio_EnableRecordingDeviceOverride_Bool = "enableRecordingDeviceOverride"; 2888 + static const char * const k_pch_audio_RecordingDeviceOverride_String = "recordingDeviceOverride"; 2889 + static const char * const k_pch_audio_RecordingDeviceOverrideName_String = "recordingDeviceOverrideName"; 2890 + static const char * const k_pch_audio_EnablePlaybackMirror_Bool = "enablePlaybackMirror"; 2891 + static const char * const k_pch_audio_PlaybackMirrorDevice_String = "playbackMirrorDevice"; 2892 + static const char * const k_pch_audio_PlaybackMirrorDeviceName_String = "playbackMirrorDeviceName"; 2893 + static const char * const k_pch_audio_OldPlaybackMirrorDevice_String = "onPlaybackMirrorDevice"; 2894 + static const char * const k_pch_audio_ActiveMirrorDevice_String = "activePlaybackMirrorDevice"; 2895 + static const char * const k_pch_audio_EnablePlaybackMirrorIndependentVolume_Bool = "enablePlaybackMirrorIndependentVolume"; 2896 + static const char * const k_pch_audio_LastHmdPlaybackDeviceId_String = "lastHmdPlaybackDeviceId"; 2897 + static const char * const k_pch_audio_VIVEHDMIGain = "viveHDMIGain"; 2898 + static const char * const k_pch_audio_DualSpeakerAndJackOutput_Bool = "dualSpeakerAndJackOutput"; 2899 + static const char * const k_pch_audio_MuteMicMonitor_Bool = "muteMicMonitor"; 2900 + 2901 + //----------------------------------------------------------------------------- 2902 + // power management keys 2903 + static const char * const k_pch_Power_Section = "power"; 2904 + static const char * const k_pch_Power_PowerOffOnExit_Bool = "powerOffOnExit"; 2905 + static const char * const k_pch_Power_TurnOffScreensTimeout_Float = "turnOffScreensTimeout"; 2906 + static const char * const k_pch_Power_TurnOffControllersTimeout_Float = "turnOffControllersTimeout"; 2907 + static const char * const k_pch_Power_ReturnToWatchdogTimeout_Float = "returnToWatchdogTimeout"; 2908 + static const char * const k_pch_Power_AutoLaunchSteamVROnButtonPress = "autoLaunchSteamVROnButtonPress"; 2909 + static const char * const k_pch_Power_PauseCompositorOnStandby_Bool = "pauseCompositorOnStandby"; 2910 + 2911 + //----------------------------------------------------------------------------- 2912 + // dashboard keys 2913 + static const char * const k_pch_Dashboard_Section = "dashboard"; 2914 + static const char * const k_pch_Dashboard_EnableDashboard_Bool = "enableDashboard"; 2915 + static const char * const k_pch_Dashboard_ArcadeMode_Bool = "arcadeMode"; 2916 + static const char * const k_pch_Dashboard_Position = "position"; 2917 + static const char * const k_pch_Dashboard_DesktopScale = "desktopScale"; 2918 + static const char * const k_pch_Dashboard_DashboardScale = "dashboardScale"; 2919 + static const char * const k_pch_Dashboard_UseStandaloneSystemLayer = "standaloneSystemLayer"; 2920 + 2921 + //----------------------------------------------------------------------------- 2922 + // model skin keys 2923 + static const char * const k_pch_modelskin_Section = "modelskins"; 2924 + 2925 + //----------------------------------------------------------------------------- 2926 + // driver keys - These could be checked in any driver_<name> section 2927 + static const char * const k_pch_Driver_Enable_Bool = "enable"; 2928 + static const char * const k_pch_Driver_BlockedBySafemode_Bool = "blocked_by_safe_mode"; 2929 + static const char * const k_pch_Driver_LoadPriority_Int32 = "loadPriority"; 2930 + 2931 + //----------------------------------------------------------------------------- 2932 + // web interface keys 2933 + static const char* const k_pch_WebInterface_Section = "WebInterface"; 2934 + 2935 + //----------------------------------------------------------------------------- 2936 + // vrwebhelper keys 2937 + static const char* const k_pch_VRWebHelper_Section = "VRWebHelper"; 2938 + static const char* const k_pch_VRWebHelper_DebuggerEnabled_Bool = "DebuggerEnabled"; 2939 + static const char* const k_pch_VRWebHelper_DebuggerPort_Int32 = "DebuggerPort"; 2940 + 2941 + //----------------------------------------------------------------------------- 2942 + // tracking overrides - keys are device paths, values are the device paths their 2943 + // tracking/pose information overrides 2944 + static const char* const k_pch_TrackingOverride_Section = "TrackingOverrides"; 2945 + 2946 + //----------------------------------------------------------------------------- 2947 + // per-app keys - the section name for these is the app key itself. Some of these are prefixed by the controller type 2948 + static const char* const k_pch_App_BindingAutosaveURLSuffix_String = "AutosaveURL"; 2949 + static const char* const k_pch_App_BindingLegacyAPISuffix_String = "_legacy"; 2950 + static const char* const k_pch_App_BindingSteamVRInputAPISuffix_String = "_steamvrinput"; 2951 + static const char* const k_pch_App_BindingCurrentURLSuffix_String = "CurrentURL"; 2952 + static const char* const k_pch_App_BindingPreviousURLSuffix_String = "PreviousURL"; 2953 + static const char* const k_pch_App_NeedToUpdateAutosaveSuffix_Bool = "NeedToUpdateAutosave"; 2954 + static const char* const k_pch_App_DominantHand_Int32 = "DominantHand"; 2955 + static const char* const k_pch_App_BlockOculusSDK_Bool = "blockOculusSDK"; 2956 + 2957 + //----------------------------------------------------------------------------- 2958 + // configuration for trackers 2959 + static const char * const k_pch_Trackers_Section = "trackers"; 2960 + 2961 + //----------------------------------------------------------------------------- 2962 + // configuration for desktop UI windows 2963 + static const char * const k_pch_DesktopUI_Section = "DesktopUI"; 2964 + 2965 + //----------------------------------------------------------------------------- 2966 + // Last known keys for righting recovery 2967 + static const char * const k_pch_LastKnown_Section = "LastKnown"; 2968 + static const char* const k_pch_LastKnown_HMDManufacturer_String = "HMDManufacturer"; 2969 + static const char* const k_pch_LastKnown_HMDModel_String = "HMDModel"; 2970 + 2971 + //----------------------------------------------------------------------------- 2972 + // Dismissed warnings 2973 + static const char * const k_pch_DismissedWarnings_Section = "DismissedWarnings"; 2974 + 2975 + //----------------------------------------------------------------------------- 2976 + // Input Settings 2977 + static const char * const k_pch_Input_Section = "input"; 2978 + static const char* const k_pch_Input_LeftThumbstickRotation_Float = "leftThumbstickRotation"; 2979 + static const char* const k_pch_Input_RightThumbstickRotation_Float = "rightThumbstickRotation"; 2980 + static const char* const k_pch_Input_ThumbstickDeadzone_Float = "thumbstickDeadzone"; 2981 + 2982 + //----------------------------------------------------------------------------- 2983 + // Log of GPU performance 2984 + static const char * const k_pch_GpuSpeed_Section = "GpuSpeed"; 2985 + 2986 + } // namespace vr 2987 + 2988 + // ivrchaperone.h 2989 + 2990 + namespace vr 2991 + { 2992 + 2993 + #pragma pack( push, 8 ) 2994 + 2995 + enum ChaperoneCalibrationState 2996 + { 2997 + // OK! 2998 + ChaperoneCalibrationState_OK = 1, // Chaperone is fully calibrated and working correctly 2999 + 3000 + // Warnings 3001 + ChaperoneCalibrationState_Warning = 100, 3002 + ChaperoneCalibrationState_Warning_BaseStationMayHaveMoved = 101, // A base station thinks that it might have moved 3003 + ChaperoneCalibrationState_Warning_BaseStationRemoved = 102, // There are less base stations than when calibrated 3004 + ChaperoneCalibrationState_Warning_SeatedBoundsInvalid = 103, // Seated bounds haven't been calibrated for the current tracking center 3005 + 3006 + // Errors 3007 + ChaperoneCalibrationState_Error = 200, // The UniverseID is invalid 3008 + ChaperoneCalibrationState_Error_BaseStationUninitialized = 201, // Tracking center hasn't be calibrated for at least one of the base stations 3009 + ChaperoneCalibrationState_Error_BaseStationConflict = 202, // Tracking center is calibrated, but base stations disagree on the tracking space 3010 + ChaperoneCalibrationState_Error_PlayAreaInvalid = 203, // Play Area hasn't been calibrated for the current tracking center 3011 + ChaperoneCalibrationState_Error_CollisionBoundsInvalid = 204, // Collision Bounds haven't been calibrated for the current tracking center 3012 + }; 3013 + 3014 + 3015 + /** HIGH LEVEL TRACKING SPACE ASSUMPTIONS: 3016 + * 0,0,0 is the preferred standing area center. 3017 + * 0Y is the floor height. 3018 + * -Z is the preferred forward facing direction. */ 3019 + class IVRChaperone 3020 + { 3021 + public: 3022 + 3023 + /** Get the current state of Chaperone calibration. This state can change at any time during a session due to physical base station changes. **/ 3024 + virtual ChaperoneCalibrationState GetCalibrationState() = 0; 3025 + 3026 + /** Returns the width and depth of the Play Area (formerly named Soft Bounds) in X and Z. 3027 + * Tracking space center (0,0,0) is the center of the Play Area. **/ 3028 + virtual bool GetPlayAreaSize( float *pSizeX, float *pSizeZ ) = 0; 3029 + 3030 + /** Returns the 4 corner positions of the Play Area (formerly named Soft Bounds). 3031 + * Corners are in counter-clockwise order. 3032 + * Standing center (0,0,0) is the center of the Play Area. 3033 + * It's a rectangle. 3034 + * 2 sides are parallel to the X axis and 2 sides are parallel to the Z axis. 3035 + * Height of every corner is 0Y (on the floor). **/ 3036 + virtual bool GetPlayAreaRect( HmdQuad_t *rect ) = 0; 3037 + 3038 + /** Reload Chaperone data from the .vrchap file on disk. */ 3039 + virtual void ReloadInfo( void ) = 0; 3040 + 3041 + /** Optionally give the chaperone system a hit about the color and brightness in the scene **/ 3042 + virtual void SetSceneColor( HmdColor_t color ) = 0; 3043 + 3044 + /** Get the current chaperone bounds draw color and brightness **/ 3045 + virtual void GetBoundsColor( HmdColor_t *pOutputColorArray, int nNumOutputColors, float flCollisionBoundsFadeDistance, HmdColor_t *pOutputCameraColor ) = 0; 3046 + 3047 + /** Determine whether the bounds are showing right now **/ 3048 + virtual bool AreBoundsVisible() = 0; 3049 + 3050 + /** Force the bounds to show, mostly for utilities **/ 3051 + virtual void ForceBoundsVisible( bool bForce ) = 0; 3052 + 3053 + /** Sets the zero pose for the given tracker coordinate system to the current position and yaw of the HMD. After 3054 + * ResetZeroPose all GetDeviceToAbsoluteTrackingPose calls as the origin will be relative to this new zero pose. 3055 + * The new zero coordinate system will not change the fact that the Y axis is up in the real world, so the next 3056 + * pose returned from GetDeviceToAbsoluteTrackingPose after a call to ResetZeroPose may not be exactly an 3057 + * identity matrix. 3058 + * 3059 + * NOTE: This function overrides the user's previously saved zero pose and should only be called as the result of a user action. 3060 + * Users are also able to set their zero pose via the OpenVR Dashboard. 3061 + **/ 3062 + virtual void ResetZeroPose( ETrackingUniverseOrigin eTrackingUniverseOrigin ) = 0; 3063 + }; 3064 + 3065 + static const char * const IVRChaperone_Version = "IVRChaperone_004"; 3066 + 3067 + #pragma pack( pop ) 3068 + 3069 + } 3070 + 3071 + // ivrchaperonesetup.h 3072 + 3073 + namespace vr 3074 + { 3075 + 3076 + enum EChaperoneConfigFile 3077 + { 3078 + EChaperoneConfigFile_Live = 1, // The live chaperone config, used by most applications and games 3079 + EChaperoneConfigFile_Temp = 2, // The temporary chaperone config, used to live-preview collision bounds in room setup 3080 + }; 3081 + 3082 + enum EChaperoneImportFlags 3083 + { 3084 + EChaperoneImport_BoundsOnly = 0x0001, 3085 + }; 3086 + 3087 + /** Manages the working copy of the chaperone info. By default this will be the same as the 3088 + * live copy. Any changes made with this interface will stay in the working copy until 3089 + * CommitWorkingCopy() is called, at which point the working copy and the live copy will be 3090 + * the same again. */ 3091 + class IVRChaperoneSetup 3092 + { 3093 + public: 3094 + 3095 + /** Saves the current working copy to disk */ 3096 + virtual bool CommitWorkingCopy( EChaperoneConfigFile configFile ) = 0; 3097 + 3098 + /** Reverts the working copy to match the live chaperone calibration. 3099 + * To modify existing data this MUST be do WHILE getting a non-error ChaperoneCalibrationStatus. 3100 + * Only after this should you do gets and sets on the existing data. */ 3101 + virtual void RevertWorkingCopy() = 0; 3102 + 3103 + /** Returns the width and depth of the Play Area (formerly named Soft Bounds) in X and Z from the working copy. 3104 + * Tracking space center (0,0,0) is the center of the Play Area. */ 3105 + virtual bool GetWorkingPlayAreaSize( float *pSizeX, float *pSizeZ ) = 0; 3106 + 3107 + /** Returns the 4 corner positions of the Play Area (formerly named Soft Bounds) from the working copy. 3108 + * Corners are in clockwise order. 3109 + * Tracking space center (0,0,0) is the center of the Play Area. 3110 + * It's a rectangle. 3111 + * 2 sides are parallel to the X axis and 2 sides are parallel to the Z axis. 3112 + * Height of every corner is 0Y (on the floor). **/ 3113 + virtual bool GetWorkingPlayAreaRect( HmdQuad_t *rect ) = 0; 3114 + 3115 + /** Returns the number of Quads if the buffer points to null. Otherwise it returns Quads 3116 + * into the buffer up to the max specified from the working copy. */ 3117 + virtual bool GetWorkingCollisionBoundsInfo( VR_OUT_ARRAY_COUNT(punQuadsCount) HmdQuad_t *pQuadsBuffer, uint32_t* punQuadsCount ) = 0; 3118 + 3119 + /** Returns the number of Quads if the buffer points to null. Otherwise it returns Quads 3120 + * into the buffer up to the max specified. */ 3121 + virtual bool GetLiveCollisionBoundsInfo( VR_OUT_ARRAY_COUNT(punQuadsCount) HmdQuad_t *pQuadsBuffer, uint32_t* punQuadsCount ) = 0; 3122 + 3123 + /** Returns the preferred seated position from the working copy. */ 3124 + virtual bool GetWorkingSeatedZeroPoseToRawTrackingPose( HmdMatrix34_t *pmatSeatedZeroPoseToRawTrackingPose ) = 0; 3125 + 3126 + /** Returns the standing origin from the working copy. */ 3127 + virtual bool GetWorkingStandingZeroPoseToRawTrackingPose( HmdMatrix34_t *pmatStandingZeroPoseToRawTrackingPose ) = 0; 3128 + 3129 + /** Sets the Play Area in the working copy. */ 3130 + virtual void SetWorkingPlayAreaSize( float sizeX, float sizeZ ) = 0; 3131 + 3132 + /** Sets the Collision Bounds in the working copy. Note: ceiling height is ignored. */ 3133 + virtual void SetWorkingCollisionBoundsInfo( VR_ARRAY_COUNT(unQuadsCount) HmdQuad_t *pQuadsBuffer, uint32_t unQuadsCount ) = 0; 3134 + 3135 + /** Sets the Collision Bounds in the working copy. */ 3136 + virtual void SetWorkingPerimeter( VR_ARRAY_COUNT( unPointCount ) HmdVector2_t *pPointBuffer, uint32_t unPointCount ) = 0; 3137 + 3138 + /** Sets the preferred seated position in the working copy. */ 3139 + virtual void SetWorkingSeatedZeroPoseToRawTrackingPose( const HmdMatrix34_t *pMatSeatedZeroPoseToRawTrackingPose ) = 0; 3140 + 3141 + /** Sets the preferred standing position in the working copy. */ 3142 + virtual void SetWorkingStandingZeroPoseToRawTrackingPose( const HmdMatrix34_t *pMatStandingZeroPoseToRawTrackingPose ) = 0; 3143 + 3144 + /** Tear everything down and reload it from the file on disk */ 3145 + virtual void ReloadFromDisk( EChaperoneConfigFile configFile ) = 0; 3146 + 3147 + /** Returns the preferred seated position. */ 3148 + virtual bool GetLiveSeatedZeroPoseToRawTrackingPose( HmdMatrix34_t *pmatSeatedZeroPoseToRawTrackingPose ) = 0; 3149 + 3150 + virtual bool ExportLiveToBuffer( VR_OUT_STRING() char *pBuffer, uint32_t *pnBufferLength ) = 0; 3151 + virtual bool ImportFromBufferToWorking( const char *pBuffer, uint32_t nImportFlags ) = 0; 3152 + 3153 + /** Shows the chaperone data in the working set to preview in the compositor.*/ 3154 + virtual void ShowWorkingSetPreview() = 0; 3155 + 3156 + /** Hides the chaperone data in the working set to preview in the compositor (if it was visible).*/ 3157 + virtual void HideWorkingSetPreview() = 0; 3158 + 3159 + /** Fire an event that the tracking system can use to know room setup is about to begin. This lets the tracking 3160 + * system make any last minute adjustments that should be incorporated into the new setup. If the user is adjusting 3161 + * live in HMD using a tweak tool, keep in mind that calling this might cause the user to see the room jump. */ 3162 + virtual void RoomSetupStarting() = 0; 3163 + }; 3164 + 3165 + static const char * const IVRChaperoneSetup_Version = "IVRChaperoneSetup_006"; 3166 + 3167 + 3168 + } 3169 + 3170 + // ivrcompositor.h 3171 + 3172 + namespace vr 3173 + { 3174 + 3175 + #pragma pack( push, 8 ) 3176 + 3177 + /** Errors that can occur with the VR compositor */ 3178 + enum EVRCompositorError 3179 + { 3180 + VRCompositorError_None = 0, 3181 + VRCompositorError_RequestFailed = 1, 3182 + VRCompositorError_IncompatibleVersion = 100, 3183 + VRCompositorError_DoNotHaveFocus = 101, 3184 + VRCompositorError_InvalidTexture = 102, 3185 + VRCompositorError_IsNotSceneApplication = 103, 3186 + VRCompositorError_TextureIsOnWrongDevice = 104, 3187 + VRCompositorError_TextureUsesUnsupportedFormat = 105, 3188 + VRCompositorError_SharedTexturesNotSupported = 106, 3189 + VRCompositorError_IndexOutOfRange = 107, 3190 + VRCompositorError_AlreadySubmitted = 108, 3191 + VRCompositorError_InvalidBounds = 109, 3192 + VRCompositorError_AlreadySet = 110, 3193 + }; 3194 + 3195 + /** Timing mode passed to SetExplicitTimingMode(); see that function for documentation */ 3196 + enum EVRCompositorTimingMode 3197 + { 3198 + VRCompositorTimingMode_Implicit = 0, 3199 + VRCompositorTimingMode_Explicit_RuntimePerformsPostPresentHandoff = 1, 3200 + VRCompositorTimingMode_Explicit_ApplicationPerformsPostPresentHandoff = 2, 3201 + }; 3202 + 3203 + /** Cumulative stats for current application. These are not cleared until a new app connects, 3204 + * but they do stop accumulating once the associated app disconnects. */ 3205 + struct Compositor_CumulativeStats 3206 + { 3207 + uint32_t m_nPid; // Process id associated with these stats (may no longer be running). 3208 + uint32_t m_nNumFramePresents; // total number of times we called present (includes reprojected frames) 3209 + uint32_t m_nNumDroppedFrames; // total number of times an old frame was re-scanned out (without reprojection) 3210 + uint32_t m_nNumReprojectedFrames; // total number of times a frame was scanned out a second time (with reprojection) 3211 + 3212 + /** Values recorded at startup before application has fully faded in the first time. */ 3213 + uint32_t m_nNumFramePresentsOnStartup; 3214 + uint32_t m_nNumDroppedFramesOnStartup; 3215 + uint32_t m_nNumReprojectedFramesOnStartup; 3216 + 3217 + /** Applications may explicitly fade to the compositor. This is usually to handle level transitions, and loading often causes 3218 + * system wide hitches. The following stats are collected during this period. Does not include values recorded during startup. */ 3219 + uint32_t m_nNumLoading; 3220 + uint32_t m_nNumFramePresentsLoading; 3221 + uint32_t m_nNumDroppedFramesLoading; 3222 + uint32_t m_nNumReprojectedFramesLoading; 3223 + 3224 + /** 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 3225 + * fading back to the compositor. The following stats are a result of this, and are a subset of those recorded above. 3226 + * Does not include values recorded during start up or loading. */ 3227 + uint32_t m_nNumTimedOut; 3228 + uint32_t m_nNumFramePresentsTimedOut; 3229 + uint32_t m_nNumDroppedFramesTimedOut; 3230 + uint32_t m_nNumReprojectedFramesTimedOut; 3231 + }; 3232 + 3233 + struct Compositor_StageRenderSettings 3234 + { 3235 + /** Primary color is applied as a tint to (i.e. multiplied with) the model's texture */ 3236 + HmdColor_t m_PrimaryColor; 3237 + HmdColor_t m_SecondaryColor; 3238 + 3239 + /** Vignette radius is in meters and is used to fade to the specified secondary solid color over 3240 + * that 3D distance from the origin of the playspace. */ 3241 + float m_flVignetteInnerRadius; 3242 + float m_flVignetteOuterRadius; 3243 + 3244 + /** Fades to the secondary color based on view incidence. This variable controls the linearity 3245 + * of the effect. It is mutually exclusive with vignette. Additionally, it treats the mesh as faceted. */ 3246 + float m_flFresnelStrength; 3247 + 3248 + /** Controls backface culling. */ 3249 + bool m_bBackfaceCulling; 3250 + 3251 + /** Converts the render model's texture to luma and applies to rgb equally. This is useful to 3252 + * combat compression artifacts that can occur on desaturated source material. */ 3253 + bool m_bGreyscale; 3254 + 3255 + /** Renders mesh as a wireframe. */ 3256 + bool m_bWireframe; 3257 + }; 3258 + 3259 + static inline Compositor_StageRenderSettings DefaultStageRenderSettings() 3260 + { 3261 + Compositor_StageRenderSettings settings; 3262 + settings.m_PrimaryColor.r = 1.0f; 3263 + settings.m_PrimaryColor.g = 1.0f; 3264 + settings.m_PrimaryColor.b = 1.0f; 3265 + settings.m_PrimaryColor.a = 1.0f; 3266 + settings.m_SecondaryColor.r = 1.0f; 3267 + settings.m_SecondaryColor.g = 1.0f; 3268 + settings.m_SecondaryColor.b = 1.0f; 3269 + settings.m_SecondaryColor.a = 1.0f; 3270 + settings.m_flVignetteInnerRadius = 0.0f; 3271 + settings.m_flVignetteOuterRadius = 0.0f; 3272 + settings.m_flFresnelStrength = 0.0f; 3273 + settings.m_bBackfaceCulling = false; 3274 + settings.m_bGreyscale = false; 3275 + settings.m_bWireframe = false; 3276 + return settings; 3277 + } 3278 + 3279 + #pragma pack( pop ) 3280 + 3281 + /** Allows the application to interact with the compositor */ 3282 + class IVRCompositor 3283 + { 3284 + public: 3285 + /** Sets tracking space returned by WaitGetPoses */ 3286 + virtual void SetTrackingSpace( ETrackingUniverseOrigin eOrigin ) = 0; 3287 + 3288 + /** Gets current tracking space returned by WaitGetPoses */ 3289 + virtual ETrackingUniverseOrigin GetTrackingSpace() = 0; 3290 + 3291 + /** Scene applications should call this function to get poses to render with (and optionally poses predicted an additional frame out to use for gameplay). 3292 + * 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 3293 + * start rendering. 3294 + * 3295 + * Return codes: 3296 + * - IsNotSceneApplication (make sure to call VR_Init with VRApplicaiton_Scene) 3297 + * - DoNotHaveFocus (some other app has taken focus - this will throttle the call to 10hz to reduce the impact on that app) 3298 + */ 3299 + virtual EVRCompositorError WaitGetPoses( VR_ARRAY_COUNT( unRenderPoseArrayCount ) TrackedDevicePose_t* pRenderPoseArray, uint32_t unRenderPoseArrayCount, 3300 + VR_ARRAY_COUNT( unGamePoseArrayCount ) TrackedDevicePose_t* pGamePoseArray, uint32_t unGamePoseArrayCount ) = 0; 3301 + 3302 + /** Get the last set of poses returned by WaitGetPoses. */ 3303 + virtual EVRCompositorError GetLastPoses( VR_ARRAY_COUNT( unRenderPoseArrayCount ) TrackedDevicePose_t* pRenderPoseArray, uint32_t unRenderPoseArrayCount, 3304 + VR_ARRAY_COUNT( unGamePoseArrayCount ) TrackedDevicePose_t* pGamePoseArray, uint32_t unGamePoseArrayCount ) = 0; 3305 + 3306 + /** Interface for accessing last set of poses returned by WaitGetPoses one at a time. 3307 + * Returns VRCompositorError_IndexOutOfRange if unDeviceIndex not less than k_unMaxTrackedDeviceCount otherwise VRCompositorError_None. 3308 + * It is okay to pass NULL for either pose if you only want one of the values. */ 3309 + virtual EVRCompositorError GetLastPoseForTrackedDeviceIndex( TrackedDeviceIndex_t unDeviceIndex, TrackedDevicePose_t *pOutputPose, TrackedDevicePose_t *pOutputGamePose ) = 0; 3310 + 3311 + /** 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 3312 + * 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. 3313 + * 3314 + * OpenGL dirty state: 3315 + * glBindTexture 3316 + * 3317 + * Return codes: 3318 + * - IsNotSceneApplication (make sure to call VR_Init with VRApplicaiton_Scene) 3319 + * - DoNotHaveFocus (some other app has taken focus) 3320 + * - TextureIsOnWrongDevice (application did not use proper AdapterIndex - see IVRSystem.GetDXGIOutputInfo) 3321 + * - SharedTexturesNotSupported (application needs to call CreateDXGIFactory1 or later before creating DX device) 3322 + * - TextureUsesUnsupportedFormat (scene textures must be compatible with DXGI sharing rules - e.g. uncompressed, no mips, etc.) 3323 + * - InvalidTexture (usually means bad arguments passed in) 3324 + * - AlreadySubmitted (app has submitted two left textures or two right textures in a single frame - i.e. before calling WaitGetPoses again) 3325 + */ 3326 + virtual EVRCompositorError Submit( EVREye eEye, const Texture_t *pTexture, const VRTextureBounds_t* pBounds = 0, EVRSubmitFlags nSubmitFlags = Submit_Default ) = 0; 3327 + 3328 + /** Clears the frame that was sent with the last call to Submit. This will cause the 3329 + * compositor to show the grid until Submit is called again. */ 3330 + virtual void ClearLastSubmittedFrame() = 0; 3331 + 3332 + /** Call immediately after presenting your app's window (i.e. companion window) to unblock the compositor. 3333 + * This is an optional call, which only needs to be used if you can't instead call WaitGetPoses immediately after Present. 3334 + * 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 3335 + * introduce a deadlock of some sort. This function tells the compositor that you have finished all rendering after having Submitted buffers for both 3336 + * eyes, and it is free to start its rendering work. This should only be called from the same thread you are rendering on. */ 3337 + virtual void PostPresentHandoff() = 0; 3338 + 3339 + /** Returns true if timing data is filled it. Sets oldest timing info if nFramesAgo is larger than the stored history. 3340 + * Be sure to set timing.size = sizeof(Compositor_FrameTiming) on struct passed in before calling this function. */ 3341 + virtual bool GetFrameTiming( Compositor_FrameTiming *pTiming, uint32_t unFramesAgo = 0 ) = 0; 3342 + 3343 + /** 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. 3344 + * 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. */ 3345 + virtual uint32_t GetFrameTimings( VR_ARRAY_COUNT( nFrames ) Compositor_FrameTiming *pTiming, uint32_t nFrames ) = 0; 3346 + 3347 + /** Returns the time in seconds left in the current (as identified by FrameTiming's frameIndex) frame. 3348 + * Due to "running start", this value may roll over to the next frame before ever reaching 0.0. */ 3349 + virtual float GetFrameTimeRemaining() = 0; 3350 + 3351 + /** Fills out stats accumulated for the last connected application. Pass in sizeof( Compositor_CumulativeStats ) as second parameter. */ 3352 + virtual void GetCumulativeStats( Compositor_CumulativeStats *pStats, uint32_t nStatsSizeInBytes ) = 0; 3353 + 3354 + /** Fades the view on the HMD to the specified color. The fade will take fSeconds, and the color values are between 3355 + * 0.0 and 1.0. This color is faded on top of the scene based on the alpha parameter. Removing the fade color instantly 3356 + * would be FadeToColor( 0.0, 0.0, 0.0, 0.0, 0.0 ). Values are in un-premultiplied alpha space. */ 3357 + virtual void FadeToColor( float fSeconds, float fRed, float fGreen, float fBlue, float fAlpha, bool bBackground = false ) = 0; 3358 + 3359 + /** Get current fade color value. */ 3360 + virtual HmdColor_t GetCurrentFadeColor( bool bBackground = false ) = 0; 3361 + 3362 + /** Fading the Grid in or out in fSeconds */ 3363 + virtual void FadeGrid( float fSeconds, bool bFadeGridIn ) = 0; 3364 + 3365 + /** Get current alpha value of grid. */ 3366 + virtual float GetCurrentGridAlpha() = 0; 3367 + 3368 + /** Override the skybox used in the compositor (e.g. for during level loads when the app can't feed scene images fast enough) 3369 + * Order is Front, Back, Left, Right, Top, Bottom. If only a single texture is passed, it is assumed in lat-long format. 3370 + * If two are passed, it is assumed a lat-long stereo pair. */ 3371 + virtual EVRCompositorError SetSkyboxOverride( VR_ARRAY_COUNT( unTextureCount ) const Texture_t *pTextures, uint32_t unTextureCount ) = 0; 3372 + 3373 + /** Resets compositor skybox back to defaults. */ 3374 + virtual void ClearSkyboxOverride() = 0; 3375 + 3376 + /** Brings the compositor window to the front. This is useful for covering any other window that may be on the HMD 3377 + * and is obscuring the compositor window. */ 3378 + virtual void CompositorBringToFront() = 0; 3379 + 3380 + /** Pushes the compositor window to the back. This is useful for allowing other applications to draw directly to the HMD. */ 3381 + virtual void CompositorGoToBack() = 0; 3382 + 3383 + /** DEPRECATED: Tells the compositor process to clean up and exit. You do not need to call this function at shutdown. 3384 + * Under normal circumstances the compositor will manage its own life cycle based on what applications are running. */ 3385 + virtual void CompositorQuit() = 0; 3386 + 3387 + /** Return whether the compositor is fullscreen */ 3388 + virtual bool IsFullscreen() = 0; 3389 + 3390 + /** Returns the process ID of the process that is currently rendering the scene */ 3391 + virtual uint32_t GetCurrentSceneFocusProcess() = 0; 3392 + 3393 + /** Returns the process ID of the process that rendered the last frame (or 0 if the compositor itself rendered the frame.) 3394 + * Returns 0 when fading out from an app and the app's process Id when fading into an app. */ 3395 + virtual uint32_t GetLastFrameRenderer() = 0; 3396 + 3397 + /** Returns true if the current process has the scene focus */ 3398 + virtual bool CanRenderScene() = 0; 3399 + 3400 + /** DEPRECATED: Opens the headset view (as either a window or docked widget depending on user's preferences) that displays what the user 3401 + * sees in the headset. */ 3402 + virtual void ShowMirrorWindow() = 0; 3403 + 3404 + /** DEPRECATED: Closes the headset view, either as a window or docked widget. */ 3405 + virtual void HideMirrorWindow() = 0; 3406 + 3407 + /** DEPRECATED: Returns true if the headset view (either as a window or docked widget) is shown. */ 3408 + virtual bool IsMirrorWindowVisible() = 0; 3409 + 3410 + /** Writes back buffer and stereo left/right pair from the application to a 'screenshots' folder in the SteamVR runtime root. */ 3411 + virtual void CompositorDumpImages() = 0; 3412 + 3413 + /** Let an app know it should be rendering with low resources. */ 3414 + virtual bool ShouldAppRenderWithLowResources() = 0; 3415 + 3416 + /** Override interleaved reprojection logic to force on. */ 3417 + virtual void ForceInterleavedReprojectionOn( bool bOverride ) = 0; 3418 + 3419 + /** Force reconnecting to the compositor process. */ 3420 + virtual void ForceReconnectProcess() = 0; 3421 + 3422 + /** Temporarily suspends rendering (useful for finer control over scene transitions). */ 3423 + virtual void SuspendRendering( bool bSuspend ) = 0; 3424 + 3425 + /** Opens a shared D3D11 texture with the undistorted composited image for each eye. Use ReleaseMirrorTextureD3D11 when finished 3426 + * instead of calling Release on the resource itself. */ 3427 + virtual vr::EVRCompositorError GetMirrorTextureD3D11( vr::EVREye eEye, void *pD3D11DeviceOrResource, void **ppD3D11ShaderResourceView ) = 0; 3428 + virtual void ReleaseMirrorTextureD3D11( void *pD3D11ShaderResourceView ) = 0; 3429 + 3430 + /** Access to mirror textures from OpenGL. */ 3431 + virtual vr::EVRCompositorError GetMirrorTextureGL( vr::EVREye eEye, vr::glUInt_t *pglTextureId, vr::glSharedTextureHandle_t *pglSharedTextureHandle ) = 0; 3432 + virtual bool ReleaseSharedGLTexture( vr::glUInt_t glTextureId, vr::glSharedTextureHandle_t glSharedTextureHandle ) = 0; 3433 + virtual void LockGLSharedTextureForAccess( vr::glSharedTextureHandle_t glSharedTextureHandle ) = 0; 3434 + virtual void UnlockGLSharedTextureForAccess( vr::glSharedTextureHandle_t glSharedTextureHandle ) = 0; 3435 + 3436 + /** [Vulkan Only] 3437 + * return 0. Otherwise it returns the length of the number of bytes necessary to hold this string including the trailing 3438 + * null. The string will be a space separated list of-required instance extensions to enable in VkCreateInstance */ 3439 + virtual uint32_t GetVulkanInstanceExtensionsRequired( VR_OUT_STRING() char *pchValue, uint32_t unBufferSize ) = 0; 3440 + 3441 + /** [Vulkan only] 3442 + * return 0. Otherwise it returns the length of the number of bytes necessary to hold this string including the trailing 3443 + * null. The string will be a space separated list of required device extensions to enable in VkCreateDevice */ 3444 + virtual uint32_t GetVulkanDeviceExtensionsRequired( VkPhysicalDevice_T *pPhysicalDevice, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize ) = 0; 3445 + 3446 + /** [ Vulkan/D3D12 Only ] 3447 + * There are two purposes for SetExplicitTimingMode: 3448 + * 1. To get a more accurate GPU timestamp for when the frame begins in Vulkan/D3D12 applications. 3449 + * 2. (Optional) To avoid having WaitGetPoses access the Vulkan queue so that the queue can be accessed from 3450 + * another thread while WaitGetPoses is executing. 3451 + * 3452 + * More accurate GPU timestamp for the start of the frame is achieved by the application calling 3453 + * SubmitExplicitTimingData immediately before its first submission to the Vulkan/D3D12 queue. 3454 + * This is more accurate because normally this GPU timestamp is recorded during WaitGetPoses. In D3D11, 3455 + * WaitGetPoses queues a GPU timestamp write, but it does not actually get submitted to the GPU until the 3456 + * application flushes. By using SubmitExplicitTimingData, the timestamp is recorded at the same place for 3457 + * Vulkan/D3D12 as it is for D3D11, resulting in a more accurate GPU time measurement for the frame. 3458 + * 3459 + * Avoiding WaitGetPoses accessing the Vulkan queue can be achieved using SetExplicitTimingMode as well. If this is desired, 3460 + * the application should set the timing mode to Explicit_ApplicationPerformsPostPresentHandoff and *MUST* call PostPresentHandoff 3461 + * itself. If these conditions are met, then WaitGetPoses is guaranteed not to access the queue. Note that PostPresentHandoff 3462 + * and SubmitExplicitTimingData will access the queue, so only WaitGetPoses becomes safe for accessing the queue from another 3463 + * thread. */ 3464 + virtual void SetExplicitTimingMode( EVRCompositorTimingMode eTimingMode ) = 0; 3465 + 3466 + /** [ Vulkan/D3D12 Only ] 3467 + * Submit explicit timing data. When SetExplicitTimingMode is true, this must be called immediately before 3468 + * the application's first vkQueueSubmit (Vulkan) or ID3D12CommandQueue::ExecuteCommandLists (D3D12) of each frame. 3469 + * This function will insert a GPU timestamp write just before the application starts its rendering. This function 3470 + * will perform a vkQueueSubmit on Vulkan so must not be done simultaneously with VkQueue operations on another thread. 3471 + * Returns VRCompositorError_RequestFailed if SetExplicitTimingMode is not enabled. */ 3472 + virtual EVRCompositorError SubmitExplicitTimingData() = 0; 3473 + 3474 + /** Indicates whether or not motion smoothing is enabled by the user settings. 3475 + * If you want to know if motion smoothing actually triggered due to a late frame, check Compositor_FrameTiming 3476 + * m_nReprojectionFlags & VRCompositor_ReprojectionMotion instead. */ 3477 + virtual bool IsMotionSmoothingEnabled() = 0; 3478 + 3479 + /** Indicates whether or not motion smoothing is supported by the current hardware. */ 3480 + virtual bool IsMotionSmoothingSupported() = 0; 3481 + 3482 + /** Indicates whether or not the current scene focus app is currently loading. This is inferred from its use of FadeGrid to 3483 + * explicitly fade to the compositor to cover up the fact that it cannot render at a sustained full framerate during this time. */ 3484 + virtual bool IsCurrentSceneFocusAppLoading() = 0; 3485 + 3486 + /** Override the stage model used in the compositor to replace the grid. RenderModelPath is a full path the an OBJ file to load. 3487 + * This file will be loaded asynchronously from disk and uploaded to the gpu by the runtime. Once ready for rendering, the 3488 + * VREvent StageOverrideReady will be sent. Use FadeToGrid to reveal. Call ClearStageOverride to free the associated resources when finished. */ 3489 + virtual EVRCompositorError SetStageOverride_Async( const char *pchRenderModelPath, const HmdMatrix34_t *pTransform = 0, 3490 + const Compositor_StageRenderSettings *pRenderSettings = 0, uint32_t nSizeOfRenderSettings = 0 ) = 0; 3491 + 3492 + /** Resets the stage to its default user specified setting. */ 3493 + virtual void ClearStageOverride() = 0; 3494 + 3495 + /** Returns true if pBenchmarkResults is filled it. Sets pBenchmarkResults with the result of the compositor benchmark. 3496 + * nSizeOfBenchmarkResults should be set to sizeof(Compositor_BenchmarkResults) */ 3497 + virtual bool GetCompositorBenchmarkResults( Compositor_BenchmarkResults *pBenchmarkResults, uint32_t nSizeOfBenchmarkResults ) = 0; 3498 + 3499 + /** Returns the frame id associated with the poses last returned by WaitGetPoses. Deltas between IDs correspond to number of headset vsync intervals. */ 3500 + virtual EVRCompositorError GetLastPosePredictionIDs( uint32_t *pRenderPosePredictionID, uint32_t *pGamePosePredictionID ) = 0; 3501 + 3502 + /** Get the most up-to-date predicted (or recorded - up to 100ms old) set of poses for a given frame id. */ 3503 + virtual EVRCompositorError GetPosesForFrame( uint32_t unPosePredictionID, VR_ARRAY_COUNT( unPoseArrayCount ) TrackedDevicePose_t* pPoseArray, uint32_t unPoseArrayCount ) = 0; 3504 + }; 3505 + 3506 + static const char * const IVRCompositor_Version = "IVRCompositor_027"; 3507 + 3508 + } // namespace vr 3509 + 3510 + 3511 + 3512 + // ivrheadsetview.h 3513 + 3514 + namespace vr 3515 + { 3516 + enum HeadsetViewMode_t 3517 + { 3518 + HeadsetViewMode_Left = 0, 3519 + HeadsetViewMode_Right, 3520 + HeadsetViewMode_Both 3521 + }; 3522 + 3523 + class IVRHeadsetView 3524 + { 3525 + public: 3526 + /** Sets the resolution in pixels to render the headset view. These values are clamped to k_unHeadsetViewMaxWidth 3527 + * and k_unHeadsetViewMaxHeight respectively. For cropped views, the rendered output will be fit to aspect ratio 3528 + * defined by the the specified dimensions. For uncropped views, the caller should use GetHeadsetViewAspectRation 3529 + * to adjust the requested render size to avoid squashing or stretching, and then apply letterboxing to compensate 3530 + * when displaying the results. */ 3531 + virtual void SetHeadsetViewSize( uint32_t nWidth, uint32_t nHeight ) = 0; 3532 + 3533 + /** Gets the current resolution used to render the headset view. */ 3534 + virtual void GetHeadsetViewSize( uint32_t *pnWidth, uint32_t *pnHeight ) = 0; 3535 + 3536 + /** Set the mode used to render the headset view. */ 3537 + virtual void SetHeadsetViewMode( HeadsetViewMode_t eHeadsetViewMode ) = 0; 3538 + 3539 + /** Get the current mode used to render the headset view. */ 3540 + virtual HeadsetViewMode_t GetHeadsetViewMode() = 0; 3541 + 3542 + /** Set whether or not the headset view should be rendered cropped to hide the hidden area mesh or not. */ 3543 + virtual void SetHeadsetViewCropped( bool bCropped ) = 0; 3544 + 3545 + /** Get the current cropping status of the headset view. */ 3546 + virtual bool GetHeadsetViewCropped() = 0; 3547 + 3548 + /** Get the aspect ratio (width:height) of the uncropped headset view (accounting for the current set mode). */ 3549 + virtual float GetHeadsetViewAspectRatio() = 0; 3550 + 3551 + /** Set the range [0..1] that the headset view blends across the stereo overlapped area in cropped both mode. */ 3552 + virtual void SetHeadsetViewBlendRange( float flStartPct, float flEndPct ) = 0; 3553 + 3554 + /** Get the current range [0..1] that the headset view blends across the stereo overlapped area in cropped both mode. */ 3555 + virtual void GetHeadsetViewBlendRange( float *pStartPct, float *pEndPct ) = 0; 3556 + }; 3557 + 3558 + static const uint32_t k_unHeadsetViewMaxWidth = 3840; 3559 + static const uint32_t k_unHeadsetViewMaxHeight = 2160; 3560 + static const char * const k_pchHeadsetViewOverlayKey = "system.HeadsetView"; 3561 + 3562 + static const char * const IVRHeadsetView_Version = "IVRHeadsetView_001"; 3563 + 3564 + /** Returns the current IVRHeadsetView pointer or NULL the interface could not be found. */ 3565 + VR_INTERFACE vr::IVRHeadsetView *VR_CALLTYPE VRHeadsetView(); 3566 + 3567 + } // namespace vr 3568 + 3569 + 3570 + // ivrnotifications.h 3571 + 3572 + namespace vr 3573 + { 3574 + 3575 + #pragma pack( push, 8 ) 3576 + 3577 + // Used for passing graphic data 3578 + struct NotificationBitmap_t 3579 + { 3580 + NotificationBitmap_t() 3581 + : m_pImageData( nullptr ) 3582 + , m_nWidth( 0 ) 3583 + , m_nHeight( 0 ) 3584 + , m_nBytesPerPixel( 0 ) 3585 + { 3586 + } 3587 + 3588 + void *m_pImageData; 3589 + int32_t m_nWidth; 3590 + int32_t m_nHeight; 3591 + int32_t m_nBytesPerPixel; 3592 + }; 3593 + 3594 + 3595 + /** Be aware that the notification type is used as 'priority' to pick the next notification */ 3596 + enum EVRNotificationType 3597 + { 3598 + /** Transient notifications are automatically hidden after a period of time set by the user. 3599 + * They are used for things like information and chat messages that do not require user interaction. */ 3600 + EVRNotificationType_Transient = 0, 3601 + 3602 + /** Persistent notifications are shown to the user until they are hidden by calling RemoveNotification(). 3603 + * They are used for things like phone calls and alarms that require user interaction. */ 3604 + EVRNotificationType_Persistent = 1, 3605 + 3606 + /** System notifications are shown no matter what. It is expected, that the ulUserValue is used as ID. 3607 + * If there is already a system notification in the queue with that ID it is not accepted into the queue 3608 + * to prevent spamming with system notification */ 3609 + EVRNotificationType_Transient_SystemWithUserValue = 2, 3610 + }; 3611 + 3612 + enum EVRNotificationStyle 3613 + { 3614 + /** Creates a notification with minimal external styling. */ 3615 + EVRNotificationStyle_None = 0, 3616 + 3617 + /** Used for notifications about overlay-level status. In Steam this is used for events like downloads completing. */ 3618 + EVRNotificationStyle_Application = 100, 3619 + 3620 + /** Used for notifications about contacts that are unknown or not available. In Steam this is used for friend invitations and offline friends. */ 3621 + EVRNotificationStyle_Contact_Disabled = 200, 3622 + 3623 + /** 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. */ 3624 + EVRNotificationStyle_Contact_Enabled = 201, 3625 + 3626 + /** 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. */ 3627 + EVRNotificationStyle_Contact_Active = 202, 3628 + }; 3629 + 3630 + static const uint32_t k_unNotificationTextMaxSize = 256; 3631 + 3632 + typedef uint32_t VRNotificationId; 3633 + 3634 + 3635 + 3636 + #pragma pack( pop ) 3637 + 3638 + /** Allows notification sources to interact with the VR system 3639 + This current interface is not yet implemented. Do not use yet. */ 3640 + class IVRNotifications 3641 + { 3642 + public: 3643 + /** Create a notification and enqueue it to be shown to the user. 3644 + * An overlay handle is required to create a notification, as otherwise it would be impossible for a user to act on it. 3645 + * To create a two-line notification, use a line break ('\n') to split the text into two lines. 3646 + * The pImage argument may be NULL, in which case the specified overlay's icon will be used instead. */ 3647 + virtual EVRNotificationError CreateNotification( VROverlayHandle_t ulOverlayHandle, uint64_t ulUserValue, EVRNotificationType type, const char *pchText, EVRNotificationStyle style, const NotificationBitmap_t *pImage, /* out */ VRNotificationId *pNotificationId ) = 0; 3648 + 3649 + /** Destroy a notification, hiding it first if it currently shown to the user. */ 3650 + virtual EVRNotificationError RemoveNotification( VRNotificationId notificationId ) = 0; 3651 + 3652 + }; 3653 + 3654 + static const char * const IVRNotifications_Version = "IVRNotifications_002"; 3655 + 3656 + } // namespace vr 3657 + 3658 + 3659 + 3660 + // ivroverlay.h 3661 + 3662 + namespace vr 3663 + { 3664 + 3665 + /** The maximum length of an overlay key in bytes, counting the terminating null character. */ 3666 + static const uint32_t k_unVROverlayMaxKeyLength = 128; 3667 + 3668 + /** The maximum length of an overlay name in bytes, counting the terminating null character. */ 3669 + static const uint32_t k_unVROverlayMaxNameLength = 128; 3670 + 3671 + /** The maximum number of overlays that can exist in the system at one time. */ 3672 + static const uint32_t k_unMaxOverlayCount = 128; 3673 + 3674 + /** The maximum number of overlay intersection mask primitives per overlay */ 3675 + static const uint32_t k_unMaxOverlayIntersectionMaskPrimitivesCount = 32; 3676 + 3677 + /** Types of input supported by VR Overlays */ 3678 + enum VROverlayInputMethod 3679 + { 3680 + VROverlayInputMethod_None = 0, // No input events will be generated automatically for this overlay 3681 + VROverlayInputMethod_Mouse = 1, // Tracked controllers will get mouse events automatically 3682 + // VROverlayInputMethod_DualAnalog = 2, // No longer supported 3683 + }; 3684 + 3685 + /** Allows the caller to figure out which overlay transform getter to call. */ 3686 + enum VROverlayTransformType 3687 + { 3688 + VROverlayTransform_Invalid = -1, 3689 + VROverlayTransform_Absolute = 0, 3690 + VROverlayTransform_TrackedDeviceRelative = 1, 3691 + VROverlayTransform_SystemOverlay = 2, 3692 + VROverlayTransform_TrackedComponent = 3, 3693 + VROverlayTransform_Cursor = 4, 3694 + VROverlayTransform_DashboardTab = 5, 3695 + VROverlayTransform_DashboardThumb = 6, 3696 + VROverlayTransform_Mountable = 7, 3697 + VROverlayTransform_Projection = 8, 3698 + }; 3699 + 3700 + /** Overlay control settings */ 3701 + enum VROverlayFlags 3702 + { 3703 + // Set this flag on a dashboard overlay to prevent a tab from showing up for that overlay 3704 + VROverlayFlags_NoDashboardTab = 1 << 3, 3705 + 3706 + // When this is set the overlay will receive VREvent_ScrollDiscrete events like a mouse wheel. 3707 + // Requires mouse input mode. 3708 + VROverlayFlags_SendVRDiscreteScrollEvents = 1 << 6, 3709 + 3710 + // Indicates that the overlay would like to receive 3711 + VROverlayFlags_SendVRTouchpadEvents = 1 << 7, 3712 + 3713 + // If set this will render a vertical scroll wheel on the primary controller, 3714 + // only needed if not using VROverlayFlags_SendVRScrollEvents but you still want to represent a scroll wheel 3715 + VROverlayFlags_ShowTouchPadScrollWheel = 1 << 8, 3716 + 3717 + // If this is set ownership and render access to the overlay are transferred 3718 + // to the new scene process on a call to IVRApplications::LaunchInternalProcess 3719 + VROverlayFlags_TransferOwnershipToInternalProcess = 1 << 9, 3720 + 3721 + // If set, renders 50% of the texture in each eye, side by side 3722 + VROverlayFlags_SideBySide_Parallel = 1 << 10, // Texture is left/right 3723 + VROverlayFlags_SideBySide_Crossed = 1 << 11, // Texture is crossed and right/left 3724 + 3725 + VROverlayFlags_Panorama = 1 << 12, // Texture is a panorama 3726 + VROverlayFlags_StereoPanorama = 1 << 13, // Texture is a stereo panorama 3727 + 3728 + // If this is set on an overlay owned by the scene application that overlay 3729 + // will be sorted with the "Other" overlays on top of all other scene overlays 3730 + VROverlayFlags_SortWithNonSceneOverlays = 1 << 14, 3731 + 3732 + // If set, the overlay will be shown in the dashboard, otherwise it will be hidden. 3733 + VROverlayFlags_VisibleInDashboard = 1 << 15, 3734 + 3735 + // If this is set and the overlay's input method is not none, the system-wide laser mouse 3736 + // mode will be activated whenever this overlay is visible. 3737 + VROverlayFlags_MakeOverlaysInteractiveIfVisible = 1 << 16, 3738 + 3739 + // If this is set the overlay will receive smooth VREvent_ScrollSmooth that emulate trackpad scrolling. 3740 + // Requires mouse input mode. 3741 + VROverlayFlags_SendVRSmoothScrollEvents = 1 << 17, 3742 + 3743 + // If this is set, the overlay texture will be protected content, preventing unauthorized reads. 3744 + VROverlayFlags_ProtectedContent = 1 << 18, 3745 + 3746 + // If this is set, the laser mouse splat will not be drawn over this overlay. The overlay will 3747 + // be responsible for drawing its own "cursor". 3748 + VROverlayFlags_HideLaserIntersection = 1 << 19, 3749 + 3750 + // If this is set, clicking away from the overlay will cause it to receive a VREvent_Modal_Cancel event. 3751 + // This is ignored for dashboard overlays. 3752 + VROverlayFlags_WantsModalBehavior = 1 << 20, 3753 + 3754 + // If this is set, alpha composition assumes the texture is pre-multiplied 3755 + VROverlayFlags_IsPremultiplied = 1 << 21, 3756 + }; 3757 + 3758 + enum VRMessageOverlayResponse 3759 + { 3760 + VRMessageOverlayResponse_ButtonPress_0 = 0, 3761 + VRMessageOverlayResponse_ButtonPress_1 = 1, 3762 + VRMessageOverlayResponse_ButtonPress_2 = 2, 3763 + VRMessageOverlayResponse_ButtonPress_3 = 3, 3764 + VRMessageOverlayResponse_CouldntFindSystemOverlay = 4, 3765 + VRMessageOverlayResponse_CouldntFindOrCreateClientOverlay= 5, 3766 + VRMessageOverlayResponse_ApplicationQuit = 6 3767 + }; 3768 + 3769 + struct VROverlayIntersectionParams_t 3770 + { 3771 + HmdVector3_t vSource; 3772 + HmdVector3_t vDirection; 3773 + ETrackingUniverseOrigin eOrigin; 3774 + }; 3775 + 3776 + struct VROverlayIntersectionResults_t 3777 + { 3778 + HmdVector3_t vPoint; 3779 + HmdVector3_t vNormal; 3780 + HmdVector2_t vUVs; 3781 + float fDistance; 3782 + }; 3783 + 3784 + // Input modes for the Big Picture gamepad text entry 3785 + enum EGamepadTextInputMode 3786 + { 3787 + k_EGamepadTextInputModeNormal = 0, 3788 + k_EGamepadTextInputModePassword = 1, 3789 + k_EGamepadTextInputModeSubmit = 2, 3790 + }; 3791 + 3792 + // Controls number of allowed lines for the Big Picture gamepad text entry 3793 + enum EGamepadTextInputLineMode 3794 + { 3795 + k_EGamepadTextInputLineModeSingleLine = 0, 3796 + k_EGamepadTextInputLineModeMultipleLines = 1 3797 + }; 3798 + 3799 + enum EVROverlayIntersectionMaskPrimitiveType 3800 + { 3801 + OverlayIntersectionPrimitiveType_Rectangle, 3802 + OverlayIntersectionPrimitiveType_Circle, 3803 + }; 3804 + 3805 + struct IntersectionMaskRectangle_t 3806 + { 3807 + float m_flTopLeftX; 3808 + float m_flTopLeftY; 3809 + float m_flWidth; 3810 + float m_flHeight; 3811 + }; 3812 + 3813 + struct IntersectionMaskCircle_t 3814 + { 3815 + float m_flCenterX; 3816 + float m_flCenterY; 3817 + float m_flRadius; 3818 + }; 3819 + 3820 + /** NOTE!!! If you change this you MUST manually update openvr_interop.cs.py and openvr_api_flat.h.py */ 3821 + typedef union 3822 + { 3823 + IntersectionMaskRectangle_t m_Rectangle; 3824 + IntersectionMaskCircle_t m_Circle; 3825 + } VROverlayIntersectionMaskPrimitive_Data_t; 3826 + 3827 + struct VROverlayIntersectionMaskPrimitive_t 3828 + { 3829 + EVROverlayIntersectionMaskPrimitiveType m_nPrimitiveType; 3830 + VROverlayIntersectionMaskPrimitive_Data_t m_Primitive; 3831 + }; 3832 + 3833 + enum EKeyboardFlags 3834 + { 3835 + KeyboardFlag_Minimal = 1 << 0, // makes the keyboard send key events immediately instead of accumulating a buffer 3836 + KeyboardFlag_Modal = 2 << 0, // makes the keyboard take all focus and dismiss when clicking off the panel 3837 + }; 3838 + 3839 + /** Defines the project used in an overlay that is using SetOverlayTransformProjection */ 3840 + struct VROverlayProjection_t 3841 + { 3842 + /** Tangent of the sides of the frustum */ 3843 + float fLeft; 3844 + float fRight; 3845 + float fTop; 3846 + float fBottom; 3847 + }; 3848 + 3849 + class IVROverlay 3850 + { 3851 + public: 3852 + 3853 + // --------------------------------------------- 3854 + // Overlay management methods 3855 + // --------------------------------------------- 3856 + 3857 + /** Finds an existing overlay with the specified key. */ 3858 + virtual EVROverlayError FindOverlay( const char *pchOverlayKey, VROverlayHandle_t * pOverlayHandle ) = 0; 3859 + 3860 + /** Creates a new named overlay. All overlays start hidden and with default settings. */ 3861 + virtual EVROverlayError CreateOverlay( const char *pchOverlayKey, const char *pchOverlayName, VROverlayHandle_t * pOverlayHandle ) = 0; 3862 + 3863 + /** Destroys the specified overlay. When an application calls VR_Shutdown all overlays created by that app are 3864 + * automatically destroyed. */ 3865 + virtual EVROverlayError DestroyOverlay( VROverlayHandle_t ulOverlayHandle ) = 0; 3866 + 3867 + /** Fills the provided buffer with the string key of the overlay. Returns the size of buffer required to store the key, including 3868 + * the terminating null character. k_unVROverlayMaxKeyLength will be enough bytes to fit the string. */ 3869 + virtual uint32_t GetOverlayKey( VROverlayHandle_t ulOverlayHandle, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize, EVROverlayError *pError = 0L ) = 0; 3870 + 3871 + /** Fills the provided buffer with the friendly name of the overlay. Returns the size of buffer required to store the key, including 3872 + * the terminating null character. k_unVROverlayMaxNameLength will be enough bytes to fit the string. */ 3873 + virtual uint32_t GetOverlayName( VROverlayHandle_t ulOverlayHandle, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize, EVROverlayError *pError = 0L ) = 0; 3874 + 3875 + /** set the name to use for this overlay */ 3876 + virtual EVROverlayError SetOverlayName( VROverlayHandle_t ulOverlayHandle, const char *pchName ) = 0; 3877 + 3878 + /** 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 3879 + * will be set and VROverlayError_ArrayTooSmall is returned. */ 3880 + virtual EVROverlayError GetOverlayImageData( VROverlayHandle_t ulOverlayHandle, void *pvBuffer, uint32_t unBufferSize, uint32_t *punWidth, uint32_t *punHeight ) = 0; 3881 + 3882 + /** returns a string that corresponds with the specified overlay error. The string will be the name 3883 + * of the error enum value for all valid error codes */ 3884 + virtual const char *GetOverlayErrorNameFromEnum( EVROverlayError error ) = 0; 3885 + 3886 + // --------------------------------------------- 3887 + // Overlay rendering methods 3888 + // --------------------------------------------- 3889 + 3890 + /** Sets the pid that is allowed to render to this overlay (the creator pid is always allow to render), 3891 + * by default this is the pid of the process that made the overlay */ 3892 + virtual EVROverlayError SetOverlayRenderingPid( VROverlayHandle_t ulOverlayHandle, uint32_t unPID ) = 0; 3893 + 3894 + /** Gets the pid that is allowed to render to this overlay */ 3895 + virtual uint32_t GetOverlayRenderingPid( VROverlayHandle_t ulOverlayHandle ) = 0; 3896 + 3897 + /** Specify flag setting for a given overlay */ 3898 + virtual EVROverlayError SetOverlayFlag( VROverlayHandle_t ulOverlayHandle, VROverlayFlags eOverlayFlag, bool bEnabled ) = 0; 3899 + 3900 + /** Sets flag setting for a given overlay */ 3901 + virtual EVROverlayError GetOverlayFlag( VROverlayHandle_t ulOverlayHandle, VROverlayFlags eOverlayFlag, bool *pbEnabled ) = 0; 3902 + 3903 + /** Gets all the flags for a given overlay */ 3904 + virtual EVROverlayError GetOverlayFlags( VROverlayHandle_t ulOverlayHandle, uint32_t *pFlags ) = 0; 3905 + 3906 + /** Sets the color tint of the overlay quad. Use 0.0 to 1.0 per channel. */ 3907 + virtual EVROverlayError SetOverlayColor( VROverlayHandle_t ulOverlayHandle, float fRed, float fGreen, float fBlue ) = 0; 3908 + 3909 + /** Gets the color tint of the overlay quad. */ 3910 + virtual EVROverlayError GetOverlayColor( VROverlayHandle_t ulOverlayHandle, float *pfRed, float *pfGreen, float *pfBlue ) = 0; 3911 + 3912 + /** Sets the alpha of the overlay quad. Use 1.0 for 100 percent opacity to 0.0 for 0 percent opacity. */ 3913 + virtual EVROverlayError SetOverlayAlpha( VROverlayHandle_t ulOverlayHandle, float fAlpha ) = 0; 3914 + 3915 + /** Gets the alpha of the overlay quad. By default overlays are rendering at 100 percent alpha (1.0). */ 3916 + virtual EVROverlayError GetOverlayAlpha( VROverlayHandle_t ulOverlayHandle, float *pfAlpha ) = 0; 3917 + 3918 + /** Sets the aspect ratio of the texels in the overlay. 1.0 means the texels are square. 2.0 means the texels 3919 + * are twice as wide as they are tall. Defaults to 1.0. */ 3920 + virtual EVROverlayError SetOverlayTexelAspect( VROverlayHandle_t ulOverlayHandle, float fTexelAspect ) = 0; 3921 + 3922 + /** Gets the aspect ratio of the texels in the overlay. Defaults to 1.0 */ 3923 + virtual EVROverlayError GetOverlayTexelAspect( VROverlayHandle_t ulOverlayHandle, float *pfTexelAspect ) = 0; 3924 + 3925 + /** Sets the rendering sort order for the overlay. Overlays are rendered this order: 3926 + * Overlays owned by the scene application 3927 + * Overlays owned by some other application 3928 + * 3929 + * Within a category overlays are rendered lowest sort order to highest sort order. Overlays with the same 3930 + * sort order are rendered back to front base on distance from the HMD. 3931 + * 3932 + * Sort order defaults to 0. */ 3933 + virtual EVROverlayError SetOverlaySortOrder( VROverlayHandle_t ulOverlayHandle, uint32_t unSortOrder ) = 0; 3934 + 3935 + /** Gets the sort order of the overlay. See SetOverlaySortOrder for how this works. */ 3936 + virtual EVROverlayError GetOverlaySortOrder( VROverlayHandle_t ulOverlayHandle, uint32_t *punSortOrder ) = 0; 3937 + 3938 + /** Sets the width of the overlay quad in meters. By default overlays are rendered on a quad that is 1 meter across */ 3939 + virtual EVROverlayError SetOverlayWidthInMeters( VROverlayHandle_t ulOverlayHandle, float fWidthInMeters ) = 0; 3940 + 3941 + /** Returns the width of the overlay quad in meters. By default overlays are rendered on a quad that is 1 meter across */ 3942 + virtual EVROverlayError GetOverlayWidthInMeters( VROverlayHandle_t ulOverlayHandle, float *pfWidthInMeters ) = 0; 3943 + 3944 + /** Use to draw overlay as a curved surface. Curvature is a percentage from (0..1] where 1 is a fully closed cylinder. 3945 + * For a specific radius, curvature can be computed as: overlay.width / (2 PI r). */ 3946 + virtual EVROverlayError SetOverlayCurvature( VROverlayHandle_t ulOverlayHandle, float fCurvature ) = 0; 3947 + 3948 + /** Returns the curvature of the overlay as a percentage from (0..1] where 1 is a fully closed cylinder. */ 3949 + virtual EVROverlayError GetOverlayCurvature( VROverlayHandle_t ulOverlayHandle, float *pfCurvature ) = 0; 3950 + 3951 + /** Sets the colorspace the overlay texture's data is in. Defaults to 'auto'. 3952 + * If the texture needs to be resolved, you should call SetOverlayTexture with the appropriate colorspace instead. */ 3953 + virtual EVROverlayError SetOverlayTextureColorSpace( VROverlayHandle_t ulOverlayHandle, EColorSpace eTextureColorSpace ) = 0; 3954 + 3955 + /** Gets the overlay's current colorspace setting. */ 3956 + virtual EVROverlayError GetOverlayTextureColorSpace( VROverlayHandle_t ulOverlayHandle, EColorSpace *peTextureColorSpace ) = 0; 3957 + 3958 + /** 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. */ 3959 + virtual EVROverlayError SetOverlayTextureBounds( VROverlayHandle_t ulOverlayHandle, const VRTextureBounds_t *pOverlayTextureBounds ) = 0; 3960 + 3961 + /** 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. */ 3962 + virtual EVROverlayError GetOverlayTextureBounds( VROverlayHandle_t ulOverlayHandle, VRTextureBounds_t *pOverlayTextureBounds ) = 0; 3963 + 3964 + /** Returns the transform type of this overlay. */ 3965 + virtual EVROverlayError GetOverlayTransformType( VROverlayHandle_t ulOverlayHandle, VROverlayTransformType *peTransformType ) = 0; 3966 + 3967 + /** Sets the transform to absolute tracking origin. */ 3968 + virtual EVROverlayError SetOverlayTransformAbsolute( VROverlayHandle_t ulOverlayHandle, ETrackingUniverseOrigin eTrackingOrigin, const HmdMatrix34_t *pmatTrackingOriginToOverlayTransform ) = 0; 3969 + 3970 + /** Gets the transform if it is absolute. Returns an error if the transform is some other type. */ 3971 + virtual EVROverlayError GetOverlayTransformAbsolute( VROverlayHandle_t ulOverlayHandle, ETrackingUniverseOrigin *peTrackingOrigin, HmdMatrix34_t *pmatTrackingOriginToOverlayTransform ) = 0; 3972 + 3973 + /** Sets the transform to relative to the transform of the specified tracked device. */ 3974 + virtual EVROverlayError SetOverlayTransformTrackedDeviceRelative( VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t unTrackedDevice, const HmdMatrix34_t *pmatTrackedDeviceToOverlayTransform ) = 0; 3975 + 3976 + /** Gets the transform if it is relative to a tracked device. Returns an error if the transform is some other type. */ 3977 + virtual EVROverlayError GetOverlayTransformTrackedDeviceRelative( VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t *punTrackedDevice, HmdMatrix34_t *pmatTrackedDeviceToOverlayTransform ) = 0; 3978 + 3979 + /** Sets the transform to draw the overlay on a rendermodel component mesh instead of a quad. This will only draw when the system is 3980 + * drawing the device. Overlays with this transform type cannot receive mouse events. */ 3981 + virtual EVROverlayError SetOverlayTransformTrackedDeviceComponent( VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t unDeviceIndex, const char *pchComponentName ) = 0; 3982 + 3983 + /** Gets the transform information when the overlay is rendering on a component. */ 3984 + virtual EVROverlayError GetOverlayTransformTrackedDeviceComponent( VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t *punDeviceIndex, VR_OUT_STRING() char *pchComponentName, uint32_t unComponentNameSize ) = 0; 3985 + 3986 + /** Gets the transform if it is relative to another overlay. Returns an error if the transform is some other type. */ 3987 + virtual vr::EVROverlayError GetOverlayTransformOverlayRelative( VROverlayHandle_t ulOverlayHandle, VROverlayHandle_t *ulOverlayHandleParent, HmdMatrix34_t *pmatParentOverlayToOverlayTransform ) = 0; 3988 + 3989 + /** Sets the transform to relative to the transform of the specified overlay. This overlays visibility will also track the parents visibility */ 3990 + virtual vr::EVROverlayError SetOverlayTransformOverlayRelative( VROverlayHandle_t ulOverlayHandle, VROverlayHandle_t ulOverlayHandleParent, const HmdMatrix34_t *pmatParentOverlayToOverlayTransform ) = 0; 3991 + 3992 + /** Sets the hotspot for the specified overlay when that overlay is used as a cursor. These are in texture space with 0,0 in the upper left corner of 3993 + * the texture and 1,1 in the lower right corner of the texture. */ 3994 + virtual EVROverlayError SetOverlayTransformCursor( VROverlayHandle_t ulCursorOverlayHandle, const HmdVector2_t *pvHotspot ) = 0; 3995 + 3996 + /** Gets cursor hotspot/transform for the specified overlay */ 3997 + virtual vr::EVROverlayError GetOverlayTransformCursor( VROverlayHandle_t ulOverlayHandle, HmdVector2_t *pvHotspot ) = 0; 3998 + 3999 + /** Sets the overlay as a projection overlay */ 4000 + virtual vr::EVROverlayError SetOverlayTransformProjection( VROverlayHandle_t ulOverlayHandle, 4001 + ETrackingUniverseOrigin eTrackingOrigin, const HmdMatrix34_t* pmatTrackingOriginToOverlayTransform, 4002 + const VROverlayProjection_t *pProjection, vr::EVREye eEye ) = 0; 4003 + 4004 + /** Shows the VR overlay. For dashboard overlays, only the Dashboard Manager is allowed to call this. */ 4005 + virtual EVROverlayError ShowOverlay( VROverlayHandle_t ulOverlayHandle ) = 0; 4006 + 4007 + /** Hides the VR overlay. For dashboard overlays, only the Dashboard Manager is allowed to call this. */ 4008 + virtual EVROverlayError HideOverlay( VROverlayHandle_t ulOverlayHandle ) = 0; 4009 + 4010 + /** Returns true if the overlay is visible. */ 4011 + virtual bool IsOverlayVisible( VROverlayHandle_t ulOverlayHandle ) = 0; 4012 + 4013 + /** 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 */ 4014 + virtual EVROverlayError GetTransformForOverlayCoordinates( VROverlayHandle_t ulOverlayHandle, ETrackingUniverseOrigin eTrackingOrigin, HmdVector2_t coordinatesInOverlay, HmdMatrix34_t *pmatTransform ) = 0; 4015 + 4016 + // --------------------------------------------- 4017 + // Overlay input methods 4018 + // --------------------------------------------- 4019 + 4020 + /** Returns true and fills the event with the next event on the overlay's event queue, if there is one. 4021 + * If there are no events this method returns false. uncbVREvent should be the size in bytes of the VREvent_t struct */ 4022 + virtual bool PollNextOverlayEvent( VROverlayHandle_t ulOverlayHandle, VREvent_t *pEvent, uint32_t uncbVREvent ) = 0; 4023 + 4024 + /** Returns the current input settings for the specified overlay. */ 4025 + virtual EVROverlayError GetOverlayInputMethod( VROverlayHandle_t ulOverlayHandle, VROverlayInputMethod *peInputMethod ) = 0; 4026 + 4027 + /** Sets the input settings for the specified overlay. */ 4028 + virtual EVROverlayError SetOverlayInputMethod( VROverlayHandle_t ulOverlayHandle, VROverlayInputMethod eInputMethod ) = 0; 4029 + 4030 + /** Gets the mouse scaling factor that is used for mouse events. The actual texture may be a different size, but this is 4031 + * typically the size of the underlying UI in pixels. */ 4032 + virtual EVROverlayError GetOverlayMouseScale( VROverlayHandle_t ulOverlayHandle, HmdVector2_t *pvecMouseScale ) = 0; 4033 + 4034 + /** Sets the mouse scaling factor that is used for mouse events. The actual texture may be a different size, but this is 4035 + * typically the size of the underlying UI in pixels (not in world space). */ 4036 + virtual EVROverlayError SetOverlayMouseScale( VROverlayHandle_t ulOverlayHandle, const HmdVector2_t *pvecMouseScale ) = 0; 4037 + 4038 + /** Computes the overlay-space pixel coordinates of where the ray intersects the overlay with the 4039 + * specified settings. Returns false if there is no intersection. */ 4040 + virtual bool ComputeOverlayIntersection( VROverlayHandle_t ulOverlayHandle, const VROverlayIntersectionParams_t *pParams, VROverlayIntersectionResults_t *pResults ) = 0; 4041 + 4042 + /** Returns true if the specified overlay is the hover target. An overlay is the hover target when it is the last overlay "moused over" 4043 + * by the virtual mouse pointer */ 4044 + virtual bool IsHoverTargetOverlay( VROverlayHandle_t ulOverlayHandle ) = 0; 4045 + 4046 + /** Sets a list of primitives to be used for controller ray intersection 4047 + * typically the size of the underlying UI in pixels (not in world space). */ 4048 + virtual EVROverlayError SetOverlayIntersectionMask( VROverlayHandle_t ulOverlayHandle, VROverlayIntersectionMaskPrimitive_t *pMaskPrimitives, uint32_t unNumMaskPrimitives, uint32_t unPrimitiveSize = sizeof( VROverlayIntersectionMaskPrimitive_t ) ) = 0; 4049 + 4050 + /** Triggers a haptic event on the laser mouse controller for the specified overlay */ 4051 + virtual EVROverlayError TriggerLaserMouseHapticVibration( VROverlayHandle_t ulOverlayHandle, float fDurationSeconds, float fFrequency, float fAmplitude ) = 0; 4052 + 4053 + /** Sets the cursor to use for the specified overlay. This will be drawn instead of the generic blob when the laser mouse is pointed at the specified overlay */ 4054 + virtual EVROverlayError SetOverlayCursor( VROverlayHandle_t ulOverlayHandle, VROverlayHandle_t ulCursorHandle ) = 0; 4055 + 4056 + /** Sets the override cursor position to use for this overlay in overlay mouse coordinates. This position will be used to draw the cursor 4057 + * instead of whatever the laser mouse cursor position is. */ 4058 + virtual EVROverlayError SetOverlayCursorPositionOverride( VROverlayHandle_t ulOverlayHandle, const HmdVector2_t *pvCursor ) = 0; 4059 + 4060 + /** Clears the override cursor position for this overlay */ 4061 + virtual EVROverlayError ClearOverlayCursorPositionOverride( VROverlayHandle_t ulOverlayHandle ) = 0; 4062 + 4063 + // --------------------------------------------- 4064 + // Overlay texture methods 4065 + // --------------------------------------------- 4066 + 4067 + /** Texture to draw for the overlay. This function can only be called by the overlay's creator or renderer process (see SetOverlayRenderingPid) . 4068 + * 4069 + * OpenGL dirty state: 4070 + * glBindTexture 4071 + */ 4072 + virtual EVROverlayError SetOverlayTexture( VROverlayHandle_t ulOverlayHandle, const Texture_t *pTexture ) = 0; 4073 + 4074 + /** Use this to tell the overlay system to release the texture set for this overlay. */ 4075 + virtual EVROverlayError ClearOverlayTexture( VROverlayHandle_t ulOverlayHandle ) = 0; 4076 + 4077 + /** Separate interface for providing the data as a stream of bytes, but there is an upper bound on data 4078 + * that can be sent. This function can only be called by the overlay's renderer process. */ 4079 + virtual EVROverlayError SetOverlayRaw( VROverlayHandle_t ulOverlayHandle, void *pvBuffer, uint32_t unWidth, uint32_t unHeight, uint32_t unBytesPerPixel ) = 0; 4080 + 4081 + /** Separate interface for providing the image through a filename: can be png or jpg, and should not be bigger than 1920x1080. 4082 + * This function can only be called by the overlay's renderer process */ 4083 + virtual EVROverlayError SetOverlayFromFile( VROverlayHandle_t ulOverlayHandle, const char *pchFilePath ) = 0; 4084 + 4085 + /** Get the native texture handle/device for an overlay you have created. 4086 + * On windows this handle will be a ID3D11ShaderResourceView with a ID3D11Texture2D bound. 4087 + * 4088 + * The texture will always be sized to match the backing texture you supplied in SetOverlayTexture above. 4089 + * 4090 + * You MUST call ReleaseNativeOverlayHandle() with pNativeTextureHandle once you are done with this texture. 4091 + * 4092 + * pNativeTextureHandle is an OUTPUT, it will be a pointer to a ID3D11ShaderResourceView *. 4093 + * pNativeTextureRef is an INPUT and should be a ID3D11Resource *. The device used by pNativeTextureRef will be used to bind pNativeTextureHandle. 4094 + */ 4095 + 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; 4096 + 4097 + /** Release the pNativeTextureHandle provided from the GetOverlayTexture call, this allows the system to free the underlying GPU resources for this object, 4098 + * so only do it once you stop rendering this texture. 4099 + */ 4100 + virtual EVROverlayError ReleaseNativeOverlayHandle( VROverlayHandle_t ulOverlayHandle, void *pNativeTextureHandle ) = 0; 4101 + 4102 + /** Get the size of the overlay texture */ 4103 + virtual EVROverlayError GetOverlayTextureSize( VROverlayHandle_t ulOverlayHandle, uint32_t *pWidth, uint32_t *pHeight ) = 0; 4104 + 4105 + // ---------------------------------------------- 4106 + // Dashboard Overlay Methods 4107 + // ---------------------------------------------- 4108 + 4109 + /** Creates a dashboard overlay and returns its handle */ 4110 + virtual EVROverlayError CreateDashboardOverlay( const char *pchOverlayKey, const char *pchOverlayFriendlyName, VROverlayHandle_t * pMainHandle, VROverlayHandle_t *pThumbnailHandle ) = 0; 4111 + 4112 + /** Returns true if the dashboard is visible */ 4113 + virtual bool IsDashboardVisible() = 0; 4114 + 4115 + /** returns true if the dashboard is visible and the specified overlay is the active system Overlay */ 4116 + virtual bool IsActiveDashboardOverlay( VROverlayHandle_t ulOverlayHandle ) = 0; 4117 + 4118 + /** Sets the dashboard overlay to only appear when the specified process ID has scene focus */ 4119 + virtual EVROverlayError SetDashboardOverlaySceneProcess( VROverlayHandle_t ulOverlayHandle, uint32_t unProcessId ) = 0; 4120 + 4121 + /** Gets the process ID that this dashboard overlay requires to have scene focus */ 4122 + virtual EVROverlayError GetDashboardOverlaySceneProcess( VROverlayHandle_t ulOverlayHandle, uint32_t *punProcessId ) = 0; 4123 + 4124 + /** Shows the dashboard. */ 4125 + virtual void ShowDashboard( const char *pchOverlayToShow ) = 0; 4126 + 4127 + /** Returns the tracked device that has the laser pointer in the dashboard */ 4128 + virtual vr::TrackedDeviceIndex_t GetPrimaryDashboardDevice() = 0; 4129 + 4130 + // --------------------------------------------- 4131 + // Keyboard methods 4132 + // --------------------------------------------- 4133 + 4134 + /** Show the virtual keyboard to accept input. In most cases, you should pass KeyboardFlag_Modal to enable modal overlay 4135 + * behavior on the keyboard itself. See EKeyboardFlags for more. */ 4136 + virtual EVROverlayError ShowKeyboard( EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, uint32_t unFlags, 4137 + const char *pchDescription, uint32_t unCharMax, const char *pchExistingText, uint64_t uUserValue ) = 0; 4138 + 4139 + /** Show the virtual keyboard to accept input for an overlay. In most cases, you should pass KeyboardFlag_Modal to enable modal 4140 + * overlay behavior on the keyboard itself. See EKeyboardFlags for more. */ 4141 + virtual EVROverlayError ShowKeyboardForOverlay( VROverlayHandle_t ulOverlayHandle, EGamepadTextInputMode eInputMode, 4142 + EGamepadTextInputLineMode eLineInputMode, uint32_t unFlags, const char *pchDescription, uint32_t unCharMax, 4143 + const char *pchExistingText, uint64_t uUserValue ) = 0; 4144 + 4145 + /** Get the text that was entered into the text input **/ 4146 + virtual uint32_t GetKeyboardText( VR_OUT_STRING() char *pchText, uint32_t cchText ) = 0; 4147 + 4148 + /** Hide the virtual keyboard **/ 4149 + virtual void HideKeyboard() = 0; 4150 + 4151 + /** Set the position of the keyboard in world space **/ 4152 + virtual void SetKeyboardTransformAbsolute( ETrackingUniverseOrigin eTrackingOrigin, const HmdMatrix34_t *pmatTrackingOriginToKeyboardTransform ) = 0; 4153 + 4154 + /** 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 **/ 4155 + virtual void SetKeyboardPositionForOverlay( VROverlayHandle_t ulOverlayHandle, HmdRect2_t avoidRect ) = 0; 4156 + 4157 + // --------------------------------------------- 4158 + // Message box methods 4159 + // --------------------------------------------- 4160 + 4161 + /** Show the message overlay. This will block and return you a result. **/ 4162 + 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; 4163 + 4164 + /** If the calling process owns the overlay and it's open, this will close it. **/ 4165 + virtual void CloseMessageOverlay() = 0; 4166 + }; 4167 + 4168 + static const char * const IVROverlay_Version = "IVROverlay_025"; 4169 + 4170 + } // namespace vr 4171 + 4172 + // ivroverlayview.h 4173 + 4174 + namespace vr 4175 + { 4176 + struct VROverlayView_t 4177 + { 4178 + VROverlayHandle_t overlayHandle; 4179 + Texture_t texture; 4180 + VRTextureBounds_t textureBounds; 4181 + }; 4182 + 4183 + enum EDeviceType 4184 + { 4185 + DeviceType_Invalid = -1, // Invalid handle 4186 + DeviceType_DirectX11 = 0, // Handle is an ID3D11Device 4187 + DeviceType_Vulkan = 1, // Handle is a pointer to a VRVulkanDevice_t structure 4188 + }; 4189 + 4190 + struct VRVulkanDevice_t 4191 + { 4192 + VkInstance_T *m_pInstance; 4193 + VkDevice_T *m_pDevice; 4194 + VkPhysicalDevice_T *m_pPhysicalDevice; 4195 + VkQueue_T *m_pQueue; 4196 + uint32_t m_uQueueFamilyIndex; 4197 + }; 4198 + 4199 + struct VRNativeDevice_t 4200 + { 4201 + void *handle; // See EDeviceType definition above 4202 + EDeviceType eType; 4203 + }; 4204 + 4205 + class IVROverlayView 4206 + { 4207 + public: 4208 + /** Acquire an OverlayView_t from an overlay handle 4209 + * 4210 + * The overlay view can be used to sample the contents directly by a native API. The 4211 + * contents of the OverlayView_t will remain unchanged through the lifetime of the 4212 + * OverlayView_t. 4213 + * 4214 + * The caller acquires read privileges over the OverlayView_t, but should not 4215 + * write to it. 4216 + * 4217 + * AcquireOverlayView() may be called on the same ulOverlayHandle multiple times to 4218 + * refresh the image contents. In this case the caller is strongly encouraged to re-use 4219 + * the same pOverlayView for all re-acquisition calls. 4220 + * 4221 + * If the producer has not yet queued an image, AcquireOverlayView will return success, 4222 + * and the Texture_t will have the expected ETextureType. However, the Texture_t->handle 4223 + * will be nullptr. Once the producer generates the first overlay frame, Texture_t->handle 4224 + * will become a valid handle. 4225 + */ 4226 + virtual EVROverlayError AcquireOverlayView(VROverlayHandle_t ulOverlayHandle, VRNativeDevice_t *pNativeDevice, VROverlayView_t *pOverlayView, uint32_t unOverlayViewSize ) = 0; 4227 + 4228 + /** Release an acquired OverlayView_t 4229 + * 4230 + * Denotes that pOverlayView will no longer require access to the resources it acquired in 4231 + * all previous calls to AcquireOverlayView(). 4232 + * 4233 + * All OverlayView_t*'s provided to AcquireOverlayView() as pOverlayViews must be 4234 + * passed into ReleaseOverlayView() in order for the underlying GPU resources to be freed. 4235 + */ 4236 + virtual EVROverlayError ReleaseOverlayView(VROverlayView_t *pOverlayView) = 0; 4237 + 4238 + /** Posts an overlay event */ 4239 + virtual void PostOverlayEvent(VROverlayHandle_t ulOverlayHandle, const VREvent_t *pvrEvent) = 0; 4240 + 4241 + /** Determines whether this process is permitted to view an overlay's content. */ 4242 + virtual bool IsViewingPermitted( VROverlayHandle_t ulOverlayHandle ) = 0; 4243 + 4244 + }; 4245 + 4246 + static const char * const IVROverlayView_Version = "IVROverlayView_003"; 4247 + 4248 + } 4249 + 4250 + // ivrrendermodels.h 4251 + 4252 + namespace vr 4253 + { 4254 + 4255 + static const char * const k_pch_Controller_Component_GDC2015 = "gdc2015"; // Canonical coordinate system of the gdc 2015 wired controller, provided for backwards compatibility 4256 + static const char * const k_pch_Controller_Component_Base = "base"; // For controllers with an unambiguous 'base'. 4257 + static const char * const k_pch_Controller_Component_Tip = "tip"; // For controllers with an unambiguous 'tip' (used for 'laser-pointing') 4258 + 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 4259 + static const char * const k_pch_Controller_Component_Status = "status"; // 1:1 aspect ratio status area, with canonical [0,1] uv mapping 4260 + 4261 + #pragma pack( push, 8 ) 4262 + 4263 + /** Errors that can occur with the VR compositor */ 4264 + enum EVRRenderModelError 4265 + { 4266 + VRRenderModelError_None = 0, 4267 + VRRenderModelError_Loading = 100, 4268 + VRRenderModelError_NotSupported = 200, 4269 + VRRenderModelError_InvalidArg = 300, 4270 + VRRenderModelError_InvalidModel = 301, 4271 + VRRenderModelError_NoShapes = 302, 4272 + VRRenderModelError_MultipleShapes = 303, 4273 + VRRenderModelError_TooManyVertices = 304, 4274 + VRRenderModelError_MultipleTextures = 305, 4275 + VRRenderModelError_BufferTooSmall = 306, 4276 + VRRenderModelError_NotEnoughNormals = 307, 4277 + VRRenderModelError_NotEnoughTexCoords = 308, 4278 + 4279 + VRRenderModelError_InvalidTexture = 400, 4280 + }; 4281 + 4282 + enum EVRRenderModelTextureFormat 4283 + { 4284 + VRRenderModelTextureFormat_RGBA8_SRGB = 0, // RGBA with 8 bits per channel per pixel. Data size is width * height * 4ub 4285 + VRRenderModelTextureFormat_BC2, 4286 + VRRenderModelTextureFormat_BC4, 4287 + VRRenderModelTextureFormat_BC7, 4288 + VRRenderModelTextureFormat_BC7_SRGB 4289 + }; 4290 + 4291 + /** A single vertex in a render model */ 4292 + struct RenderModel_Vertex_t 4293 + { 4294 + HmdVector3_t vPosition; // position in meters in device space 4295 + HmdVector3_t vNormal; 4296 + float rfTextureCoord[2]; 4297 + }; 4298 + 4299 + /** A texture map for use on a render model */ 4300 + #if defined(__linux__) || defined(__APPLE__) 4301 + // This structure was originally defined mis-packed on Linux, preserved for 4302 + // compatibility. 4303 + #pragma pack( push, 4 ) 4304 + #endif 4305 + 4306 + struct RenderModel_TextureMap_t 4307 + { 4308 + uint16_t unWidth, unHeight; // width and height of the texture map in pixels 4309 + const uint8_t *rubTextureMapData; // Map texture data. 4310 + EVRRenderModelTextureFormat format; // Refer to EVRRenderModelTextureFormat 4311 + }; 4312 + #if defined(__linux__) || defined(__APPLE__) 4313 + #pragma pack( pop ) 4314 + #endif 4315 + 4316 + /** Session unique texture identifier. Rendermodels which share the same texture will have the same id. 4317 + IDs <0 denote the texture is not present */ 4318 + 4319 + typedef int32_t TextureID_t; 4320 + 4321 + const TextureID_t INVALID_TEXTURE_ID = -1; 4322 + 4323 + #if defined(__linux__) || defined(__APPLE__) 4324 + // This structure was originally defined mis-packed on Linux, preserved for 4325 + // compatibility. 4326 + #pragma pack( push, 4 ) 4327 + #endif 4328 + 4329 + struct RenderModel_t 4330 + { 4331 + const RenderModel_Vertex_t *rVertexData; // Vertex data for the mesh 4332 + uint32_t unVertexCount; // Number of vertices in the vertex data 4333 + const uint16_t *rIndexData; // Indices into the vertex data for each triangle 4334 + uint32_t unTriangleCount; // Number of triangles in the mesh. Index count is 3 * TriangleCount 4335 + TextureID_t diffuseTextureId; // Session unique texture identifier. Rendermodels which share the same texture will have the same id. <0 == texture not present 4336 + }; 4337 + #if defined(__linux__) || defined(__APPLE__) 4338 + #pragma pack( pop ) 4339 + #endif 4340 + 4341 + 4342 + struct RenderModel_ControllerMode_State_t 4343 + { 4344 + bool bScrollWheelVisible; // is this controller currently set to be in a scroll wheel mode 4345 + }; 4346 + 4347 + #pragma pack( pop ) 4348 + 4349 + class IVRRenderModels 4350 + { 4351 + public: 4352 + 4353 + /** Loads and returns a render model for use in the application. pchRenderModelName should be a render model name 4354 + * from the Prop_RenderModelName_String property or an absolute path name to a render model on disk. 4355 + * 4356 + * The resulting render model is valid until VR_Shutdown() is called or until FreeRenderModel() is called. When the 4357 + * application is finished with the render model it should call FreeRenderModel() to free the memory associated 4358 + * with the model. 4359 + * 4360 + * The method returns VRRenderModelError_Loading while the render model is still being loaded. 4361 + * The method returns VRRenderModelError_None once loaded successfully, otherwise will return an error. */ 4362 + virtual EVRRenderModelError LoadRenderModel_Async( const char *pchRenderModelName, RenderModel_t **ppRenderModel ) = 0; 4363 + 4364 + /** Frees a previously returned render model 4365 + * It is safe to call this on a null ptr. */ 4366 + virtual void FreeRenderModel( RenderModel_t *pRenderModel ) = 0; 4367 + 4368 + /** Loads and returns a texture for use in the application. */ 4369 + virtual EVRRenderModelError LoadTexture_Async( TextureID_t textureId, RenderModel_TextureMap_t **ppTexture ) = 0; 4370 + 4371 + /** Frees a previously returned texture 4372 + * It is safe to call this on a null ptr. */ 4373 + virtual void FreeTexture( RenderModel_TextureMap_t *pTexture ) = 0; 4374 + 4375 + /** Creates a D3D11 texture and loads data into it. */ 4376 + virtual EVRRenderModelError LoadTextureD3D11_Async( TextureID_t textureId, void *pD3D11Device, void **ppD3D11Texture2D ) = 0; 4377 + 4378 + /** Helper function to copy the bits into an existing texture. */ 4379 + virtual EVRRenderModelError LoadIntoTextureD3D11_Async( TextureID_t textureId, void *pDstTexture ) = 0; 4380 + 4381 + /** Use this to free textures created with LoadTextureD3D11_Async instead of calling Release on them. */ 4382 + virtual void FreeTextureD3D11( void *pD3D11Texture2D ) = 0; 4383 + 4384 + /** Use this to get the names of available render models. Index does not correlate to a tracked device index, but 4385 + * is only used for iterating over all available render models. If the index is out of range, this function will return 0. 4386 + * Otherwise, it will return the size of the buffer required for the name. */ 4387 + virtual uint32_t GetRenderModelName( uint32_t unRenderModelIndex, VR_OUT_STRING() char *pchRenderModelName, uint32_t unRenderModelNameLen ) = 0; 4388 + 4389 + /** Returns the number of available render models. */ 4390 + virtual uint32_t GetRenderModelCount() = 0; 4391 + 4392 + 4393 + /** Returns the number of components of the specified render model. 4394 + * Components are useful when client application wish to draw, label, or otherwise interact with components of tracked objects. 4395 + * Examples controller components: 4396 + * renderable things such as triggers, buttons 4397 + * non-renderable things which include coordinate systems such as 'tip', 'base', a neutral controller agnostic hand-pose 4398 + * If all controller components are enumerated and rendered, it will be equivalent to drawing the traditional render model 4399 + * Returns 0 if components not supported, >0 otherwise */ 4400 + virtual uint32_t GetComponentCount( const char *pchRenderModelName ) = 0; 4401 + 4402 + /** Use this to get the names of available components. Index does not correlate to a tracked device index, but 4403 + * is only used for iterating over all available components. If the index is out of range, this function will return 0. 4404 + * Otherwise, it will return the size of the buffer required for the name. */ 4405 + virtual uint32_t GetComponentName( const char *pchRenderModelName, uint32_t unComponentIndex, VR_OUT_STRING( ) char *pchComponentName, uint32_t unComponentNameLen ) = 0; 4406 + 4407 + /** Get the button mask for all buttons associated with this component 4408 + * If no buttons (or axes) are associated with this component, return 0 4409 + * Note: multiple components may be associated with the same button. Ex: two grip buttons on a single controller. 4410 + * Note: A single component may be associated with multiple buttons. Ex: A trackpad which also provides "D-pad" functionality */ 4411 + virtual uint64_t GetComponentButtonMask( const char *pchRenderModelName, const char *pchComponentName ) = 0; 4412 + 4413 + /** Use this to get the render model name for the specified rendermode/component combination, to be passed to LoadRenderModel. 4414 + * If the component name is out of range, this function will return 0. 4415 + * Otherwise, it will return the size of the buffer required for the name. */ 4416 + virtual uint32_t GetComponentRenderModelName( const char *pchRenderModelName, const char *pchComponentName, VR_OUT_STRING( ) char *pchComponentRenderModelName, uint32_t unComponentRenderModelNameLen ) = 0; 4417 + 4418 + /** Use this to query information about the component, as a function of the controller state. 4419 + * 4420 + * For dynamic controller components (ex: trigger) values will reflect component motions 4421 + * For static components this will return a consistent value independent of the VRControllerState_t 4422 + * 4423 + * If the pchRenderModelName or pchComponentName is invalid, this will return false (and transforms will be set to identity). 4424 + * Otherwise, return true 4425 + * Note: For dynamic objects, visibility may be dynamic. (I.e., true/false will be returned based on controller state and controller mode state ) */ 4426 + virtual bool GetComponentStateForDevicePath( const char *pchRenderModelName, const char *pchComponentName, vr::VRInputValueHandle_t devicePath, const vr::RenderModel_ControllerMode_State_t *pState, vr::RenderModel_ComponentState_t *pComponentState ) = 0; 4427 + 4428 + /** This version of GetComponentState takes a controller state block instead of an action origin. This function is deprecated. You should use the new input system and GetComponentStateForDevicePath instead. */ 4429 + 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; 4430 + 4431 + /** Returns true if the render model has a component with the specified name */ 4432 + virtual bool RenderModelHasComponent( const char *pchRenderModelName, const char *pchComponentName ) = 0; 4433 + 4434 + /** Returns the URL of the thumbnail image for this rendermodel */ 4435 + virtual uint32_t GetRenderModelThumbnailURL( const char *pchRenderModelName, VR_OUT_STRING() char *pchThumbnailURL, uint32_t unThumbnailURLLen, vr::EVRRenderModelError *peError ) = 0; 4436 + 4437 + /** 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 4438 + * 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 4439 + * model. */ 4440 + virtual uint32_t GetRenderModelOriginalPath( const char *pchRenderModelName, VR_OUT_STRING() char *pchOriginalPath, uint32_t unOriginalPathLen, vr::EVRRenderModelError *peError ) = 0; 4441 + 4442 + /** Returns a string for a render model error */ 4443 + virtual const char *GetRenderModelErrorNameFromEnum( vr::EVRRenderModelError error ) = 0; 4444 + }; 4445 + 4446 + static const char * const IVRRenderModels_Version = "IVRRenderModels_006"; 4447 + 4448 + } 4449 + 4450 + 4451 + // ivrextendeddisplay.h 4452 + 4453 + namespace vr 4454 + { 4455 + 4456 + /** NOTE: Use of this interface is not recommended in production applications. It will not work for displays which use 4457 + * direct-to-display mode. Creating our own window is also incompatible with the VR compositor and is not available when the compositor is running. */ 4458 + class IVRExtendedDisplay 4459 + { 4460 + public: 4461 + 4462 + /** Size and position that the window needs to be on the VR display. */ 4463 + virtual void GetWindowBounds( int32_t *pnX, int32_t *pnY, uint32_t *pnWidth, uint32_t *pnHeight ) = 0; 4464 + 4465 + /** Gets the viewport in the frame buffer to draw the output of the distortion into */ 4466 + virtual void GetEyeOutputViewport( EVREye eEye, uint32_t *pnX, uint32_t *pnY, uint32_t *pnWidth, uint32_t *pnHeight ) = 0; 4467 + 4468 + /** [D3D10/11 Only] 4469 + * Returns the adapter index and output index that the user should pass into EnumAdapters and EnumOutputs 4470 + * to create the device and swap chain in DX10 and DX11. If an error occurs both indices will be set to -1. 4471 + */ 4472 + virtual void GetDXGIOutputInfo( int32_t *pnAdapterIndex, int32_t *pnAdapterOutputIndex ) = 0; 4473 + 4474 + }; 4475 + 4476 + static const char * const IVRExtendedDisplay_Version = "IVRExtendedDisplay_001"; 4477 + 4478 + } 4479 + 4480 + 4481 + // ivrtrackedcamera.h 4482 + 4483 + namespace vr 4484 + { 4485 + 4486 + class IVRTrackedCamera 4487 + { 4488 + public: 4489 + /** Returns a string for an error */ 4490 + virtual const char *GetCameraErrorNameFromEnum( vr::EVRTrackedCameraError eCameraError ) = 0; 4491 + 4492 + /** For convenience, same as tracked property request Prop_HasCamera_Bool */ 4493 + virtual vr::EVRTrackedCameraError HasCamera( vr::TrackedDeviceIndex_t nDeviceIndex, bool *pHasCamera ) = 0; 4494 + 4495 + /** Gets size of the image frame. */ 4496 + virtual vr::EVRTrackedCameraError GetCameraFrameSize( vr::TrackedDeviceIndex_t nDeviceIndex, vr::EVRTrackedCameraFrameType eFrameType, uint32_t *pnWidth, uint32_t *pnHeight, uint32_t *pnFrameBufferSize ) = 0; 4497 + 4498 + virtual vr::EVRTrackedCameraError GetCameraIntrinsics( vr::TrackedDeviceIndex_t nDeviceIndex, uint32_t nCameraIndex, vr::EVRTrackedCameraFrameType eFrameType, vr::HmdVector2_t *pFocalLength, vr::HmdVector2_t *pCenter ) = 0; 4499 + 4500 + virtual vr::EVRTrackedCameraError GetCameraProjection( vr::TrackedDeviceIndex_t nDeviceIndex, uint32_t nCameraIndex, vr::EVRTrackedCameraFrameType eFrameType, float flZNear, float flZFar, vr::HmdMatrix44_t *pProjection ) = 0; 4501 + 4502 + /** 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. 4503 + * 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. 4504 + * The camera should be considered a global resource accessible for shared consumption but not exclusive to any caller. 4505 + * The camera may go inactive due to lack of active consumers or headset idleness. */ 4506 + virtual vr::EVRTrackedCameraError AcquireVideoStreamingService( vr::TrackedDeviceIndex_t nDeviceIndex, vr::TrackedCameraHandle_t *pHandle ) = 0; 4507 + virtual vr::EVRTrackedCameraError ReleaseVideoStreamingService( vr::TrackedCameraHandle_t hTrackedCamera ) = 0; 4508 + 4509 + /** Copies the image frame into a caller's provided buffer. The image data is currently provided as RGBA data, 4 bytes per pixel. 4510 + * A caller can provide null for the framebuffer or frameheader if not desired. Requesting the frame header first, followed by the frame buffer allows 4511 + * the caller to determine if the frame as advanced per the frame header sequence. 4512 + * If there is no frame available yet, due to initial camera spinup or re-activation, the error will be VRTrackedCameraError_NoFrameAvailable. 4513 + * Ideally a caller should be polling at ~16ms intervals */ 4514 + virtual vr::EVRTrackedCameraError GetVideoStreamFrameBuffer( vr::TrackedCameraHandle_t hTrackedCamera, vr::EVRTrackedCameraFrameType eFrameType, void *pFrameBuffer, uint32_t nFrameBufferSize, vr::CameraVideoStreamFrameHeader_t *pFrameHeader, uint32_t nFrameHeaderSize ) = 0; 4515 + 4516 + /** Gets size of the image frame. */ 4517 + virtual vr::EVRTrackedCameraError GetVideoStreamTextureSize( vr::TrackedDeviceIndex_t nDeviceIndex, vr::EVRTrackedCameraFrameType eFrameType, vr::VRTextureBounds_t *pTextureBounds, uint32_t *pnWidth, uint32_t *pnHeight ) = 0; 4518 + 4519 + /** Access a shared D3D11 texture for the specified tracked camera stream. 4520 + * 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. 4521 + * Instead, use GetVideoStreamTextureSize() with VRTrackedCameraFrameType_Undistorted to determine the proper interior subregion bounds along with GetVideoStreamTextureD3D11() with 4522 + * VRTrackedCameraFrameType_MaximumUndistorted to provide the texture. The VRTrackedCameraFrameType_MaximumUndistorted will yield an image where the invalid regions are decoded 4523 + * 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 4524 + * guarantees a rectangle where all pixels are valid. */ 4525 + virtual vr::EVRTrackedCameraError GetVideoStreamTextureD3D11( vr::TrackedCameraHandle_t hTrackedCamera, vr::EVRTrackedCameraFrameType eFrameType, void *pD3D11DeviceOrResource, void **ppD3D11ShaderResourceView, vr::CameraVideoStreamFrameHeader_t *pFrameHeader, uint32_t nFrameHeaderSize ) = 0; 4526 + 4527 + /** Access a shared GL texture for the specified tracked camera stream */ 4528 + virtual vr::EVRTrackedCameraError GetVideoStreamTextureGL( vr::TrackedCameraHandle_t hTrackedCamera, vr::EVRTrackedCameraFrameType eFrameType, vr::glUInt_t *pglTextureId, vr::CameraVideoStreamFrameHeader_t *pFrameHeader, uint32_t nFrameHeaderSize ) = 0; 4529 + virtual vr::EVRTrackedCameraError ReleaseVideoStreamTextureGL( vr::TrackedCameraHandle_t hTrackedCamera, vr::glUInt_t glTextureId ) = 0; 4530 + virtual void SetCameraTrackingSpace( vr::ETrackingUniverseOrigin eUniverse ) = 0; 4531 + virtual vr::ETrackingUniverseOrigin GetCameraTrackingSpace( ) = 0; 4532 + }; 4533 + 4534 + static const char * const IVRTrackedCamera_Version = "IVRTrackedCamera_006"; 4535 + 4536 + } // namespace vr 4537 + 4538 + 4539 + // ivrscreenshots.h 4540 + 4541 + namespace vr 4542 + { 4543 + 4544 + /** Errors that can occur with the VR compositor */ 4545 + enum EVRScreenshotError 4546 + { 4547 + VRScreenshotError_None = 0, 4548 + VRScreenshotError_RequestFailed = 1, 4549 + VRScreenshotError_IncompatibleVersion = 100, 4550 + VRScreenshotError_NotFound = 101, 4551 + VRScreenshotError_BufferTooSmall = 102, 4552 + VRScreenshotError_ScreenshotAlreadyInProgress = 108, 4553 + }; 4554 + 4555 + /** Allows the application to generate screenshots */ 4556 + class IVRScreenshots 4557 + { 4558 + public: 4559 + /** Request a screenshot of the requested type. 4560 + * A request of the VRScreenshotType_Stereo type will always 4561 + * work. Other types will depend on the underlying application 4562 + * support. 4563 + * The first file name is for the preview image and should be a 4564 + * regular screenshot (ideally from the left eye). The second 4565 + * is the VR screenshot in the correct format. They should be 4566 + * in the same aspect ratio. Formats per type: 4567 + * VRScreenshotType_Mono: the VR filename is ignored (can be 4568 + * nullptr), this is a normal flat single shot. 4569 + * VRScreenshotType_Stereo: The VR image should be a 4570 + * side-by-side with the left eye image on the left. 4571 + * VRScreenshotType_Cubemap: The VR image should be six square 4572 + * images composited horizontally. 4573 + * VRScreenshotType_StereoPanorama: above/below with left eye 4574 + * panorama being the above image. Image is typically square 4575 + * with the panorama being 2x horizontal. 4576 + * 4577 + * Note that the VR dashboard will call this function when 4578 + * the user presses the screenshot binding (currently System 4579 + * Button + Trigger). If Steam is running, the destination 4580 + * file names will be in %TEMP% and will be copied into 4581 + * Steam's screenshot library for the running application 4582 + * once SubmitScreenshot() is called. 4583 + * If Steam is not running, the paths will be in the user's 4584 + * documents folder under Documents\SteamVR\Screenshots. 4585 + * Other VR applications can call this to initiate a 4586 + * screenshot outside of user control. 4587 + * The destination file names do not need an extension, 4588 + * will be replaced with the correct one for the format 4589 + * which is currently .png. */ 4590 + virtual vr::EVRScreenshotError RequestScreenshot( vr::ScreenshotHandle_t *pOutScreenshotHandle, vr::EVRScreenshotType type, const char *pchPreviewFilename, const char *pchVRFilename ) = 0; 4591 + 4592 + /** Called by the running VR application to indicate that it 4593 + * wishes to be in charge of screenshots. If the 4594 + * application does not call this, the Compositor will only 4595 + * support VRScreenshotType_Stereo screenshots that will be 4596 + * captured without notification to the running app. 4597 + * Once hooked your application will receive a 4598 + * VREvent_RequestScreenshot event when the user presses the 4599 + * buttons to take a screenshot. */ 4600 + virtual vr::EVRScreenshotError HookScreenshot( VR_ARRAY_COUNT( numTypes ) const vr::EVRScreenshotType *pSupportedTypes, int numTypes ) = 0; 4601 + 4602 + /** When your application receives a 4603 + * VREvent_RequestScreenshot event, call these functions to get 4604 + * the details of the screenshot request. */ 4605 + virtual vr::EVRScreenshotType GetScreenshotPropertyType( vr::ScreenshotHandle_t screenshotHandle, vr::EVRScreenshotError *pError ) = 0; 4606 + 4607 + /** Get the filename for the preview or vr image (see 4608 + * vr::EScreenshotPropertyFilenames). The return value is 4609 + * the size of the string. */ 4610 + virtual uint32_t GetScreenshotPropertyFilename( vr::ScreenshotHandle_t screenshotHandle, vr::EVRScreenshotPropertyFilenames filenameType, VR_OUT_STRING() char *pchFilename, uint32_t cchFilename, vr::EVRScreenshotError *pError ) = 0; 4611 + 4612 + /** Call this if the application is taking the screen shot 4613 + * will take more than a few ms processing. This will result 4614 + * in an overlay being presented that shows a completion 4615 + * bar. */ 4616 + virtual vr::EVRScreenshotError UpdateScreenshotProgress( vr::ScreenshotHandle_t screenshotHandle, float flProgress ) = 0; 4617 + 4618 + /** Tells the compositor to take an internal screenshot of 4619 + * type VRScreenshotType_Stereo. It will take the current 4620 + * submitted scene textures of the running application and 4621 + * write them into the preview image and a side-by-side file 4622 + * for the VR image. 4623 + * This is similar to request screenshot, but doesn't ever 4624 + * talk to the application, just takes the shot and submits. */ 4625 + virtual vr::EVRScreenshotError TakeStereoScreenshot( vr::ScreenshotHandle_t *pOutScreenshotHandle, const char *pchPreviewFilename, const char *pchVRFilename ) = 0; 4626 + 4627 + /** Submit the completed screenshot. If Steam is running 4628 + * this will call into the Steam client and upload the 4629 + * screenshot to the screenshots section of the library for 4630 + * the running application. If Steam is not running, this 4631 + * function will display a notification to the user that the 4632 + * screenshot was taken. The paths should be full paths with 4633 + * extensions. 4634 + * File paths should be absolute including extensions. 4635 + * screenshotHandle can be k_unScreenshotHandleInvalid if this 4636 + * was a new shot taking by the app to be saved and not 4637 + * initiated by a user (achievement earned or something) */ 4638 + virtual vr::EVRScreenshotError SubmitScreenshot( vr::ScreenshotHandle_t screenshotHandle, vr::EVRScreenshotType type, const char *pchSourcePreviewFilename, const char *pchSourceVRFilename ) = 0; 4639 + }; 4640 + 4641 + static const char * const IVRScreenshots_Version = "IVRScreenshots_001"; 4642 + 4643 + } // namespace vr 4644 + 4645 + 4646 + 4647 + // ivrresources.h 4648 + 4649 + namespace vr 4650 + { 4651 + 4652 + class IVRResources 4653 + { 4654 + public: 4655 + 4656 + // ------------------------------------ 4657 + // Shared Resource Methods 4658 + // ------------------------------------ 4659 + 4660 + /** Loads the specified resource into the provided buffer if large enough. 4661 + * Returns the size in bytes of the buffer required to hold the specified resource. */ 4662 + virtual uint32_t LoadSharedResource( const char *pchResourceName, char *pchBuffer, uint32_t unBufferLen ) = 0; 4663 + 4664 + /** Provides the full path to the specified resource. Resource names can include named directories for 4665 + * drivers and other things, and this resolves all of those and returns the actual physical path. 4666 + * pchResourceTypeDirectory is the subdirectory of resources to look in. */ 4667 + virtual uint32_t GetResourceFullPath( const char *pchResourceName, const char *pchResourceTypeDirectory, VR_OUT_STRING() char *pchPathBuffer, uint32_t unBufferLen ) = 0; 4668 + }; 4669 + 4670 + static const char * const IVRResources_Version = "IVRResources_001"; 4671 + 4672 + 4673 + } 4674 + 4675 + // ivrdrivermanager.h 4676 + 4677 + namespace vr 4678 + { 4679 + 4680 + class IVRDriverManager 4681 + { 4682 + public: 4683 + virtual uint32_t GetDriverCount() const = 0; 4684 + 4685 + /** Returns the length of the number of bytes necessary to hold this string including the trailing null. */ 4686 + virtual uint32_t GetDriverName( vr::DriverId_t nDriver, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize ) = 0; 4687 + 4688 + virtual DriverHandle_t GetDriverHandle( const char *pchDriverName ) = 0; 4689 + 4690 + virtual bool IsEnabled( vr::DriverId_t nDriver ) const = 0; 4691 + }; 4692 + 4693 + static const char * const IVRDriverManager_Version = "IVRDriverManager_001"; 4694 + 4695 + } // namespace vr 4696 + 4697 + 4698 + 4699 + // ivrinput.h 4700 + 4701 + namespace vr 4702 + { 4703 + // Maximum number of characters in an action name, including the trailing null 4704 + static const uint32_t k_unMaxActionNameLength = 64; 4705 + 4706 + // Maximum number of characters in an action set name, including the trailing null 4707 + static const uint32_t k_unMaxActionSetNameLength = 64; 4708 + 4709 + // Maximum number of origins for an action 4710 + static const uint32_t k_unMaxActionOriginCount = 16; 4711 + 4712 + // Maximum number of characters in a bone name, including the trailing null 4713 + static const uint32_t k_unMaxBoneNameLength = 32; 4714 + 4715 + enum EVRSkeletalTransformSpace 4716 + { 4717 + VRSkeletalTransformSpace_Model = 0, 4718 + VRSkeletalTransformSpace_Parent = 1 4719 + }; 4720 + 4721 + enum EVRSkeletalReferencePose 4722 + { 4723 + VRSkeletalReferencePose_BindPose = 0, 4724 + VRSkeletalReferencePose_OpenHand, 4725 + VRSkeletalReferencePose_Fist, 4726 + VRSkeletalReferencePose_GripLimit 4727 + }; 4728 + 4729 + enum EVRFinger 4730 + { 4731 + VRFinger_Thumb = 0, 4732 + VRFinger_Index, 4733 + VRFinger_Middle, 4734 + VRFinger_Ring, 4735 + VRFinger_Pinky, 4736 + VRFinger_Count 4737 + }; 4738 + 4739 + enum EVRFingerSplay 4740 + { 4741 + VRFingerSplay_Thumb_Index = 0, 4742 + VRFingerSplay_Index_Middle, 4743 + VRFingerSplay_Middle_Ring, 4744 + VRFingerSplay_Ring_Pinky, 4745 + VRFingerSplay_Count 4746 + }; 4747 + 4748 + enum EVRSummaryType 4749 + { 4750 + // The skeletal summary data will match the animated bone transforms for the action. 4751 + VRSummaryType_FromAnimation = 0, 4752 + 4753 + // The skeletal summary data will include unprocessed data directly from the device when available. 4754 + // This data is generally less latent than the data that is computed from the animations. 4755 + VRSummaryType_FromDevice = 1, 4756 + }; 4757 + 4758 + enum EVRInputFilterCancelType 4759 + { 4760 + VRInputFilterCancel_Timers = 0, 4761 + VRInputFilterCancel_Momentum = 1, 4762 + }; 4763 + 4764 + enum EVRInputStringBits 4765 + { 4766 + VRInputString_Hand = 0x01, 4767 + VRInputString_ControllerType = 0x02, 4768 + VRInputString_InputSource = 0x04, 4769 + 4770 + VRInputString_All = 0xFFFFFFFF 4771 + }; 4772 + 4773 + struct InputAnalogActionData_t 4774 + { 4775 + /** Whether or not this action is currently available to be bound in the active action set */ 4776 + bool bActive; 4777 + 4778 + /** The origin that caused this action's current state */ 4779 + VRInputValueHandle_t activeOrigin; 4780 + 4781 + /** The current state of this action; will be delta updates for mouse actions */ 4782 + float x, y, z; 4783 + 4784 + /** Deltas since the previous call to UpdateActionState() */ 4785 + float deltaX, deltaY, deltaZ; 4786 + 4787 + /** Time relative to now when this event happened. Will be negative to indicate a past time. */ 4788 + float fUpdateTime; 4789 + }; 4790 + 4791 + struct InputDigitalActionData_t 4792 + { 4793 + /** Whether or not this action is currently available to be bound in the active action set */ 4794 + bool bActive; 4795 + 4796 + /** The origin that caused this action's current state */ 4797 + VRInputValueHandle_t activeOrigin; 4798 + 4799 + /** The current state of this action; will be true if currently pressed */ 4800 + bool bState; 4801 + 4802 + /** This is true if the state has changed since the last frame */ 4803 + bool bChanged; 4804 + 4805 + /** Time relative to now when this event happened. Will be negative to indicate a past time. */ 4806 + float fUpdateTime; 4807 + }; 4808 + 4809 + struct InputPoseActionData_t 4810 + { 4811 + /** Whether or not this action is currently available to be bound in the active action set */ 4812 + bool bActive; 4813 + 4814 + /** The origin that caused this action's current state */ 4815 + VRInputValueHandle_t activeOrigin; 4816 + 4817 + /** The current state of this action */ 4818 + TrackedDevicePose_t pose; 4819 + }; 4820 + 4821 + struct InputSkeletalActionData_t 4822 + { 4823 + /** Whether or not this action is currently available to be bound in the active action set */ 4824 + bool bActive; 4825 + 4826 + /** The origin that caused this action's current state */ 4827 + VRInputValueHandle_t activeOrigin; 4828 + }; 4829 + 4830 + struct InputOriginInfo_t 4831 + { 4832 + VRInputValueHandle_t devicePath; 4833 + TrackedDeviceIndex_t trackedDeviceIndex; 4834 + char rchRenderModelComponentName[128]; 4835 + }; 4836 + 4837 + struct InputBindingInfo_t 4838 + { 4839 + char rchDevicePathName[128]; 4840 + char rchInputPathName[128]; 4841 + char rchModeName[128]; 4842 + char rchSlotName[128]; 4843 + char rchInputSourceType[ 32 ]; 4844 + }; 4845 + 4846 + // * Experimental global action set priority * 4847 + // These constants are part of the experimental support in SteamVR for overlay 4848 + // apps selectively overriding input in the base scene application. This may be 4849 + // useful for overlay applications that need to use part or all of a controller 4850 + // without taking away all input to the game. This system must be enabled by the 4851 + // "Experimental overlay input overrides" setting in the developer section of 4852 + // SteamVR settings. 4853 + // 4854 + // To use this system, set the nPriority field of an action set to any number in 4855 + // this range. 4856 + static const int32_t k_nActionSetOverlayGlobalPriorityMin = 0x01000000; 4857 + static const int32_t k_nActionSetOverlayGlobalPriorityMax = 0x01FFFFFF; 4858 + 4859 + static const int32_t k_nActionSetPriorityReservedMin = 0x02000000; 4860 + 4861 + struct VRActiveActionSet_t 4862 + { 4863 + /** This is the handle of the action set to activate for this frame. */ 4864 + VRActionSetHandle_t ulActionSet; 4865 + 4866 + /** This is the handle of a device path that this action set should be active for. To 4867 + * activate for all devices, set this to k_ulInvalidInputValueHandle. */ 4868 + VRInputValueHandle_t ulRestrictedToDevice; 4869 + 4870 + /** The action set to activate for all devices other than ulRestrictedDevice. If 4871 + * ulRestrictedToDevice is set to k_ulInvalidInputValueHandle, this parameter is 4872 + * ignored. */ 4873 + VRActionSetHandle_t ulSecondaryActionSet; 4874 + 4875 + // This field is ignored 4876 + uint32_t unPadding; 4877 + 4878 + /** The priority of this action set relative to other action sets. Any inputs 4879 + * bound to a source (e.g. trackpad, joystick, trigger) will disable bindings in 4880 + * other active action sets with a smaller priority. 4881 + * 4882 + * Overlay applications (i.e. ApplicationType_Overlay) may set their action set priority 4883 + * to a value between k_nActionSetOverlayGlobalPriorityMin and k_nActionSetOverlayGlobalPriorityMax 4884 + * to cause any inputs bound to a source used by that action set to be disabled in scene applications. 4885 + * 4886 + * No action set priority may value may be larger than k_nActionSetPriorityReservedMin 4887 + */ 4888 + int32_t nPriority; 4889 + }; 4890 + 4891 + /** Contains summary information about the current skeletal pose */ 4892 + struct VRSkeletalSummaryData_t 4893 + { 4894 + /** The amount that each finger is 'curled' inwards towards the palm. In the case of the thumb, 4895 + * this represents how much the thumb is wrapped around the fist. 4896 + * 0 means straight, 1 means fully curled */ 4897 + float flFingerCurl[ VRFinger_Count ]; 4898 + 4899 + /** The amount that each pair of adjacent fingers are separated. 4900 + * 0 means the digits are touching, 1 means they are fully separated. 4901 + */ 4902 + float flFingerSplay[ VRFingerSplay_Count ]; 4903 + }; 4904 + 4905 + 4906 + class IVRInput 4907 + { 4908 + public: 4909 + 4910 + // --------------- Handle management --------------- // 4911 + 4912 + /** Sets the path to the action manifest JSON file that is used by this application. If this information 4913 + * was set on the Steam partner site, calls to this function are ignored. If the Steam partner site 4914 + * setting and the path provided by this call are different, VRInputError_MismatchedActionManifest is returned. 4915 + * This call must be made before the first call to UpdateActionState or IVRSystem::PollNextEvent. */ 4916 + virtual EVRInputError SetActionManifestPath( const char *pchActionManifestPath ) = 0; 4917 + 4918 + /** Returns a handle for an action set. This handle is used for all performance-sensitive calls. */ 4919 + virtual EVRInputError GetActionSetHandle( const char *pchActionSetName, VRActionSetHandle_t *pHandle ) = 0; 4920 + 4921 + /** Returns a handle for an action. This handle is used for all performance-sensitive calls. */ 4922 + virtual EVRInputError GetActionHandle( const char *pchActionName, VRActionHandle_t *pHandle ) = 0; 4923 + 4924 + /** Returns a handle for any path in the input system. E.g. /user/hand/right */ 4925 + virtual EVRInputError GetInputSourceHandle( const char *pchInputSourcePath, VRInputValueHandle_t *pHandle ) = 0; 4926 + 4927 + 4928 + 4929 + // --------------- Reading action state ------------------- // 4930 + 4931 + /** Reads the current state into all actions. After this call, the results of Get*Action calls 4932 + * will be the same until the next call to UpdateActionState. */ 4933 + virtual EVRInputError UpdateActionState( VR_ARRAY_COUNT( unSetCount ) VRActiveActionSet_t *pSets, uint32_t unSizeOfVRSelectedActionSet_t, uint32_t unSetCount ) = 0; 4934 + 4935 + /** Reads the state of a digital action given its handle. This will return VRInputError_WrongType if the type of 4936 + * action is something other than digital */ 4937 + virtual EVRInputError GetDigitalActionData( VRActionHandle_t action, InputDigitalActionData_t *pActionData, uint32_t unActionDataSize, VRInputValueHandle_t ulRestrictToDevice ) = 0; 4938 + 4939 + /** Reads the state of an analog action given its handle. This will return VRInputError_WrongType if the type of 4940 + * action is something other than analog */ 4941 + virtual EVRInputError GetAnalogActionData( VRActionHandle_t action, InputAnalogActionData_t *pActionData, uint32_t unActionDataSize, VRInputValueHandle_t ulRestrictToDevice ) = 0; 4942 + 4943 + /** Reads the state of a pose action given its handle for the number of seconds relative to now. This 4944 + * will generally be called with negative times from the fUpdateTime fields in other actions. */ 4945 + virtual EVRInputError GetPoseActionDataRelativeToNow( VRActionHandle_t action, ETrackingUniverseOrigin eOrigin, float fPredictedSecondsFromNow, InputPoseActionData_t *pActionData, uint32_t unActionDataSize, VRInputValueHandle_t ulRestrictToDevice ) = 0; 4946 + 4947 + /** Reads the state of a pose action given its handle. The returned values will match the values returned 4948 + * by the last call to IVRCompositor::WaitGetPoses(). */ 4949 + virtual EVRInputError GetPoseActionDataForNextFrame( VRActionHandle_t action, ETrackingUniverseOrigin eOrigin, InputPoseActionData_t *pActionData, uint32_t unActionDataSize, VRInputValueHandle_t ulRestrictToDevice ) = 0; 4950 + 4951 + /** Reads the state of a skeletal action given its handle. */ 4952 + virtual EVRInputError GetSkeletalActionData( VRActionHandle_t action, InputSkeletalActionData_t *pActionData, uint32_t unActionDataSize ) = 0; 4953 + 4954 + /** Returns the current dominant hand for the user for this application. This function will only return success for applications 4955 + * which include "supports_dominant_hand_setting": true in their action manifests. The dominant hand will only change after 4956 + * a call to UpdateActionState, and the action data returned after that point will use the new dominant hand. */ 4957 + virtual EVRInputError GetDominantHand( ETrackedControllerRole *peDominantHand ) = 0; 4958 + 4959 + /** Sets the dominant hand for the user for this application. */ 4960 + virtual EVRInputError SetDominantHand( ETrackedControllerRole eDominantHand ) = 0; 4961 + 4962 + // --------------- Static Skeletal Data ------------------- // 4963 + 4964 + /** Reads the number of bones in skeleton associated with the given action */ 4965 + virtual EVRInputError GetBoneCount( VRActionHandle_t action, uint32_t* pBoneCount ) = 0; 4966 + 4967 + /** Fills the given array with the index of each bone's parent in the skeleton associated with the given action */ 4968 + virtual EVRInputError GetBoneHierarchy( VRActionHandle_t action, VR_ARRAY_COUNT( unIndexArayCount ) BoneIndex_t* pParentIndices, uint32_t unIndexArayCount ) = 0; 4969 + 4970 + /** Fills the given buffer with the name of the bone at the given index in the skeleton associated with the given action */ 4971 + virtual EVRInputError GetBoneName( VRActionHandle_t action, BoneIndex_t nBoneIndex, VR_OUT_STRING() char* pchBoneName, uint32_t unNameBufferSize ) = 0; 4972 + 4973 + /** Fills the given buffer with the transforms for a specific static skeletal reference pose */ 4974 + virtual EVRInputError GetSkeletalReferenceTransforms( VRActionHandle_t action, EVRSkeletalTransformSpace eTransformSpace, EVRSkeletalReferencePose eReferencePose, VR_ARRAY_COUNT( unTransformArrayCount ) VRBoneTransform_t *pTransformArray, uint32_t unTransformArrayCount ) = 0; 4975 + 4976 + /** Reads the level of accuracy to which the controller is able to track the user to recreate a skeletal pose */ 4977 + virtual EVRInputError GetSkeletalTrackingLevel( VRActionHandle_t action, EVRSkeletalTrackingLevel* pSkeletalTrackingLevel ) = 0; 4978 + 4979 + // --------------- Dynamic Skeletal Data ------------------- // 4980 + 4981 + /** Reads the state of the skeletal bone data associated with this action and copies it into the given buffer. */ 4982 + virtual EVRInputError GetSkeletalBoneData( VRActionHandle_t action, EVRSkeletalTransformSpace eTransformSpace, EVRSkeletalMotionRange eMotionRange, VR_ARRAY_COUNT( unTransformArrayCount ) VRBoneTransform_t *pTransformArray, uint32_t unTransformArrayCount ) = 0; 4983 + 4984 + /** Reads summary information about the current pose of the skeleton associated with the given action. */ 4985 + virtual EVRInputError GetSkeletalSummaryData( VRActionHandle_t action, EVRSummaryType eSummaryType, VRSkeletalSummaryData_t * pSkeletalSummaryData ) = 0; 4986 + 4987 + /** Reads the state of the skeletal bone data in a compressed form that is suitable for 4988 + * sending over the network. The required buffer size will never exceed ( sizeof(VR_BoneTransform_t)*boneCount + 2). 4989 + * Usually the size will be much smaller. */ 4990 + virtual EVRInputError GetSkeletalBoneDataCompressed( VRActionHandle_t action, EVRSkeletalMotionRange eMotionRange, VR_OUT_BUFFER_COUNT( unCompressedSize ) void *pvCompressedData, uint32_t unCompressedSize, uint32_t *punRequiredCompressedSize ) = 0; 4991 + 4992 + /** Turns a compressed buffer from GetSkeletalBoneDataCompressed and turns it back into a bone transform array. */ 4993 + virtual EVRInputError DecompressSkeletalBoneData( const void *pvCompressedBuffer, uint32_t unCompressedBufferSize, EVRSkeletalTransformSpace eTransformSpace, VR_ARRAY_COUNT( unTransformArrayCount ) VRBoneTransform_t *pTransformArray, uint32_t unTransformArrayCount ) = 0; 4994 + 4995 + // --------------- Haptics ------------------- // 4996 + 4997 + /** Triggers a haptic event as described by the specified action */ 4998 + virtual EVRInputError TriggerHapticVibrationAction( VRActionHandle_t action, float fStartSecondsFromNow, float fDurationSeconds, float fFrequency, float fAmplitude, VRInputValueHandle_t ulRestrictToDevice ) = 0; 4999 + 5000 + // --------------- Action Origins ---------------- // 5001 + 5002 + /** Retrieve origin handles for an action */ 5003 + virtual EVRInputError GetActionOrigins( VRActionSetHandle_t actionSetHandle, VRActionHandle_t digitalActionHandle, VR_ARRAY_COUNT( originOutCount ) VRInputValueHandle_t *originsOut, uint32_t originOutCount ) = 0; 5004 + 5005 + /** Retrieves the name of the origin in the current language. unStringSectionsToInclude is a bitfield of values in EVRInputStringBits that allows the 5006 + application to specify which parts of the origin's information it wants a string for. */ 5007 + virtual EVRInputError GetOriginLocalizedName( VRInputValueHandle_t origin, VR_OUT_STRING() char *pchNameArray, uint32_t unNameArraySize, int32_t unStringSectionsToInclude ) = 0; 5008 + 5009 + /** Retrieves useful information for the origin of this action */ 5010 + virtual EVRInputError GetOriginTrackedDeviceInfo( VRInputValueHandle_t origin, InputOriginInfo_t *pOriginInfo, uint32_t unOriginInfoSize ) = 0; 5011 + 5012 + /** Retrieves useful information about the bindings for an action */ 5013 + virtual EVRInputError GetActionBindingInfo( VRActionHandle_t action, InputBindingInfo_t *pOriginInfo, uint32_t unBindingInfoSize, uint32_t unBindingInfoCount, uint32_t *punReturnedBindingInfoCount ) = 0; 5014 + 5015 + /** Shows the current binding for the action in-headset */ 5016 + virtual EVRInputError ShowActionOrigins( VRActionSetHandle_t actionSetHandle, VRActionHandle_t ulActionHandle ) = 0; 5017 + 5018 + /** Shows the current binding all the actions in the specified action sets */ 5019 + virtual EVRInputError ShowBindingsForActionSet( VR_ARRAY_COUNT( unSetCount ) VRActiveActionSet_t *pSets, uint32_t unSizeOfVRSelectedActionSet_t, uint32_t unSetCount, VRInputValueHandle_t originToHighlight ) = 0; 5020 + 5021 + /** Use this to query what action on the component returned by GetOriginTrackedDeviceInfo would trigger this binding. */ 5022 + virtual EVRInputError GetComponentStateForBinding( const char *pchRenderModelName, const char *pchComponentName, 5023 + const InputBindingInfo_t *pOriginInfo, uint32_t unBindingInfoSize, uint32_t unBindingInfoCount, 5024 + vr::RenderModel_ComponentState_t *pComponentState ) = 0; 5025 + 5026 + 5027 + // --------------- Legacy Input ------------------- // 5028 + virtual bool IsUsingLegacyInput() = 0; 5029 + 5030 + 5031 + // --------------- Utilities ------------------- // 5032 + 5033 + /** Opens the binding user interface. If no app key is provided it will use the key from the calling process. 5034 + * If no set is provided it will open to the root of the app binding page. */ 5035 + virtual EVRInputError OpenBindingUI( const char* pchAppKey, VRActionSetHandle_t ulActionSetHandle, VRInputValueHandle_t ulDeviceHandle, bool bShowOnDesktop ) = 0; 5036 + 5037 + /** Returns the variant set in the current bindings. If the binding doesn't include a variant setting, this function 5038 + * will return an empty string */ 5039 + virtual EVRInputError GetBindingVariant( vr::VRInputValueHandle_t ulDevicePath, 5040 + VR_OUT_STRING() char *pchVariantArray, uint32_t unVariantArraySize ) = 0; 5041 + 5042 + }; 5043 + 5044 + static const char * const IVRInput_Version = "IVRInput_010"; 5045 + 5046 + } // namespace vr 5047 + 5048 + // ivriobuffer.h 5049 + 5050 + namespace vr 5051 + { 5052 + 5053 + typedef uint64_t IOBufferHandle_t; 5054 + static const uint64_t k_ulInvalidIOBufferHandle = 0; 5055 + 5056 + enum EIOBufferError 5057 + { 5058 + IOBuffer_Success = 0, 5059 + IOBuffer_OperationFailed = 100, 5060 + IOBuffer_InvalidHandle = 101, 5061 + IOBuffer_InvalidArgument = 102, 5062 + IOBuffer_PathExists = 103, 5063 + IOBuffer_PathDoesNotExist = 104, 5064 + IOBuffer_Permission = 105, 5065 + }; 5066 + 5067 + enum EIOBufferMode 5068 + { 5069 + IOBufferMode_Read = 0x0001, 5070 + IOBufferMode_Write = 0x0002, 5071 + IOBufferMode_Create = 0x0200, 5072 + }; 5073 + 5074 + // ---------------------------------------------------------------------------------------------- 5075 + // Purpose: 5076 + // ---------------------------------------------------------------------------------------------- 5077 + class IVRIOBuffer 5078 + { 5079 + public: 5080 + /** opens an existing or creates a new IOBuffer of unSize bytes */ 5081 + virtual vr::EIOBufferError Open( const char *pchPath, vr::EIOBufferMode mode, uint32_t unElementSize, uint32_t unElements, vr::IOBufferHandle_t *pulBuffer ) = 0; 5082 + 5083 + /** closes a previously opened or created buffer */ 5084 + virtual vr::EIOBufferError Close( vr::IOBufferHandle_t ulBuffer ) = 0; 5085 + 5086 + /** reads up to unBytes from buffer into *pDst, returning number of bytes read in *punRead */ 5087 + virtual vr::EIOBufferError Read( vr::IOBufferHandle_t ulBuffer, void *pDst, uint32_t unBytes, uint32_t *punRead ) = 0; 5088 + 5089 + /** writes unBytes of data from *pSrc into a buffer. */ 5090 + virtual vr::EIOBufferError Write( vr::IOBufferHandle_t ulBuffer, void *pSrc, uint32_t unBytes ) = 0; 5091 + 5092 + /** retrieves the property container of an buffer. */ 5093 + virtual vr::PropertyContainerHandle_t PropertyContainer( vr::IOBufferHandle_t ulBuffer ) = 0; 5094 + 5095 + /** inexpensively checks for readers to allow writers to fast-fail potentially expensive copies and writes. */ 5096 + virtual bool HasReaders( vr::IOBufferHandle_t ulBuffer ) = 0; 5097 + }; 5098 + 5099 + static const char *IVRIOBuffer_Version = "IVRIOBuffer_002"; 5100 + } 5101 + 5102 + // ivrspatialanchors.h 5103 + 5104 + namespace vr 5105 + { 5106 + static const SpatialAnchorHandle_t k_ulInvalidSpatialAnchorHandle = 0; 5107 + 5108 + struct SpatialAnchorPose_t 5109 + { 5110 + HmdMatrix34_t mAnchorToAbsoluteTracking; 5111 + }; 5112 + 5113 + class IVRSpatialAnchors 5114 + { 5115 + public: 5116 + 5117 + /** Returns a handle for an spatial anchor described by "descriptor". On success, pHandle 5118 + * will contain a handle valid for this session. Caller can wait for an event or occasionally 5119 + * poll GetSpatialAnchorPose() to find the virtual coordinate associated with this anchor. */ 5120 + virtual EVRSpatialAnchorError CreateSpatialAnchorFromDescriptor( const char *pchDescriptor, SpatialAnchorHandle_t *pHandleOut ) = 0; 5121 + 5122 + /** Returns a handle for an new spatial anchor at pPose. On success, pHandle 5123 + * will contain a handle valid for this session. Caller can wait for an event or occasionally 5124 + * poll GetSpatialAnchorDescriptor() to find the permanent descriptor for this pose. 5125 + * The result of GetSpatialAnchorPose() may evolve from this initial position if the driver chooses 5126 + * to update it. 5127 + * The anchor will be associated with the driver that provides unDeviceIndex, and the driver may use that specific 5128 + * device as a hint for how to best create the anchor. 5129 + * The eOrigin must match whatever tracking origin you are working in (seated/standing/raw). 5130 + * This should be called when the user is close to (and ideally looking at/interacting with) the target physical 5131 + * location. At that moment, the driver will have the most information about how to recover that physical point 5132 + * in the future, and the quality of the anchor (when the descriptor is re-used) will be highest. 5133 + * The caller may decide to apply offsets from this initial pose, but is advised to stay relatively close to the 5134 + * original pose location for highest fidelity. */ 5135 + virtual EVRSpatialAnchorError CreateSpatialAnchorFromPose( TrackedDeviceIndex_t unDeviceIndex, ETrackingUniverseOrigin eOrigin, SpatialAnchorPose_t *pPose, SpatialAnchorHandle_t *pHandleOut ) = 0; 5136 + 5137 + /** Get the pose for a given handle. This is intended to be cheap enough to call every frame (or fairly often) 5138 + * so that the driver can refine this position when it has more information available. */ 5139 + virtual EVRSpatialAnchorError GetSpatialAnchorPose( SpatialAnchorHandle_t unHandle, ETrackingUniverseOrigin eOrigin, SpatialAnchorPose_t *pPoseOut ) = 0; 5140 + 5141 + /** Get the descriptor for a given handle. This will be empty for handles where the driver has not 5142 + * yet built a descriptor. It will be the application-supplied descriptor for previously saved anchors 5143 + * that the application is requesting poses for. If the driver has called UpdateSpatialAnchorDescriptor() 5144 + * already in this session, it will be the descriptor provided by the driver. 5145 + * Returns true if the descriptor fits into the buffer, else false. Buffer size should be at least 5146 + * k_unMaxSpatialAnchorDescriptorSize. */ 5147 + virtual EVRSpatialAnchorError GetSpatialAnchorDescriptor( SpatialAnchorHandle_t unHandle, VR_OUT_STRING() char *pchDescriptorOut, uint32_t *punDescriptorBufferLenInOut ) = 0; 5148 + 5149 + }; 5150 + 5151 + static const char * const IVRSpatialAnchors_Version = "IVRSpatialAnchors_001"; 5152 + 5153 + } // namespace vr 5154 + 5155 + // ivrdebug.h 5156 + 5157 + namespace vr 5158 + { 5159 + enum EVRDebugError 5160 + { 5161 + VRDebugError_Success = 0, 5162 + VRDebugError_BadParameter 5163 + }; 5164 + 5165 + /** Handle for vr profiler events */ 5166 + typedef uint64_t VrProfilerEventHandle_t; 5167 + 5168 + class IVRDebug 5169 + { 5170 + public: 5171 + 5172 + /** Create a vr profiler discrete event (point) 5173 + * The event will be associated with the message provided in pchMessage, and the current 5174 + * time will be used as the event timestamp. */ 5175 + virtual EVRDebugError EmitVrProfilerEvent( const char *pchMessage ) = 0; 5176 + 5177 + /** Create an vr profiler duration event (line) 5178 + * The current time will be used as the timestamp for the start of the line. 5179 + * On success, pHandleOut will contain a handle valid for terminating this event. */ 5180 + virtual EVRDebugError BeginVrProfilerEvent( VrProfilerEventHandle_t *pHandleOut ) = 0; 5181 + 5182 + /** Terminate a vr profiler event 5183 + * The event associated with hHandle will be considered completed when this method is called. 5184 + * The current time will be used assocaited to the termination time of the event, and 5185 + * pchMessage will be used as the event title. */ 5186 + virtual EVRDebugError FinishVrProfilerEvent( VrProfilerEventHandle_t hHandle, const char *pchMessage ) = 0; 5187 + 5188 + /** Sends a request to the driver for the specified device and returns the response. The maximum response size is 32k, 5189 + * but this method can be called with a smaller buffer. If the response exceeds the size of the buffer, it is truncated. 5190 + * The size of the response including its terminating null is returned. */ 5191 + virtual uint32_t DriverDebugRequest( vr::TrackedDeviceIndex_t unDeviceIndex, const char *pchRequest, VR_OUT_STRING() char *pchResponseBuffer, uint32_t unResponseBufferSize ) = 0; 5192 + 5193 + }; 5194 + 5195 + static const char * const IVRDebug_Version = "IVRDebug_001"; 5196 + 5197 + } // namespace vr 5198 + // End 5199 + 5200 + #endif // _OPENVR_API 5201 + 5202 + 5203 + 5204 + namespace vr 5205 + { 5206 + #if !defined( OPENVR_INTERFACE_INTERNAL ) 5207 + 5208 + /** Finds the active installation of the VR API and initializes it. The provided path must be absolute 5209 + * or relative to the current working directory. These are the local install versions of the equivalent 5210 + * functions in steamvr.h and will work without a local Steam install. 5211 + * 5212 + * This path is to the "root" of the VR API install. That's the directory with 5213 + * the "drivers" directory and a platform (i.e. "win32") directory in it, not the directory with the DLL itself. 5214 + * 5215 + * pStartupInfo is reserved for future use. 5216 + */ 5217 + inline IVRSystem *VR_Init( EVRInitError *peError, EVRApplicationType eApplicationType, const char *pStartupInfo = nullptr ); 5218 + 5219 + /** unloads vrclient.dll. Any interface pointers from the interface are 5220 + * invalid after this point */ 5221 + inline void VR_Shutdown(); 5222 + 5223 + /** Returns true if there is an HMD attached. This check is as lightweight as possible and 5224 + * can be called outside of VR_Init/VR_Shutdown. It should be used when an application wants 5225 + * to know if initializing VR is a possibility but isn't ready to take that step yet. 5226 + */ 5227 + VR_INTERFACE bool VR_CALLTYPE VR_IsHmdPresent(); 5228 + 5229 + /** Returns true if the OpenVR runtime is installed. */ 5230 + VR_INTERFACE bool VR_CALLTYPE VR_IsRuntimeInstalled(); 5231 + 5232 + /** Returns where the OpenVR runtime is installed. */ 5233 + VR_INTERFACE bool VR_GetRuntimePath( VR_OUT_STRING() char *pchPathBuffer, uint32_t unBufferSize, uint32_t *punRequiredBufferSize ); 5234 + 5235 + /** Returns the name of the enum value for an EVRInitError. This function may be called outside of VR_Init()/VR_Shutdown(). */ 5236 + VR_INTERFACE const char *VR_CALLTYPE VR_GetVRInitErrorAsSymbol( EVRInitError error ); 5237 + 5238 + /** Returns an English string for an EVRInitError. Applications should call VR_GetVRInitErrorAsSymbol instead and 5239 + * use that as a key to look up their own localized error message. This function may be called outside of VR_Init()/VR_Shutdown(). */ 5240 + VR_INTERFACE const char *VR_CALLTYPE VR_GetVRInitErrorAsEnglishDescription( EVRInitError error ); 5241 + 5242 + /** Returns the interface of the specified version. This method must be called after VR_Init. The 5243 + * pointer returned is valid until VR_Shutdown is called. 5244 + */ 5245 + VR_INTERFACE void *VR_CALLTYPE VR_GetGenericInterface( const char *pchInterfaceVersion, EVRInitError *peError ); 5246 + 5247 + /** Returns whether the interface of the specified version exists. 5248 + */ 5249 + VR_INTERFACE bool VR_CALLTYPE VR_IsInterfaceVersionValid( const char *pchInterfaceVersion ); 5250 + 5251 + /** Returns a token that represents whether the VR interface handles need to be reloaded */ 5252 + VR_INTERFACE uint32_t VR_CALLTYPE VR_GetInitToken(); 5253 + 5254 + // These typedefs allow old enum names from SDK 0.9.11 to be used in applications. 5255 + // They will go away in the future. 5256 + typedef EVRInitError HmdError; 5257 + typedef EVREye Hmd_Eye; 5258 + typedef EColorSpace ColorSpace; 5259 + typedef ETrackingResult HmdTrackingResult; 5260 + typedef ETrackedDeviceClass TrackedDeviceClass; 5261 + typedef ETrackingUniverseOrigin TrackingUniverseOrigin; 5262 + typedef ETrackedDeviceProperty TrackedDeviceProperty; 5263 + typedef ETrackedPropertyError TrackedPropertyError; 5264 + typedef EVRSubmitFlags VRSubmitFlags_t; 5265 + typedef EVRState VRState_t; 5266 + typedef ECollisionBoundsStyle CollisionBoundsStyle_t; 5267 + typedef EVROverlayError VROverlayError; 5268 + typedef EVRFirmwareError VRFirmwareError; 5269 + typedef EVRCompositorError VRCompositorError; 5270 + typedef EVRScreenshotError VRScreenshotsError; 5271 + 5272 + inline uint32_t &VRToken() 5273 + { 5274 + static uint32_t token; 5275 + return token; 5276 + } 5277 + 5278 + class COpenVRContext 5279 + { 5280 + public: 5281 + COpenVRContext() { Clear(); } 5282 + void Clear(); 5283 + 5284 + inline void CheckClear() 5285 + { 5286 + if ( VRToken() != VR_GetInitToken() ) 5287 + { 5288 + Clear(); 5289 + VRToken() = VR_GetInitToken(); 5290 + } 5291 + } 5292 + 5293 + IVRSystem *VRSystem() 5294 + { 5295 + CheckClear(); 5296 + if ( m_pVRSystem == nullptr ) 5297 + { 5298 + EVRInitError eError; 5299 + m_pVRSystem = ( IVRSystem * )VR_GetGenericInterface( IVRSystem_Version, &eError ); 5300 + } 5301 + return m_pVRSystem; 5302 + } 5303 + IVRChaperone *VRChaperone() 5304 + { 5305 + CheckClear(); 5306 + if ( m_pVRChaperone == nullptr ) 5307 + { 5308 + EVRInitError eError; 5309 + m_pVRChaperone = ( IVRChaperone * )VR_GetGenericInterface( IVRChaperone_Version, &eError ); 5310 + } 5311 + return m_pVRChaperone; 5312 + } 5313 + 5314 + IVRChaperoneSetup *VRChaperoneSetup() 5315 + { 5316 + CheckClear(); 5317 + if ( m_pVRChaperoneSetup == nullptr ) 5318 + { 5319 + EVRInitError eError; 5320 + m_pVRChaperoneSetup = ( IVRChaperoneSetup * )VR_GetGenericInterface( IVRChaperoneSetup_Version, &eError ); 5321 + } 5322 + return m_pVRChaperoneSetup; 5323 + } 5324 + 5325 + IVRCompositor *VRCompositor() 5326 + { 5327 + CheckClear(); 5328 + if ( m_pVRCompositor == nullptr ) 5329 + { 5330 + EVRInitError eError; 5331 + m_pVRCompositor = ( IVRCompositor * )VR_GetGenericInterface( IVRCompositor_Version, &eError ); 5332 + } 5333 + return m_pVRCompositor; 5334 + } 5335 + 5336 + IVROverlay *VROverlay() 5337 + { 5338 + CheckClear(); 5339 + if ( m_pVROverlay == nullptr ) 5340 + { 5341 + EVRInitError eError; 5342 + m_pVROverlay = ( IVROverlay * )VR_GetGenericInterface( IVROverlay_Version, &eError ); 5343 + } 5344 + return m_pVROverlay; 5345 + } 5346 + 5347 + IVROverlayView *VROverlayView() 5348 + { 5349 + CheckClear(); 5350 + if ( m_pVROverlayView == nullptr ) 5351 + { 5352 + EVRInitError eError; 5353 + m_pVROverlayView = ( IVROverlayView * ) VR_GetGenericInterface( IVROverlayView_Version, &eError ); 5354 + } 5355 + return m_pVROverlayView; 5356 + } 5357 + 5358 + IVRHeadsetView *VRHeadsetView() 5359 + { 5360 + CheckClear(); 5361 + if ( m_pVRHeadsetView == nullptr ) 5362 + { 5363 + EVRInitError eError; 5364 + m_pVRHeadsetView = ( IVRHeadsetView * ) VR_GetGenericInterface( IVRHeadsetView_Version, &eError ); 5365 + } 5366 + return m_pVRHeadsetView; 5367 + } 5368 + 5369 + IVRResources *VRResources() 5370 + { 5371 + CheckClear(); 5372 + if ( m_pVRResources == nullptr ) 5373 + { 5374 + EVRInitError eError; 5375 + m_pVRResources = (IVRResources *)VR_GetGenericInterface( IVRResources_Version, &eError ); 5376 + } 5377 + return m_pVRResources; 5378 + } 5379 + 5380 + IVRScreenshots *VRScreenshots() 5381 + { 5382 + CheckClear(); 5383 + if ( m_pVRScreenshots == nullptr ) 5384 + { 5385 + EVRInitError eError; 5386 + m_pVRScreenshots = ( IVRScreenshots * )VR_GetGenericInterface( IVRScreenshots_Version, &eError ); 5387 + } 5388 + return m_pVRScreenshots; 5389 + } 5390 + 5391 + IVRRenderModels *VRRenderModels() 5392 + { 5393 + CheckClear(); 5394 + if ( m_pVRRenderModels == nullptr ) 5395 + { 5396 + EVRInitError eError; 5397 + m_pVRRenderModels = ( IVRRenderModels * )VR_GetGenericInterface( IVRRenderModels_Version, &eError ); 5398 + } 5399 + return m_pVRRenderModels; 5400 + } 5401 + 5402 + IVRExtendedDisplay *VRExtendedDisplay() 5403 + { 5404 + CheckClear(); 5405 + if ( m_pVRExtendedDisplay == nullptr ) 5406 + { 5407 + EVRInitError eError; 5408 + m_pVRExtendedDisplay = ( IVRExtendedDisplay * )VR_GetGenericInterface( IVRExtendedDisplay_Version, &eError ); 5409 + } 5410 + return m_pVRExtendedDisplay; 5411 + } 5412 + 5413 + IVRSettings *VRSettings() 5414 + { 5415 + CheckClear(); 5416 + if ( m_pVRSettings == nullptr ) 5417 + { 5418 + EVRInitError eError; 5419 + m_pVRSettings = ( IVRSettings * )VR_GetGenericInterface( IVRSettings_Version, &eError ); 5420 + } 5421 + return m_pVRSettings; 5422 + } 5423 + 5424 + IVRApplications *VRApplications() 5425 + { 5426 + CheckClear(); 5427 + if ( m_pVRApplications == nullptr ) 5428 + { 5429 + EVRInitError eError; 5430 + m_pVRApplications = ( IVRApplications * )VR_GetGenericInterface( IVRApplications_Version, &eError ); 5431 + } 5432 + return m_pVRApplications; 5433 + } 5434 + 5435 + IVRTrackedCamera *VRTrackedCamera() 5436 + { 5437 + CheckClear(); 5438 + if ( m_pVRTrackedCamera == nullptr ) 5439 + { 5440 + EVRInitError eError; 5441 + m_pVRTrackedCamera = ( IVRTrackedCamera * )VR_GetGenericInterface( IVRTrackedCamera_Version, &eError ); 5442 + } 5443 + return m_pVRTrackedCamera; 5444 + } 5445 + 5446 + IVRDriverManager *VRDriverManager() 5447 + { 5448 + CheckClear(); 5449 + if ( !m_pVRDriverManager ) 5450 + { 5451 + EVRInitError eError; 5452 + m_pVRDriverManager = ( IVRDriverManager * )VR_GetGenericInterface( IVRDriverManager_Version, &eError ); 5453 + } 5454 + return m_pVRDriverManager; 5455 + } 5456 + 5457 + IVRInput *VRInput() 5458 + { 5459 + CheckClear(); 5460 + if ( !m_pVRInput ) 5461 + { 5462 + EVRInitError eError; 5463 + m_pVRInput = (IVRInput *)VR_GetGenericInterface( IVRInput_Version, &eError ); 5464 + } 5465 + return m_pVRInput; 5466 + } 5467 + 5468 + IVRIOBuffer *VRIOBuffer() 5469 + { 5470 + if ( !m_pVRIOBuffer ) 5471 + { 5472 + EVRInitError eError; 5473 + m_pVRIOBuffer = ( IVRIOBuffer * )VR_GetGenericInterface( IVRIOBuffer_Version, &eError ); 5474 + } 5475 + return m_pVRIOBuffer; 5476 + } 5477 + 5478 + IVRSpatialAnchors *VRSpatialAnchors() 5479 + { 5480 + CheckClear(); 5481 + if ( !m_pVRSpatialAnchors ) 5482 + { 5483 + EVRInitError eError; 5484 + m_pVRSpatialAnchors = (IVRSpatialAnchors *)VR_GetGenericInterface( IVRSpatialAnchors_Version, &eError ); 5485 + } 5486 + return m_pVRSpatialAnchors; 5487 + } 5488 + 5489 + IVRDebug *VRDebug() 5490 + { 5491 + CheckClear(); 5492 + if ( !m_pVRDebug ) 5493 + { 5494 + EVRInitError eError; 5495 + m_pVRDebug = (IVRDebug *)VR_GetGenericInterface( IVRDebug_Version, &eError ); 5496 + } 5497 + return m_pVRDebug; 5498 + } 5499 + 5500 + IVRNotifications *VRNotifications() 5501 + { 5502 + CheckClear(); 5503 + if ( !m_pVRNotifications ) 5504 + { 5505 + EVRInitError eError; 5506 + m_pVRNotifications = ( IVRNotifications * )VR_GetGenericInterface( IVRNotifications_Version, &eError ); 5507 + } 5508 + return m_pVRNotifications; 5509 + } 5510 + 5511 + private: 5512 + IVRSystem *m_pVRSystem; 5513 + IVRChaperone *m_pVRChaperone; 5514 + IVRChaperoneSetup *m_pVRChaperoneSetup; 5515 + IVRCompositor *m_pVRCompositor; 5516 + IVRHeadsetView *m_pVRHeadsetView; 5517 + IVROverlay *m_pVROverlay; 5518 + IVROverlayView *m_pVROverlayView; 5519 + IVRResources *m_pVRResources; 5520 + IVRRenderModels *m_pVRRenderModels; 5521 + IVRExtendedDisplay *m_pVRExtendedDisplay; 5522 + IVRSettings *m_pVRSettings; 5523 + IVRApplications *m_pVRApplications; 5524 + IVRTrackedCamera *m_pVRTrackedCamera; 5525 + IVRScreenshots *m_pVRScreenshots; 5526 + IVRDriverManager *m_pVRDriverManager; 5527 + IVRInput *m_pVRInput; 5528 + IVRIOBuffer *m_pVRIOBuffer; 5529 + IVRSpatialAnchors *m_pVRSpatialAnchors; 5530 + IVRDebug *m_pVRDebug; 5531 + IVRNotifications *m_pVRNotifications; 5532 + }; 5533 + 5534 + inline COpenVRContext &OpenVRInternal_ModuleContext() 5535 + { 5536 + static void *ctx[ sizeof( COpenVRContext ) / sizeof( void * ) ]; 5537 + return *( COpenVRContext * )ctx; // bypass zero-init constructor 5538 + } 5539 + 5540 + inline IVRSystem *VR_CALLTYPE VRSystem() { return OpenVRInternal_ModuleContext().VRSystem(); } 5541 + inline IVRChaperone *VR_CALLTYPE VRChaperone() { return OpenVRInternal_ModuleContext().VRChaperone(); } 5542 + inline IVRChaperoneSetup *VR_CALLTYPE VRChaperoneSetup() { return OpenVRInternal_ModuleContext().VRChaperoneSetup(); } 5543 + inline IVRCompositor *VR_CALLTYPE VRCompositor() { return OpenVRInternal_ModuleContext().VRCompositor(); } 5544 + inline IVROverlay *VR_CALLTYPE VROverlay() { return OpenVRInternal_ModuleContext().VROverlay(); } 5545 + inline IVROverlayView *VR_CALLTYPE VROverlayView() { return OpenVRInternal_ModuleContext().VROverlayView(); } 5546 + inline IVRHeadsetView *VR_CALLTYPE VRHeadsetView() { return OpenVRInternal_ModuleContext().VRHeadsetView(); } 5547 + inline IVRScreenshots *VR_CALLTYPE VRScreenshots() { return OpenVRInternal_ModuleContext().VRScreenshots(); } 5548 + inline IVRRenderModels *VR_CALLTYPE VRRenderModels() { return OpenVRInternal_ModuleContext().VRRenderModels(); } 5549 + inline IVRApplications *VR_CALLTYPE VRApplications() { return OpenVRInternal_ModuleContext().VRApplications(); } 5550 + inline IVRSettings *VR_CALLTYPE VRSettings() { return OpenVRInternal_ModuleContext().VRSettings(); } 5551 + inline IVRResources *VR_CALLTYPE VRResources() { return OpenVRInternal_ModuleContext().VRResources(); } 5552 + inline IVRExtendedDisplay *VR_CALLTYPE VRExtendedDisplay() { return OpenVRInternal_ModuleContext().VRExtendedDisplay(); } 5553 + inline IVRTrackedCamera *VR_CALLTYPE VRTrackedCamera() { return OpenVRInternal_ModuleContext().VRTrackedCamera(); } 5554 + inline IVRDriverManager *VR_CALLTYPE VRDriverManager() { return OpenVRInternal_ModuleContext().VRDriverManager(); } 5555 + inline IVRInput *VR_CALLTYPE VRInput() { return OpenVRInternal_ModuleContext().VRInput(); } 5556 + inline IVRIOBuffer *VR_CALLTYPE VRIOBuffer() { return OpenVRInternal_ModuleContext().VRIOBuffer(); } 5557 + inline IVRSpatialAnchors *VR_CALLTYPE VRSpatialAnchors() { return OpenVRInternal_ModuleContext().VRSpatialAnchors(); } 5558 + inline IVRNotifications *VR_CALLTYPE VRNotifications() { return OpenVRInternal_ModuleContext().VRNotifications(); } 5559 + inline IVRDebug *VR_CALLTYPE VRDebug() { return OpenVRInternal_ModuleContext().VRDebug(); } 5560 + 5561 + inline void COpenVRContext::Clear() 5562 + { 5563 + m_pVRSystem = nullptr; 5564 + m_pVRChaperone = nullptr; 5565 + m_pVRChaperoneSetup = nullptr; 5566 + m_pVRCompositor = nullptr; 5567 + m_pVROverlay = nullptr; 5568 + m_pVROverlayView = nullptr; 5569 + m_pVRHeadsetView = nullptr; 5570 + m_pVRRenderModels = nullptr; 5571 + m_pVRExtendedDisplay = nullptr; 5572 + m_pVRSettings = nullptr; 5573 + m_pVRApplications = nullptr; 5574 + m_pVRTrackedCamera = nullptr; 5575 + m_pVRResources = nullptr; 5576 + m_pVRScreenshots = nullptr; 5577 + m_pVRDriverManager = nullptr; 5578 + m_pVRInput = nullptr; 5579 + m_pVRIOBuffer = nullptr; 5580 + m_pVRSpatialAnchors = nullptr; 5581 + m_pVRNotifications = nullptr; 5582 + m_pVRDebug = nullptr; 5583 + } 5584 + 5585 + VR_INTERFACE uint32_t VR_CALLTYPE VR_InitInternal2( EVRInitError *peError, EVRApplicationType eApplicationType, const char *pStartupInfo ); 5586 + VR_INTERFACE void VR_CALLTYPE VR_ShutdownInternal(); 5587 + 5588 + /** Finds the active installation of vrclient.dll and initializes it */ 5589 + inline IVRSystem *VR_Init( EVRInitError *peError, EVRApplicationType eApplicationType, const char *pStartupInfo ) 5590 + { 5591 + IVRSystem *pVRSystem = nullptr; 5592 + 5593 + EVRInitError eError; 5594 + VRToken() = VR_InitInternal2( &eError, eApplicationType, pStartupInfo ); 5595 + COpenVRContext &ctx = OpenVRInternal_ModuleContext(); 5596 + ctx.Clear(); 5597 + 5598 + if ( eError == VRInitError_None ) 5599 + { 5600 + if ( VR_IsInterfaceVersionValid( IVRSystem_Version ) ) 5601 + { 5602 + pVRSystem = VRSystem(); 5603 + } 5604 + else 5605 + { 5606 + VR_ShutdownInternal(); 5607 + eError = VRInitError_Init_InterfaceNotFound; 5608 + } 5609 + } 5610 + 5611 + if ( peError ) 5612 + *peError = eError; 5613 + return pVRSystem; 5614 + } 5615 + 5616 + /** unloads vrclient.dll. Any interface pointers from the interface are 5617 + * invalid after this point */ 5618 + inline void VR_Shutdown() 5619 + { 5620 + VR_ShutdownInternal(); 5621 + } 5622 + 5623 + #endif // OPENVR_INTERFACE_INTERNAL 5624 + }
+6
src/xrt/auxiliary/tracking/CMakeLists.txt
··· 7 7 t_imu_fusion.hpp 8 8 t_imu.cpp 9 9 t_imu.h 10 + t_openvr_tracker.cpp 11 + t_openvr_tracker.h 10 12 t_tracking.h 11 13 ) 12 14 target_link_libraries( ··· 53 55 target_sources(aux_tracking PRIVATE t_tracker_slam.cpp) 54 56 target_link_libraries(aux_tracking PRIVATE xrt-external-slam) 55 57 endif() 58 + 59 + if(XRT_HAVE_OPENVR) 60 + target_link_libraries(aux_tracking PRIVATE xrt-external-openvr ${OPENVR_LIBRARIES}) 61 + endif()
+175
src/xrt/auxiliary/tracking/t_openvr_tracker.cpp
··· 1 + // Copyright 2023, Collabora, Ltd. 2 + // SPDX-License-Identifier: BSL-1.0 3 + /*! 4 + * @file 5 + * @brief OpenVR tracking source. 6 + * @author Mateo de Mayo <mateo.demayo@collabora.com> 7 + * @ingroup aux_tracking 8 + */ 9 + 10 + #include "t_openvr_tracker.h" 11 + 12 + #include "util/u_logging.h" 13 + #include "xrt/xrt_config_have.h" 14 + 15 + #ifdef XRT_HAVE_OPENVR 16 + #include <openvr.h> 17 + #include <cstddef> 18 + #include <map> 19 + 20 + #include "math/m_api.h" 21 + #include "os/os_threading.h" 22 + #include "util/u_logging.h" 23 + #include "util/u_time.h" 24 + #include "xrt/xrt_defines.h" 25 + #include "xrt/xrt_tracking.h" 26 + 27 + struct openvr_tracker 28 + { 29 + vr::IVRSystem *vr_system; 30 + struct os_thread_helper thread; 31 + std::map<enum openvr_device, struct xrt_pose_sink *> sinks; 32 + double sample_frequency_hz; 33 + 34 + struct xrt_pose_sink * 35 + get_sink_for_device_index(uint64_t i) 36 + { 37 + vr::ETrackedDeviceClass dev_class = vr_system->GetTrackedDeviceClass(i); 38 + struct xrt_pose_sink *sink = nullptr; 39 + if (dev_class == vr::TrackedDeviceClass_HMD && sinks.count(T_OPENVR_DEVICE_HMD) > 0) { 40 + sink = sinks.at(T_OPENVR_DEVICE_HMD); 41 + } else if (dev_class == vr::TrackedDeviceClass_Controller && 42 + vr_system->GetControllerRoleForTrackedDeviceIndex(i) == vr::TrackedControllerRole_LeftHand && 43 + sinks.count(T_OPENVR_DEVICE_LEFT_CONTROLLER) > 0) { 44 + sink = sinks.at(T_OPENVR_DEVICE_LEFT_CONTROLLER); 45 + } else if (dev_class == vr::TrackedDeviceClass_Controller && 46 + vr_system->GetControllerRoleForTrackedDeviceIndex(i) == 47 + vr::TrackedControllerRole_RightHand && 48 + sinks.count(T_OPENVR_DEVICE_RIGHT_CONTROLLER) > 0) { 49 + sink = sinks.at(T_OPENVR_DEVICE_RIGHT_CONTROLLER); 50 + } else if (dev_class == vr::TrackedDeviceClass_GenericTracker && 51 + sinks.count(T_OPENVR_DEVICE_TRACKER) > 0) { 52 + sink = sinks.at(T_OPENVR_DEVICE_TRACKER); 53 + } 54 + return sink; 55 + } 56 + }; 57 + 58 + static void * 59 + tracking_loop(void *ot_ptr) 60 + { 61 + struct openvr_tracker *ovrt = (struct openvr_tracker *)ot_ptr; 62 + 63 + while (os_thread_helper_is_running(&ovrt->thread)) { 64 + os_nanosleep(U_TIME_1S_IN_NS / ovrt->sample_frequency_hz); 65 + 66 + // Flush events 67 + vr::VREvent_t event; 68 + while (ovrt->vr_system->PollNextEvent(&event, sizeof(event))) { 69 + } 70 + 71 + timepoint_ns now = os_monotonic_get_ns(); 72 + 73 + const uint32_t MAX_DEVS = vr::k_unMaxTrackedDeviceCount; 74 + auto origin = vr::ETrackingUniverseOrigin::TrackingUniverseRawAndUncalibrated; 75 + vr::TrackedDevicePose_t poses[MAX_DEVS]; 76 + ovrt->vr_system->GetDeviceToAbsoluteTrackingPose(origin, 0, poses, MAX_DEVS); 77 + 78 + for (uint32_t i = 0; i < MAX_DEVS; i++) { 79 + struct xrt_pose_sink *sink_for_i = ovrt->get_sink_for_device_index(i); 80 + if (sink_for_i != nullptr && poses[i].bDeviceIsConnected && poses[i].bPoseIsValid) { 81 + const auto &m = poses[i].mDeviceToAbsoluteTracking.m; 82 + struct xrt_vec3 p = {m[0][3], m[1][3], m[2][3]}; 83 + struct xrt_matrix_3x3 R = { 84 + m[0][0], m[0][1], m[0][2], // 85 + m[1][0], m[1][1], m[1][2], // 86 + m[2][0], m[2][1], m[2][2], // 87 + }; 88 + struct xrt_quat q = {}; 89 + math_quat_from_matrix_3x3(&R, &q); 90 + 91 + struct xrt_pose_sample sample = {now, {q, p}}; 92 + xrt_sink_push_pose(sink_for_i, &sample); 93 + } 94 + } 95 + } 96 + 97 + return nullptr; 98 + } 99 + 100 + extern "C" { 101 + 102 + struct openvr_tracker * 103 + t_openvr_tracker_create(double sample_frequency, enum openvr_device *devs, struct xrt_pose_sink **sinks, int sink_count) 104 + { 105 + struct openvr_tracker *ovrt = new openvr_tracker{}; 106 + os_thread_helper_init(&ovrt->thread); 107 + 108 + for (int i = 0; i < sink_count; i++) { 109 + ovrt->sinks[devs[i]] = sinks[i]; 110 + } 111 + ovrt->sample_frequency_hz = sample_frequency; 112 + 113 + vr::EVRInitError e = vr::VRInitError_None; 114 + ovrt->vr_system = vr::VR_Init(&e, vr::VRApplication_Background); 115 + if (e != vr::VRInitError_None) { 116 + if (e == vr::VRInitError_Init_NoServerForBackgroundApp) { 117 + U_LOG_E("Unable to find OpenVR server running. error=%d", e); 118 + } else { 119 + U_LOG_E("Unable to initialize OpenVR, error=%d", e); 120 + } 121 + return nullptr; 122 + } 123 + U_LOG(U_LOGGING_INFO, "OpenVR tracker created"); 124 + return ovrt; 125 + } 126 + 127 + void 128 + t_openvr_tracker_start(struct openvr_tracker *ovrt) 129 + { 130 + os_thread_helper_start(&ovrt->thread, tracking_loop, ovrt); 131 + } 132 + 133 + void 134 + t_openvr_tracker_stop(struct openvr_tracker *ovrt) 135 + { 136 + os_thread_helper_stop_and_wait(&ovrt->thread); 137 + } 138 + 139 + void 140 + t_openvr_tracker_destroy(struct openvr_tracker *ovrt) 141 + { 142 + if (os_thread_helper_is_running(&ovrt->thread)) { 143 + t_openvr_tracker_stop(ovrt); 144 + } 145 + vr::VR_Shutdown(); 146 + ovrt->vr_system = nullptr; 147 + os_thread_helper_destroy(&ovrt->thread); 148 + delete ovrt; 149 + } 150 + } 151 + 152 + #else 153 + 154 + struct openvr_tracker * 155 + t_openvr_tracker_create(double /*unused*/, 156 + enum openvr_device * /*unused*/, 157 + struct xrt_pose_sink ** /*unused*/, 158 + int /*unused*/) 159 + { 160 + U_LOG_W("OpenVR was not built, unable to initialize lighthouse tracking."); 161 + return nullptr; 162 + } 163 + 164 + void 165 + t_openvr_tracker_start(struct openvr_tracker * /*unused*/) 166 + {} 167 + 168 + void 169 + t_openvr_tracker_stop(struct openvr_tracker * /*unused*/) 170 + {} 171 + 172 + void 173 + t_openvr_tracker_destroy(struct openvr_tracker * /*unused*/) 174 + {} 175 + #endif
+59
src/xrt/auxiliary/tracking/t_openvr_tracker.h
··· 1 + // Copyright 2023, Collabora, Ltd. 2 + // SPDX-License-Identifier: BSL-1.0 3 + /*! 4 + * @file 5 + * @brief OpenVR tracking source. 6 + * @author Mateo de Mayo <mateo.demayo@collabora.com> 7 + * @ingroup aux_tracking 8 + */ 9 + 10 + #pragma once 11 + 12 + #include "xrt/xrt_tracking.h" 13 + 14 + #ifdef __cplusplus 15 + extern "C" { 16 + #endif 17 + 18 + enum openvr_device 19 + { 20 + T_OPENVR_DEVICE_UNKNOWN = 0, 21 + T_OPENVR_DEVICE_HMD, 22 + T_OPENVR_DEVICE_LEFT_CONTROLLER, 23 + T_OPENVR_DEVICE_RIGHT_CONTROLLER, 24 + T_OPENVR_DEVICE_TRACKER, 25 + }; 26 + 27 + struct openvr_tracker; 28 + 29 + /*! 30 + * Creates an OpenVR tracker. 31 + * 32 + * This creates an OpenVR instance in a separate 33 + * thread, and reports the tracking data of each device class `devs[i]` into the 34 + * pose sink `sinks[i]` at a rate of `sample_frequency`. 35 + * 36 + * @param sample_frequency_hz Sample frequency of the tracking data in hertz 37 + * @param devs Devices to report tracking data of 38 + * @param sinks Where to stream the tracking data of each device in `devs` to 39 + * @param sink_count Number of sinks/devices to track 40 + * @return struct openvr_tracker* if successfully created, null otherwise. 41 + */ 42 + struct openvr_tracker * 43 + t_openvr_tracker_create(double sample_frequency_hz, 44 + enum openvr_device *devs, 45 + struct xrt_pose_sink **sinks, 46 + int sink_count); 47 + 48 + void 49 + t_openvr_tracker_start(struct openvr_tracker *ovrt); 50 + 51 + void 52 + t_openvr_tracker_stop(struct openvr_tracker *ovrt); 53 + 54 + void 55 + t_openvr_tracker_destroy(struct openvr_tracker *ovrt); 56 + 57 + #ifdef __cplusplus 58 + } 59 + #endif
+24 -2
src/xrt/auxiliary/tracking/t_tracker_slam.cpp
··· 25 25 #include "math/m_space.h" 26 26 #include "math/m_vec3.h" 27 27 #include "tracking/t_euroc_recorder.h" 28 + #include "tracking/t_openvr_tracker.h" 28 29 #include "tracking/t_tracking.h" 29 30 30 31 #include <slam_tracker.hpp> ··· 69 70 DEBUG_GET_ONCE_OPTION(slam_config, "SLAM_CONFIG", nullptr) 70 71 DEBUG_GET_ONCE_BOOL_OPTION(slam_ui, "SLAM_UI", false) 71 72 DEBUG_GET_ONCE_BOOL_OPTION(slam_submit_from_start, "SLAM_SUBMIT_FROM_START", false) 73 + DEBUG_GET_ONCE_NUM_OPTION(slam_openvr_groundtruth_device, "SLAM_OPENVR_GROUNDTRUTH_DEVICE", 0) 72 74 DEBUG_GET_ONCE_NUM_OPTION(slam_prediction_type, "SLAM_PREDICTION_TYPE", long(SLAM_PRED_SP_SO_IA_IL)) 73 75 DEBUG_GET_ONCE_BOOL_OPTION(slam_write_csvs, "SLAM_WRITE_CSVS", false) 74 76 DEBUG_GET_ONCE_OPTION(slam_csv_path, "SLAM_CSV_PATH", "evaluation/") ··· 359 361 MatFrame *cv_wrapper; //!< Wraps a xrt_frame in a cv::Mat to send to the SLAM system 360 362 361 363 struct xrt_slam_sinks *euroc_recorder; //!< EuRoC dataset recording sinks 364 + struct openvr_tracker *ovr_tracker; //!< OpenVR lighthouse tracker 362 365 363 366 // Used mainly for checking that the timestamps come in order 364 367 timepoint_ns last_imu_ts; //!< Last received IMU sample timestamp ··· 815 818 816 819 t.slam_rels.push(rel, nts); 817 820 818 - xrt_pose_sample sample{nts, rel.pose}; 819 - xrt_sink_push_pose(t.euroc_recorder->gt, &sample); 820 821 gt_ui_push(t, nts, rel.pose); 821 822 t.slam_traj_writer->push(nts, rel.pose); 822 823 ··· 1167 1168 } 1168 1169 1169 1170 t.gt.trajectory->insert_or_assign(sample->timestamp_ns, sample->pose); 1171 + xrt_sink_push_pose(t.euroc_recorder->gt, sample); 1170 1172 } 1171 1173 1172 1174 //! Receive and send IMU samples to the external SLAM system ··· 1203 1205 static void 1204 1206 receive_frame(TrackerSlam &t, struct xrt_frame *frame, int cam_index) 1205 1207 { 1208 + if (cam_index == 1) { 1209 + flush_poses(t); // Useful to flush SLAM poses when no openxr app is open 1210 + } 1206 1211 SLAM_DASSERT(t.last_cam_ts[0] != INT64_MIN || cam_index == 0, "First frame was not a cam0 frame"); 1207 1212 1208 1213 // Construct and send the image sample ··· 1248 1253 t_slam_node_break_apart(struct xrt_frame_node *node) 1249 1254 { 1250 1255 auto &t = *container_of(node, TrackerSlam, node); 1256 + if (t.ovr_tracker != NULL) { 1257 + t_openvr_tracker_stop(t.ovr_tracker); 1258 + } 1251 1259 t.slam->finalize(); 1252 1260 t.slam->stop(); 1253 1261 os_thread_helper_stop_and_wait(&t.oth); ··· 1260 1268 auto t_ptr = container_of(node, TrackerSlam, node); 1261 1269 auto &t = *t_ptr; // Needed by SLAM_DEBUG 1262 1270 SLAM_DEBUG("Destroying SLAM tracker"); 1271 + if (t.ovr_tracker != NULL) { 1272 + t_openvr_tracker_destroy(t.ovr_tracker); 1273 + } 1263 1274 os_thread_helper_destroy(&t_ptr->oth); 1264 1275 delete t.gt.trajectory; 1265 1276 delete t.slam_times_writer; ··· 1308 1319 config->slam_config = debug_get_option_slam_config(); 1309 1320 config->slam_ui = debug_get_bool_option_slam_ui(); 1310 1321 config->submit_from_start = debug_get_bool_option_slam_submit_from_start(); 1322 + config->openvr_groundtruth_device = int(debug_get_num_option_slam_openvr_groundtruth_device()); 1311 1323 config->prediction = t_slam_prediction_type(debug_get_num_option_slam_prediction_type()); 1312 1324 config->write_csvs = debug_get_bool_option_slam_write_csvs(); 1313 1325 config->csv_path = debug_get_option_slam_csv_path(); ··· 1454 1466 t.filt_traj_writer = new TrajectoryWriter{dir, "filtering.csv", write_csvs}; 1455 1467 1456 1468 setup_ui(t); 1469 + 1470 + // Setup OpenVR groundtruth tracker 1471 + if (config->openvr_groundtruth_device > 0) { 1472 + enum openvr_device dev_class = openvr_device(config->openvr_groundtruth_device); 1473 + const double freq = 1000.0f; 1474 + t.ovr_tracker = t_openvr_tracker_create(freq, &dev_class, &t.sinks.gt, 1); 1475 + if (t.ovr_tracker != NULL) { 1476 + t_openvr_tracker_start(t.ovr_tracker); 1477 + } 1478 + } 1457 1479 1458 1480 *out_xts = &t.base; 1459 1481 *out_sink = &t.sinks;
+1
src/xrt/auxiliary/tracking/t_tracking.h
··· 649 649 int cam_count; //!< Number of cameras in use 650 650 bool slam_ui; //!< Whether to open the external UI of the external SLAM system 651 651 bool submit_from_start; //!< Whether to submit data to the SLAM tracker without user action 652 + int openvr_groundtruth_device; //!< If >0, use lighthouse as groundtruth, see @ref enum openvr_device 652 653 enum t_slam_prediction_type prediction; //!< Which level of prediction to use 653 654 bool write_csvs; //!< Whether to enable CSV writers from the start for later analysis 654 655 const char *csv_path; //!< Path to write CSVs to
+1 -1
src/xrt/drivers/euroc/euroc_player.cpp
··· 915 915 u_var_add_ro_ff_vec3_f32(ep, ep->gyro_ff, "Gyroscope"); 916 916 u_var_add_ro_ff_vec3_f32(ep, ep->accel_ff, "Accelerometer"); 917 917 for (int i = 0; i < ep->dataset.cam_count; i++) { 918 - char label[] = "Camera NNNN"; 918 + char label[] = "Camera NNNNNNNNNN"; 919 919 (void)snprintf(label, sizeof(label), "Camera %d", i); 920 920 u_var_add_sink_debug(ep, &ep->ui_cam_sinks[i], label); 921 921 }
+1
src/xrt/include/xrt/xrt_config_have.h.cmake_in
··· 30 30 #cmakedefine XRT_HAVE_OPENCV 31 31 #cmakedefine XRT_HAVE_OPENGL 32 32 #cmakedefine XRT_HAVE_OPENGLES 33 + #cmakedefine XRT_HAVE_OPENVR 33 34 #cmakedefine XRT_HAVE_PERCETTO 34 35 #cmakedefine XRT_HAVE_SDL2 35 36 #cmakedefine XRT_HAVE_SYSTEMD