diff --git a/bin/linux32/libopenvr_api.so b/bin/linux32/libopenvr_api.so index ede8ac71..5f8f2696 100755 Binary files a/bin/linux32/libopenvr_api.so and b/bin/linux32/libopenvr_api.so differ diff --git a/bin/linux32/libopenvr_api.so.dbg b/bin/linux32/libopenvr_api.so.dbg index 6f9c578f..27803d26 100755 Binary files a/bin/linux32/libopenvr_api.so.dbg and b/bin/linux32/libopenvr_api.so.dbg differ diff --git a/bin/linux64/libopenvr_api.so b/bin/linux64/libopenvr_api.so index 28e9f338..0db0884c 100755 Binary files a/bin/linux64/libopenvr_api.so and b/bin/linux64/libopenvr_api.so differ diff --git a/bin/linux64/libopenvr_api.so.dbg b/bin/linux64/libopenvr_api.so.dbg index 50e8d620..893dc497 100755 Binary files a/bin/linux64/libopenvr_api.so.dbg and b/bin/linux64/libopenvr_api.so.dbg differ diff --git a/bin/osx32/libopenvr_api.dylib b/bin/osx32/libopenvr_api.dylib index 1be0a9b4..7a719c37 100755 Binary files a/bin/osx32/libopenvr_api.dylib and b/bin/osx32/libopenvr_api.dylib differ diff --git a/bin/osx32/libopenvr_api.dylib.dSYM/Contents/Resources/DWARF/libopenvr_api.dylib b/bin/osx32/libopenvr_api.dylib.dSYM/Contents/Resources/DWARF/libopenvr_api.dylib index 9b783da0..05fe06bf 100644 Binary files a/bin/osx32/libopenvr_api.dylib.dSYM/Contents/Resources/DWARF/libopenvr_api.dylib and b/bin/osx32/libopenvr_api.dylib.dSYM/Contents/Resources/DWARF/libopenvr_api.dylib differ diff --git a/bin/win32/openvr_api.dll b/bin/win32/openvr_api.dll index 9fab1525..376529cd 100644 Binary files a/bin/win32/openvr_api.dll and b/bin/win32/openvr_api.dll differ diff --git a/bin/win32/openvr_api.pdb b/bin/win32/openvr_api.pdb index 5dcbf246..e41c9180 100644 Binary files a/bin/win32/openvr_api.pdb and b/bin/win32/openvr_api.pdb differ diff --git a/bin/win64/openvr_api.dll b/bin/win64/openvr_api.dll index b1930037..b31cce41 100644 Binary files a/bin/win64/openvr_api.dll and b/bin/win64/openvr_api.dll differ diff --git a/bin/win64/openvr_api.pdb b/bin/win64/openvr_api.pdb index bc675e2d..80f1167c 100644 Binary files a/bin/win64/openvr_api.pdb and b/bin/win64/openvr_api.pdb differ diff --git a/headers/openvr.h b/headers/openvr.h index 801a690c..dd2addd2 100644 --- a/headers/openvr.h +++ b/headers/openvr.h @@ -29,6 +29,10 @@ namespace vr { #pragma pack( push, 8 ) +/** A handle for a spatial anchor. This handle is only valid during the session it was created in. +* Anchors that live beyond one session should be saved by their string descriptors. */ +typedef uint32_t SpatialAnchorHandle_t; + typedef void* glSharedTextureHandle_t; typedef int32_t glInt_t; typedef uint32_t glUInt_t; @@ -43,6 +47,11 @@ struct HmdMatrix34_t float m[3][4]; }; +struct HmdMatrix33_t +{ + float m[3][3]; +}; + struct HmdMatrix44_t { float m[4][4]; @@ -112,13 +121,17 @@ enum EVREye enum ETextureType { + TextureType_Invalid = -1, // Handle has been invalidated TextureType_DirectX = 0, // Handle is an ID3D11Texture TextureType_OpenGL = 1, // Handle is an OpenGL texture name or an OpenGL render buffer name, depending on submit flags TextureType_Vulkan = 2, // Handle is a pointer to a VRVulkanTextureData_t structure - TextureType_IOSurface = 3, // Handle is a macOS cross-process-sharable IOSurfaceRef + TextureType_IOSurface = 3, // Handle is a macOS cross-process-sharable IOSurfaceRef, deprecated in favor of TextureType_Metal on supported platforms TextureType_DirectX12 = 4, // Handle is a pointer to a D3D12TextureData_t structure TextureType_DXGISharedHandle = 5, // Handle is a HANDLE DXGI share handle, only supported for Overlay render targets. // this texture is used directly by our renderer, so only perform atomic (copyresource or resolve) on it + TextureType_Metal = 6, // Handle is a MTLTexture conforming to the MTLSharedTexture protocol. Textures submitted to IVRCompositor::Submit which + // are of type MTLTextureType2DArray assume layer 0 is the left eye texture (vr::EVREye::Eye_left), layer 1 is the right + // eye texture (vr::EVREye::Eye_Right) }; enum EColorSpace @@ -171,6 +184,8 @@ enum ETrackedDeviceClass TrackedDeviceClass_GenericTracker = 3, // Generic trackers, similar to controllers TrackedDeviceClass_TrackingReference = 4, // Camera and base stations that serve as tracking reference points TrackedDeviceClass_DisplayRedirect = 5, // Accessories that aren't necessarily tracked themselves, but may redirect video output from other tracked devices + + TrackedDeviceClass_Max }; @@ -241,6 +256,8 @@ static const PropertyTypeTag_t k_unWildcardPropertyTag = 34; static const PropertyTypeTag_t k_unHapticVibrationPropertyTag = 35; static const PropertyTypeTag_t k_unSkeletonPropertyTag = 36; +static const PropertyTypeTag_t k_unSpatialAnchorPosePropertyTag = 40; + static const PropertyTypeTag_t k_unOpenVRInternalReserved_Start = 1000; static const PropertyTypeTag_t k_unOpenVRInternalReserved_End = 10000; @@ -361,6 +378,19 @@ enum ETrackedDeviceProperty Prop_ImuFactoryGyroScale_Vector3 = 2065, Prop_ImuFactoryAccelerometerBias_Vector3 = 2066, Prop_ImuFactoryAccelerometerScale_Vector3 = 2067, + // reserved 2068 + Prop_ConfigurationIncludesLighthouse20Features_Bool = 2069, + + // Driver requested mura correction properties + Prop_DriverRequestedMuraCorrectionMode_Int32 = 2200, + Prop_DriverRequestedMuraFeather_InnerLeft_Int32 = 2201, + Prop_DriverRequestedMuraFeather_InnerRight_Int32 = 2202, + Prop_DriverRequestedMuraFeather_InnerTop_Int32 = 2203, + Prop_DriverRequestedMuraFeather_InnerBottom_Int32 = 2204, + Prop_DriverRequestedMuraFeather_OuterLeft_Int32 = 2205, + Prop_DriverRequestedMuraFeather_OuterRight_Int32 = 2206, + Prop_DriverRequestedMuraFeather_OuterTop_Int32 = 2207, + Prop_DriverRequestedMuraFeather_OuterBottom_Int32 = 2208, // Properties that are unique to TrackedDeviceClass_Controller Prop_AttachedDeviceId_String = 3000, @@ -405,6 +435,7 @@ enum ETrackedDeviceProperty Prop_HasCameraComponent_Bool = 6004, Prop_HasDriverDirectModeComponent_Bool = 6005, Prop_HasVirtualDisplayComponent_Bool = 6006, + Prop_HasSpatialAnchorsSupport_Bool = 6007, // Properties that are set internally based on other information provided by drivers Prop_ControllerType_String = 7000, @@ -438,6 +469,16 @@ enum ETrackedPropertyError TrackedProp_CannotWriteToWildcards = 12, }; + +typedef uint64_t VRActionHandle_t; +typedef uint64_t VRActionSetHandle_t; +typedef uint64_t VRInputValueHandle_t; + +static const VRActionHandle_t k_ulInvalidActionHandle = 0; +static const VRActionSetHandle_t k_ulInvalidActionSetHandle = 0; +static const VRInputValueHandle_t k_ulInvalidInputValueHandle = 0; + + /** Allows the application to control what part of the provided texture will be used in the * frame buffer. */ struct VRTextureBounds_t @@ -496,7 +537,8 @@ enum EVRSubmitFlags }; /** Data required for passing Vulkan textures to IVRCompositor::Submit. -* Be sure to call OpenVR_Shutdown before destroying these resources. */ +* Be sure to call OpenVR_Shutdown before destroying these resources. +* Please see https://github.com/ValveSoftware/openvr/wiki/Vulkan for Vulkan-specific documentation */ struct VRVulkanTextureData_t { uint64_t m_nImage; // VkImage @@ -657,7 +699,8 @@ enum EVREventType VREvent_KeyboardSectionSettingChanged = 862, VREvent_PerfSectionSettingChanged = 863, VREvent_DashboardSectionSettingChanged = 864, - VREvent_WebInterfaceSectionSettingChanged = 865, + VREvent_WebInterfaceSectionSettingChanged = 865, + VREvent_TrackersSectionSettingChanged = 866, VREvent_StatusUpdate = 900, @@ -700,8 +743,15 @@ enum EVREventType VREvent_MessageOverlayCloseRequested = 1651, VREvent_Input_HapticVibration = 1700, // data is hapticVibration - VREvent_Input_BindingLoadFailed = 1701, // data is process - VREvent_Input_BindingLoadSuccessful = 1702, // data is process + VREvent_Input_BindingLoadFailed = 1701, // data is inputBinding + VREvent_Input_BindingLoadSuccessful = 1702, // data is inputBinding + VREvent_Input_ActionManifestReloaded = 1703, // no data + VREvent_Input_ActionManifestLoadFailed = 1704, // data is actionManifest + + VREvent_SpatialAnchors_PoseUpdated = 1800, // data is spatialAnchor. broadcast + VREvent_SpatialAnchors_DescriptorUpdated = 1801, // data is spatialAnchor. broadcast + VREvent_SpatialAnchors_RequestPoseUpdate = 1802, // data is spatialAnchor. sent to specific driver + VREvent_SpatialAnchors_RequestDescriptorUpdate = 1803, // data is spatialAnchor. sent to specific driver // Vendors are free to expose private events in this reserved region VREvent_VendorSpecific_Reserved_Start = 10000, @@ -750,6 +800,10 @@ enum EVRButtonId k_EButton_Dashboard_Back = k_EButton_Grip, + k_EButton_Knuckles_A = k_EButton_Grip, + k_EButton_Knuckles_B = k_EButton_ApplicationMenu, + k_EButton_Knuckles_JoyStick = k_EButton_Axis3, + k_EButton_Max = 64 }; @@ -939,10 +993,22 @@ struct VREvent_InputBindingLoad_t vr::PropertyContainerHandle_t ulAppContainer; uint64_t pathMessage; uint64_t pathUrl; + uint64_t pathControllerType; }; +struct VREvent_InputActionManifestLoad_t +{ + uint64_t pathAppKey; + uint64_t pathMessage; + uint64_t pathMessageParam; + uint64_t pathManifestPath; +}; + +struct VREvent_SpatialAnchor_t +{ + SpatialAnchorHandle_t unHandle; +}; -/** NOTE!!! If you change this you MUST manually update openvr_interop.cs.py */ typedef union { VREvent_Reserved_t reserved; @@ -969,6 +1035,9 @@ typedef union VREvent_HapticVibration_t hapticVibration; VREvent_WebConsole_t webConsole; VREvent_InputBindingLoad_t inputBinding; + VREvent_InputActionManifestLoad_t actionManifest; + VREvent_SpatialAnchor_t spatialAnchor; + /** NOTE!!! If you change this you MUST manually update openvr_interop.cs.py */ } VREvent_Data_t; @@ -1010,8 +1079,26 @@ enum EVRInputError VRInputError_NoData = 13, VRInputError_BufferTooSmall = 14, VRInputError_MismatchedActionManifest = 15, + VRInputError_MissingSkeletonData = 16, }; +enum EVRSpatialAnchorError +{ + VRSpatialAnchorError_Success = 0, + VRSpatialAnchorError_Internal = 1, + VRSpatialAnchorError_UnknownHandle = 2, + VRSpatialAnchorError_ArrayTooSmall = 3, + VRSpatialAnchorError_InvalidDescriptorChar = 4, + VRSpatialAnchorError_NotYetAvailable = 5, + VRSpatialAnchorError_NotAvailableInThisUniverse = 6, + VRSpatialAnchorError_PermanentlyUnavailable = 7, + VRSpatialAnchorError_WrongDriver = 8, + VRSpatialAnchorError_DescriptorTooLong = 9, + VRSpatialAnchorError_Unknown = 10, + VRSpatialAnchorError_NoRoomCalibration = 11, + VRSpatialAnchorError_InvalidArgument = 12, + VRSpatialAnchorError_UnknownDriver = 13, +}; /** The mesh to draw into the stencil (or depth) buffer to perform * early stencil (or depth) kills of pixels that will never appear on the HMD. @@ -1194,6 +1281,19 @@ enum EVRNotificationError }; +enum EVRSkeletalMotionRange +{ + // The range of motion of the skeleton takes into account any physical limits imposed by + // the controller itself. This will tend to be the most accurate pose compared to the user's + // actual hand pose, but might not allow a closed fist for example + VRSkeletalMotionRange_WithController = 0, + + // Retarget the range of motion provided by the input device to make the hand appear to move + // as if it was not holding a controller. eg: map "hand grasping controller" to "closed fist" + VRSkeletalMotionRange_WithoutController = 1, +}; + + /** Holds the transform for a single bone */ struct VRBoneTransform_t { @@ -1252,6 +1352,7 @@ enum EVRInitError VRInitError_Init_FirmwareRecoveryBusy = 139, VRInitError_Init_USBServiceBusy = 140, VRInitError_Init_VRWebHelperStartupFailed = 141, + VRInitError_Init_TrackerManagerInitFailed = 142, VRInitError_Driver_Failed = 200, VRInitError_Driver_Unknown = 201, @@ -1395,6 +1496,12 @@ enum EVSync VSync_NoWaitRender, // do not block following render work (allow to get started early) }; +enum EVRMuraCorrectionMode +{ + EVRMuraCorrectionMode_Default = 0, + EVRMuraCorrectionMode_NoCorrection +}; + /** raw IMU data provided by IVRIOBuffer from paths to tracked devices with IMUs */ enum Imu_OffScaleFlags { @@ -1613,10 +1720,10 @@ class IVRSystem */ virtual void ApplyTransform( TrackedDevicePose_t *pOutputPose, const TrackedDevicePose_t *pTrackedDevicePose, const HmdMatrix34_t *pTransform ) = 0; - /** Returns the device index associated with a specific role, for example the left hand or the right hand. */ + /** 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. */ virtual vr::TrackedDeviceIndex_t GetTrackedDeviceIndexForControllerRole( vr::ETrackedControllerRole unDeviceType ) = 0; - /** Returns the controller type associated with a device index. */ + /** Returns the controller type associated with a device index. This function is deprecated in favor of the new IVRInput system. */ virtual vr::ETrackedControllerRole GetControllerRoleForTrackedDeviceIndex( vr::TrackedDeviceIndex_t unDeviceIndex ) = 0; // ------------------------------------ @@ -1700,22 +1807,22 @@ class IVRSystem // ------------------------------------ /** Fills the supplied struct with the current state of the controller. Returns false if the controller index - * is invalid. */ + * is invalid. This function is deprecated in favor of the new IVRInput system. */ virtual bool GetControllerState( vr::TrackedDeviceIndex_t unControllerDeviceIndex, vr::VRControllerState_t *pControllerState, uint32_t unControllerStateSize ) = 0; /** fills the supplied struct with the current state of the controller and the provided pose with the pose of * the controller when the controller state was updated most recently. Use this form if you need a precise controller - * pose as input to your application when the user presses or releases a button. */ + * 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. */ virtual bool GetControllerStateWithPose( ETrackingUniverseOrigin eOrigin, vr::TrackedDeviceIndex_t unControllerDeviceIndex, vr::VRControllerState_t *pControllerState, uint32_t unControllerStateSize, TrackedDevicePose_t *pTrackedDevicePose ) = 0; /** Trigger a single haptic pulse on a controller. After this call the application may not trigger another haptic pulse on this controller - * and axis combination for 5ms. */ + * and axis combination for 5ms. This function is deprecated in favor of the new IVRInput system. */ virtual void TriggerHapticPulse( vr::TrackedDeviceIndex_t unControllerDeviceIndex, uint32_t unAxisId, unsigned short usDurationMicroSec ) = 0; - /** returns the name of an EVRButtonId enum value */ + /** returns the name of an EVRButtonId enum value. This function is deprecated in favor of the new IVRInput system. */ virtual const char *GetButtonIdNameFromEnum( EVRButtonId eButtonId ) = 0; - /** returns the name of an EVRControllerAxisType enum value */ + /** returns the name of an EVRControllerAxisType enum value. This function is deprecated in favor of the new IVRInput system. */ virtual const char *GetControllerAxisTypeNameFromEnum( EVRControllerAxisType eAxisType ) = 0; /** Returns true if this application is receiving input from the system. This would return false if @@ -1990,6 +2097,8 @@ namespace vr } // namespace vr // ivrsettings.h +#include + namespace vr { enum EVRSettingsError @@ -2032,6 +2141,88 @@ namespace vr //----------------------------------------------------------------------------- static const char * const IVRSettings_Version = "IVRSettings_002"; + class CVRSettingHelper + { + IVRSettings *m_pSettings = nullptr; + public: + CVRSettingHelper( IVRSettings *pSettings ) + { + m_pSettings = pSettings; + } + + const char *GetSettingsErrorNameFromEnum( EVRSettingsError eError ) + { + return m_pSettings->GetSettingsErrorNameFromEnum( eError ); + } + + // Returns true if file sync occurred (force or settings dirty) + bool Sync( bool bForce = false, EVRSettingsError *peError = nullptr ) + { + return m_pSettings->Sync( bForce, peError ); + } + + void SetBool( const char *pchSection, const char *pchSettingsKey, bool bValue, EVRSettingsError *peError = nullptr ) + { + m_pSettings->SetBool( pchSection, pchSettingsKey, bValue, peError ); + } + + void SetInt32( const char *pchSection, const char *pchSettingsKey, int32_t nValue, EVRSettingsError *peError = nullptr ) + { + m_pSettings->SetInt32( pchSection, pchSettingsKey, nValue, peError ); + } + void SetFloat( const char *pchSection, const char *pchSettingsKey, float flValue, EVRSettingsError *peError = nullptr ) + { + m_pSettings->SetFloat( pchSection, pchSettingsKey, flValue, peError ); + } + void SetString( const char *pchSection, const char *pchSettingsKey, const char *pchValue, EVRSettingsError *peError = nullptr ) + { + m_pSettings->SetString( pchSection, pchSettingsKey, pchValue, peError ); + } + void SetString( const std::string & sSection, const std::string & sSettingsKey, const std::string & sValue, EVRSettingsError *peError = nullptr ) + { + m_pSettings->SetString( sSection.c_str(), sSettingsKey.c_str(), sValue.c_str(), peError ); + } + + bool GetBool( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) + { + return m_pSettings->GetBool( pchSection, pchSettingsKey, peError ); + } + int32_t GetInt32( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) + { + return m_pSettings->GetInt32( pchSection, pchSettingsKey, peError ); + } + float GetFloat( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) + { + return m_pSettings->GetFloat( pchSection, pchSettingsKey, peError ); + } + void GetString( const char *pchSection, const char *pchSettingsKey, VR_OUT_STRING() char *pchValue, uint32_t unValueLen, EVRSettingsError *peError = nullptr ) + { + m_pSettings->GetString( pchSection, pchSettingsKey, pchValue, unValueLen, peError ); + } + std::string GetString( const std::string & sSection, const std::string & sSettingsKey, EVRSettingsError *peError = nullptr ) + { + char buf[4096]; + vr::EVRSettingsError eError; + m_pSettings->GetString( sSection.c_str(), sSettingsKey.c_str(), buf, sizeof( buf ), &eError ); + if ( peError ) + *peError = eError; + if ( eError == vr::VRSettingsError_None ) + return buf; + else + return ""; + } + + void RemoveSection( const char *pchSection, EVRSettingsError *peError = nullptr ) + { + m_pSettings->RemoveSection( pchSection, peError ); + } + void RemoveKeyInSection( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) + { + m_pSettings->RemoveKeyInSection( pchSection, pchSettingsKey, peError ); + } + }; + + //----------------------------------------------------------------------------- // steamvr keys static const char * const k_pch_SteamVR_Section = "steamvr"; @@ -2085,6 +2276,8 @@ namespace vr static const char * const k_pch_SteamVR_DebugInput = "debugInput"; static const char * const k_pch_SteamVR_LegacyInputRebinding = "legacyInputRebinding"; static const char * const k_pch_SteamVR_DebugInputBinding = "debugInputBinding"; + static const char * const k_pch_SteamVR_InputBindingUIBlock = "inputBindingUI"; + static const char * const k_pch_SteamVR_RenderCameraMode = "renderCameraMode"; //----------------------------------------------------------------------------- // lighthouse keys @@ -2201,6 +2394,7 @@ namespace vr static const char * const k_pch_Dashboard_ArcadeMode_Bool = "arcadeMode"; static const char * const k_pch_Dashboard_EnableWebUI = "webUI"; static const char * const k_pch_Dashboard_EnableWebUIDevTools = "webUIDevTools"; + static const char * const k_pch_Dashboard_EnableWebUIDashboardReplacement = "webUIDashboard"; //----------------------------------------------------------------------------- // model skin keys @@ -2213,6 +2407,7 @@ namespace vr //----------------------------------------------------------------------------- // web interface keys static const char* const k_pch_WebInterface_Section = "WebInterface"; + static const char* const k_pch_WebInterface_WebEnable_Bool = "WebEnable"; static const char* const k_pch_WebInterface_WebPort_String = "WebPort"; //----------------------------------------------------------------------------- @@ -2227,6 +2422,10 @@ namespace vr static const char* const k_pch_App_NeedToUpdateAutosaveSuffix_Bool = "NeedToUpdateAutosave"; static const char* const k_pch_App_ActionManifestURL_String = "ActionManifestURL"; + //----------------------------------------------------------------------------- + // configuration for trackers + static const char * const k_pch_Trackers_Section = "trackers"; + } // namespace vr // ivrchaperone.h @@ -2631,7 +2830,7 @@ class IVRCompositor /** Returns true if the mirror window is shown. */ virtual bool IsMirrorWindowVisible() = 0; - /** Writes all images that the compositor knows about (including overlays) to a 'screenshots' folder in the SteamVR runtime root. */ + /** Writes back buffer and stereo left/right pair from the application to a 'screenshots' folder in the SteamVR runtime root. */ virtual void CompositorDumpImages() = 0; /** Let an app know it should be rendering with low resources. */ @@ -3474,6 +3673,9 @@ class IVRRenderModels * If the pchRenderModelName or pchComponentName is invalid, this will return false (and transforms will be set to identity). * Otherwise, return true * Note: For dynamic objects, visibility may be dynamic. (I.e., true/false will be returned based on controller state and controller mode state ) */ + 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; + + /** 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. */ 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; /** Returns true if the render model has a component with the specified name */ @@ -3491,7 +3693,7 @@ class IVRRenderModels virtual const char *GetRenderModelErrorNameFromEnum( vr::EVRRenderModelError error ) = 0; }; -static const char * const IVRRenderModels_Version = "IVRRenderModels_005"; +static const char * const IVRRenderModels_Version = "IVRRenderModels_006"; } @@ -3738,14 +3940,6 @@ static const char * const IVRDriverManager_Version = "IVRDriverManager_001"; namespace vr { - typedef uint64_t VRActionHandle_t; - typedef uint64_t VRActionSetHandle_t; - typedef uint64_t VRInputValueHandle_t; - - static const VRActionHandle_t k_ulInvalidActionHandle = 0; - static const VRActionSetHandle_t k_ulInvalidActionSetHandle = 0; - static const VRInputValueHandle_t k_ulInvalidInputValueHandle = 0; - static const uint32_t k_unMaxActionNameLength = 64; static const uint32_t k_unMaxActionSetNameLength = 64; static const uint32_t k_unMaxActionOriginCount = 16; @@ -3798,21 +3992,23 @@ namespace vr TrackedDevicePose_t pose; }; - enum EVRSkeletalTransformSpace - { - VRSkeletalTransformSpace_Action = 0, - VRSkeletalTransformSpace_Parent = 1, - VRSkeletalTransformSpace_Additive = 2, - }; - - - struct InputSkeletonActionData_t + struct InputSkeletalActionData_t { // Whether or not this action is currently available to be bound in the active action set bool bActive; // The origin that caused this action's current state VRInputValueHandle_t activeOrigin; + + // The number of bones in the skeletal data + uint32_t boneCount; + }; + + enum EVRSkeletalTransformSpace + { + VRSkeletalTransformSpace_Model = 0, + VRSkeletalTransformSpace_Parent = 1, + VRSkeletalTransformSpace_Additive = 2, }; enum EVRInputFilterCancelType @@ -3841,6 +4037,14 @@ namespace vr * ulRestrictedToDevice is set to k_ulInvalidInputValueHandle, this parameter is * ignored. */ VRActionSetHandle_t ulSecondaryActionSet; + + // This field is ignored + uint32_t unPadding; + + /** The priority of this action set relative to other action sets. Any inputs + * bound to a source (e.g. trackpad, joystick, trigger) will disable bindings in + * other active action sets with a smaller priority. */ + int32_t nPriority; }; @@ -3873,30 +4077,35 @@ namespace vr /** Reads the state of a digital action given its handle. This will return VRInputError_WrongType if the type of * action is something other than digital */ - virtual EVRInputError GetDigitalActionData( VRActionHandle_t action, InputDigitalActionData_t *pActionData, uint32_t unActionDataSize ) = 0; + virtual EVRInputError GetDigitalActionData( VRActionHandle_t action, InputDigitalActionData_t *pActionData, uint32_t unActionDataSize, VRInputValueHandle_t ulRestrictToDevice ) = 0; /** Reads the state of an analog action given its handle. This will return VRInputError_WrongType if the type of * action is something other than analog */ - virtual EVRInputError GetAnalogActionData( VRActionHandle_t action, InputAnalogActionData_t *pActionData, uint32_t unActionDataSize ) = 0; + virtual EVRInputError GetAnalogActionData( VRActionHandle_t action, InputAnalogActionData_t *pActionData, uint32_t unActionDataSize, VRInputValueHandle_t ulRestrictToDevice ) = 0; /** Reads the state of a pose action given its handle. */ - virtual EVRInputError GetPoseActionData( VRActionHandle_t action, ETrackingUniverseOrigin eOrigin, float fPredictedSecondsFromNow, InputPoseActionData_t *pActionData, uint32_t unActionDataSize ) = 0; + virtual EVRInputError GetPoseActionData( VRActionHandle_t action, ETrackingUniverseOrigin eOrigin, float fPredictedSecondsFromNow, InputPoseActionData_t *pActionData, uint32_t unActionDataSize, VRInputValueHandle_t ulRestrictToDevice ) = 0; /** Reads the state of a skeletal action given its handle. */ - virtual EVRInputError GetSkeletalActionData( VRActionHandle_t action, EVRSkeletalTransformSpace eBoneParent, float fPredictedSecondsFromNow, InputSkeletonActionData_t *pActionData, uint32_t unActionDataSize, VR_ARRAY_COUNT( unTransformArrayCount ) VRBoneTransform_t *pTransformArray, uint32_t unTransformArrayCount ) = 0; + virtual EVRInputError GetSkeletalActionData( VRActionHandle_t action, InputSkeletalActionData_t *pActionData, uint32_t unActionDataSize, VRInputValueHandle_t ulRestrictToDevice ) = 0; + + // --------------- Skeletal Bone Data ------------------- // - /** Reads the state of a skeletal action given its handle in a compressed form that is suitable for + /** Reads the state of the skeletal bone data associated with this action and copies it into the given buffer. */ + virtual EVRInputError GetSkeletalBoneData( VRActionHandle_t action, EVRSkeletalTransformSpace eTransformSpace, EVRSkeletalMotionRange eMotionRange, VR_ARRAY_COUNT( unTransformArrayCount ) VRBoneTransform_t *pTransformArray, uint32_t unTransformArrayCount, VRInputValueHandle_t ulRestrictToDevice ) = 0; + + /** Reads the state of the skeletal bone data in a compressed form that is suitable for * sending over the network. The required buffer size will never exceed ( sizeof(VR_BoneTransform_t)*boneCount + 2). * Usually the size will be much smaller. */ - virtual EVRInputError GetSkeletalActionDataCompressed( VRActionHandle_t action, EVRSkeletalTransformSpace eBoneParent, float fPredictedSecondsFromNow, VR_OUT_BUFFER_COUNT( unCompressedSize ) void *pvCompressedData, uint32_t unCompressedSize, uint32_t *punRequiredCompressedSize ) = 0; + virtual EVRInputError GetSkeletalBoneDataCompressed( VRActionHandle_t action, EVRSkeletalTransformSpace eTransformSpace, EVRSkeletalMotionRange eMotionRange, VR_OUT_BUFFER_COUNT( unCompressedSize ) void *pvCompressedData, uint32_t unCompressedSize, uint32_t *punRequiredCompressedSize, VRInputValueHandle_t ulRestrictToDevice ) = 0; - /** Turns a compressed buffer from GetSkeletalActionDataCompressed and turns it back into a bone transform array. */ - virtual EVRInputError UncompressSkeletalActionData( void *pvCompressedBuffer, uint32_t unCompressedBufferSize, EVRSkeletalTransformSpace *peBoneParent, VR_ARRAY_COUNT( unTransformArrayCount ) VRBoneTransform_t *pTransformArray, uint32_t unTransformArrayCount ) = 0; + /** Turns a compressed buffer from GetSkeletalBoneDataCompressed and turns it back into a bone transform array. */ + virtual EVRInputError DecompressSkeletalBoneData( void *pvCompressedBuffer, uint32_t unCompressedBufferSize, EVRSkeletalTransformSpace *peTransformSpace, VR_ARRAY_COUNT( unTransformArrayCount ) VRBoneTransform_t *pTransformArray, uint32_t unTransformArrayCount ) = 0; // --------------- Haptics ------------------- // /** Triggers a haptic event as described by the specified action */ - virtual EVRInputError TriggerHapticVibrationAction( VRActionHandle_t action, float fStartSecondsFromNow, float fDurationSeconds, float fFrequency, float fAmplitude ) = 0; + virtual EVRInputError TriggerHapticVibrationAction( VRActionHandle_t action, float fStartSecondsFromNow, float fDurationSeconds, float fFrequency, float fAmplitude, VRInputValueHandle_t ulRestrictToDevice ) = 0; // --------------- Action Origins ---------------- // @@ -3916,7 +4125,7 @@ namespace vr virtual EVRInputError ShowBindingsForActionSet( VR_ARRAY_COUNT( unSetCount ) VRActiveActionSet_t *pSets, uint32_t unSizeOfVRSelectedActionSet_t, uint32_t unSetCount, VRInputValueHandle_t originToHighlight ) = 0; }; - static const char * const IVRInput_Version = "IVRInput_003"; + static const char * const IVRInput_Version = "IVRInput_004"; } // namespace vr @@ -3969,6 +4178,58 @@ static const uint64_t k_ulInvalidIOBufferHandle = 0; static const char *IVRIOBuffer_Version = "IVRIOBuffer_001"; } + +// ivrspatialanchors.h +namespace vr +{ + static const SpatialAnchorHandle_t k_ulInvalidSpatialAnchorHandle = 0; + + struct SpatialAnchorPose_t + { + HmdMatrix34_t mAnchorToAbsoluteTracking; + }; + + class IVRSpatialAnchors + { + public: + + /** Returns a handle for an spatial anchor described by "descriptor". On success, pHandle + * will contain a handle valid for this session. Caller can wait for an event or occasionally + * poll GetSpatialAnchorPose() to find the virtual coordinate associated with this anchor. */ + virtual EVRSpatialAnchorError CreateSpatialAnchorFromDescriptor( const char *pchDescriptor, SpatialAnchorHandle_t *pHandleOut ) = 0; + + /** Returns a handle for an new spatial anchor at pPose. On success, pHandle + * will contain a handle valid for this session. Caller can wait for an event or occasionally + * poll GetSpatialAnchorDescriptor() to find the permanent descriptor for this pose. + * The result of GetSpatialAnchorPose() may evolve from this initial position if the driver chooses + * to update it. + * The anchor will be associated with the driver that provides unDeviceIndex, and the driver may use that specific + * device as a hint for how to best create the anchor. + * The eOrigin must match whatever tracking origin you are working in (seated/standing/raw). + * This should be called when the user is close to (and ideally looking at/interacting with) the target physical + * location. At that moment, the driver will have the most information about how to recover that physical point + * in the future, and the quality of the anchor (when the descriptor is re-used) will be highest. + * The caller may decide to apply offsets from this initial pose, but is advised to stay relatively close to the + * original pose location for highest fidelity. */ + virtual EVRSpatialAnchorError CreateSpatialAnchorFromPose( TrackedDeviceIndex_t unDeviceIndex, ETrackingUniverseOrigin eOrigin, SpatialAnchorPose_t *pPose, SpatialAnchorHandle_t *pHandleOut ) = 0; + + /** Get the pose for a given handle. This is intended to be cheap enough to call every frame (or fairly often) + * so that the driver can refine this position when it has more information available. */ + virtual EVRSpatialAnchorError GetSpatialAnchorPose( SpatialAnchorHandle_t unHandle, ETrackingUniverseOrigin eOrigin, SpatialAnchorPose_t *pPoseOut ) = 0; + + /** Get the descriptor for a given handle. This will be empty for handles where the driver has not + * yet built a descriptor. It will be the application-supplied descriptor for previously saved anchors + * that the application is requesting poses for. If the driver has called UpdateSpatialAnchorDescriptor() + * already in this session, it will be the descriptor provided by the driver. + * Returns true if the descriptor fits into the buffer, else false. Buffer size should be at least + * k_unMaxSpatialAnchorDescriptorSize. */ + virtual EVRSpatialAnchorError GetSpatialAnchorDescriptor( SpatialAnchorHandle_t unHandle, VR_OUT_STRING() char *pchDescriptorOut, uint32_t *punDescriptorBufferLenInOut ) = 0; + + }; + + static const char * const IVRSpatialAnchors_Version = "IVRSpatialAnchors_001"; + +} // namespace vr // End #endif // _OPENVR_API @@ -3976,6 +4237,8 @@ static const uint64_t k_ulInvalidIOBufferHandle = 0; namespace vr { +#if !defined( OPENVR_INTERFACE_INTERNAL ) + /** Finds the active installation of the VR API and initializes it. The provided path must be absolute * or relative to the current working directory. These are the local install versions of the equivalent * functions in steamvr.h and will work without a local Steam install. @@ -4214,6 +4477,17 @@ namespace vr return m_pVRInput; } + IVRSpatialAnchors *VRSpatialAnchors() + { + CheckClear(); + if ( !m_pVRSpatialAnchors ) + { + EVRInitError eError; + m_pVRSpatialAnchors = (IVRSpatialAnchors *)VR_GetGenericInterface( IVRSpatialAnchors_Version, &eError ); + } + return m_pVRSpatialAnchors; + } + IVRIOBuffer *VRIOBuffer() { if ( !m_pVRIOBuffer ) @@ -4240,6 +4514,7 @@ namespace vr IVRDriverManager *m_pVRDriverManager; IVRInput *m_pVRInput; IVRIOBuffer *m_pVRIOBuffer; + IVRSpatialAnchors *m_pVRSpatialAnchors; }; inline COpenVRContext &OpenVRInternal_ModuleContext() @@ -4263,6 +4538,7 @@ namespace vr inline IVRDriverManager *VR_CALLTYPE VRDriverManager() { return OpenVRInternal_ModuleContext().VRDriverManager(); } inline IVRInput *VR_CALLTYPE VRInput() { return OpenVRInternal_ModuleContext().VRInput(); } inline IVRIOBuffer *VR_CALLTYPE VRIOBuffer() { return OpenVRInternal_ModuleContext().VRIOBuffer(); } + inline IVRSpatialAnchors *VR_CALLTYPE VRSpatialAnchors() { return OpenVRInternal_ModuleContext().VRSpatialAnchors(); } inline void COpenVRContext::Clear() { @@ -4281,6 +4557,7 @@ namespace vr m_pVRDriverManager = nullptr; m_pVRInput = nullptr; m_pVRIOBuffer = nullptr; + m_pVRSpatialAnchors = nullptr; } VR_INTERFACE uint32_t VR_CALLTYPE VR_InitInternal2( EVRInitError *peError, EVRApplicationType eApplicationType, const char *pStartupInfo ); @@ -4320,4 +4597,6 @@ namespace vr { VR_ShutdownInternal(); } + +#endif // OPENVR_INTERFACE_INTERNAL } diff --git a/headers/openvr_api.cs b/headers/openvr_api.cs index e8764c45..23966f36 100644 --- a/headers/openvr_api.cs +++ b/headers/openvr_api.cs @@ -196,7 +196,7 @@ public struct IVRSystem internal _GetControllerStateWithPose GetControllerStateWithPose; [UnmanagedFunctionPointer(CallingConvention.StdCall)] - internal delegate void _TriggerHapticPulse(uint unControllerDeviceIndex, uint unAxisId, char usDurationMicroSec); + internal delegate void _TriggerHapticPulse(uint unControllerDeviceIndex, uint unAxisId, ushort usDurationMicroSec); [MarshalAs(UnmanagedType.FunctionPtr)] internal _TriggerHapticPulse TriggerHapticPulse; @@ -1350,6 +1350,11 @@ public struct IVRRenderModels [MarshalAs(UnmanagedType.FunctionPtr)] internal _GetComponentRenderModelName GetComponentRenderModelName; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _GetComponentStateForDevicePath(string pchRenderModelName, string pchComponentName, ulong devicePath, ref RenderModel_ControllerMode_State_t pState, ref RenderModel_ComponentState_t pComponentState); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetComponentStateForDevicePath GetComponentStateForDevicePath; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] internal delegate bool _GetComponentState(string pchRenderModelName, string pchComponentName, ref VRControllerState_t pControllerState, ref RenderModel_ControllerMode_State_t pState, ref RenderModel_ComponentState_t pComponentState); [MarshalAs(UnmanagedType.FunctionPtr)] @@ -1561,37 +1566,42 @@ public struct IVRInput internal _UpdateActionState UpdateActionState; [UnmanagedFunctionPointer(CallingConvention.StdCall)] - internal delegate EVRInputError _GetDigitalActionData(ulong action, ref InputDigitalActionData_t pActionData, uint unActionDataSize); + internal delegate EVRInputError _GetDigitalActionData(ulong action, ref InputDigitalActionData_t pActionData, uint unActionDataSize, ulong ulRestrictToDevice); [MarshalAs(UnmanagedType.FunctionPtr)] internal _GetDigitalActionData GetDigitalActionData; [UnmanagedFunctionPointer(CallingConvention.StdCall)] - internal delegate EVRInputError _GetAnalogActionData(ulong action, ref InputAnalogActionData_t pActionData, uint unActionDataSize); + internal delegate EVRInputError _GetAnalogActionData(ulong action, ref InputAnalogActionData_t pActionData, uint unActionDataSize, ulong ulRestrictToDevice); [MarshalAs(UnmanagedType.FunctionPtr)] internal _GetAnalogActionData GetAnalogActionData; [UnmanagedFunctionPointer(CallingConvention.StdCall)] - internal delegate EVRInputError _GetPoseActionData(ulong action, ETrackingUniverseOrigin eOrigin, float fPredictedSecondsFromNow, ref InputPoseActionData_t pActionData, uint unActionDataSize); + internal delegate EVRInputError _GetPoseActionData(ulong action, ETrackingUniverseOrigin eOrigin, float fPredictedSecondsFromNow, ref InputPoseActionData_t pActionData, uint unActionDataSize, ulong ulRestrictToDevice); [MarshalAs(UnmanagedType.FunctionPtr)] internal _GetPoseActionData GetPoseActionData; [UnmanagedFunctionPointer(CallingConvention.StdCall)] - internal delegate EVRInputError _GetSkeletalActionData(ulong action, EVRSkeletalTransformSpace eBoneParent, float fPredictedSecondsFromNow, ref InputSkeletonActionData_t pActionData, uint unActionDataSize, [In, Out] VRBoneTransform_t[] pTransformArray, uint unTransformArrayCount); + internal delegate EVRInputError _GetSkeletalActionData(ulong action, ref InputSkeletalActionData_t pActionData, uint unActionDataSize, ulong ulRestrictToDevice); [MarshalAs(UnmanagedType.FunctionPtr)] internal _GetSkeletalActionData GetSkeletalActionData; [UnmanagedFunctionPointer(CallingConvention.StdCall)] - internal delegate EVRInputError _GetSkeletalActionDataCompressed(ulong action, EVRSkeletalTransformSpace eBoneParent, float fPredictedSecondsFromNow, IntPtr pvCompressedData, uint unCompressedSize, ref uint punRequiredCompressedSize); + internal delegate EVRInputError _GetSkeletalBoneData(ulong action, EVRSkeletalTransformSpace eTransformSpace, EVRSkeletalMotionRange eMotionRange, [In, Out] VRBoneTransform_t[] pTransformArray, uint unTransformArrayCount, ulong ulRestrictToDevice); [MarshalAs(UnmanagedType.FunctionPtr)] - internal _GetSkeletalActionDataCompressed GetSkeletalActionDataCompressed; + internal _GetSkeletalBoneData GetSkeletalBoneData; [UnmanagedFunctionPointer(CallingConvention.StdCall)] - internal delegate EVRInputError _UncompressSkeletalActionData(IntPtr pvCompressedBuffer, uint unCompressedBufferSize, ref EVRSkeletalTransformSpace peBoneParent, [In, Out] VRBoneTransform_t[] pTransformArray, uint unTransformArrayCount); + internal delegate EVRInputError _GetSkeletalBoneDataCompressed(ulong action, EVRSkeletalTransformSpace eTransformSpace, EVRSkeletalMotionRange eMotionRange, IntPtr pvCompressedData, uint unCompressedSize, ref uint punRequiredCompressedSize, ulong ulRestrictToDevice); [MarshalAs(UnmanagedType.FunctionPtr)] - internal _UncompressSkeletalActionData UncompressSkeletalActionData; + internal _GetSkeletalBoneDataCompressed GetSkeletalBoneDataCompressed; [UnmanagedFunctionPointer(CallingConvention.StdCall)] - internal delegate EVRInputError _TriggerHapticVibrationAction(ulong action, float fStartSecondsFromNow, float fDurationSeconds, float fFrequency, float fAmplitude); + internal delegate EVRInputError _DecompressSkeletalBoneData(IntPtr pvCompressedBuffer, uint unCompressedBufferSize, ref EVRSkeletalTransformSpace peTransformSpace, [In, Out] VRBoneTransform_t[] pTransformArray, uint unTransformArrayCount); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _DecompressSkeletalBoneData DecompressSkeletalBoneData; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRInputError _TriggerHapticVibrationAction(ulong action, float fStartSecondsFromNow, float fDurationSeconds, float fFrequency, float fAmplitude, ulong ulRestrictToDevice); [MarshalAs(UnmanagedType.FunctionPtr)] internal _TriggerHapticVibrationAction TriggerHapticVibrationAction; @@ -1652,6 +1662,31 @@ public struct IVRIOBuffer } +[StructLayout(LayoutKind.Sequential)] +public struct IVRSpatialAnchors +{ + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRSpatialAnchorError _CreateSpatialAnchorFromDescriptor(string pchDescriptor, ref uint pHandleOut); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _CreateSpatialAnchorFromDescriptor CreateSpatialAnchorFromDescriptor; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRSpatialAnchorError _CreateSpatialAnchorFromPose(uint unDeviceIndex, ETrackingUniverseOrigin eOrigin, ref SpatialAnchorPose_t pPose, ref uint pHandleOut); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _CreateSpatialAnchorFromPose CreateSpatialAnchorFromPose; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRSpatialAnchorError _GetSpatialAnchorPose(uint unHandle, ETrackingUniverseOrigin eOrigin, ref SpatialAnchorPose_t pPoseOut); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetSpatialAnchorPose GetSpatialAnchorPose; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRSpatialAnchorError _GetSpatialAnchorDescriptor(uint unHandle, System.Text.StringBuilder pchDescriptorOut, ref uint punDescriptorBufferLenInOut); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetSpatialAnchorDescriptor GetSpatialAnchorDescriptor; + +} + public class CVRSystem { @@ -1921,7 +1956,7 @@ public bool GetControllerStateWithPose(ETrackingUniverseOrigin eOrigin,uint unCo bool result = FnTable.GetControllerStateWithPose(eOrigin,unControllerDeviceIndex,ref pControllerState,unControllerStateSize,ref pTrackedDevicePose); return result; } - public void TriggerHapticPulse(uint unControllerDeviceIndex,uint unAxisId,char usDurationMicroSec) + public void TriggerHapticPulse(uint unControllerDeviceIndex,uint unAxisId,ushort usDurationMicroSec) { FnTable.TriggerHapticPulse(unControllerDeviceIndex,unAxisId,usDurationMicroSec); } @@ -3160,6 +3195,11 @@ public uint GetComponentRenderModelName(string pchRenderModelName,string pchComp uint result = FnTable.GetComponentRenderModelName(pchRenderModelName,pchComponentName,pchComponentRenderModelName,unComponentRenderModelNameLen); return result; } + public bool GetComponentStateForDevicePath(string pchRenderModelName,string pchComponentName,ulong devicePath,ref RenderModel_ControllerMode_State_t pState,ref RenderModel_ComponentState_t pComponentState) + { + bool result = FnTable.GetComponentStateForDevicePath(pchRenderModelName,pchComponentName,devicePath,ref pState,ref pComponentState); + return result; + } // This is a terrible hack to workaround the fact that VRControllerState_t and VREvent_t were // originally mis-compiled with the wrong packing for Linux and OSX. [UnmanagedFunctionPointer(CallingConvention.StdCall)] @@ -3425,40 +3465,45 @@ public EVRInputError UpdateActionState(VRActiveActionSet_t [] pSets,uint unSizeO EVRInputError result = FnTable.UpdateActionState(pSets,unSizeOfVRSelectedActionSet_t,(uint) pSets.Length); return result; } - public EVRInputError GetDigitalActionData(ulong action,ref InputDigitalActionData_t pActionData,uint unActionDataSize) + public EVRInputError GetDigitalActionData(ulong action,ref InputDigitalActionData_t pActionData,uint unActionDataSize,ulong ulRestrictToDevice) { - EVRInputError result = FnTable.GetDigitalActionData(action,ref pActionData,unActionDataSize); + EVRInputError result = FnTable.GetDigitalActionData(action,ref pActionData,unActionDataSize,ulRestrictToDevice); return result; } - public EVRInputError GetAnalogActionData(ulong action,ref InputAnalogActionData_t pActionData,uint unActionDataSize) + public EVRInputError GetAnalogActionData(ulong action,ref InputAnalogActionData_t pActionData,uint unActionDataSize,ulong ulRestrictToDevice) { - EVRInputError result = FnTable.GetAnalogActionData(action,ref pActionData,unActionDataSize); + EVRInputError result = FnTable.GetAnalogActionData(action,ref pActionData,unActionDataSize,ulRestrictToDevice); return result; } - public EVRInputError GetPoseActionData(ulong action,ETrackingUniverseOrigin eOrigin,float fPredictedSecondsFromNow,ref InputPoseActionData_t pActionData,uint unActionDataSize) + public EVRInputError GetPoseActionData(ulong action,ETrackingUniverseOrigin eOrigin,float fPredictedSecondsFromNow,ref InputPoseActionData_t pActionData,uint unActionDataSize,ulong ulRestrictToDevice) { - EVRInputError result = FnTable.GetPoseActionData(action,eOrigin,fPredictedSecondsFromNow,ref pActionData,unActionDataSize); + EVRInputError result = FnTable.GetPoseActionData(action,eOrigin,fPredictedSecondsFromNow,ref pActionData,unActionDataSize,ulRestrictToDevice); return result; } - public EVRInputError GetSkeletalActionData(ulong action,EVRSkeletalTransformSpace eBoneParent,float fPredictedSecondsFromNow,ref InputSkeletonActionData_t pActionData,uint unActionDataSize,VRBoneTransform_t [] pTransformArray) + public EVRInputError GetSkeletalActionData(ulong action,ref InputSkeletalActionData_t pActionData,uint unActionDataSize,ulong ulRestrictToDevice) { - EVRInputError result = FnTable.GetSkeletalActionData(action,eBoneParent,fPredictedSecondsFromNow,ref pActionData,unActionDataSize,pTransformArray,(uint) pTransformArray.Length); + EVRInputError result = FnTable.GetSkeletalActionData(action,ref pActionData,unActionDataSize,ulRestrictToDevice); return result; } - public EVRInputError GetSkeletalActionDataCompressed(ulong action,EVRSkeletalTransformSpace eBoneParent,float fPredictedSecondsFromNow,IntPtr pvCompressedData,uint unCompressedSize,ref uint punRequiredCompressedSize) + public EVRInputError GetSkeletalBoneData(ulong action,EVRSkeletalTransformSpace eTransformSpace,EVRSkeletalMotionRange eMotionRange,VRBoneTransform_t [] pTransformArray,ulong ulRestrictToDevice) + { + EVRInputError result = FnTable.GetSkeletalBoneData(action,eTransformSpace,eMotionRange,pTransformArray,(uint) pTransformArray.Length,ulRestrictToDevice); + return result; + } + public EVRInputError GetSkeletalBoneDataCompressed(ulong action,EVRSkeletalTransformSpace eTransformSpace,EVRSkeletalMotionRange eMotionRange,IntPtr pvCompressedData,uint unCompressedSize,ref uint punRequiredCompressedSize,ulong ulRestrictToDevice) { punRequiredCompressedSize = 0; - EVRInputError result = FnTable.GetSkeletalActionDataCompressed(action,eBoneParent,fPredictedSecondsFromNow,pvCompressedData,unCompressedSize,ref punRequiredCompressedSize); + EVRInputError result = FnTable.GetSkeletalBoneDataCompressed(action,eTransformSpace,eMotionRange,pvCompressedData,unCompressedSize,ref punRequiredCompressedSize,ulRestrictToDevice); return result; } - public EVRInputError UncompressSkeletalActionData(IntPtr pvCompressedBuffer,uint unCompressedBufferSize,ref EVRSkeletalTransformSpace peBoneParent,VRBoneTransform_t [] pTransformArray) + public EVRInputError DecompressSkeletalBoneData(IntPtr pvCompressedBuffer,uint unCompressedBufferSize,ref EVRSkeletalTransformSpace peTransformSpace,VRBoneTransform_t [] pTransformArray) { - EVRInputError result = FnTable.UncompressSkeletalActionData(pvCompressedBuffer,unCompressedBufferSize,ref peBoneParent,pTransformArray,(uint) pTransformArray.Length); + EVRInputError result = FnTable.DecompressSkeletalBoneData(pvCompressedBuffer,unCompressedBufferSize,ref peTransformSpace,pTransformArray,(uint) pTransformArray.Length); return result; } - public EVRInputError TriggerHapticVibrationAction(ulong action,float fStartSecondsFromNow,float fDurationSeconds,float fFrequency,float fAmplitude) + public EVRInputError TriggerHapticVibrationAction(ulong action,float fStartSecondsFromNow,float fDurationSeconds,float fFrequency,float fAmplitude,ulong ulRestrictToDevice) { - EVRInputError result = FnTable.TriggerHapticVibrationAction(action,fStartSecondsFromNow,fDurationSeconds,fFrequency,fAmplitude); + EVRInputError result = FnTable.TriggerHapticVibrationAction(action,fStartSecondsFromNow,fDurationSeconds,fFrequency,fAmplitude,ulRestrictToDevice); return result; } public EVRInputError GetActionOrigins(ulong actionSetHandle,ulong digitalActionHandle,ulong [] originsOut) @@ -3526,10 +3571,45 @@ public ulong PropertyContainer(ulong ulBuffer) } +public class CVRSpatialAnchors +{ + IVRSpatialAnchors FnTable; + internal CVRSpatialAnchors(IntPtr pInterface) + { + FnTable = (IVRSpatialAnchors)Marshal.PtrToStructure(pInterface, typeof(IVRSpatialAnchors)); + } + public EVRSpatialAnchorError CreateSpatialAnchorFromDescriptor(string pchDescriptor,ref uint pHandleOut) + { + pHandleOut = 0; + EVRSpatialAnchorError result = FnTable.CreateSpatialAnchorFromDescriptor(pchDescriptor,ref pHandleOut); + return result; + } + public EVRSpatialAnchorError CreateSpatialAnchorFromPose(uint unDeviceIndex,ETrackingUniverseOrigin eOrigin,ref SpatialAnchorPose_t pPose,ref uint pHandleOut) + { + pHandleOut = 0; + EVRSpatialAnchorError result = FnTable.CreateSpatialAnchorFromPose(unDeviceIndex,eOrigin,ref pPose,ref pHandleOut); + return result; + } + public EVRSpatialAnchorError GetSpatialAnchorPose(uint unHandle,ETrackingUniverseOrigin eOrigin,ref SpatialAnchorPose_t pPoseOut) + { + EVRSpatialAnchorError result = FnTable.GetSpatialAnchorPose(unHandle,eOrigin,ref pPoseOut); + return result; + } + public EVRSpatialAnchorError GetSpatialAnchorDescriptor(uint unHandle,System.Text.StringBuilder pchDescriptorOut,ref uint punDescriptorBufferLenInOut) + { + punDescriptorBufferLenInOut = 0; + EVRSpatialAnchorError result = FnTable.GetSpatialAnchorDescriptor(unHandle,pchDescriptorOut,ref punDescriptorBufferLenInOut); + return result; + } +} + + public class OpenVRInterop { [DllImportAttribute("openvr_api", EntryPoint = "VR_InitInternal", CallingConvention = CallingConvention.Cdecl)] internal static extern uint InitInternal(ref EVRInitError peError, EVRApplicationType eApplicationType); + [DllImportAttribute("openvr_api", EntryPoint = "VR_InitInternal2", CallingConvention = CallingConvention.Cdecl)] + internal static extern uint InitInternal2(ref EVRInitError peError, EVRApplicationType eApplicationType,[In, MarshalAs(UnmanagedType.LPStr)] string pStartupInfo); [DllImportAttribute("openvr_api", EntryPoint = "VR_ShutdownInternal", CallingConvention = CallingConvention.Cdecl)] internal static extern void ShutdownInternal(); [DllImportAttribute("openvr_api", EntryPoint = "VR_IsHmdPresent", CallingConvention = CallingConvention.Cdecl)] @@ -3554,12 +3634,14 @@ public enum EVREye } public enum ETextureType { + Invalid = -1, DirectX = 0, OpenGL = 1, Vulkan = 2, IOSurface = 3, DirectX12 = 4, DXGISharedHandle = 5, + Metal = 6, } public enum EColorSpace { @@ -3583,6 +3665,7 @@ public enum ETrackedDeviceClass GenericTracker = 3, TrackingReference = 4, DisplayRedirect = 5, + Max = 6, } public enum ETrackedControllerRole { @@ -3708,6 +3791,16 @@ public enum ETrackedDeviceProperty Prop_ImuFactoryGyroScale_Vector3 = 2065, Prop_ImuFactoryAccelerometerBias_Vector3 = 2066, Prop_ImuFactoryAccelerometerScale_Vector3 = 2067, + Prop_ConfigurationIncludesLighthouse20Features_Bool = 2069, + Prop_DriverRequestedMuraCorrectionMode_Int32 = 2200, + Prop_DriverRequestedMuraFeather_InnerLeft_Int32 = 2201, + Prop_DriverRequestedMuraFeather_InnerRight_Int32 = 2202, + Prop_DriverRequestedMuraFeather_InnerTop_Int32 = 2203, + Prop_DriverRequestedMuraFeather_InnerBottom_Int32 = 2204, + Prop_DriverRequestedMuraFeather_OuterLeft_Int32 = 2205, + Prop_DriverRequestedMuraFeather_OuterRight_Int32 = 2206, + Prop_DriverRequestedMuraFeather_OuterTop_Int32 = 2207, + Prop_DriverRequestedMuraFeather_OuterBottom_Int32 = 2208, Prop_AttachedDeviceId_String = 3000, Prop_SupportedButtons_Uint64 = 3001, Prop_Axis0Type_Int32 = 3002, @@ -3742,6 +3835,7 @@ public enum ETrackedDeviceProperty Prop_HasCameraComponent_Bool = 6004, Prop_HasDriverDirectModeComponent_Bool = 6005, Prop_HasVirtualDisplayComponent_Bool = 6006, + Prop_HasSpatialAnchorsSupport_Bool = 6007, Prop_ControllerType_String = 7000, Prop_LegacyInputProfile_String = 7001, Prop_VendorSpecific_Reserved_Start = 10000, @@ -3893,6 +3987,7 @@ public enum EVREventType VREvent_PerfSectionSettingChanged = 863, VREvent_DashboardSectionSettingChanged = 864, VREvent_WebInterfaceSectionSettingChanged = 865, + VREvent_TrackersSectionSettingChanged = 866, VREvent_StatusUpdate = 900, VREvent_WebInterface_InstallDriverCompleted = 950, VREvent_MCImageUpdated = 1000, @@ -3926,6 +4021,12 @@ public enum EVREventType VREvent_Input_HapticVibration = 1700, VREvent_Input_BindingLoadFailed = 1701, VREvent_Input_BindingLoadSuccessful = 1702, + VREvent_Input_ActionManifestReloaded = 1703, + VREvent_Input_ActionManifestLoadFailed = 1704, + VREvent_SpatialAnchors_PoseUpdated = 1800, + VREvent_SpatialAnchors_DescriptorUpdated = 1801, + VREvent_SpatialAnchors_RequestPoseUpdate = 1802, + VREvent_SpatialAnchors_RequestDescriptorUpdate = 1803, VREvent_VendorSpecific_Reserved_Start = 10000, VREvent_VendorSpecific_Reserved_End = 19999, } @@ -3956,6 +4057,9 @@ public enum EVRButtonId k_EButton_SteamVR_Touchpad = 32, k_EButton_SteamVR_Trigger = 33, k_EButton_Dashboard_Back = 2, + k_EButton_Knuckles_A = 2, + k_EButton_Knuckles_B = 1, + k_EButton_Knuckles_JoyStick = 35, k_EButton_Max = 64, } public enum EVRMouseButton @@ -3987,6 +4091,24 @@ public enum EVRInputError NoData = 13, BufferTooSmall = 14, MismatchedActionManifest = 15, + MissingSkeletonData = 16, +} +public enum EVRSpatialAnchorError +{ + Success = 0, + Internal = 1, + UnknownHandle = 2, + ArrayTooSmall = 3, + InvalidDescriptorChar = 4, + NotYetAvailable = 5, + NotAvailableInThisUniverse = 6, + PermanentlyUnavailable = 7, + WrongDriver = 8, + DescriptorTooLong = 9, + Unknown = 10, + NoRoomCalibration = 11, + InvalidArgument = 12, + UnknownDriver = 13, } public enum EHiddenAreaMeshType { @@ -4069,6 +4191,11 @@ public enum EVRNotificationError InvalidOverlayHandle = 102, SystemWithUserValueAlreadyExists = 103, } +public enum EVRSkeletalMotionRange +{ + WithController = 0, + WithoutController = 1, +} public enum EVRInitError { None = 0, @@ -4115,6 +4242,7 @@ public enum EVRInitError Init_FirmwareRecoveryBusy = 139, Init_USBServiceBusy = 140, Init_VRWebHelperStartupFailed = 141, + Init_TrackerManagerInitFailed = 142, Driver_Failed = 200, Driver_Unknown = 201, Driver_HmdUnknown = 202, @@ -4213,6 +4341,11 @@ public enum EVSync WaitRender = 1, NoWaitRender = 2, } +public enum EVRMuraCorrectionMode +{ + Default = 0, + NoCorrection = 1, +} public enum Imu_OffScaleFlags { OffScale_AccelX = 1, @@ -4440,7 +4573,7 @@ public enum EVRScreenshotError } public enum EVRSkeletalTransformSpace { - Action = 0, + Model = 0, Parent = 1, Additive = 2, } @@ -4490,6 +4623,8 @@ public enum EIOBufferMode [FieldOffset(0)] public VREvent_DualAnalog_t dualAnalog; [FieldOffset(0)] public VREvent_HapticVibration_t hapticVibration; [FieldOffset(0)] public VREvent_WebConsole_t webConsole; + [FieldOffset(0)] public VREvent_InputBindingLoad_t inputBinding; + [FieldOffset(0)] public VREvent_SpatialAnchor_t spatialAnchor; [FieldOffset(0)] public VREvent_Keyboard_t keyboard; // This has to be at the end due to a mono bug } @@ -4515,6 +4650,18 @@ public enum EIOBufferMode public float m10; public float m11; } +[StructLayout(LayoutKind.Sequential)] public struct HmdMatrix33_t +{ + public float m0; //float[3][3] + public float m1; + public float m2; + public float m3; + public float m4; + public float m5; + public float m6; + public float m7; + public float m8; +} [StructLayout(LayoutKind.Sequential)] public struct HmdMatrix44_t { public float m0; //float[4][4] @@ -4711,6 +4858,22 @@ public enum EIOBufferMode [StructLayout(LayoutKind.Sequential)] public struct VREvent_Keyboard_t { public byte cNewInput0,cNewInput1,cNewInput2,cNewInput3,cNewInput4,cNewInput5,cNewInput6,cNewInput7; + public string cNewInput + { + get + { + var stringBuilder = new System.Text.StringBuilder(8); + stringBuilder.Append(cNewInput0); + stringBuilder.Append(cNewInput1); + stringBuilder.Append(cNewInput2); + stringBuilder.Append(cNewInput3); + stringBuilder.Append(cNewInput4); + stringBuilder.Append(cNewInput5); + stringBuilder.Append(cNewInput6); + stringBuilder.Append(cNewInput7); + return stringBuilder.ToString(); + } + } public ulong uUserValue; } [StructLayout(LayoutKind.Sequential)] public struct VREvent_Ipd_t @@ -4791,6 +4954,18 @@ public enum EIOBufferMode public ulong ulAppContainer; public ulong pathMessage; public ulong pathUrl; + public ulong pathControllerType; +} +[StructLayout(LayoutKind.Sequential)] public struct VREvent_InputActionManifestLoad_t +{ + public ulong pathAppKey; + public ulong pathMessage; + public ulong pathMessageParam; + public ulong pathManifestPath; +} +[StructLayout(LayoutKind.Sequential)] public struct VREvent_SpatialAnchor_t +{ + public uint unHandle; } [StructLayout(LayoutKind.Sequential)] public struct VREvent_t { @@ -5020,15 +5195,15 @@ public void Unpack(ref VRControllerState_t unpacked) } [StructLayout(LayoutKind.Sequential)] public struct RenderModel_TextureMap_t { - public char unWidth; - public char unHeight; + public ushort unWidth; + public ushort unHeight; public IntPtr rubTextureMapData; // const uint8_t * } // This structure is for backwards binary compatibility on Linux and OSX only [StructLayout(LayoutKind.Sequential, Pack = 4)] public struct RenderModel_TextureMap_t_Packed { - public char unWidth; - public char unHeight; + public ushort unWidth; + public ushort unHeight; public IntPtr rubTextureMapData; // const uint8_t * public RenderModel_TextureMap_t_Packed(RenderModel_TextureMap_t unpacked) { @@ -5088,6 +5263,10 @@ public void Unpack(ref RenderModel_t unpacked) public int m_nHeight; public int m_nBytesPerPixel; } +[StructLayout(LayoutKind.Sequential)] public struct CVRSettingHelper +{ + public IntPtr m_pSettings; // class vr::IVRSettings * +} [StructLayout(LayoutKind.Sequential)] public struct InputAnalogActionData_t { [MarshalAs(UnmanagedType.I1)] @@ -5119,23 +5298,166 @@ public void Unpack(ref RenderModel_t unpacked) public ulong activeOrigin; public TrackedDevicePose_t pose; } -[StructLayout(LayoutKind.Sequential)] public struct InputSkeletonActionData_t +[StructLayout(LayoutKind.Sequential)] public struct InputSkeletalActionData_t { [MarshalAs(UnmanagedType.I1)] public bool bActive; public ulong activeOrigin; + public uint boneCount; } [StructLayout(LayoutKind.Sequential)] public struct InputOriginInfo_t { public ulong devicePath; public uint trackedDeviceIndex; public byte rchRenderModelComponentName0,rchRenderModelComponentName1,rchRenderModelComponentName2,rchRenderModelComponentName3,rchRenderModelComponentName4,rchRenderModelComponentName5,rchRenderModelComponentName6,rchRenderModelComponentName7,rchRenderModelComponentName8,rchRenderModelComponentName9,rchRenderModelComponentName10,rchRenderModelComponentName11,rchRenderModelComponentName12,rchRenderModelComponentName13,rchRenderModelComponentName14,rchRenderModelComponentName15,rchRenderModelComponentName16,rchRenderModelComponentName17,rchRenderModelComponentName18,rchRenderModelComponentName19,rchRenderModelComponentName20,rchRenderModelComponentName21,rchRenderModelComponentName22,rchRenderModelComponentName23,rchRenderModelComponentName24,rchRenderModelComponentName25,rchRenderModelComponentName26,rchRenderModelComponentName27,rchRenderModelComponentName28,rchRenderModelComponentName29,rchRenderModelComponentName30,rchRenderModelComponentName31,rchRenderModelComponentName32,rchRenderModelComponentName33,rchRenderModelComponentName34,rchRenderModelComponentName35,rchRenderModelComponentName36,rchRenderModelComponentName37,rchRenderModelComponentName38,rchRenderModelComponentName39,rchRenderModelComponentName40,rchRenderModelComponentName41,rchRenderModelComponentName42,rchRenderModelComponentName43,rchRenderModelComponentName44,rchRenderModelComponentName45,rchRenderModelComponentName46,rchRenderModelComponentName47,rchRenderModelComponentName48,rchRenderModelComponentName49,rchRenderModelComponentName50,rchRenderModelComponentName51,rchRenderModelComponentName52,rchRenderModelComponentName53,rchRenderModelComponentName54,rchRenderModelComponentName55,rchRenderModelComponentName56,rchRenderModelComponentName57,rchRenderModelComponentName58,rchRenderModelComponentName59,rchRenderModelComponentName60,rchRenderModelComponentName61,rchRenderModelComponentName62,rchRenderModelComponentName63,rchRenderModelComponentName64,rchRenderModelComponentName65,rchRenderModelComponentName66,rchRenderModelComponentName67,rchRenderModelComponentName68,rchRenderModelComponentName69,rchRenderModelComponentName70,rchRenderModelComponentName71,rchRenderModelComponentName72,rchRenderModelComponentName73,rchRenderModelComponentName74,rchRenderModelComponentName75,rchRenderModelComponentName76,rchRenderModelComponentName77,rchRenderModelComponentName78,rchRenderModelComponentName79,rchRenderModelComponentName80,rchRenderModelComponentName81,rchRenderModelComponentName82,rchRenderModelComponentName83,rchRenderModelComponentName84,rchRenderModelComponentName85,rchRenderModelComponentName86,rchRenderModelComponentName87,rchRenderModelComponentName88,rchRenderModelComponentName89,rchRenderModelComponentName90,rchRenderModelComponentName91,rchRenderModelComponentName92,rchRenderModelComponentName93,rchRenderModelComponentName94,rchRenderModelComponentName95,rchRenderModelComponentName96,rchRenderModelComponentName97,rchRenderModelComponentName98,rchRenderModelComponentName99,rchRenderModelComponentName100,rchRenderModelComponentName101,rchRenderModelComponentName102,rchRenderModelComponentName103,rchRenderModelComponentName104,rchRenderModelComponentName105,rchRenderModelComponentName106,rchRenderModelComponentName107,rchRenderModelComponentName108,rchRenderModelComponentName109,rchRenderModelComponentName110,rchRenderModelComponentName111,rchRenderModelComponentName112,rchRenderModelComponentName113,rchRenderModelComponentName114,rchRenderModelComponentName115,rchRenderModelComponentName116,rchRenderModelComponentName117,rchRenderModelComponentName118,rchRenderModelComponentName119,rchRenderModelComponentName120,rchRenderModelComponentName121,rchRenderModelComponentName122,rchRenderModelComponentName123,rchRenderModelComponentName124,rchRenderModelComponentName125,rchRenderModelComponentName126,rchRenderModelComponentName127; + public string rchRenderModelComponentName + { + get + { + var stringBuilder = new System.Text.StringBuilder(128); + stringBuilder.Append(rchRenderModelComponentName0); + stringBuilder.Append(rchRenderModelComponentName1); + stringBuilder.Append(rchRenderModelComponentName2); + stringBuilder.Append(rchRenderModelComponentName3); + stringBuilder.Append(rchRenderModelComponentName4); + stringBuilder.Append(rchRenderModelComponentName5); + stringBuilder.Append(rchRenderModelComponentName6); + stringBuilder.Append(rchRenderModelComponentName7); + stringBuilder.Append(rchRenderModelComponentName8); + stringBuilder.Append(rchRenderModelComponentName9); + stringBuilder.Append(rchRenderModelComponentName10); + stringBuilder.Append(rchRenderModelComponentName11); + stringBuilder.Append(rchRenderModelComponentName12); + stringBuilder.Append(rchRenderModelComponentName13); + stringBuilder.Append(rchRenderModelComponentName14); + stringBuilder.Append(rchRenderModelComponentName15); + stringBuilder.Append(rchRenderModelComponentName16); + stringBuilder.Append(rchRenderModelComponentName17); + stringBuilder.Append(rchRenderModelComponentName18); + stringBuilder.Append(rchRenderModelComponentName19); + stringBuilder.Append(rchRenderModelComponentName20); + stringBuilder.Append(rchRenderModelComponentName21); + stringBuilder.Append(rchRenderModelComponentName22); + stringBuilder.Append(rchRenderModelComponentName23); + stringBuilder.Append(rchRenderModelComponentName24); + stringBuilder.Append(rchRenderModelComponentName25); + stringBuilder.Append(rchRenderModelComponentName26); + stringBuilder.Append(rchRenderModelComponentName27); + stringBuilder.Append(rchRenderModelComponentName28); + stringBuilder.Append(rchRenderModelComponentName29); + stringBuilder.Append(rchRenderModelComponentName30); + stringBuilder.Append(rchRenderModelComponentName31); + stringBuilder.Append(rchRenderModelComponentName32); + stringBuilder.Append(rchRenderModelComponentName33); + stringBuilder.Append(rchRenderModelComponentName34); + stringBuilder.Append(rchRenderModelComponentName35); + stringBuilder.Append(rchRenderModelComponentName36); + stringBuilder.Append(rchRenderModelComponentName37); + stringBuilder.Append(rchRenderModelComponentName38); + stringBuilder.Append(rchRenderModelComponentName39); + stringBuilder.Append(rchRenderModelComponentName40); + stringBuilder.Append(rchRenderModelComponentName41); + stringBuilder.Append(rchRenderModelComponentName42); + stringBuilder.Append(rchRenderModelComponentName43); + stringBuilder.Append(rchRenderModelComponentName44); + stringBuilder.Append(rchRenderModelComponentName45); + stringBuilder.Append(rchRenderModelComponentName46); + stringBuilder.Append(rchRenderModelComponentName47); + stringBuilder.Append(rchRenderModelComponentName48); + stringBuilder.Append(rchRenderModelComponentName49); + stringBuilder.Append(rchRenderModelComponentName50); + stringBuilder.Append(rchRenderModelComponentName51); + stringBuilder.Append(rchRenderModelComponentName52); + stringBuilder.Append(rchRenderModelComponentName53); + stringBuilder.Append(rchRenderModelComponentName54); + stringBuilder.Append(rchRenderModelComponentName55); + stringBuilder.Append(rchRenderModelComponentName56); + stringBuilder.Append(rchRenderModelComponentName57); + stringBuilder.Append(rchRenderModelComponentName58); + stringBuilder.Append(rchRenderModelComponentName59); + stringBuilder.Append(rchRenderModelComponentName60); + stringBuilder.Append(rchRenderModelComponentName61); + stringBuilder.Append(rchRenderModelComponentName62); + stringBuilder.Append(rchRenderModelComponentName63); + stringBuilder.Append(rchRenderModelComponentName64); + stringBuilder.Append(rchRenderModelComponentName65); + stringBuilder.Append(rchRenderModelComponentName66); + stringBuilder.Append(rchRenderModelComponentName67); + stringBuilder.Append(rchRenderModelComponentName68); + stringBuilder.Append(rchRenderModelComponentName69); + stringBuilder.Append(rchRenderModelComponentName70); + stringBuilder.Append(rchRenderModelComponentName71); + stringBuilder.Append(rchRenderModelComponentName72); + stringBuilder.Append(rchRenderModelComponentName73); + stringBuilder.Append(rchRenderModelComponentName74); + stringBuilder.Append(rchRenderModelComponentName75); + stringBuilder.Append(rchRenderModelComponentName76); + stringBuilder.Append(rchRenderModelComponentName77); + stringBuilder.Append(rchRenderModelComponentName78); + stringBuilder.Append(rchRenderModelComponentName79); + stringBuilder.Append(rchRenderModelComponentName80); + stringBuilder.Append(rchRenderModelComponentName81); + stringBuilder.Append(rchRenderModelComponentName82); + stringBuilder.Append(rchRenderModelComponentName83); + stringBuilder.Append(rchRenderModelComponentName84); + stringBuilder.Append(rchRenderModelComponentName85); + stringBuilder.Append(rchRenderModelComponentName86); + stringBuilder.Append(rchRenderModelComponentName87); + stringBuilder.Append(rchRenderModelComponentName88); + stringBuilder.Append(rchRenderModelComponentName89); + stringBuilder.Append(rchRenderModelComponentName90); + stringBuilder.Append(rchRenderModelComponentName91); + stringBuilder.Append(rchRenderModelComponentName92); + stringBuilder.Append(rchRenderModelComponentName93); + stringBuilder.Append(rchRenderModelComponentName94); + stringBuilder.Append(rchRenderModelComponentName95); + stringBuilder.Append(rchRenderModelComponentName96); + stringBuilder.Append(rchRenderModelComponentName97); + stringBuilder.Append(rchRenderModelComponentName98); + stringBuilder.Append(rchRenderModelComponentName99); + stringBuilder.Append(rchRenderModelComponentName100); + stringBuilder.Append(rchRenderModelComponentName101); + stringBuilder.Append(rchRenderModelComponentName102); + stringBuilder.Append(rchRenderModelComponentName103); + stringBuilder.Append(rchRenderModelComponentName104); + stringBuilder.Append(rchRenderModelComponentName105); + stringBuilder.Append(rchRenderModelComponentName106); + stringBuilder.Append(rchRenderModelComponentName107); + stringBuilder.Append(rchRenderModelComponentName108); + stringBuilder.Append(rchRenderModelComponentName109); + stringBuilder.Append(rchRenderModelComponentName110); + stringBuilder.Append(rchRenderModelComponentName111); + stringBuilder.Append(rchRenderModelComponentName112); + stringBuilder.Append(rchRenderModelComponentName113); + stringBuilder.Append(rchRenderModelComponentName114); + stringBuilder.Append(rchRenderModelComponentName115); + stringBuilder.Append(rchRenderModelComponentName116); + stringBuilder.Append(rchRenderModelComponentName117); + stringBuilder.Append(rchRenderModelComponentName118); + stringBuilder.Append(rchRenderModelComponentName119); + stringBuilder.Append(rchRenderModelComponentName120); + stringBuilder.Append(rchRenderModelComponentName121); + stringBuilder.Append(rchRenderModelComponentName122); + stringBuilder.Append(rchRenderModelComponentName123); + stringBuilder.Append(rchRenderModelComponentName124); + stringBuilder.Append(rchRenderModelComponentName125); + stringBuilder.Append(rchRenderModelComponentName126); + stringBuilder.Append(rchRenderModelComponentName127); + return stringBuilder.ToString(); + } + } } [StructLayout(LayoutKind.Sequential)] public struct VRActiveActionSet_t { public ulong ulActionSet; public ulong ulRestrictedToDevice; public ulong ulSecondaryActionSet; + public uint unPadding; + public int nPriority; +} +[StructLayout(LayoutKind.Sequential)] public struct SpatialAnchorPose_t +{ + public HmdMatrix34_t mAnchorToAbsoluteTracking; } [StructLayout(LayoutKind.Sequential)] public struct COpenVRContext { @@ -5154,6 +5476,7 @@ public void Unpack(ref RenderModel_t unpacked) public IntPtr m_pVRDriverManager; // class vr::IVRDriverManager * public IntPtr m_pVRInput; // class vr::IVRInput * public IntPtr m_pVRIOBuffer; // class vr::IVRIOBuffer * + public IntPtr m_pVRSpatialAnchors; // class vr::IVRSpatialAnchors * } public class OpenVR @@ -5164,6 +5487,11 @@ public static uint InitInternal(ref EVRInitError peError, EVRApplicationType eAp return OpenVRInterop.InitInternal(ref peError, eApplicationType); } + public static uint InitInternal2(ref EVRInitError peError, EVRApplicationType eApplicationType, string pchStartupInfo) + { + return OpenVRInterop.InitInternal2(ref peError, eApplicationType, pchStartupInfo); + } + public static void ShutdownInternal() { OpenVRInterop.ShutdownInternal(); @@ -5224,9 +5552,13 @@ public static uint GetInitToken() public const uint k_unWildcardPropertyTag = 34; public const uint k_unHapticVibrationPropertyTag = 35; public const uint k_unSkeletonPropertyTag = 36; + public const uint k_unSpatialAnchorPosePropertyTag = 40; public const uint k_unOpenVRInternalReserved_Start = 1000; public const uint k_unOpenVRInternalReserved_End = 10000; public const uint k_unMaxPropertyStringSize = 32768; + public const ulong k_ulInvalidActionHandle = 0; + public const ulong k_ulInvalidActionSetHandle = 0; + public const ulong k_ulInvalidInputValueHandle = 0; public const uint k_unControllerStateAxisCount = 5; public const ulong k_ulOverlayHandleInvalid = 0; public const uint k_unScreenshotHandleInvalid = 0; @@ -5250,7 +5582,7 @@ public static uint GetInitToken() public const string k_pch_Controller_Component_Tip = "tip"; public const string k_pch_Controller_Component_HandGrip = "handgrip"; public const string k_pch_Controller_Component_Status = "status"; - public const string IVRRenderModels_Version = "IVRRenderModels_005"; + public const string IVRRenderModels_Version = "IVRRenderModels_006"; public const uint k_unNotificationTextMaxSize = 256; public const string IVRNotifications_Version = "IVRNotifications_002"; public const uint k_unMaxSettingsKeyLength = 128; @@ -5306,6 +5638,8 @@ public static uint GetInitToken() public const string k_pch_SteamVR_DebugInput = "debugInput"; public const string k_pch_SteamVR_LegacyInputRebinding = "legacyInputRebinding"; public const string k_pch_SteamVR_DebugInputBinding = "debugInputBinding"; + public const string k_pch_SteamVR_InputBindingUIBlock = "inputBindingUI"; + public const string k_pch_SteamVR_RenderCameraMode = "renderCameraMode"; public const string k_pch_Lighthouse_Section = "driver_lighthouse"; public const string k_pch_Lighthouse_DisableIMU_Bool = "disableimu"; public const string k_pch_Lighthouse_DisableIMUExceptHMD_Bool = "disableimuexcepthmd"; @@ -5389,27 +5723,29 @@ public static uint GetInitToken() public const string k_pch_Dashboard_ArcadeMode_Bool = "arcadeMode"; public const string k_pch_Dashboard_EnableWebUI = "webUI"; public const string k_pch_Dashboard_EnableWebUIDevTools = "webUIDevTools"; + public const string k_pch_Dashboard_EnableWebUIDashboardReplacement = "webUIDashboard"; public const string k_pch_modelskin_Section = "modelskins"; public const string k_pch_Driver_Enable_Bool = "enable"; public const string k_pch_WebInterface_Section = "WebInterface"; + public const string k_pch_WebInterface_WebEnable_Bool = "WebEnable"; public const string k_pch_WebInterface_WebPort_String = "WebPort"; public const string k_pch_TrackingOverride_Section = "TrackingOverrides"; public const string k_pch_App_BindingAutosaveURLSuffix_String = "AutosaveURL"; public const string k_pch_App_BindingCurrentURLSuffix_String = "CurrentURL"; public const string k_pch_App_NeedToUpdateAutosaveSuffix_Bool = "NeedToUpdateAutosave"; public const string k_pch_App_ActionManifestURL_String = "ActionManifestURL"; + public const string k_pch_Trackers_Section = "trackers"; public const string IVRScreenshots_Version = "IVRScreenshots_001"; public const string IVRResources_Version = "IVRResources_001"; public const string IVRDriverManager_Version = "IVRDriverManager_001"; - public const ulong k_ulInvalidActionHandle = 0; - public const ulong k_ulInvalidActionSetHandle = 0; - public const ulong k_ulInvalidInputValueHandle = 0; public const uint k_unMaxActionNameLength = 64; public const uint k_unMaxActionSetNameLength = 64; public const uint k_unMaxActionOriginCount = 16; - public const string IVRInput_Version = "IVRInput_003"; + public const string IVRInput_Version = "IVRInput_004"; public const ulong k_ulInvalidIOBufferHandle = 0; public const string IVRIOBuffer_Version = "IVRIOBuffer_001"; + public const uint k_ulInvalidSpatialAnchorHandle = 0; + public const string IVRSpatialAnchors_Version = "IVRSpatialAnchors_001"; static uint VRToken { get; set; } @@ -5433,6 +5769,7 @@ public void Clear() m_pVRScreenshots = null; m_pVRTrackedCamera = null; m_pVRInput = null; + m_pVRSpatialAnchors = null; } void CheckClear() @@ -5600,6 +5937,19 @@ public CVRInput VRInput() return m_pVRInput; } + public CVRSpatialAnchors VRSpatialAnchors() + { + CheckClear(); + if (m_pVRSpatialAnchors == null) + { + var eError = EVRInitError.None; + var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix + IVRSpatialAnchors_Version, ref eError); + if (pInterface != IntPtr.Zero && eError == EVRInitError.None) + m_pVRSpatialAnchors = new CVRSpatialAnchors(pInterface); + } + return m_pVRSpatialAnchors; + } + private CVRSystem m_pVRSystem; private CVRChaperone m_pVRChaperone; private CVRChaperoneSetup m_pVRChaperoneSetup; @@ -5612,6 +5962,7 @@ public CVRInput VRInput() private CVRScreenshots m_pVRScreenshots; private CVRTrackedCamera m_pVRTrackedCamera; private CVRInput m_pVRInput; + private CVRSpatialAnchors m_pVRSpatialAnchors; }; private static COpenVRContext _OpenVRInternal_ModuleContext = null; @@ -5637,11 +5988,20 @@ static COpenVRContext OpenVRInternal_ModuleContext public static CVRScreenshots Screenshots { get { return OpenVRInternal_ModuleContext.VRScreenshots(); } } public static CVRTrackedCamera TrackedCamera { get { return OpenVRInternal_ModuleContext.VRTrackedCamera(); } } public static CVRInput Input { get { return OpenVRInternal_ModuleContext.VRInput(); } } + public static CVRSpatialAnchors SpatialAnchors { get { return OpenVRInternal_ModuleContext.VRSpatialAnchors(); } } /** Finds the active installation of vrclient.dll and initializes it */ - public static CVRSystem Init(ref EVRInitError peError, EVRApplicationType eApplicationType = EVRApplicationType.VRApplication_Scene) + public static CVRSystem Init(ref EVRInitError peError, EVRApplicationType eApplicationType = EVRApplicationType.VRApplication_Scene, string pchStartupInfo= "") { - VRToken = InitInternal(ref peError, eApplicationType); + try + { + VRToken = InitInternal2(ref peError, eApplicationType, pchStartupInfo); + } + catch (EntryPointNotFoundException e) + { + VRToken = InitInternal(ref peError, eApplicationType); + } + OpenVRInternal_ModuleContext.Clear(); if (peError != EVRInitError.None) diff --git a/headers/openvr_api.json b/headers/openvr_api.json index a6bd7cbd..528cd166 100644 --- a/headers/openvr_api.json +++ b/headers/openvr_api.json @@ -1,4 +1,5 @@ -{"typedefs":[{"typedef": "vr::glSharedTextureHandle_t","type": "void *"} +{"typedefs":[{"typedef": "vr::SpatialAnchorHandle_t","type": "uint32_t"} +,{"typedef": "vr::glSharedTextureHandle_t","type": "void *"} ,{"typedef": "vr::glInt_t","type": "int32_t"} ,{"typedef": "vr::glUInt_t","type": "uint32_t"} ,{"typedef": "vr::SharedTextureHandle_t","type": "uint64_t"} @@ -8,6 +9,9 @@ ,{"typedef": "vr::PropertyContainerHandle_t","type": "uint64_t"} ,{"typedef": "vr::PropertyTypeTag_t","type": "uint32_t"} ,{"typedef": "vr::DriverHandle_t","type": "PropertyContainerHandle_t"} +,{"typedef": "vr::VRActionHandle_t","type": "uint64_t"} +,{"typedef": "vr::VRActionSetHandle_t","type": "uint64_t"} +,{"typedef": "vr::VRInputValueHandle_t","type": "uint64_t"} ,{"typedef": "vr::VREvent_Data_t","type": "union VREvent_Data_t"} ,{"typedef": "vr::VRControllerState_t","type": "struct vr::VRControllerState001_t"} ,{"typedef": "vr::VROverlayHandle_t","type": "uint64_t"} @@ -17,9 +21,6 @@ ,{"typedef": "vr::VRComponentProperties","type": "uint32_t"} ,{"typedef": "vr::TextureID_t","type": "int32_t"} ,{"typedef": "vr::VRNotificationId","type": "uint32_t"} -,{"typedef": "vr::VRActionHandle_t","type": "uint64_t"} -,{"typedef": "vr::VRActionSetHandle_t","type": "uint64_t"} -,{"typedef": "vr::VRInputValueHandle_t","type": "uint64_t"} ,{"typedef": "vr::IOBufferHandle_t","type": "uint64_t"} ,{"typedef": "vr::HmdError","type": "enum vr::EVRInitError"} ,{"typedef": "vr::Hmd_Eye","type": "enum vr::EVREye"} @@ -43,12 +44,14 @@ ,{"name": "Eye_Right","value": "1"} ]} , {"enumname": "vr::ETextureType","values": [ - {"name": "TextureType_DirectX","value": "0"} + {"name": "TextureType_Invalid","value": "-1"} + ,{"name": "TextureType_DirectX","value": "0"} ,{"name": "TextureType_OpenGL","value": "1"} ,{"name": "TextureType_Vulkan","value": "2"} ,{"name": "TextureType_IOSurface","value": "3"} ,{"name": "TextureType_DirectX12","value": "4"} ,{"name": "TextureType_DXGISharedHandle","value": "5"} + ,{"name": "TextureType_Metal","value": "6"} ]} , {"enumname": "vr::EColorSpace","values": [ {"name": "ColorSpace_Auto","value": "0"} @@ -69,6 +72,7 @@ ,{"name": "TrackedDeviceClass_GenericTracker","value": "3"} ,{"name": "TrackedDeviceClass_TrackingReference","value": "4"} ,{"name": "TrackedDeviceClass_DisplayRedirect","value": "5"} + ,{"name": "TrackedDeviceClass_Max","value": "6"} ]} , {"enumname": "vr::ETrackedControllerRole","values": [ {"name": "TrackedControllerRole_Invalid","value": "0"} @@ -191,6 +195,16 @@ ,{"name": "Prop_ImuFactoryGyroScale_Vector3","value": "2065"} ,{"name": "Prop_ImuFactoryAccelerometerBias_Vector3","value": "2066"} ,{"name": "Prop_ImuFactoryAccelerometerScale_Vector3","value": "2067"} + ,{"name": "Prop_ConfigurationIncludesLighthouse20Features_Bool","value": "2069"} + ,{"name": "Prop_DriverRequestedMuraCorrectionMode_Int32","value": "2200"} + ,{"name": "Prop_DriverRequestedMuraFeather_InnerLeft_Int32","value": "2201"} + ,{"name": "Prop_DriverRequestedMuraFeather_InnerRight_Int32","value": "2202"} + ,{"name": "Prop_DriverRequestedMuraFeather_InnerTop_Int32","value": "2203"} + ,{"name": "Prop_DriverRequestedMuraFeather_InnerBottom_Int32","value": "2204"} + ,{"name": "Prop_DriverRequestedMuraFeather_OuterLeft_Int32","value": "2205"} + ,{"name": "Prop_DriverRequestedMuraFeather_OuterRight_Int32","value": "2206"} + ,{"name": "Prop_DriverRequestedMuraFeather_OuterTop_Int32","value": "2207"} + ,{"name": "Prop_DriverRequestedMuraFeather_OuterBottom_Int32","value": "2208"} ,{"name": "Prop_AttachedDeviceId_String","value": "3000"} ,{"name": "Prop_SupportedButtons_Uint64","value": "3001"} ,{"name": "Prop_Axis0Type_Int32","value": "3002"} @@ -225,6 +239,7 @@ ,{"name": "Prop_HasCameraComponent_Bool","value": "6004"} ,{"name": "Prop_HasDriverDirectModeComponent_Bool","value": "6005"} ,{"name": "Prop_HasVirtualDisplayComponent_Bool","value": "6006"} + ,{"name": "Prop_HasSpatialAnchorsSupport_Bool","value": "6007"} ,{"name": "Prop_ControllerType_String","value": "7000"} ,{"name": "Prop_LegacyInputProfile_String","value": "7001"} ,{"name": "Prop_VendorSpecific_Reserved_Start","value": "10000"} @@ -372,6 +387,7 @@ ,{"name": "VREvent_PerfSectionSettingChanged","value": "863"} ,{"name": "VREvent_DashboardSectionSettingChanged","value": "864"} ,{"name": "VREvent_WebInterfaceSectionSettingChanged","value": "865"} + ,{"name": "VREvent_TrackersSectionSettingChanged","value": "866"} ,{"name": "VREvent_StatusUpdate","value": "900"} ,{"name": "VREvent_WebInterface_InstallDriverCompleted","value": "950"} ,{"name": "VREvent_MCImageUpdated","value": "1000"} @@ -405,6 +421,12 @@ ,{"name": "VREvent_Input_HapticVibration","value": "1700"} ,{"name": "VREvent_Input_BindingLoadFailed","value": "1701"} ,{"name": "VREvent_Input_BindingLoadSuccessful","value": "1702"} + ,{"name": "VREvent_Input_ActionManifestReloaded","value": "1703"} + ,{"name": "VREvent_Input_ActionManifestLoadFailed","value": "1704"} + ,{"name": "VREvent_SpatialAnchors_PoseUpdated","value": "1800"} + ,{"name": "VREvent_SpatialAnchors_DescriptorUpdated","value": "1801"} + ,{"name": "VREvent_SpatialAnchors_RequestPoseUpdate","value": "1802"} + ,{"name": "VREvent_SpatialAnchors_RequestDescriptorUpdate","value": "1803"} ,{"name": "VREvent_VendorSpecific_Reserved_Start","value": "10000"} ,{"name": "VREvent_VendorSpecific_Reserved_End","value": "19999"} ]} @@ -433,6 +455,9 @@ ,{"name": "k_EButton_SteamVR_Touchpad","value": "32"} ,{"name": "k_EButton_SteamVR_Trigger","value": "33"} ,{"name": "k_EButton_Dashboard_Back","value": "2"} + ,{"name": "k_EButton_Knuckles_A","value": "2"} + ,{"name": "k_EButton_Knuckles_B","value": "1"} + ,{"name": "k_EButton_Knuckles_JoyStick","value": "35"} ,{"name": "k_EButton_Max","value": "64"} ]} , {"enumname": "vr::EVRMouseButton","values": [ @@ -461,6 +486,23 @@ ,{"name": "VRInputError_NoData","value": "13"} ,{"name": "VRInputError_BufferTooSmall","value": "14"} ,{"name": "VRInputError_MismatchedActionManifest","value": "15"} + ,{"name": "VRInputError_MissingSkeletonData","value": "16"} +]} +, {"enumname": "vr::EVRSpatialAnchorError","values": [ + {"name": "VRSpatialAnchorError_Success","value": "0"} + ,{"name": "VRSpatialAnchorError_Internal","value": "1"} + ,{"name": "VRSpatialAnchorError_UnknownHandle","value": "2"} + ,{"name": "VRSpatialAnchorError_ArrayTooSmall","value": "3"} + ,{"name": "VRSpatialAnchorError_InvalidDescriptorChar","value": "4"} + ,{"name": "VRSpatialAnchorError_NotYetAvailable","value": "5"} + ,{"name": "VRSpatialAnchorError_NotAvailableInThisUniverse","value": "6"} + ,{"name": "VRSpatialAnchorError_PermanentlyUnavailable","value": "7"} + ,{"name": "VRSpatialAnchorError_WrongDriver","value": "8"} + ,{"name": "VRSpatialAnchorError_DescriptorTooLong","value": "9"} + ,{"name": "VRSpatialAnchorError_Unknown","value": "10"} + ,{"name": "VRSpatialAnchorError_NoRoomCalibration","value": "11"} + ,{"name": "VRSpatialAnchorError_InvalidArgument","value": "12"} + ,{"name": "VRSpatialAnchorError_UnknownDriver","value": "13"} ]} , {"enumname": "vr::EHiddenAreaMeshType","values": [ {"name": "k_eHiddenAreaMesh_Standard","value": "0"} @@ -535,6 +577,10 @@ ,{"name": "VRNotificationError_InvalidOverlayHandle","value": "102"} ,{"name": "VRNotificationError_SystemWithUserValueAlreadyExists","value": "103"} ]} +, {"enumname": "vr::EVRSkeletalMotionRange","values": [ + {"name": "VRSkeletalMotionRange_WithController","value": "0"} + ,{"name": "VRSkeletalMotionRange_WithoutController","value": "1"} +]} , {"enumname": "vr::EVRInitError","values": [ {"name": "VRInitError_None","value": "0"} ,{"name": "VRInitError_Unknown","value": "1"} @@ -580,6 +626,7 @@ ,{"name": "VRInitError_Init_FirmwareRecoveryBusy","value": "139"} ,{"name": "VRInitError_Init_USBServiceBusy","value": "140"} ,{"name": "VRInitError_Init_VRWebHelperStartupFailed","value": "141"} + ,{"name": "VRInitError_Init_TrackerManagerInitFailed","value": "142"} ,{"name": "VRInitError_Driver_Failed","value": "200"} ,{"name": "VRInitError_Driver_Unknown","value": "201"} ,{"name": "VRInitError_Driver_HmdUnknown","value": "202"} @@ -672,6 +719,10 @@ ,{"name": "VSync_WaitRender","value": "1"} ,{"name": "VSync_NoWaitRender","value": "2"} ]} +, {"enumname": "vr::EVRMuraCorrectionMode","values": [ + {"name": "EVRMuraCorrectionMode_Default","value": "0"} + ,{"name": "EVRMuraCorrectionMode_NoCorrection","value": "1"} +]} , {"enumname": "vr::Imu_OffScaleFlags","values": [ {"name": "OffScale_AccelX","value": "1"} ,{"name": "OffScale_AccelY","value": "2"} @@ -875,7 +926,7 @@ ,{"name": "VRScreenshotError_ScreenshotAlreadyInProgress","value": "108"} ]} , {"enumname": "vr::EVRSkeletalTransformSpace","values": [ - {"name": "VRSkeletalTransformSpace_Action","value": "0"} + {"name": "VRSkeletalTransformSpace_Model","value": "0"} ,{"name": "VRSkeletalTransformSpace_Parent","value": "1"} ,{"name": "VRSkeletalTransformSpace_Additive","value": "2"} ]} @@ -948,12 +999,20 @@ "constname": "k_unHapticVibrationPropertyTag","consttype": "const PropertyTypeTag_t", "constval": "35"} ,{ "constname": "k_unSkeletonPropertyTag","consttype": "const PropertyTypeTag_t", "constval": "36"} +,{ + "constname": "k_unSpatialAnchorPosePropertyTag","consttype": "const PropertyTypeTag_t", "constval": "40"} ,{ "constname": "k_unOpenVRInternalReserved_Start","consttype": "const PropertyTypeTag_t", "constval": "1000"} ,{ "constname": "k_unOpenVRInternalReserved_End","consttype": "const PropertyTypeTag_t", "constval": "10000"} ,{ "constname": "k_unMaxPropertyStringSize","consttype": "const uint32_t", "constval": "32768"} +,{ + "constname": "k_ulInvalidActionHandle","consttype": "const VRActionHandle_t", "constval": "0"} +,{ + "constname": "k_ulInvalidActionSetHandle","consttype": "const VRActionSetHandle_t", "constval": "0"} +,{ + "constname": "k_ulInvalidInputValueHandle","consttype": "const VRInputValueHandle_t", "constval": "0"} ,{ "constname": "k_unControllerStateAxisCount","consttype": "const uint32_t", "constval": "5"} ,{ @@ -1001,7 +1060,7 @@ ,{ "constname": "k_pch_Controller_Component_Status","consttype": "const char *const", "constval": "status"} ,{ - "constname": "IVRRenderModels_Version","consttype": "const char *const", "constval": "IVRRenderModels_005"} + "constname": "IVRRenderModels_Version","consttype": "const char *const", "constval": "IVRRenderModels_006"} ,{ "constname": "k_unNotificationTextMaxSize","consttype": "const uint32_t", "constval": "256"} ,{ @@ -1112,6 +1171,10 @@ "constname": "k_pch_SteamVR_LegacyInputRebinding","consttype": "const char *const", "constval": "legacyInputRebinding"} ,{ "constname": "k_pch_SteamVR_DebugInputBinding","consttype": "const char *const", "constval": "debugInputBinding"} +,{ + "constname": "k_pch_SteamVR_InputBindingUIBlock","consttype": "const char *const", "constval": "inputBindingUI"} +,{ + "constname": "k_pch_SteamVR_RenderCameraMode","consttype": "const char *const", "constval": "renderCameraMode"} ,{ "constname": "k_pch_Lighthouse_Section","consttype": "const char *const", "constval": "driver_lighthouse"} ,{ @@ -1278,12 +1341,16 @@ "constname": "k_pch_Dashboard_EnableWebUI","consttype": "const char *const", "constval": "webUI"} ,{ "constname": "k_pch_Dashboard_EnableWebUIDevTools","consttype": "const char *const", "constval": "webUIDevTools"} +,{ + "constname": "k_pch_Dashboard_EnableWebUIDashboardReplacement","consttype": "const char *const", "constval": "webUIDashboard"} ,{ "constname": "k_pch_modelskin_Section","consttype": "const char *const", "constval": "modelskins"} ,{ "constname": "k_pch_Driver_Enable_Bool","consttype": "const char *const", "constval": "enable"} ,{ "constname": "k_pch_WebInterface_Section","consttype": "const char *const", "constval": "WebInterface"} +,{ + "constname": "k_pch_WebInterface_WebEnable_Bool","consttype": "const char *const", "constval": "WebEnable"} ,{ "constname": "k_pch_WebInterface_WebPort_String","consttype": "const char *const", "constval": "WebPort"} ,{ @@ -1296,18 +1363,14 @@ "constname": "k_pch_App_NeedToUpdateAutosaveSuffix_Bool","consttype": "const char *const", "constval": "NeedToUpdateAutosave"} ,{ "constname": "k_pch_App_ActionManifestURL_String","consttype": "const char *const", "constval": "ActionManifestURL"} +,{ + "constname": "k_pch_Trackers_Section","consttype": "const char *const", "constval": "trackers"} ,{ "constname": "IVRScreenshots_Version","consttype": "const char *const", "constval": "IVRScreenshots_001"} ,{ "constname": "IVRResources_Version","consttype": "const char *const", "constval": "IVRResources_001"} ,{ "constname": "IVRDriverManager_Version","consttype": "const char *const", "constval": "IVRDriverManager_001"} -,{ - "constname": "k_ulInvalidActionHandle","consttype": "const VRActionHandle_t", "constval": "0"} -,{ - "constname": "k_ulInvalidActionSetHandle","consttype": "const VRActionSetHandle_t", "constval": "0"} -,{ - "constname": "k_ulInvalidInputValueHandle","consttype": "const VRInputValueHandle_t", "constval": "0"} ,{ "constname": "k_unMaxActionNameLength","consttype": "const uint32_t", "constval": "64"} ,{ @@ -1315,14 +1378,20 @@ ,{ "constname": "k_unMaxActionOriginCount","consttype": "const uint32_t", "constval": "16"} ,{ - "constname": "IVRInput_Version","consttype": "const char *const", "constval": "IVRInput_003"} + "constname": "IVRInput_Version","consttype": "const char *const", "constval": "IVRInput_004"} ,{ "constname": "k_ulInvalidIOBufferHandle","consttype": "const uint64_t", "constval": "0"} ,{ "constname": "IVRIOBuffer_Version","consttype": "const char *", "constval": "IVRIOBuffer_001"} +,{ + "constname": "k_ulInvalidSpatialAnchorHandle","consttype": "const SpatialAnchorHandle_t", "constval": "0"} +,{ + "constname": "IVRSpatialAnchors_Version","consttype": "const char *const", "constval": "IVRSpatialAnchors_001"} ], "structs":[{"struct": "vr::HmdMatrix34_t","fields": [ { "fieldname": "m", "fieldtype": "float [3][4]"}]} +,{"struct": "vr::HmdMatrix33_t","fields": [ +{ "fieldname": "m", "fieldtype": "float [3][3]"}]} ,{"struct": "vr::HmdMatrix44_t","fields": [ { "fieldname": "m", "fieldtype": "float [4][4]"}]} ,{"struct": "vr::HmdVector3_t","fields": [ @@ -1477,7 +1546,15 @@ ,{"struct": "vr::VREvent_InputBindingLoad_t","fields": [ { "fieldname": "ulAppContainer", "fieldtype": "vr::PropertyContainerHandle_t"}, { "fieldname": "pathMessage", "fieldtype": "uint64_t"}, -{ "fieldname": "pathUrl", "fieldtype": "uint64_t"}]} +{ "fieldname": "pathUrl", "fieldtype": "uint64_t"}, +{ "fieldname": "pathControllerType", "fieldtype": "uint64_t"}]} +,{"struct": "vr::VREvent_InputActionManifestLoad_t","fields": [ +{ "fieldname": "pathAppKey", "fieldtype": "uint64_t"}, +{ "fieldname": "pathMessage", "fieldtype": "uint64_t"}, +{ "fieldname": "pathMessageParam", "fieldtype": "uint64_t"}, +{ "fieldname": "pathManifestPath", "fieldtype": "uint64_t"}]} +,{"struct": "vr::VREvent_SpatialAnchor_t","fields": [ +{ "fieldname": "unHandle", "fieldtype": "SpatialAnchorHandle_t"}]} ,{"struct": "vr::(anonymous)","fields": [ { "fieldname": "reserved", "fieldtype": "struct vr::VREvent_Reserved_t"}, { "fieldname": "controller", "fieldtype": "struct vr::VREvent_Controller_t"}, @@ -1502,7 +1579,9 @@ { "fieldname": "dualAnalog", "fieldtype": "struct vr::VREvent_DualAnalog_t"}, { "fieldname": "hapticVibration", "fieldtype": "struct vr::VREvent_HapticVibration_t"}, { "fieldname": "webConsole", "fieldtype": "struct vr::VREvent_WebConsole_t"}, -{ "fieldname": "inputBinding", "fieldtype": "struct vr::VREvent_InputBindingLoad_t"}]} +{ "fieldname": "inputBinding", "fieldtype": "struct vr::VREvent_InputBindingLoad_t"}, +{ "fieldname": "actionManifest", "fieldtype": "struct vr::VREvent_InputActionManifestLoad_t"}, +{ "fieldname": "spatialAnchor", "fieldtype": "struct vr::VREvent_SpatialAnchor_t"}]} ,{"struct": "vr::VREvent_t","fields": [ { "fieldname": "eventType", "fieldtype": "uint32_t"}, { "fieldname": "trackedDeviceIndex", "fieldtype": "TrackedDeviceIndex_t"}, @@ -1648,6 +1727,8 @@ { "fieldname": "m_nWidth", "fieldtype": "int32_t"}, { "fieldname": "m_nHeight", "fieldtype": "int32_t"}, { "fieldname": "m_nBytesPerPixel", "fieldtype": "int32_t"}]} +,{"struct": "vr::CVRSettingHelper","fields": [ +{ "fieldname": "m_pSettings", "fieldtype": "class vr::IVRSettings *"}]} ,{"struct": "vr::InputAnalogActionData_t","fields": [ { "fieldname": "bActive", "fieldtype": "_Bool"}, { "fieldname": "activeOrigin", "fieldtype": "VRInputValueHandle_t"}, @@ -1668,9 +1749,10 @@ { "fieldname": "bActive", "fieldtype": "_Bool"}, { "fieldname": "activeOrigin", "fieldtype": "VRInputValueHandle_t"}, { "fieldname": "pose", "fieldtype": "struct vr::TrackedDevicePose_t"}]} -,{"struct": "vr::InputSkeletonActionData_t","fields": [ +,{"struct": "vr::InputSkeletalActionData_t","fields": [ { "fieldname": "bActive", "fieldtype": "_Bool"}, -{ "fieldname": "activeOrigin", "fieldtype": "VRInputValueHandle_t"}]} +{ "fieldname": "activeOrigin", "fieldtype": "VRInputValueHandle_t"}, +{ "fieldname": "boneCount", "fieldtype": "uint32_t"}]} ,{"struct": "vr::InputOriginInfo_t","fields": [ { "fieldname": "devicePath", "fieldtype": "VRInputValueHandle_t"}, { "fieldname": "trackedDeviceIndex", "fieldtype": "TrackedDeviceIndex_t"}, @@ -1678,7 +1760,11 @@ ,{"struct": "vr::VRActiveActionSet_t","fields": [ { "fieldname": "ulActionSet", "fieldtype": "VRActionSetHandle_t"}, { "fieldname": "ulRestrictedToDevice", "fieldtype": "VRInputValueHandle_t"}, -{ "fieldname": "ulSecondaryActionSet", "fieldtype": "VRActionSetHandle_t"}]} +{ "fieldname": "ulSecondaryActionSet", "fieldtype": "VRActionSetHandle_t"}, +{ "fieldname": "unPadding", "fieldtype": "uint32_t"}, +{ "fieldname": "nPriority", "fieldtype": "int32_t"}]} +,{"struct": "vr::SpatialAnchorPose_t","fields": [ +{ "fieldname": "mAnchorToAbsoluteTracking", "fieldtype": "struct vr::HmdMatrix34_t"}]} ,{"struct": "vr::COpenVRContext","fields": [ { "fieldname": "m_pVRSystem", "fieldtype": "class vr::IVRSystem *"}, { "fieldname": "m_pVRChaperone", "fieldtype": "class vr::IVRChaperone *"}, @@ -1694,7 +1780,8 @@ { "fieldname": "m_pVRScreenshots", "fieldtype": "class vr::IVRScreenshots *"}, { "fieldname": "m_pVRDriverManager", "fieldtype": "class vr::IVRDriverManager *"}, { "fieldname": "m_pVRInput", "fieldtype": "class vr::IVRInput *"}, -{ "fieldname": "m_pVRIOBuffer", "fieldtype": "class vr::IVRIOBuffer *"}]} +{ "fieldname": "m_pVRIOBuffer", "fieldtype": "class vr::IVRIOBuffer *"}, +{ "fieldname": "m_pVRSpatialAnchors", "fieldtype": "class vr::IVRSpatialAnchors *"}]} ], "methods":[{ "classname": "vr::IVRSystem", @@ -3947,6 +4034,18 @@ { "paramname": "unComponentRenderModelNameLen" ,"paramtype": "uint32_t"} ] } +,{ + "classname": "vr::IVRRenderModels", + "methodname": "GetComponentStateForDevicePath", + "returntype": "bool", + "params": [ +{ "paramname": "pchRenderModelName" ,"paramtype": "const char *"}, +{ "paramname": "pchComponentName" ,"paramtype": "const char *"}, +{ "paramname": "devicePath" ,"paramtype": "vr::VRInputValueHandle_t"}, +{ "paramname": "pState" ,"paramtype": "const vr::RenderModel_ControllerMode_State_t *"}, +{ "paramname": "pComponentState" ,"paramtype": "vr::RenderModel_ComponentState_t *"} + ] +} ,{ "classname": "vr::IVRRenderModels", "methodname": "GetComponentState", @@ -4309,7 +4408,8 @@ "params": [ { "paramname": "action" ,"paramtype": "vr::VRActionHandle_t"}, { "paramname": "pActionData" ,"paramtype": "struct vr::InputDigitalActionData_t *"}, -{ "paramname": "unActionDataSize" ,"paramtype": "uint32_t"} +{ "paramname": "unActionDataSize" ,"paramtype": "uint32_t"}, +{ "paramname": "ulRestrictToDevice" ,"paramtype": "vr::VRInputValueHandle_t"} ] } ,{ @@ -4319,7 +4419,8 @@ "params": [ { "paramname": "action" ,"paramtype": "vr::VRActionHandle_t"}, { "paramname": "pActionData" ,"paramtype": "struct vr::InputAnalogActionData_t *"}, -{ "paramname": "unActionDataSize" ,"paramtype": "uint32_t"} +{ "paramname": "unActionDataSize" ,"paramtype": "uint32_t"}, +{ "paramname": "ulRestrictToDevice" ,"paramtype": "vr::VRInputValueHandle_t"} ] } ,{ @@ -4331,7 +4432,8 @@ { "paramname": "eOrigin" ,"paramtype": "vr::ETrackingUniverseOrigin"}, { "paramname": "fPredictedSecondsFromNow" ,"paramtype": "float"}, { "paramname": "pActionData" ,"paramtype": "struct vr::InputPoseActionData_t *"}, -{ "paramname": "unActionDataSize" ,"paramtype": "uint32_t"} +{ "paramname": "unActionDataSize" ,"paramtype": "uint32_t"}, +{ "paramname": "ulRestrictToDevice" ,"paramtype": "vr::VRInputValueHandle_t"} ] } ,{ @@ -4340,35 +4442,46 @@ "returntype": "vr::EVRInputError", "params": [ { "paramname": "action" ,"paramtype": "vr::VRActionHandle_t"}, -{ "paramname": "eBoneParent" ,"paramtype": "vr::EVRSkeletalTransformSpace"}, -{ "paramname": "fPredictedSecondsFromNow" ,"paramtype": "float"}, -{ "paramname": "pActionData" ,"paramtype": "struct vr::InputSkeletonActionData_t *"}, +{ "paramname": "pActionData" ,"paramtype": "struct vr::InputSkeletalActionData_t *"}, { "paramname": "unActionDataSize" ,"paramtype": "uint32_t"}, +{ "paramname": "ulRestrictToDevice" ,"paramtype": "vr::VRInputValueHandle_t"} + ] +} +,{ + "classname": "vr::IVRInput", + "methodname": "GetSkeletalBoneData", + "returntype": "vr::EVRInputError", + "params": [ +{ "paramname": "action" ,"paramtype": "vr::VRActionHandle_t"}, +{ "paramname": "eTransformSpace" ,"paramtype": "vr::EVRSkeletalTransformSpace"}, +{ "paramname": "eMotionRange" ,"paramtype": "vr::EVRSkeletalMotionRange"}, { "paramname": "pTransformArray" ,"array_count": "unTransformArrayCount" ,"paramtype": "struct vr::VRBoneTransform_t *"}, -{ "paramname": "unTransformArrayCount" ,"paramtype": "uint32_t"} +{ "paramname": "unTransformArrayCount" ,"paramtype": "uint32_t"}, +{ "paramname": "ulRestrictToDevice" ,"paramtype": "vr::VRInputValueHandle_t"} ] } ,{ "classname": "vr::IVRInput", - "methodname": "GetSkeletalActionDataCompressed", + "methodname": "GetSkeletalBoneDataCompressed", "returntype": "vr::EVRInputError", "params": [ { "paramname": "action" ,"paramtype": "vr::VRActionHandle_t"}, -{ "paramname": "eBoneParent" ,"paramtype": "vr::EVRSkeletalTransformSpace"}, -{ "paramname": "fPredictedSecondsFromNow" ,"paramtype": "float"}, +{ "paramname": "eTransformSpace" ,"paramtype": "vr::EVRSkeletalTransformSpace"}, +{ "paramname": "eMotionRange" ,"paramtype": "vr::EVRSkeletalMotionRange"}, { "paramname": "pvCompressedData" ,"out_buffer_count": "unCompressedSize" ,"paramtype": "void *"}, { "paramname": "unCompressedSize" ,"paramtype": "uint32_t"}, -{ "paramname": "punRequiredCompressedSize" ,"paramtype": "uint32_t *"} +{ "paramname": "punRequiredCompressedSize" ,"paramtype": "uint32_t *"}, +{ "paramname": "ulRestrictToDevice" ,"paramtype": "vr::VRInputValueHandle_t"} ] } ,{ "classname": "vr::IVRInput", - "methodname": "UncompressSkeletalActionData", + "methodname": "DecompressSkeletalBoneData", "returntype": "vr::EVRInputError", "params": [ { "paramname": "pvCompressedBuffer" ,"paramtype": "void *"}, { "paramname": "unCompressedBufferSize" ,"paramtype": "uint32_t"}, -{ "paramname": "peBoneParent" ,"paramtype": "vr::EVRSkeletalTransformSpace *"}, +{ "paramname": "peTransformSpace" ,"paramtype": "vr::EVRSkeletalTransformSpace *"}, { "paramname": "pTransformArray" ,"array_count": "unTransformArrayCount" ,"paramtype": "struct vr::VRBoneTransform_t *"}, { "paramname": "unTransformArrayCount" ,"paramtype": "uint32_t"} ] @@ -4382,7 +4495,8 @@ { "paramname": "fStartSecondsFromNow" ,"paramtype": "float"}, { "paramname": "fDurationSeconds" ,"paramtype": "float"}, { "paramname": "fFrequency" ,"paramtype": "float"}, -{ "paramname": "fAmplitude" ,"paramtype": "float"} +{ "paramname": "fAmplitude" ,"paramtype": "float"}, +{ "paramname": "ulRestrictToDevice" ,"paramtype": "vr::VRInputValueHandle_t"} ] } ,{ @@ -4485,5 +4599,45 @@ { "paramname": "ulBuffer" ,"paramtype": "vr::IOBufferHandle_t"} ] } +,{ + "classname": "vr::IVRSpatialAnchors", + "methodname": "CreateSpatialAnchorFromDescriptor", + "returntype": "vr::EVRSpatialAnchorError", + "params": [ +{ "paramname": "pchDescriptor" ,"paramtype": "const char *"}, +{ "paramname": "pHandleOut" ,"paramtype": "vr::SpatialAnchorHandle_t *"} + ] +} +,{ + "classname": "vr::IVRSpatialAnchors", + "methodname": "CreateSpatialAnchorFromPose", + "returntype": "vr::EVRSpatialAnchorError", + "params": [ +{ "paramname": "unDeviceIndex" ,"paramtype": "vr::TrackedDeviceIndex_t"}, +{ "paramname": "eOrigin" ,"paramtype": "vr::ETrackingUniverseOrigin"}, +{ "paramname": "pPose" ,"paramtype": "struct vr::SpatialAnchorPose_t *"}, +{ "paramname": "pHandleOut" ,"paramtype": "vr::SpatialAnchorHandle_t *"} + ] +} +,{ + "classname": "vr::IVRSpatialAnchors", + "methodname": "GetSpatialAnchorPose", + "returntype": "vr::EVRSpatialAnchorError", + "params": [ +{ "paramname": "unHandle" ,"paramtype": "vr::SpatialAnchorHandle_t"}, +{ "paramname": "eOrigin" ,"paramtype": "vr::ETrackingUniverseOrigin"}, +{ "paramname": "pPoseOut" ,"paramtype": "struct vr::SpatialAnchorPose_t *"} + ] +} +,{ + "classname": "vr::IVRSpatialAnchors", + "methodname": "GetSpatialAnchorDescriptor", + "returntype": "vr::EVRSpatialAnchorError", + "params": [ +{ "paramname": "unHandle" ,"paramtype": "vr::SpatialAnchorHandle_t"}, +{ "paramname": "pchDescriptorOut" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "punDescriptorBufferLenInOut" ,"paramtype": "uint32_t *"} + ] +} ] } \ No newline at end of file diff --git a/headers/openvr_capi.h b/headers/openvr_capi.h index ee24e90a..1ee5a367 100644 --- a/headers/openvr_capi.h +++ b/headers/openvr_capi.h @@ -88,9 +88,13 @@ static const unsigned int k_unInputValuePropertyTag = 33; static const unsigned int k_unWildcardPropertyTag = 34; static const unsigned int k_unHapticVibrationPropertyTag = 35; static const unsigned int k_unSkeletonPropertyTag = 36; +static const unsigned int k_unSpatialAnchorPosePropertyTag = 40; static const unsigned int k_unOpenVRInternalReserved_Start = 1000; static const unsigned int k_unOpenVRInternalReserved_End = 10000; static const unsigned int k_unMaxPropertyStringSize = 32768; +static const unsigned long k_ulInvalidActionHandle = 0; +static const unsigned long k_ulInvalidActionSetHandle = 0; +static const unsigned long k_ulInvalidInputValueHandle = 0; static const unsigned int k_unControllerStateAxisCount = 5; static const unsigned long k_ulOverlayHandleInvalid = 0; static const unsigned int k_unScreenshotHandleInvalid = 0; @@ -114,7 +118,7 @@ static const char * k_pch_Controller_Component_Base = "base"; static const char * k_pch_Controller_Component_Tip = "tip"; static const char * k_pch_Controller_Component_HandGrip = "handgrip"; static const char * k_pch_Controller_Component_Status = "status"; -static const char * IVRRenderModels_Version = "IVRRenderModels_005"; +static const char * IVRRenderModels_Version = "IVRRenderModels_006"; static const unsigned int k_unNotificationTextMaxSize = 256; static const char * IVRNotifications_Version = "IVRNotifications_002"; static const unsigned int k_unMaxSettingsKeyLength = 128; @@ -170,6 +174,8 @@ static const char * k_pch_SteamVR_ForceWindows32bitVRMonitor = "forceWindows32Bi static const char * k_pch_SteamVR_DebugInput = "debugInput"; static const char * k_pch_SteamVR_LegacyInputRebinding = "legacyInputRebinding"; static const char * k_pch_SteamVR_DebugInputBinding = "debugInputBinding"; +static const char * k_pch_SteamVR_InputBindingUIBlock = "inputBindingUI"; +static const char * k_pch_SteamVR_RenderCameraMode = "renderCameraMode"; static const char * k_pch_Lighthouse_Section = "driver_lighthouse"; static const char * k_pch_Lighthouse_DisableIMU_Bool = "disableimu"; static const char * k_pch_Lighthouse_DisableIMUExceptHMD_Bool = "disableimuexcepthmd"; @@ -253,27 +259,29 @@ static const char * k_pch_Dashboard_EnableDashboard_Bool = "enableDashboard"; static const char * k_pch_Dashboard_ArcadeMode_Bool = "arcadeMode"; static const char * k_pch_Dashboard_EnableWebUI = "webUI"; static const char * k_pch_Dashboard_EnableWebUIDevTools = "webUIDevTools"; +static const char * k_pch_Dashboard_EnableWebUIDashboardReplacement = "webUIDashboard"; static const char * k_pch_modelskin_Section = "modelskins"; static const char * k_pch_Driver_Enable_Bool = "enable"; static const char * k_pch_WebInterface_Section = "WebInterface"; +static const char * k_pch_WebInterface_WebEnable_Bool = "WebEnable"; static const char * k_pch_WebInterface_WebPort_String = "WebPort"; static const char * k_pch_TrackingOverride_Section = "TrackingOverrides"; static const char * k_pch_App_BindingAutosaveURLSuffix_String = "AutosaveURL"; static const char * k_pch_App_BindingCurrentURLSuffix_String = "CurrentURL"; static const char * k_pch_App_NeedToUpdateAutosaveSuffix_Bool = "NeedToUpdateAutosave"; static const char * k_pch_App_ActionManifestURL_String = "ActionManifestURL"; +static const char * k_pch_Trackers_Section = "trackers"; static const char * IVRScreenshots_Version = "IVRScreenshots_001"; static const char * IVRResources_Version = "IVRResources_001"; static const char * IVRDriverManager_Version = "IVRDriverManager_001"; -static const unsigned long k_ulInvalidActionHandle = 0; -static const unsigned long k_ulInvalidActionSetHandle = 0; -static const unsigned long k_ulInvalidInputValueHandle = 0; static const unsigned int k_unMaxActionNameLength = 64; static const unsigned int k_unMaxActionSetNameLength = 64; static const unsigned int k_unMaxActionOriginCount = 16; -static const char * IVRInput_Version = "IVRInput_003"; +static const char * IVRInput_Version = "IVRInput_004"; static const unsigned long k_ulInvalidIOBufferHandle = 0; static const char * IVRIOBuffer_Version = "IVRIOBuffer_001"; +static const unsigned int k_ulInvalidSpatialAnchorHandle = 0; +static const char * IVRSpatialAnchors_Version = "IVRSpatialAnchors_001"; // OpenVR Enums @@ -285,12 +293,14 @@ typedef enum EVREye typedef enum ETextureType { + ETextureType_TextureType_Invalid = -1, ETextureType_TextureType_DirectX = 0, ETextureType_TextureType_OpenGL = 1, ETextureType_TextureType_Vulkan = 2, ETextureType_TextureType_IOSurface = 3, ETextureType_TextureType_DirectX12 = 4, ETextureType_TextureType_DXGISharedHandle = 5, + ETextureType_TextureType_Metal = 6, } ETextureType; typedef enum EColorSpace @@ -317,6 +327,7 @@ typedef enum ETrackedDeviceClass ETrackedDeviceClass_TrackedDeviceClass_GenericTracker = 3, ETrackedDeviceClass_TrackedDeviceClass_TrackingReference = 4, ETrackedDeviceClass_TrackedDeviceClass_DisplayRedirect = 5, + ETrackedDeviceClass_TrackedDeviceClass_Max = 6, } ETrackedDeviceClass; typedef enum ETrackedControllerRole @@ -445,6 +456,16 @@ typedef enum ETrackedDeviceProperty ETrackedDeviceProperty_Prop_ImuFactoryGyroScale_Vector3 = 2065, ETrackedDeviceProperty_Prop_ImuFactoryAccelerometerBias_Vector3 = 2066, ETrackedDeviceProperty_Prop_ImuFactoryAccelerometerScale_Vector3 = 2067, + ETrackedDeviceProperty_Prop_ConfigurationIncludesLighthouse20Features_Bool = 2069, + ETrackedDeviceProperty_Prop_DriverRequestedMuraCorrectionMode_Int32 = 2200, + ETrackedDeviceProperty_Prop_DriverRequestedMuraFeather_InnerLeft_Int32 = 2201, + ETrackedDeviceProperty_Prop_DriverRequestedMuraFeather_InnerRight_Int32 = 2202, + ETrackedDeviceProperty_Prop_DriverRequestedMuraFeather_InnerTop_Int32 = 2203, + ETrackedDeviceProperty_Prop_DriverRequestedMuraFeather_InnerBottom_Int32 = 2204, + ETrackedDeviceProperty_Prop_DriverRequestedMuraFeather_OuterLeft_Int32 = 2205, + ETrackedDeviceProperty_Prop_DriverRequestedMuraFeather_OuterRight_Int32 = 2206, + ETrackedDeviceProperty_Prop_DriverRequestedMuraFeather_OuterTop_Int32 = 2207, + ETrackedDeviceProperty_Prop_DriverRequestedMuraFeather_OuterBottom_Int32 = 2208, ETrackedDeviceProperty_Prop_AttachedDeviceId_String = 3000, ETrackedDeviceProperty_Prop_SupportedButtons_Uint64 = 3001, ETrackedDeviceProperty_Prop_Axis0Type_Int32 = 3002, @@ -479,6 +500,7 @@ typedef enum ETrackedDeviceProperty ETrackedDeviceProperty_Prop_HasCameraComponent_Bool = 6004, ETrackedDeviceProperty_Prop_HasDriverDirectModeComponent_Bool = 6005, ETrackedDeviceProperty_Prop_HasVirtualDisplayComponent_Bool = 6006, + ETrackedDeviceProperty_Prop_HasSpatialAnchorsSupport_Bool = 6007, ETrackedDeviceProperty_Prop_ControllerType_String = 7000, ETrackedDeviceProperty_Prop_LegacyInputProfile_String = 7001, ETrackedDeviceProperty_Prop_VendorSpecific_Reserved_Start = 10000, @@ -634,6 +656,7 @@ typedef enum EVREventType EVREventType_VREvent_PerfSectionSettingChanged = 863, EVREventType_VREvent_DashboardSectionSettingChanged = 864, EVREventType_VREvent_WebInterfaceSectionSettingChanged = 865, + EVREventType_VREvent_TrackersSectionSettingChanged = 866, EVREventType_VREvent_StatusUpdate = 900, EVREventType_VREvent_WebInterface_InstallDriverCompleted = 950, EVREventType_VREvent_MCImageUpdated = 1000, @@ -667,6 +690,12 @@ typedef enum EVREventType EVREventType_VREvent_Input_HapticVibration = 1700, EVREventType_VREvent_Input_BindingLoadFailed = 1701, EVREventType_VREvent_Input_BindingLoadSuccessful = 1702, + EVREventType_VREvent_Input_ActionManifestReloaded = 1703, + EVREventType_VREvent_Input_ActionManifestLoadFailed = 1704, + EVREventType_VREvent_SpatialAnchors_PoseUpdated = 1800, + EVREventType_VREvent_SpatialAnchors_DescriptorUpdated = 1801, + EVREventType_VREvent_SpatialAnchors_RequestPoseUpdate = 1802, + EVREventType_VREvent_SpatialAnchors_RequestDescriptorUpdate = 1803, EVREventType_VREvent_VendorSpecific_Reserved_Start = 10000, EVREventType_VREvent_VendorSpecific_Reserved_End = 19999, } EVREventType; @@ -699,6 +728,9 @@ typedef enum EVRButtonId EVRButtonId_k_EButton_SteamVR_Touchpad = 32, EVRButtonId_k_EButton_SteamVR_Trigger = 33, EVRButtonId_k_EButton_Dashboard_Back = 2, + EVRButtonId_k_EButton_Knuckles_A = 2, + EVRButtonId_k_EButton_Knuckles_B = 1, + EVRButtonId_k_EButton_Knuckles_JoyStick = 35, EVRButtonId_k_EButton_Max = 64, } EVRButtonId; @@ -733,8 +765,27 @@ typedef enum EVRInputError EVRInputError_VRInputError_NoData = 13, EVRInputError_VRInputError_BufferTooSmall = 14, EVRInputError_VRInputError_MismatchedActionManifest = 15, + EVRInputError_VRInputError_MissingSkeletonData = 16, } EVRInputError; +typedef enum EVRSpatialAnchorError +{ + EVRSpatialAnchorError_VRSpatialAnchorError_Success = 0, + EVRSpatialAnchorError_VRSpatialAnchorError_Internal = 1, + EVRSpatialAnchorError_VRSpatialAnchorError_UnknownHandle = 2, + EVRSpatialAnchorError_VRSpatialAnchorError_ArrayTooSmall = 3, + EVRSpatialAnchorError_VRSpatialAnchorError_InvalidDescriptorChar = 4, + EVRSpatialAnchorError_VRSpatialAnchorError_NotYetAvailable = 5, + EVRSpatialAnchorError_VRSpatialAnchorError_NotAvailableInThisUniverse = 6, + EVRSpatialAnchorError_VRSpatialAnchorError_PermanentlyUnavailable = 7, + EVRSpatialAnchorError_VRSpatialAnchorError_WrongDriver = 8, + EVRSpatialAnchorError_VRSpatialAnchorError_DescriptorTooLong = 9, + EVRSpatialAnchorError_VRSpatialAnchorError_Unknown = 10, + EVRSpatialAnchorError_VRSpatialAnchorError_NoRoomCalibration = 11, + EVRSpatialAnchorError_VRSpatialAnchorError_InvalidArgument = 12, + EVRSpatialAnchorError_VRSpatialAnchorError_UnknownDriver = 13, +} EVRSpatialAnchorError; + typedef enum EHiddenAreaMeshType { EHiddenAreaMeshType_k_eHiddenAreaMesh_Standard = 0, @@ -824,6 +875,12 @@ typedef enum EVRNotificationError EVRNotificationError_VRNotificationError_SystemWithUserValueAlreadyExists = 103, } EVRNotificationError; +typedef enum EVRSkeletalMotionRange +{ + EVRSkeletalMotionRange_VRSkeletalMotionRange_WithController = 0, + EVRSkeletalMotionRange_VRSkeletalMotionRange_WithoutController = 1, +} EVRSkeletalMotionRange; + typedef enum EVRInitError { EVRInitError_VRInitError_None = 0, @@ -870,6 +927,7 @@ typedef enum EVRInitError EVRInitError_VRInitError_Init_FirmwareRecoveryBusy = 139, EVRInitError_VRInitError_Init_USBServiceBusy = 140, EVRInitError_VRInitError_Init_VRWebHelperStartupFailed = 141, + EVRInitError_VRInitError_Init_TrackerManagerInitFailed = 142, EVRInitError_VRInitError_Driver_Failed = 200, EVRInitError_VRInitError_Driver_Unknown = 201, EVRInitError_VRInitError_Driver_HmdUnknown = 202, @@ -975,6 +1033,12 @@ typedef enum EVSync EVSync_VSync_NoWaitRender = 2, } EVSync; +typedef enum EVRMuraCorrectionMode +{ + EVRMuraCorrectionMode_Default = 0, + EVRMuraCorrectionMode_NoCorrection = 1, +} EVRMuraCorrectionMode; + typedef enum Imu_OffScaleFlags { Imu_OffScaleFlags_OffScale_AccelX = 1, @@ -1225,7 +1289,7 @@ typedef enum EVRScreenshotError typedef enum EVRSkeletalTransformSpace { - EVRSkeletalTransformSpace_VRSkeletalTransformSpace_Action = 0, + EVRSkeletalTransformSpace_VRSkeletalTransformSpace_Model = 0, EVRSkeletalTransformSpace_VRSkeletalTransformSpace_Parent = 1, EVRSkeletalTransformSpace_VRSkeletalTransformSpace_Additive = 2, } EVRSkeletalTransformSpace; @@ -1261,6 +1325,7 @@ typedef uint32_t TrackedDeviceIndex_t; typedef uint32_t VRNotificationId; typedef uint64_t VROverlayHandle_t; +typedef uint32_t SpatialAnchorHandle_t; typedef void * glSharedTextureHandle_t; typedef int32_t glInt_t; typedef uint32_t glUInt_t; @@ -1271,15 +1336,15 @@ typedef uint64_t WebConsoleHandle_t; typedef uint64_t PropertyContainerHandle_t; typedef uint32_t PropertyTypeTag_t; typedef PropertyContainerHandle_t DriverHandle_t; +typedef uint64_t VRActionHandle_t; +typedef uint64_t VRActionSetHandle_t; +typedef uint64_t VRInputValueHandle_t; typedef uint64_t VROverlayHandle_t; typedef uint64_t TrackedCameraHandle_t; typedef uint32_t ScreenshotHandle_t; typedef uint32_t VRComponentProperties; typedef int32_t TextureID_t; typedef uint32_t VRNotificationId; -typedef uint64_t VRActionHandle_t; -typedef uint64_t VRActionSetHandle_t; -typedef uint64_t VRInputValueHandle_t; typedef uint64_t IOBufferHandle_t; typedef EVRInitError HmdError; typedef EVREye Hmd_Eye; @@ -1304,6 +1369,11 @@ typedef struct HmdMatrix34_t float m[3][4]; //float[3][4] } HmdMatrix34_t; +typedef struct HmdMatrix33_t +{ + float m[3][3]; //float[3][3] +} HmdMatrix33_t; + typedef struct HmdMatrix44_t { float m[4][4]; //float[4][4] @@ -1589,8 +1659,22 @@ typedef struct VREvent_InputBindingLoad_t PropertyContainerHandle_t ulAppContainer; uint64_t pathMessage; uint64_t pathUrl; + uint64_t pathControllerType; } VREvent_InputBindingLoad_t; +typedef struct VREvent_InputActionManifestLoad_t +{ + uint64_t pathAppKey; + uint64_t pathMessage; + uint64_t pathMessageParam; + uint64_t pathManifestPath; +} VREvent_InputActionManifestLoad_t; + +typedef struct VREvent_SpatialAnchor_t +{ + SpatialAnchorHandle_t unHandle; +} VREvent_SpatialAnchor_t; + typedef struct HiddenAreaMesh_t { struct HmdVector2_t * pVertexData; // const struct vr::HmdVector2_t * @@ -1800,6 +1884,11 @@ typedef struct NotificationBitmap_t int32_t m_nBytesPerPixel; } NotificationBitmap_t; +typedef struct CVRSettingHelper +{ + intptr_t m_pSettings; // class vr::IVRSettings * +} CVRSettingHelper; + typedef struct InputAnalogActionData_t { bool bActive; @@ -1829,11 +1918,12 @@ typedef struct InputPoseActionData_t struct TrackedDevicePose_t pose; } InputPoseActionData_t; -typedef struct InputSkeletonActionData_t +typedef struct InputSkeletalActionData_t { bool bActive; VRInputValueHandle_t activeOrigin; -} InputSkeletonActionData_t; + uint32_t boneCount; +} InputSkeletalActionData_t; typedef struct InputOriginInfo_t { @@ -1847,8 +1937,15 @@ typedef struct VRActiveActionSet_t VRActionSetHandle_t ulActionSet; VRInputValueHandle_t ulRestrictedToDevice; VRActionSetHandle_t ulSecondaryActionSet; + uint32_t unPadding; + int32_t nPriority; } VRActiveActionSet_t; +typedef struct SpatialAnchorPose_t +{ + struct HmdMatrix34_t mAnchorToAbsoluteTracking; +} SpatialAnchorPose_t; + typedef struct COpenVRContext { intptr_t m_pVRSystem; // class vr::IVRSystem * @@ -1866,6 +1963,7 @@ typedef struct COpenVRContext intptr_t m_pVRDriverManager; // class vr::IVRDriverManager * intptr_t m_pVRInput; // class vr::IVRInput * intptr_t m_pVRIOBuffer; // class vr::IVRIOBuffer * + intptr_t m_pVRSpatialAnchors; // class vr::IVRSpatialAnchors * } COpenVRContext; @@ -2206,6 +2304,7 @@ struct VR_IVRRenderModels_FnTable uint32_t (OPENVR_FNTABLE_CALLTYPE *GetComponentName)(char * pchRenderModelName, uint32_t unComponentIndex, char * pchComponentName, uint32_t unComponentNameLen); uint64_t (OPENVR_FNTABLE_CALLTYPE *GetComponentButtonMask)(char * pchRenderModelName, char * pchComponentName); uint32_t (OPENVR_FNTABLE_CALLTYPE *GetComponentRenderModelName)(char * pchRenderModelName, char * pchComponentName, char * pchComponentRenderModelName, uint32_t unComponentRenderModelNameLen); + bool (OPENVR_FNTABLE_CALLTYPE *GetComponentStateForDevicePath)(char * pchRenderModelName, char * pchComponentName, VRInputValueHandle_t devicePath, RenderModel_ControllerMode_State_t * pState, RenderModel_ComponentState_t * pComponentState); bool (OPENVR_FNTABLE_CALLTYPE *GetComponentState)(char * pchRenderModelName, char * pchComponentName, VRControllerState_t * pControllerState, struct RenderModel_ControllerMode_State_t * pState, struct RenderModel_ComponentState_t * pComponentState); bool (OPENVR_FNTABLE_CALLTYPE *RenderModelHasComponent)(char * pchRenderModelName, char * pchComponentName); uint32_t (OPENVR_FNTABLE_CALLTYPE *GetRenderModelThumbnailURL)(char * pchRenderModelName, char * pchThumbnailURL, uint32_t unThumbnailURLLen, EVRRenderModelError * peError); @@ -2266,13 +2365,14 @@ struct VR_IVRInput_FnTable EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetActionHandle)(char * pchActionName, VRActionHandle_t * pHandle); EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetInputSourceHandle)(char * pchInputSourcePath, VRInputValueHandle_t * pHandle); EVRInputError (OPENVR_FNTABLE_CALLTYPE *UpdateActionState)(struct VRActiveActionSet_t * pSets, uint32_t unSizeOfVRSelectedActionSet_t, uint32_t unSetCount); - EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetDigitalActionData)(VRActionHandle_t action, struct InputDigitalActionData_t * pActionData, uint32_t unActionDataSize); - EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetAnalogActionData)(VRActionHandle_t action, struct InputAnalogActionData_t * pActionData, uint32_t unActionDataSize); - EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetPoseActionData)(VRActionHandle_t action, ETrackingUniverseOrigin eOrigin, float fPredictedSecondsFromNow, struct InputPoseActionData_t * pActionData, uint32_t unActionDataSize); - EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetSkeletalActionData)(VRActionHandle_t action, EVRSkeletalTransformSpace eBoneParent, float fPredictedSecondsFromNow, struct InputSkeletonActionData_t * pActionData, uint32_t unActionDataSize, struct VRBoneTransform_t * pTransformArray, uint32_t unTransformArrayCount); - EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetSkeletalActionDataCompressed)(VRActionHandle_t action, EVRSkeletalTransformSpace eBoneParent, float fPredictedSecondsFromNow, void * pvCompressedData, uint32_t unCompressedSize, uint32_t * punRequiredCompressedSize); - EVRInputError (OPENVR_FNTABLE_CALLTYPE *UncompressSkeletalActionData)(void * pvCompressedBuffer, uint32_t unCompressedBufferSize, EVRSkeletalTransformSpace * peBoneParent, struct VRBoneTransform_t * pTransformArray, uint32_t unTransformArrayCount); - EVRInputError (OPENVR_FNTABLE_CALLTYPE *TriggerHapticVibrationAction)(VRActionHandle_t action, float fStartSecondsFromNow, float fDurationSeconds, float fFrequency, float fAmplitude); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetDigitalActionData)(VRActionHandle_t action, struct InputDigitalActionData_t * pActionData, uint32_t unActionDataSize, VRInputValueHandle_t ulRestrictToDevice); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetAnalogActionData)(VRActionHandle_t action, struct InputAnalogActionData_t * pActionData, uint32_t unActionDataSize, VRInputValueHandle_t ulRestrictToDevice); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetPoseActionData)(VRActionHandle_t action, ETrackingUniverseOrigin eOrigin, float fPredictedSecondsFromNow, struct InputPoseActionData_t * pActionData, uint32_t unActionDataSize, VRInputValueHandle_t ulRestrictToDevice); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetSkeletalActionData)(VRActionHandle_t action, struct InputSkeletalActionData_t * pActionData, uint32_t unActionDataSize, VRInputValueHandle_t ulRestrictToDevice); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetSkeletalBoneData)(VRActionHandle_t action, EVRSkeletalTransformSpace eTransformSpace, EVRSkeletalMotionRange eMotionRange, struct VRBoneTransform_t * pTransformArray, uint32_t unTransformArrayCount, VRInputValueHandle_t ulRestrictToDevice); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetSkeletalBoneDataCompressed)(VRActionHandle_t action, EVRSkeletalTransformSpace eTransformSpace, EVRSkeletalMotionRange eMotionRange, void * pvCompressedData, uint32_t unCompressedSize, uint32_t * punRequiredCompressedSize, VRInputValueHandle_t ulRestrictToDevice); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *DecompressSkeletalBoneData)(void * pvCompressedBuffer, uint32_t unCompressedBufferSize, EVRSkeletalTransformSpace * peTransformSpace, struct VRBoneTransform_t * pTransformArray, uint32_t unTransformArrayCount); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *TriggerHapticVibrationAction)(VRActionHandle_t action, float fStartSecondsFromNow, float fDurationSeconds, float fFrequency, float fAmplitude, VRInputValueHandle_t ulRestrictToDevice); EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetActionOrigins)(VRActionSetHandle_t actionSetHandle, VRActionHandle_t digitalActionHandle, VRInputValueHandle_t * originsOut, uint32_t originOutCount); EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetOriginLocalizedName)(VRInputValueHandle_t origin, char * pchNameArray, uint32_t unNameArraySize); EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetOriginTrackedDeviceInfo)(VRInputValueHandle_t origin, struct InputOriginInfo_t * pOriginInfo, uint32_t unOriginInfoSize); @@ -2289,6 +2389,14 @@ struct VR_IVRIOBuffer_FnTable PropertyContainerHandle_t (OPENVR_FNTABLE_CALLTYPE *PropertyContainer)(IOBufferHandle_t ulBuffer); }; +struct VR_IVRSpatialAnchors_FnTable +{ + EVRSpatialAnchorError (OPENVR_FNTABLE_CALLTYPE *CreateSpatialAnchorFromDescriptor)(char * pchDescriptor, SpatialAnchorHandle_t * pHandleOut); + EVRSpatialAnchorError (OPENVR_FNTABLE_CALLTYPE *CreateSpatialAnchorFromPose)(TrackedDeviceIndex_t unDeviceIndex, ETrackingUniverseOrigin eOrigin, struct SpatialAnchorPose_t * pPose, SpatialAnchorHandle_t * pHandleOut); + EVRSpatialAnchorError (OPENVR_FNTABLE_CALLTYPE *GetSpatialAnchorPose)(SpatialAnchorHandle_t unHandle, ETrackingUniverseOrigin eOrigin, struct SpatialAnchorPose_t * pPoseOut); + EVRSpatialAnchorError (OPENVR_FNTABLE_CALLTYPE *GetSpatialAnchorDescriptor)(SpatialAnchorHandle_t unHandle, char * pchDescriptorOut, uint32_t * punDescriptorBufferLenInOut); +}; + #if 0 // Global entry points diff --git a/headers/openvr_driver.h b/headers/openvr_driver.h index 5ece0a00..97a5d953 100644 --- a/headers/openvr_driver.h +++ b/headers/openvr_driver.h @@ -29,6 +29,10 @@ namespace vr { #pragma pack( push, 8 ) +/** A handle for a spatial anchor. This handle is only valid during the session it was created in. +* Anchors that live beyond one session should be saved by their string descriptors. */ +typedef uint32_t SpatialAnchorHandle_t; + typedef void* glSharedTextureHandle_t; typedef int32_t glInt_t; typedef uint32_t glUInt_t; @@ -43,6 +47,11 @@ struct HmdMatrix34_t float m[3][4]; }; +struct HmdMatrix33_t +{ + float m[3][3]; +}; + struct HmdMatrix44_t { float m[4][4]; @@ -112,13 +121,17 @@ enum EVREye enum ETextureType { + TextureType_Invalid = -1, // Handle has been invalidated TextureType_DirectX = 0, // Handle is an ID3D11Texture TextureType_OpenGL = 1, // Handle is an OpenGL texture name or an OpenGL render buffer name, depending on submit flags TextureType_Vulkan = 2, // Handle is a pointer to a VRVulkanTextureData_t structure - TextureType_IOSurface = 3, // Handle is a macOS cross-process-sharable IOSurfaceRef + TextureType_IOSurface = 3, // Handle is a macOS cross-process-sharable IOSurfaceRef, deprecated in favor of TextureType_Metal on supported platforms TextureType_DirectX12 = 4, // Handle is a pointer to a D3D12TextureData_t structure TextureType_DXGISharedHandle = 5, // Handle is a HANDLE DXGI share handle, only supported for Overlay render targets. // this texture is used directly by our renderer, so only perform atomic (copyresource or resolve) on it + TextureType_Metal = 6, // Handle is a MTLTexture conforming to the MTLSharedTexture protocol. Textures submitted to IVRCompositor::Submit which + // are of type MTLTextureType2DArray assume layer 0 is the left eye texture (vr::EVREye::Eye_left), layer 1 is the right + // eye texture (vr::EVREye::Eye_Right) }; enum EColorSpace @@ -171,6 +184,8 @@ enum ETrackedDeviceClass TrackedDeviceClass_GenericTracker = 3, // Generic trackers, similar to controllers TrackedDeviceClass_TrackingReference = 4, // Camera and base stations that serve as tracking reference points TrackedDeviceClass_DisplayRedirect = 5, // Accessories that aren't necessarily tracked themselves, but may redirect video output from other tracked devices + + TrackedDeviceClass_Max }; @@ -241,6 +256,8 @@ static const PropertyTypeTag_t k_unWildcardPropertyTag = 34; static const PropertyTypeTag_t k_unHapticVibrationPropertyTag = 35; static const PropertyTypeTag_t k_unSkeletonPropertyTag = 36; +static const PropertyTypeTag_t k_unSpatialAnchorPosePropertyTag = 40; + static const PropertyTypeTag_t k_unOpenVRInternalReserved_Start = 1000; static const PropertyTypeTag_t k_unOpenVRInternalReserved_End = 10000; @@ -361,6 +378,19 @@ enum ETrackedDeviceProperty Prop_ImuFactoryGyroScale_Vector3 = 2065, Prop_ImuFactoryAccelerometerBias_Vector3 = 2066, Prop_ImuFactoryAccelerometerScale_Vector3 = 2067, + // reserved 2068 + Prop_ConfigurationIncludesLighthouse20Features_Bool = 2069, + + // Driver requested mura correction properties + Prop_DriverRequestedMuraCorrectionMode_Int32 = 2200, + Prop_DriverRequestedMuraFeather_InnerLeft_Int32 = 2201, + Prop_DriverRequestedMuraFeather_InnerRight_Int32 = 2202, + Prop_DriverRequestedMuraFeather_InnerTop_Int32 = 2203, + Prop_DriverRequestedMuraFeather_InnerBottom_Int32 = 2204, + Prop_DriverRequestedMuraFeather_OuterLeft_Int32 = 2205, + Prop_DriverRequestedMuraFeather_OuterRight_Int32 = 2206, + Prop_DriverRequestedMuraFeather_OuterTop_Int32 = 2207, + Prop_DriverRequestedMuraFeather_OuterBottom_Int32 = 2208, // Properties that are unique to TrackedDeviceClass_Controller Prop_AttachedDeviceId_String = 3000, @@ -405,6 +435,7 @@ enum ETrackedDeviceProperty Prop_HasCameraComponent_Bool = 6004, Prop_HasDriverDirectModeComponent_Bool = 6005, Prop_HasVirtualDisplayComponent_Bool = 6006, + Prop_HasSpatialAnchorsSupport_Bool = 6007, // Properties that are set internally based on other information provided by drivers Prop_ControllerType_String = 7000, @@ -438,6 +469,16 @@ enum ETrackedPropertyError TrackedProp_CannotWriteToWildcards = 12, }; + +typedef uint64_t VRActionHandle_t; +typedef uint64_t VRActionSetHandle_t; +typedef uint64_t VRInputValueHandle_t; + +static const VRActionHandle_t k_ulInvalidActionHandle = 0; +static const VRActionSetHandle_t k_ulInvalidActionSetHandle = 0; +static const VRInputValueHandle_t k_ulInvalidInputValueHandle = 0; + + /** Allows the application to control what part of the provided texture will be used in the * frame buffer. */ struct VRTextureBounds_t @@ -496,7 +537,8 @@ enum EVRSubmitFlags }; /** Data required for passing Vulkan textures to IVRCompositor::Submit. -* Be sure to call OpenVR_Shutdown before destroying these resources. */ +* Be sure to call OpenVR_Shutdown before destroying these resources. +* Please see https://github.com/ValveSoftware/openvr/wiki/Vulkan for Vulkan-specific documentation */ struct VRVulkanTextureData_t { uint64_t m_nImage; // VkImage @@ -657,7 +699,8 @@ enum EVREventType VREvent_KeyboardSectionSettingChanged = 862, VREvent_PerfSectionSettingChanged = 863, VREvent_DashboardSectionSettingChanged = 864, - VREvent_WebInterfaceSectionSettingChanged = 865, + VREvent_WebInterfaceSectionSettingChanged = 865, + VREvent_TrackersSectionSettingChanged = 866, VREvent_StatusUpdate = 900, @@ -700,8 +743,15 @@ enum EVREventType VREvent_MessageOverlayCloseRequested = 1651, VREvent_Input_HapticVibration = 1700, // data is hapticVibration - VREvent_Input_BindingLoadFailed = 1701, // data is process - VREvent_Input_BindingLoadSuccessful = 1702, // data is process + VREvent_Input_BindingLoadFailed = 1701, // data is inputBinding + VREvent_Input_BindingLoadSuccessful = 1702, // data is inputBinding + VREvent_Input_ActionManifestReloaded = 1703, // no data + VREvent_Input_ActionManifestLoadFailed = 1704, // data is actionManifest + + VREvent_SpatialAnchors_PoseUpdated = 1800, // data is spatialAnchor. broadcast + VREvent_SpatialAnchors_DescriptorUpdated = 1801, // data is spatialAnchor. broadcast + VREvent_SpatialAnchors_RequestPoseUpdate = 1802, // data is spatialAnchor. sent to specific driver + VREvent_SpatialAnchors_RequestDescriptorUpdate = 1803, // data is spatialAnchor. sent to specific driver // Vendors are free to expose private events in this reserved region VREvent_VendorSpecific_Reserved_Start = 10000, @@ -750,6 +800,10 @@ enum EVRButtonId k_EButton_Dashboard_Back = k_EButton_Grip, + k_EButton_Knuckles_A = k_EButton_Grip, + k_EButton_Knuckles_B = k_EButton_ApplicationMenu, + k_EButton_Knuckles_JoyStick = k_EButton_Axis3, + k_EButton_Max = 64 }; @@ -939,10 +993,22 @@ struct VREvent_InputBindingLoad_t vr::PropertyContainerHandle_t ulAppContainer; uint64_t pathMessage; uint64_t pathUrl; + uint64_t pathControllerType; +}; + +struct VREvent_InputActionManifestLoad_t +{ + uint64_t pathAppKey; + uint64_t pathMessage; + uint64_t pathMessageParam; + uint64_t pathManifestPath; }; +struct VREvent_SpatialAnchor_t +{ + SpatialAnchorHandle_t unHandle; +}; -/** NOTE!!! If you change this you MUST manually update openvr_interop.cs.py */ typedef union { VREvent_Reserved_t reserved; @@ -969,6 +1035,9 @@ typedef union VREvent_HapticVibration_t hapticVibration; VREvent_WebConsole_t webConsole; VREvent_InputBindingLoad_t inputBinding; + VREvent_InputActionManifestLoad_t actionManifest; + VREvent_SpatialAnchor_t spatialAnchor; + /** NOTE!!! If you change this you MUST manually update openvr_interop.cs.py */ } VREvent_Data_t; @@ -1010,8 +1079,26 @@ enum EVRInputError VRInputError_NoData = 13, VRInputError_BufferTooSmall = 14, VRInputError_MismatchedActionManifest = 15, + VRInputError_MissingSkeletonData = 16, }; +enum EVRSpatialAnchorError +{ + VRSpatialAnchorError_Success = 0, + VRSpatialAnchorError_Internal = 1, + VRSpatialAnchorError_UnknownHandle = 2, + VRSpatialAnchorError_ArrayTooSmall = 3, + VRSpatialAnchorError_InvalidDescriptorChar = 4, + VRSpatialAnchorError_NotYetAvailable = 5, + VRSpatialAnchorError_NotAvailableInThisUniverse = 6, + VRSpatialAnchorError_PermanentlyUnavailable = 7, + VRSpatialAnchorError_WrongDriver = 8, + VRSpatialAnchorError_DescriptorTooLong = 9, + VRSpatialAnchorError_Unknown = 10, + VRSpatialAnchorError_NoRoomCalibration = 11, + VRSpatialAnchorError_InvalidArgument = 12, + VRSpatialAnchorError_UnknownDriver = 13, +}; /** The mesh to draw into the stencil (or depth) buffer to perform * early stencil (or depth) kills of pixels that will never appear on the HMD. @@ -1194,6 +1281,19 @@ enum EVRNotificationError }; +enum EVRSkeletalMotionRange +{ + // The range of motion of the skeleton takes into account any physical limits imposed by + // the controller itself. This will tend to be the most accurate pose compared to the user's + // actual hand pose, but might not allow a closed fist for example + VRSkeletalMotionRange_WithController = 0, + + // Retarget the range of motion provided by the input device to make the hand appear to move + // as if it was not holding a controller. eg: map "hand grasping controller" to "closed fist" + VRSkeletalMotionRange_WithoutController = 1, +}; + + /** Holds the transform for a single bone */ struct VRBoneTransform_t { @@ -1252,6 +1352,7 @@ enum EVRInitError VRInitError_Init_FirmwareRecoveryBusy = 139, VRInitError_Init_USBServiceBusy = 140, VRInitError_Init_VRWebHelperStartupFailed = 141, + VRInitError_Init_TrackerManagerInitFailed = 142, VRInitError_Driver_Failed = 200, VRInitError_Driver_Unknown = 201, @@ -1395,6 +1496,12 @@ enum EVSync VSync_NoWaitRender, // do not block following render work (allow to get started early) }; +enum EVRMuraCorrectionMode +{ + EVRMuraCorrectionMode_Default = 0, + EVRMuraCorrectionMode_NoCorrection +}; + /** raw IMU data provided by IVRIOBuffer from paths to tracked devices with IMUs */ enum Imu_OffScaleFlags { @@ -1569,6 +1676,8 @@ VR_CAMERA_DECL_ALIGN( 8 ) struct CameraVideoStreamFrame_t #endif // _VRTRACKEDCAMERATYPES_H // ivrsettings.h +#include + namespace vr { enum EVRSettingsError @@ -1611,6 +1720,88 @@ namespace vr //----------------------------------------------------------------------------- static const char * const IVRSettings_Version = "IVRSettings_002"; + class CVRSettingHelper + { + IVRSettings *m_pSettings = nullptr; + public: + CVRSettingHelper( IVRSettings *pSettings ) + { + m_pSettings = pSettings; + } + + const char *GetSettingsErrorNameFromEnum( EVRSettingsError eError ) + { + return m_pSettings->GetSettingsErrorNameFromEnum( eError ); + } + + // Returns true if file sync occurred (force or settings dirty) + bool Sync( bool bForce = false, EVRSettingsError *peError = nullptr ) + { + return m_pSettings->Sync( bForce, peError ); + } + + void SetBool( const char *pchSection, const char *pchSettingsKey, bool bValue, EVRSettingsError *peError = nullptr ) + { + m_pSettings->SetBool( pchSection, pchSettingsKey, bValue, peError ); + } + + void SetInt32( const char *pchSection, const char *pchSettingsKey, int32_t nValue, EVRSettingsError *peError = nullptr ) + { + m_pSettings->SetInt32( pchSection, pchSettingsKey, nValue, peError ); + } + void SetFloat( const char *pchSection, const char *pchSettingsKey, float flValue, EVRSettingsError *peError = nullptr ) + { + m_pSettings->SetFloat( pchSection, pchSettingsKey, flValue, peError ); + } + void SetString( const char *pchSection, const char *pchSettingsKey, const char *pchValue, EVRSettingsError *peError = nullptr ) + { + m_pSettings->SetString( pchSection, pchSettingsKey, pchValue, peError ); + } + void SetString( const std::string & sSection, const std::string & sSettingsKey, const std::string & sValue, EVRSettingsError *peError = nullptr ) + { + m_pSettings->SetString( sSection.c_str(), sSettingsKey.c_str(), sValue.c_str(), peError ); + } + + bool GetBool( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) + { + return m_pSettings->GetBool( pchSection, pchSettingsKey, peError ); + } + int32_t GetInt32( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) + { + return m_pSettings->GetInt32( pchSection, pchSettingsKey, peError ); + } + float GetFloat( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) + { + return m_pSettings->GetFloat( pchSection, pchSettingsKey, peError ); + } + void GetString( const char *pchSection, const char *pchSettingsKey, VR_OUT_STRING() char *pchValue, uint32_t unValueLen, EVRSettingsError *peError = nullptr ) + { + m_pSettings->GetString( pchSection, pchSettingsKey, pchValue, unValueLen, peError ); + } + std::string GetString( const std::string & sSection, const std::string & sSettingsKey, EVRSettingsError *peError = nullptr ) + { + char buf[4096]; + vr::EVRSettingsError eError; + m_pSettings->GetString( sSection.c_str(), sSettingsKey.c_str(), buf, sizeof( buf ), &eError ); + if ( peError ) + *peError = eError; + if ( eError == vr::VRSettingsError_None ) + return buf; + else + return ""; + } + + void RemoveSection( const char *pchSection, EVRSettingsError *peError = nullptr ) + { + m_pSettings->RemoveSection( pchSection, peError ); + } + void RemoveKeyInSection( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) + { + m_pSettings->RemoveKeyInSection( pchSection, pchSettingsKey, peError ); + } + }; + + //----------------------------------------------------------------------------- // steamvr keys static const char * const k_pch_SteamVR_Section = "steamvr"; @@ -1664,6 +1855,8 @@ namespace vr static const char * const k_pch_SteamVR_DebugInput = "debugInput"; static const char * const k_pch_SteamVR_LegacyInputRebinding = "legacyInputRebinding"; static const char * const k_pch_SteamVR_DebugInputBinding = "debugInputBinding"; + static const char * const k_pch_SteamVR_InputBindingUIBlock = "inputBindingUI"; + static const char * const k_pch_SteamVR_RenderCameraMode = "renderCameraMode"; //----------------------------------------------------------------------------- // lighthouse keys @@ -1780,6 +1973,7 @@ namespace vr static const char * const k_pch_Dashboard_ArcadeMode_Bool = "arcadeMode"; static const char * const k_pch_Dashboard_EnableWebUI = "webUI"; static const char * const k_pch_Dashboard_EnableWebUIDevTools = "webUIDevTools"; + static const char * const k_pch_Dashboard_EnableWebUIDashboardReplacement = "webUIDashboard"; //----------------------------------------------------------------------------- // model skin keys @@ -1792,6 +1986,7 @@ namespace vr //----------------------------------------------------------------------------- // web interface keys static const char* const k_pch_WebInterface_Section = "WebInterface"; + static const char* const k_pch_WebInterface_WebEnable_Bool = "WebEnable"; static const char* const k_pch_WebInterface_WebPort_String = "WebPort"; //----------------------------------------------------------------------------- @@ -1806,6 +2001,10 @@ namespace vr static const char* const k_pch_App_NeedToUpdateAutosaveSuffix_Bool = "NeedToUpdateAutosave"; static const char* const k_pch_App_ActionManifestURL_String = "ActionManifestURL"; + //----------------------------------------------------------------------------- + // configuration for trackers + static const char * const k_pch_Trackers_Section = "trackers"; + } // namespace vr // iservertrackeddevicedriver.h @@ -2169,6 +2368,29 @@ class IVRWatchdogProvider static const char *IVRWatchdogProvider_Version = "IVRWatchdogProvider_001"; + + + +/** This is an optional interface drivers may implement. It will be loaded in vrcompositor.exe */ +class IVRCompositorPluginProvider +{ +public: + /** initializes the driver when used to load compositor plugins */ + virtual EVRInitError Init( IVRDriverContext *pDriverContext ) = 0; + + /** cleans up the driver right before it is unloaded */ + virtual void Cleanup() = 0; + + /** Returns the versions of interfaces used by this driver */ + virtual const char * const *GetInterfaceVersions() = 0; + + /** Requests a component interface of the driver for specific functionality. The driver should return NULL + * if the requested interface or version is not supported. */ + virtual void *GetComponent( const char *pchComponentNameAndVersion ) = 0; +}; + +static const char *IVRCompositorPluginProvider_Version = "IVRCompositorPluginProvider_001"; + } // ivrproperties.h #include @@ -2605,11 +2827,11 @@ namespace vr virtual EVRInputError CreateSkeletonComponent( PropertyContainerHandle_t ulContainer, const char *pchName, const char *pchSkeletonPath, const char *pchBasePosePath, const VRBoneTransform_t *pGripLimitTransforms, uint32_t unGripLimitTransformCount, VRInputComponentHandle_t *pHandle ) = 0; /** Updates a skeleton component. */ - virtual EVRInputError UpdateSkeletonComponent( VRInputComponentHandle_t ulComponent, const VRBoneTransform_t *pTransforms, uint32_t unTransformCount ) = 0; + virtual EVRInputError UpdateSkeletonComponent( VRInputComponentHandle_t ulComponent, EVRSkeletalMotionRange eMotionRange, const VRBoneTransform_t *pTransforms, uint32_t unTransformCount ) = 0; }; - static const char * const IVRDriverInput_Version = "IVRDriverInput_001"; + static const char * const IVRDriverInput_Version = "IVRDriverInput_002"; } // namespace vr @@ -2679,6 +2901,22 @@ static const char *IVRServerDriverHost_Version = "IVRServerDriverHost_005"; } +// ivrcompositordriverhost.h +namespace vr +{ + +class IVRCompositorDriverHost +{ +public: + /** Returns true and fills the event with the next event on the queue if there is one. If there are no events + * this method returns false. uncbVREvent should be the size in bytes of the VREvent_t struct */ + virtual bool PollNextEvent( VREvent_t *pEvent, uint32_t uncbVREvent ) = 0; +}; + +static const char *IVRCompositorDriverHost_Version = "IVRCompositorDriverHost_001"; + +} + // ivrhiddenarea.h namespace vr { @@ -2782,9 +3020,6 @@ namespace vr }; static const char *IVRVirtualDisplay_Version = "IVRVirtualDisplay_002"; - - /** Returns the current IVRVirtualDisplay pointer or NULL the interface could not be found. */ - VR_INTERFACE vr::IVRVirtualDisplay *VR_CALLTYPE VRVirtualDisplay(); } @@ -2885,10 +3120,103 @@ static const char * const IVRDriverManager_Version = "IVRDriverManager_001"; +// ivrdriverspatialanchors.h +namespace vr +{ + struct SpatialAnchorDriverPose_t + { + /** This position is in the same "world" space (+Y up) as provided by DriverPose_t. */ + vr::HmdQuaternion_t qWorldRotation; + vr::HmdVector3d_t vWorldTranslation; + + /** The pose will automatically start returning VRSpatialAnchorError_NotAvailableInThisUniverse + * if this is nonzero and does not match the current universe ID. */ + uint64_t ulRequiredUniverseId; + + /** When this time expires, SteamVR will start generating + * VREvent_SpatialAnchors_RequestPoseUpdate when the pose is read by an application + * to let the driver know it is still worth updating. + * You can use this facility in several ways: + * 1. Set to -1 to never receive an update request for this pose. The driver + * may still update poses at any time. + * 2. Set to 0 to always receive an update request *after* each time the pose + * is read. The rate of requests could be very high if the application gets + * the pose at framerate. + * 3. If the driver knows there is no reason to update the pose for some amount of + * time, it can set that time here and receive the update request reminder later. + * 4. If the driver plans to automatically update this pose for some amount of time + * (as it gets better information about the virtual location of this anchor) it can + * set that duration here to indicate that no "update requested" reminders are needed. + * When that automatic update period expires, any future interest in the pose will + * be indicated by a pose update request. + * The driver may always update the pose, including during the valid duration. */ + double fValidDuration; // seconds + }; + + class IVRDriverSpatialAnchors + { + public: + + /* NOTE: You must declare support for spatial anchors in your driver manifest. Add + * "spatialAnchorsSupport": true to your manifest. Without that setting, SteamVR + * will short-circuit anchor requests from applications and provide a generic descriptor + * that does not have any of the advantages of true spatial anchors. */ + + /* The driver should monitor for events VREvent_SpatialAnchors_RequestPoseUpdate (for new + * descriptors from applications that need UpdateSpatialAnchorPose()) and for + * VREvent_SpatialAnchors_RequestDescriptorUpdate (for new poses that need UpdateSpatialAnchorDescriptor()). + * For automatic pose updates over time, the driver should keep track of the handles it + * has seen and provide updates when conditions change. If the driver uses fValidDuration, + * it may wait for VREvent_SpatialAnchors_RequestPoseUpdate instead of keeping track itself. */ + + /** Update a pose for a spatial anchor. Should be called when an event notifies the driver that a + * new descriptor has been registered by an application. May be called for any anchor whenever the + * driver has better information about the best virtual coordinate to represent the anchor. Should + * be called on all active handles whenever driver state changes in a way that changes how physical + * world locations map to virtual coordinates (e.g. anything that would cause a universe ID change). + * This fires an event when it is called for the first time (to alert whoever submitted the descriptor). */ + virtual EVRSpatialAnchorError UpdateSpatialAnchorPose( SpatialAnchorHandle_t unHandle, const SpatialAnchorDriverPose_t *pPose ) = 0; + + /** Invalidate any pose associated with the handle and cause future calls to GetSpatialAnchorPose (on + * both the client and driver side) to return the specified error. eError must be one of + * VRSpatialAnchorError_NotYetAvailable, VRSpatialAnchorError_NotAvailableInThisUniverse, or + * VRSpatialAnchorError_PermanentlyUnavailable */ + virtual EVRSpatialAnchorError SetSpatialAnchorPoseError( SpatialAnchorHandle_t unHandle, EVRSpatialAnchorError eError, double fValidDuration ) = 0; + + /** Update the descriptor for a spatial anchor. Should be called when an event notifies the driver + * that a new pose has been registered by an application. May be called for any anchor whenever the + * driver has better or additional information it wants to include in the anchor descriptor. Note, + * however, that the application may never fetch the updated anchor descriptor and may request the + * original descriptor in a future session having ignored the update. + * The supplied descriptor should be only the driver's opaque internal data, not the decorated form that + * is used by clients (wrapped by runtime metadata). The descriptor must not contain non-ASCII characters or + * the two special characters ~ or " + * This fires an event every time it is called. */ + virtual EVRSpatialAnchorError UpdateSpatialAnchorDescriptor( SpatialAnchorHandle_t unHandle, const char *pchDescriptor ) = 0; + + /** Get the pose for a given handle. */ + virtual EVRSpatialAnchorError GetSpatialAnchorPose( SpatialAnchorHandle_t unHandle, SpatialAnchorDriverPose_t *pDriverPoseOut ) = 0; + + /** Get the descriptor for a given handle. This will be VRSpatialAnchorError_NotYetAvailable for handles + * where the driver has not yet built a descriptor. It will be the application-supplied descriptor for previously + * saved anchors that the application is requesting poses for. If the driver has called UpdateSpatialAnchorDescriptor() + * already in this session, it will be the descriptor provided by the driver. + * If bDecorated, returns the descriptor wrapped with runtime metadata suitable for a client to save. Else returns only + * the driver's opaque internal data. + */ + virtual EVRSpatialAnchorError GetSpatialAnchorDescriptor( SpatialAnchorHandle_t unHandle, VR_OUT_STRING() char *pchDescriptorOut, uint32_t *punDescriptorBufferLenInOut, bool bDecorated ) = 0; + + }; + + static const char * const IVRDriverSpatialAnchors_Version = "IVRDriverSpatialAnchors_001"; + +} // namespace vr + namespace vr { +#if !defined( OPENVR_INTERFACE_INTERNAL ) static const char * const k_InterfaceVersions[] = { IVRSettings_Version, @@ -2901,6 +3229,7 @@ namespace vr IVRVirtualDisplay_Version, IVRDriverManager_Version, IVRResources_Version, + IVRCompositorPluginProvider_Version, nullptr }; @@ -2918,6 +3247,7 @@ namespace vr EVRInitError InitServer(); EVRInitError InitWatchdog(); + EVRInitError InitCompositor(); IVRSettings *VRSettings() { @@ -2973,6 +3303,16 @@ namespace vr return m_pVRWatchdogHost; } + IVRCompositorDriverHost *VRCompositorDriverHost() + { + if ( m_pVRCompositorDriverHost == nullptr ) + { + EVRInitError eError; + m_pVRCompositorDriverHost = ( IVRCompositorDriverHost * )VRDriverContext()->GetGenericInterface( IVRCompositorDriverHost_Version, &eError ); + } + return m_pVRCompositorDriverHost; + } + IVRDriverLog *VRDriverLog() { if ( m_pVRDriverLog == nullptr ) @@ -3028,6 +3368,16 @@ namespace vr return m_pVRIOBuffer; } + IVRDriverSpatialAnchors *VRDriverSpatialAnchors() + { + if ( !m_pVRDriverSpatialAnchors ) + { + EVRInitError eError; + m_pVRDriverSpatialAnchors = (IVRDriverSpatialAnchors *)VRDriverContext()->GetGenericInterface( IVRDriverSpatialAnchors_Version, &eError ); + } + return m_pVRDriverSpatialAnchors; + } + private: CVRPropertyHelpers m_propertyHelpers; CVRHiddenAreaHelpers m_hiddenAreaHelpers; @@ -3036,11 +3386,13 @@ namespace vr IVRProperties *m_pVRProperties; IVRServerDriverHost *m_pVRServerDriverHost; IVRWatchdogHost *m_pVRWatchdogHost; + IVRCompositorDriverHost *m_pVRCompositorDriverHost; IVRDriverLog *m_pVRDriverLog; IVRDriverManager *m_pVRDriverManager; IVRResources *m_pVRResources; IVRDriverInput *m_pVRDriverInput; IVRIOBuffer *m_pVRIOBuffer; + IVRDriverSpatialAnchors *m_pVRDriverSpatialAnchors; }; inline COpenVRDriverContext &OpenVRInternal_ModuleServerDriverContext() @@ -3056,23 +3408,27 @@ namespace vr inline IVRDriverLog *VR_CALLTYPE VRDriverLog() { return OpenVRInternal_ModuleServerDriverContext().VRDriverLog(); } inline IVRServerDriverHost *VR_CALLTYPE VRServerDriverHost() { return OpenVRInternal_ModuleServerDriverContext().VRServerDriverHost(); } inline IVRWatchdogHost *VR_CALLTYPE VRWatchdogHost() { return OpenVRInternal_ModuleServerDriverContext().VRWatchdogHost(); } + inline IVRCompositorDriverHost *VR_CALLTYPE VRCompositorDriverHost() { return OpenVRInternal_ModuleServerDriverContext().VRCompositorDriverHost(); } inline DriverHandle_t VR_CALLTYPE VRDriverHandle() { return OpenVRInternal_ModuleServerDriverContext().VRDriverHandle(); } inline IVRDriverManager *VR_CALLTYPE VRDriverManager() { return OpenVRInternal_ModuleServerDriverContext().VRDriverManager(); } inline IVRResources *VR_CALLTYPE VRResources() { return OpenVRInternal_ModuleServerDriverContext().VRResources(); } inline IVRDriverInput *VR_CALLTYPE VRDriverInput() { return OpenVRInternal_ModuleServerDriverContext().VRDriverInput(); } inline IVRIOBuffer *VR_CALLTYPE VRIOBuffer() { return OpenVRInternal_ModuleServerDriverContext().VRIOBuffer(); } + inline IVRDriverSpatialAnchors *VR_CALLTYPE VRDriverSpatialAnchors() { return OpenVRInternal_ModuleServerDriverContext().VRDriverSpatialAnchors(); } inline void COpenVRDriverContext::Clear() { m_pVRSettings = nullptr; m_pVRProperties = nullptr; m_pVRServerDriverHost = nullptr; - m_pVRDriverLog = nullptr; m_pVRWatchdogHost = nullptr; + m_pVRCompositorDriverHost = nullptr; + m_pVRDriverLog = nullptr; m_pVRDriverManager = nullptr; m_pVRResources = nullptr; m_pVRDriverInput = nullptr; m_pVRIOBuffer = nullptr; + m_pVRDriverSpatialAnchors = nullptr; } inline EVRInitError COpenVRDriverContext::InitServer() @@ -3098,6 +3454,19 @@ namespace vr return VRInitError_None; } + inline EVRInitError COpenVRDriverContext::InitCompositor() + { + Clear(); + if ( !VRCompositorDriverHost() + || !VRSettings() + || !VRProperties() + || !VRDriverLog() + || !VRDriverManager() + || !VRResources() ) + return VRInitError_Init_InterfaceNotFound; + return VRInitError_None; + } + inline EVRInitError InitServerDriverContext( IVRDriverContext *pContext ) { VRDriverContext() = pContext; @@ -3110,6 +3479,12 @@ namespace vr return OpenVRInternal_ModuleServerDriverContext().InitWatchdog(); } + inline EVRInitError InitCompositorDriverContext( IVRDriverContext *pContext ) + { + VRDriverContext() = pContext; + return OpenVRInternal_ModuleServerDriverContext().InitCompositor(); + } + inline void CleanupDriverContext() { VRDriverContext() = nullptr; @@ -3135,6 +3510,20 @@ namespace vr #define VR_CLEANUP_WATCHDOG_DRIVER_CONTEXT() \ vr::CleanupDriverContext(); + +#define VR_INIT_COMPOSITOR_DRIVER_CONTEXT( pContext ) \ + { \ + vr::EVRInitError eError = vr::InitCompositorDriverContext( pContext ); \ + if( eError != vr::VRInitError_None ) \ + return eError; \ + } + +#define VR_CLEANUP_COMPOSITOR_DRIVER_CONTEXT() \ + vr::CleanupDriverContext(); + + +#endif // OPENVR_INTERFACE_INTERNAL + } // End diff --git a/lib/linux32/libopenvr_api.so b/lib/linux32/libopenvr_api.so index 50f365d0..4104293d 100755 Binary files a/lib/linux32/libopenvr_api.so and b/lib/linux32/libopenvr_api.so differ diff --git a/lib/linux64/libopenvr_api.so b/lib/linux64/libopenvr_api.so index db220fe7..80853c38 100755 Binary files a/lib/linux64/libopenvr_api.so and b/lib/linux64/libopenvr_api.so differ diff --git a/lib/win32/openvr_api.lib b/lib/win32/openvr_api.lib index fd184484..b3f0b479 100644 Binary files a/lib/win32/openvr_api.lib and b/lib/win32/openvr_api.lib differ diff --git a/lib/win64/openvr_api.lib b/lib/win64/openvr_api.lib index ea467746..2ce7e756 100644 Binary files a/lib/win64/openvr_api.lib and b/lib/win64/openvr_api.lib differ diff --git a/samples/bin/drivers/sample/resources/driver.vrresources b/samples/bin/drivers/sample/resources/driver.vrresources index 6ed60add..f1a0b5c2 100644 --- a/samples/bin/drivers/sample/resources/driver.vrresources +++ b/samples/bin/drivers/sample/resources/driver.vrresources @@ -31,6 +31,17 @@ "Model-v2.0" : { "Alias" : "Model-v1.0", "Prop_NamedIconPathDeviceAlertLow_String" : "{sample}/icons/headset_model2_alertlow.png" + }, + + "Controller" : { + "Prop_NamedIconPathDeviceOff_String" : "{sample}/icons/controller_status_off.png", + "Prop_NamedIconPathDeviceSearching_String" : "{sample}/icons/controller_status_searching.gif", + "Prop_NamedIconPathDeviceSearchingAlert_String" : "{sample}/icons/controller_status_searching_alert.gif", + "Prop_NamedIconPathDeviceReady_String" : "{sample}/icons/controller_status_ready.png", + "Prop_NamedIconPathDeviceReadyAlert_String" : "{sample}/icons/controller_status_ready_alert.png", + "Prop_NamedIconPathDeviceNotReady_String" : "{sample}/icons/controller_status_error.png", + "Prop_NamedIconPathDeviceStandby_String" : "{sample}/icons/controller_status_standby.png", + "Prop_NamedIconPathDeviceAlertLow_String" : "{sample}/icons/controller_status_ready_low.png" } } -} \ No newline at end of file +} diff --git a/samples/bin/drivers/sample/resources/icons/controller_status_error.png b/samples/bin/drivers/sample/resources/icons/controller_status_error.png new file mode 100644 index 00000000..1cc1636e Binary files /dev/null and b/samples/bin/drivers/sample/resources/icons/controller_status_error.png differ diff --git a/samples/bin/drivers/sample/resources/icons/controller_status_off.png b/samples/bin/drivers/sample/resources/icons/controller_status_off.png new file mode 100644 index 00000000..4403086b Binary files /dev/null and b/samples/bin/drivers/sample/resources/icons/controller_status_off.png differ diff --git a/samples/bin/drivers/sample/resources/icons/controller_status_ready.png b/samples/bin/drivers/sample/resources/icons/controller_status_ready.png new file mode 100644 index 00000000..8a5be67c Binary files /dev/null and b/samples/bin/drivers/sample/resources/icons/controller_status_ready.png differ diff --git a/samples/bin/drivers/sample/resources/icons/controller_status_ready_alert.png b/samples/bin/drivers/sample/resources/icons/controller_status_ready_alert.png new file mode 100644 index 00000000..fdba4907 Binary files /dev/null and b/samples/bin/drivers/sample/resources/icons/controller_status_ready_alert.png differ diff --git a/samples/bin/drivers/sample/resources/icons/controller_status_ready_low.png b/samples/bin/drivers/sample/resources/icons/controller_status_ready_low.png new file mode 100644 index 00000000..671e0cee Binary files /dev/null and b/samples/bin/drivers/sample/resources/icons/controller_status_ready_low.png differ diff --git a/samples/bin/drivers/sample/resources/icons/controller_status_searching.gif b/samples/bin/drivers/sample/resources/icons/controller_status_searching.gif new file mode 100644 index 00000000..3dde000e Binary files /dev/null and b/samples/bin/drivers/sample/resources/icons/controller_status_searching.gif differ diff --git a/samples/bin/drivers/sample/resources/icons/controller_status_searching_alert.gif b/samples/bin/drivers/sample/resources/icons/controller_status_searching_alert.gif new file mode 100644 index 00000000..a75e4a62 Binary files /dev/null and b/samples/bin/drivers/sample/resources/icons/controller_status_searching_alert.gif differ diff --git a/samples/bin/drivers/sample/resources/icons/controller_status_standby.png b/samples/bin/drivers/sample/resources/icons/controller_status_standby.png new file mode 100644 index 00000000..f4007b03 Binary files /dev/null and b/samples/bin/drivers/sample/resources/icons/controller_status_standby.png differ diff --git a/samples/bin/drivers/sample/resources/input/legacy_binding_mycontroller.json b/samples/bin/drivers/sample/resources/input/legacy_binding_mycontroller.json new file mode 100644 index 00000000..46a4a137 --- /dev/null +++ b/samples/bin/drivers/sample/resources/input/legacy_binding_mycontroller.json @@ -0,0 +1,47 @@ +{ + "bindings" : { + "/actions/legacy" : { + "sources" : [ + { + "inputs" : { + "single" : { + "output" : "/actions/legacy/in/right_axis1_press" + } + }, + "mode" : "button", + "parameters" : { + "sub_mode" : "complex" + }, + "path" : "/user/hand/right/input/a" + }, + { + "inputs" : { + "single" : { + "output" : "/actions/legacy/in/right_a_press" + } + }, + "mode" : "button", + "parameters" : { + "sub_mode" : "complex" + }, + "path" : "/user/hand/right/input/c" + }, + { + "inputs" : { + "single" : { + "output" : "/actions/legacy/in/right_grip_press" + } + }, + "mode" : "button", + "parameters" : { + "sub_mode" : "complex" + }, + "path" : "/user/hand/right/input/b" + } + ] + } + }, + "controller_type" : "mycontroller", + "description" : "", + "name" : "Default binding for Sample Driver Controller for legacy applications" +} diff --git a/samples/bin/drivers/sample/resources/input/mycontroller_profile.json b/samples/bin/drivers/sample/resources/input/mycontroller_profile.json new file mode 100644 index 00000000..65a29f44 --- /dev/null +++ b/samples/bin/drivers/sample/resources/input/mycontroller_profile.json @@ -0,0 +1,37 @@ +{ + "jsonid": "input_profile", + "legacy_binding": "{sample}/input/legacy_binding_mycontroller.json", + "controller_type": "mycontroller", + "input_bindingui_mode": "single_device", + "input_bindingui_right": { + "image": "{sample}/icons/sample_controller.svg" + }, + "input_source": { + "/input/a": { + "binding_image_point": [ 80, 60 ], + "type": "button", + "order": 1 + }, + "/input/b": { + "binding_image_point": [ 250, 60 ], + "type": "button", + "order": 2 + }, + "/input/c": { + "binding_image_point": [ 450, 60 ], + "type": "button", + "order": 3 + }, + "/output/haptic": { + "binding_image_point": [ 300, 150 ], + "type": "vibration", + "order": 4 + } + }, + "default_bindings": [ + { + "app_key": "openvr.component.vrcompositor", + "binding_url": "vrcompositor_binding_mycontroller.json" + } + ] +} diff --git a/samples/bin/drivers/sample/resources/input/vrcompositor_binding_mycontroller.json b/samples/bin/drivers/sample/resources/input/vrcompositor_binding_mycontroller.json new file mode 100644 index 00000000..4e47c974 --- /dev/null +++ b/samples/bin/drivers/sample/resources/input/vrcompositor_binding_mycontroller.json @@ -0,0 +1,37 @@ +{ + "app_key" : "openvr.component.vrcompositor", + "bindings" : { + "/actions/lasermouse" : { + "sources" : [ + { + "inputs" : { + "single" : { + "output" : "/actions/lasermouse/in/leftclick" + } + }, + "mode" : "button", + "path" : "/devices/sample/CTRL_1234/input/b" + } + ] + }, + "/actions/system" : { + "sources" : [ + { + "inputs" : { + "single" : { + "output" : "/actions/system/in/toggledashboard" + } + }, + "mode" : "button", + "parameters" : { + "sub_mode" : "complex" + }, + "path" : "/devices/sample/CTRL_1234/input/a" + } + ] + } + }, + "controller_type" : "mycontroller", + "description" : "", + "name" : "My VR Compositor configuration for mycontroller" +} diff --git a/samples/bin/drivers/sample/resources/localization/localization.json b/samples/bin/drivers/sample/resources/localization/localization.json new file mode 100644 index 00000000..f9f478a9 --- /dev/null +++ b/samples/bin/drivers/sample/resources/localization/localization.json @@ -0,0 +1,8 @@ +[ + { + "language_tag": "en_US", + "mycontroller" : "Sample Driver Controller", + + "/input/c" : "'C' key" + } +] diff --git a/samples/bin/hellovr_actions.json b/samples/bin/hellovr_actions.json index bb0327c5..d410c861 100644 --- a/samples/bin/hellovr_actions.json +++ b/samples/bin/hellovr_actions.json @@ -2,7 +2,7 @@ "default_bindings": [ { "controller_type" : "vive_controller", - "binding_url" : "hellovr_bindings_vive_controller" + "binding_url" : "hellovr_bindings_vive_controller.json" } ], "actions": [ @@ -15,7 +15,7 @@ "type": "boolean" }, { - "name": "/actions/demo/in/TriggerHaptic", + "name": "/actions/demo/in/triggerhaptic", "type": "boolean" }, { @@ -31,24 +31,25 @@ "type": "pose" }, { - "name": "/actions/demo/out/Haptic_Left", + "name": "/actions/demo/out/haptic_left", "type": "vibration" }, { - "name": "/actions/demo/out/Haptic_Right", + "name": "/actions/demo/out/haptic_right", "type": "vibration" } ], "localization" : [ { - "language_tag": "en", + "language_tag": "en_US", "/actions/demo/in/HideCubes" : "Hide Cubes", - "/actions/demo/in/TriggerHaptic" : "Trigger Haptic Pulse", + "/actions/demo/in/HideThisController" : "Hide this Controller", + "/actions/demo/in/triggerhaptic" : "Trigger Haptic Pulse", "/actions/demo/in/AnalogInput" : "Analog Input", "/actions/demo/in/Hand_Right" : "Right Hand Pose", "/actions/demo/in/Hand_Left" : "Left Hand Pose", - "/actions/demo/out/Haptic_Left" : "Left Haptic Feedback", - "/actions/demo/out/Haptic_Right" : "Right Haptic Feedback" + "/actions/demo/out/haptic_left" : "Left Haptic Feedback", + "/actions/demo/out/haptic_right" : "Right Haptic Feedback" } ] } diff --git a/samples/bin/hellovr_bindings_vive_controller.json b/samples/bin/hellovr_bindings_vive_controller.json index 4fb3e5b7..0a95efdb 100644 --- a/samples/bin/hellovr_bindings_vive_controller.json +++ b/samples/bin/hellovr_bindings_vive_controller.json @@ -11,6 +11,16 @@ "path" : "/user/hand/right/pose/raw" } ], + "haptics" : [ + { + "output" : "/actions/demo/out/haptic_right", + "path" : "/user/hand/right/output/haptic" + }, + { + "output" : "/actions/demo/out/haptic_left", + "path" : "/user/hand/left/output/haptic" + } + ], "sources" : [ { "inputs" : { diff --git a/samples/bin/linux64/libopenvr_api.so b/samples/bin/linux64/libopenvr_api.so index 28e9f338..0db0884c 100644 Binary files a/samples/bin/linux64/libopenvr_api.so and b/samples/bin/linux64/libopenvr_api.so differ diff --git a/samples/bin/osx32/libopenvr_api.dylib b/samples/bin/osx32/libopenvr_api.dylib index 1be0a9b4..7a719c37 100644 Binary files a/samples/bin/osx32/libopenvr_api.dylib and b/samples/bin/osx32/libopenvr_api.dylib differ diff --git a/samples/bin/win32/openvr_api.dll b/samples/bin/win32/openvr_api.dll index 9fab1525..376529cd 100644 Binary files a/samples/bin/win32/openvr_api.dll and b/samples/bin/win32/openvr_api.dll differ diff --git a/samples/bin/win64/openvr_api.dll b/samples/bin/win64/openvr_api.dll index b1930037..b31cce41 100644 Binary files a/samples/bin/win64/openvr_api.dll and b/samples/bin/win64/openvr_api.dll differ diff --git a/samples/driver_sample/driver_sample.cpp b/samples/driver_sample/driver_sample.cpp index 90091c44..d5cdc38f 100644 --- a/samples/driver_sample/driver_sample.cpp +++ b/samples/driver_sample/driver_sample.cpp @@ -386,15 +386,152 @@ class CSampleDeviceDriver : public vr::ITrackedDeviceServerDriver, public vr::IV //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- -class CServerDriver_Sample: public IServerTrackedDeviceProvider +class CSampleControllerDriver : public vr::ITrackedDeviceServerDriver { public: - CServerDriver_Sample() - : m_pNullHmdLatest( NULL ) - , m_bEnableNullDriver( false ) + CSampleControllerDriver() + { + m_unObjectId = vr::k_unTrackedDeviceIndexInvalid; + m_ulPropertyContainer = vr::k_ulInvalidPropertyContainer; + + m_sSerialNumber = "CTRL_1234"; + + m_sModelNumber = "MyController"; + } + + virtual ~CSampleControllerDriver() + { + } + + + virtual EVRInitError Activate( vr::TrackedDeviceIndex_t unObjectId ) + { + m_unObjectId = unObjectId; + m_ulPropertyContainer = vr::VRProperties()->TrackedDeviceToPropertyContainer( m_unObjectId ); + + vr::VRProperties()->SetStringProperty( m_ulPropertyContainer, Prop_ModelNumber_String, m_sModelNumber.c_str() ); + vr::VRProperties()->SetStringProperty( m_ulPropertyContainer, Prop_RenderModelName_String, m_sModelNumber.c_str() ); + + // return a constant that's not 0 (invalid) or 1 (reserved for Oculus) + vr::VRProperties()->SetUint64Property( m_ulPropertyContainer, Prop_CurrentUniverseId_Uint64, 2 ); + + // avoid "not fullscreen" warnings from vrmonitor + vr::VRProperties()->SetBoolProperty( m_ulPropertyContainer, Prop_IsOnDesktop_Bool, false ); + + // our sample device isn't actually tracked, so set this property to avoid having the icon blink in the status window + vr::VRProperties()->SetBoolProperty( m_ulPropertyContainer, Prop_NeverTracked_Bool, true ); + + // even though we won't ever track we want to pretend to be the right hand so binding will work as expected + vr::VRProperties()->SetInt32Property( m_ulPropertyContainer, Prop_ControllerRoleHint_Int32, TrackedControllerRole_RightHand ); + + // this file tells the UI what to show the user for binding this controller as well as what default bindings should + // be for legacy or other apps + vr::VRProperties()->SetStringProperty( m_ulPropertyContainer, Prop_InputProfilePath_String, "{sample}/input/mycontroller_profile.json" ); + + // create all the input components + vr::VRDriverInput()->CreateBooleanComponent( m_ulPropertyContainer, "/input/a/click", &m_compA ); + vr::VRDriverInput()->CreateBooleanComponent( m_ulPropertyContainer, "/input/b/click", &m_compB ); + vr::VRDriverInput()->CreateBooleanComponent( m_ulPropertyContainer, "/input/c/click", &m_compC ); + + // create our haptic component + vr::VRDriverInput()->CreateHapticComponent( m_ulPropertyContainer, "/output/haptic", &m_compHaptic ); + + return VRInitError_None; + } + + virtual void Deactivate() + { + m_unObjectId = vr::k_unTrackedDeviceIndexInvalid; + } + + virtual void EnterStandby() { } + void *GetComponent( const char *pchComponentNameAndVersion ) + { + // override this to add a component to a driver + return NULL; + } + + virtual void PowerOff() + { + } + + /** debug request from a client */ + virtual void DebugRequest( const char *pchRequest, char *pchResponseBuffer, uint32_t unResponseBufferSize ) + { + if ( unResponseBufferSize >= 1 ) + pchResponseBuffer[0] = 0; + } + + virtual DriverPose_t GetPose() + { + DriverPose_t pose = { 0 }; + pose.poseIsValid = false; + pose.result = TrackingResult_Calibrating_OutOfRange; + pose.deviceIsConnected = true; + + pose.qWorldFromDriverRotation = HmdQuaternion_Init( 1, 0, 0, 0 ); + pose.qDriverFromHeadRotation = HmdQuaternion_Init( 1, 0, 0, 0 ); + + return pose; + } + + + void RunFrame() + { +#if defined( _WINDOWS ) + // Your driver would read whatever hardware state is associated with its input components and pass that + // in to UpdateBooleanComponent. This could happen in RunFrame or on a thread of your own that's reading USB + // state. There's no need to update input state unless it changes, but it doesn't do any harm to do so. + + vr::VRDriverInput()->UpdateBooleanComponent( m_compA, (0x8000 & GetAsyncKeyState( 'A' )) != 0, 0 ); + vr::VRDriverInput()->UpdateBooleanComponent( m_compB, (0x8000 & GetAsyncKeyState( 'B' )) != 0, 0 ); + vr::VRDriverInput()->UpdateBooleanComponent( m_compC, (0x8000 & GetAsyncKeyState( 'C' )) != 0, 0 ); +#endif + } + + void ProcessEvent( const vr::VREvent_t & vrEvent ) + { + switch ( vrEvent.eventType ) + { + case vr::VREvent_Input_HapticVibration: + { + if ( vrEvent.data.hapticVibration.componentHandle == m_compHaptic ) + { + // This is where you would send a signal to your hardware to trigger actual haptic feedback + DriverLog( "BUZZ!\n" ); + } + } + break; + } + } + + + std::string GetSerialNumber() const { return m_sSerialNumber; } + +private: + vr::TrackedDeviceIndex_t m_unObjectId; + vr::PropertyContainerHandle_t m_ulPropertyContainer; + + vr::VRInputComponentHandle_t m_compA; + vr::VRInputComponentHandle_t m_compB; + vr::VRInputComponentHandle_t m_compC; + vr::VRInputComponentHandle_t m_compHaptic; + + std::string m_sSerialNumber; + std::string m_sModelNumber; + + +}; + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +class CServerDriver_Sample: public IServerTrackedDeviceProvider +{ +public: virtual EVRInitError Init( vr::IVRDriverContext *pDriverContext ) ; virtual void Cleanup() ; virtual const char * const *GetInterfaceVersions() { return vr::k_InterfaceVersions; } @@ -404,9 +541,8 @@ class CServerDriver_Sample: public IServerTrackedDeviceProvider virtual void LeaveStandby() {} private: - CSampleDeviceDriver *m_pNullHmdLatest; - - bool m_bEnableNullDriver; + CSampleDeviceDriver *m_pNullHmdLatest = nullptr; + CSampleControllerDriver *m_pController = nullptr; }; CServerDriver_Sample g_serverDriverNull; @@ -419,6 +555,10 @@ EVRInitError CServerDriver_Sample::Init( vr::IVRDriverContext *pDriverContext ) m_pNullHmdLatest = new CSampleDeviceDriver(); vr::VRServerDriverHost()->TrackedDeviceAdded( m_pNullHmdLatest->GetSerialNumber().c_str(), vr::TrackedDeviceClass_HMD, m_pNullHmdLatest ); + + m_pController = new CSampleControllerDriver(); + vr::VRServerDriverHost()->TrackedDeviceAdded( m_pController->GetSerialNumber().c_str(), vr::TrackedDeviceClass_Controller, m_pController ); + return VRInitError_None; } @@ -427,6 +567,8 @@ void CServerDriver_Sample::Cleanup() CleanupDriverLog(); delete m_pNullHmdLatest; m_pNullHmdLatest = NULL; + delete m_pController; + m_pController = NULL; } @@ -436,6 +578,19 @@ void CServerDriver_Sample::RunFrame() { m_pNullHmdLatest->RunFrame(); } + if ( m_pController ) + { + m_pController->RunFrame(); + } + + vr::VREvent_t vrEvent; + while ( vr::VRServerDriverHost()->PollNextEvent( &vrEvent, sizeof( vrEvent ) ) ) + { + if ( m_pController ) + { + m_pController->ProcessEvent( vrEvent ); + } + } } //----------------------------------------------------------------------------- diff --git a/samples/driver_sample/driver_sample.vcxproj b/samples/driver_sample/driver_sample.vcxproj index 266c8216..94cb0305 100644 --- a/samples/driver_sample/driver_sample.vcxproj +++ b/samples/driver_sample/driver_sample.vcxproj @@ -27,7 +27,7 @@ DynamicLibrary true - v120 + v141 Unicode @@ -68,19 +68,19 @@ true - $(SolutionDir)\..\bin\drivers\sample\bin\win32\ + $(SolutionDir)\bin\drivers\sample\bin\win32\ true - $(SolutionDir)\..\bin\drivers\sample\bin\win64\ + $(SolutionDir)\bin\drivers\sample\bin\win64\ false - $(SolutionDir)\..\bin\drivers\sample\bin\win32\ + $(SolutionDir)\bin\drivers\sample\bin\win32\ false - $(SolutionDir)\..\bin\drivers\sample\bin\win64\ + $(SolutionDir)\bin\drivers\sample\bin\win64\ diff --git a/samples/hellovr_opengl/hellovr_opengl.vcxproj b/samples/hellovr_opengl/hellovr_opengl.vcxproj index 8681565b..42e59bfb 100644 --- a/samples/hellovr_opengl/hellovr_opengl.vcxproj +++ b/samples/hellovr_opengl/hellovr_opengl.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -14,18 +14,21 @@ {FF19F6AE-67E0-4585-9D4A-038CB6E8DD09} Win32Proj hellovr_opengl + 10.0.16299.0 Application true Unicode + v141 Application false true Unicode + v141 diff --git a/samples/hellovr_opengl/hellovr_opengl_main.cpp b/samples/hellovr_opengl/hellovr_opengl_main.cpp index 2e4b5e0e..14e6348f 100644 --- a/samples/hellovr_opengl/hellovr_opengl_main.cpp +++ b/samples/hellovr_opengl/hellovr_opengl_main.cpp @@ -252,7 +252,7 @@ class CMainApplication bool GetDigitalActionRisingEdge(vr::VRActionHandle_t action, vr::VRInputValueHandle_t *pDevicePath = nullptr ) { vr::InputDigitalActionData_t actionData; - vr::VRInput()->GetDigitalActionData(action, &actionData, sizeof(actionData)); + vr::VRInput()->GetDigitalActionData(action, &actionData, sizeof(actionData), vr::k_ulInvalidInputValueHandle ); if (pDevicePath) { *pDevicePath = vr::k_ulInvalidInputValueHandle; @@ -275,7 +275,7 @@ bool GetDigitalActionRisingEdge(vr::VRActionHandle_t action, vr::VRInputValueHan bool GetDigitalActionFallingEdge(vr::VRActionHandle_t action, vr::VRInputValueHandle_t *pDevicePath = nullptr ) { vr::InputDigitalActionData_t actionData; - vr::VRInput()->GetDigitalActionData(action, &actionData, sizeof(actionData)); + vr::VRInput()->GetDigitalActionData(action, &actionData, sizeof(actionData), vr::k_ulInvalidInputValueHandle ); if (pDevicePath) { *pDevicePath = vr::k_ulInvalidInputValueHandle; @@ -298,7 +298,7 @@ bool GetDigitalActionFallingEdge(vr::VRActionHandle_t action, vr::VRInputValueHa bool GetDigitalActionState(vr::VRActionHandle_t action, vr::VRInputValueHandle_t *pDevicePath = nullptr ) { vr::InputDigitalActionData_t actionData; - vr::VRInput()->GetDigitalActionData(action, &actionData, sizeof(actionData)); + vr::VRInput()->GetDigitalActionData(action, &actionData, sizeof(actionData), vr::k_ulInvalidInputValueHandle ); if (pDevicePath) { *pDevicePath = vr::k_ulInvalidInputValueHandle; @@ -739,16 +739,16 @@ bool CMainApplication::HandleInput() { if ( ulHapticDevice == m_rHand[Left].m_source ) { - vr::VRInput()->TriggerHapticVibrationAction( m_rHand[Left].m_actionHaptic, 0, 1, 4.f, 1.0f ); + vr::VRInput()->TriggerHapticVibrationAction( m_rHand[Left].m_actionHaptic, 0, 1, 4.f, 1.0f, vr::k_ulInvalidInputValueHandle ); } if ( ulHapticDevice == m_rHand[Right].m_source ) { - vr::VRInput()->TriggerHapticVibrationAction( m_rHand[Right].m_actionHaptic, 0, 1, 4.f, 1.0f ); + vr::VRInput()->TriggerHapticVibrationAction( m_rHand[Right].m_actionHaptic, 0, 1, 4.f, 1.0f, vr::k_ulInvalidInputValueHandle ); } } vr::InputAnalogActionData_t analogData; - if ( vr::VRInput()->GetAnalogActionData( m_actionAnalongInput, &analogData, sizeof( analogData ) ) == vr::VRInputError_None && analogData.bActive ) + if ( vr::VRInput()->GetAnalogActionData( m_actionAnalongInput, &analogData, sizeof( analogData ), vr::k_ulInvalidInputValueHandle ) == vr::VRInputError_None && analogData.bActive ) { m_vAnalogValue[0] = analogData.x; m_vAnalogValue[1] = analogData.y; @@ -773,7 +773,7 @@ bool CMainApplication::HandleInput() for ( EHand eHand = Left; eHand <= Right; ((int&)eHand)++ ) { vr::InputPoseActionData_t poseData; - if ( vr::VRInput()->GetPoseActionData( m_rHand[eHand].m_actionPose, vr::TrackingUniverseStanding, 0, &poseData, sizeof( poseData ) ) != vr::VRInputError_None + if ( vr::VRInput()->GetPoseActionData( m_rHand[eHand].m_actionPose, vr::TrackingUniverseStanding, 0, &poseData, sizeof( poseData ), vr::k_ulInvalidInputValueHandle ) != vr::VRInputError_None || !poseData.bActive || !poseData.pose.bPoseIsValid ) { m_rHand[eHand].m_bShowController = false; diff --git a/samples/samples_vs2010.sln b/samples/samples_vs2010.sln deleted file mode 100644 index ae7c59e5..00000000 --- a/samples/samples_vs2010.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hellovr_opengl", "hellovr_opengl\hellovr_opengl.vcxproj", "{FF19F6AE-67E0-4585-9D4A-038CB6E8DD09}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {FF19F6AE-67E0-4585-9D4A-038CB6E8DD09}.Debug|Win32.ActiveCfg = Debug|Win32 - {FF19F6AE-67E0-4585-9D4A-038CB6E8DD09}.Debug|Win32.Build.0 = Debug|Win32 - {FF19F6AE-67E0-4585-9D4A-038CB6E8DD09}.Release|Win32.ActiveCfg = Release|Win32 - {FF19F6AE-67E0-4585-9D4A-038CB6E8DD09}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/samples/samples_vs2017.sln b/samples/samples_vs2017.sln new file mode 100644 index 00000000..e6505e1a --- /dev/null +++ b/samples/samples_vs2017.sln @@ -0,0 +1,36 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hellovr_opengl", "hellovr_opengl\hellovr_opengl.vcxproj", "{FF19F6AE-67E0-4585-9D4A-038CB6E8DD09}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "driver_sample", "driver_sample\driver_sample.vcxproj", "{A47C788B-1BDA-4057-87A9-FC35ED711B44}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FF19F6AE-67E0-4585-9D4A-038CB6E8DD09}.Debug|Win32.ActiveCfg = Debug|Win32 + {FF19F6AE-67E0-4585-9D4A-038CB6E8DD09}.Debug|Win32.Build.0 = Debug|Win32 + {FF19F6AE-67E0-4585-9D4A-038CB6E8DD09}.Debug|x64.ActiveCfg = Debug|Win32 + {FF19F6AE-67E0-4585-9D4A-038CB6E8DD09}.Release|Win32.ActiveCfg = Release|Win32 + {FF19F6AE-67E0-4585-9D4A-038CB6E8DD09}.Release|Win32.Build.0 = Release|Win32 + {FF19F6AE-67E0-4585-9D4A-038CB6E8DD09}.Release|x64.ActiveCfg = Release|Win32 + {A47C788B-1BDA-4057-87A9-FC35ED711B44}.Debug|Win32.ActiveCfg = Debug|Win32 + {A47C788B-1BDA-4057-87A9-FC35ED711B44}.Debug|Win32.Build.0 = Debug|Win32 + {A47C788B-1BDA-4057-87A9-FC35ED711B44}.Debug|x64.ActiveCfg = Debug|x64 + {A47C788B-1BDA-4057-87A9-FC35ED711B44}.Debug|x64.Build.0 = Debug|x64 + {A47C788B-1BDA-4057-87A9-FC35ED711B44}.Release|Win32.ActiveCfg = Release|Win32 + {A47C788B-1BDA-4057-87A9-FC35ED711B44}.Release|Win32.Build.0 = Release|Win32 + {A47C788B-1BDA-4057-87A9-FC35ED711B44}.Release|x64.ActiveCfg = Release|x64 + {A47C788B-1BDA-4057-87A9-FC35ED711B44}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/samples/shared/pathtools.cpp b/samples/shared/pathtools.cpp index 89db4e08..4a8bb53e 100644 --- a/samples/shared/pathtools.cpp +++ b/samples/shared/pathtools.cpp @@ -757,6 +757,7 @@ std::string Path_FilePathToUrl( const std::string & sRelativePath, const std::st std::string sAbsolute = Path_MakeAbsolute( sRelativePath, sBasePath ); if ( sAbsolute.empty() ) return sAbsolute; + sAbsolute = Path_FixSlashes( sAbsolute, '/' ); return std::string( FILE_URL_PREFIX ) + sAbsolute; } } @@ -768,7 +769,9 @@ std::string Path_UrlToFilePath( const std::string & sFileUrl ) { if ( !strnicmp( sFileUrl.c_str(), FILE_URL_PREFIX, strlen( FILE_URL_PREFIX ) ) ) { - return sFileUrl.c_str() + strlen( FILE_URL_PREFIX ); + std::string sRet = sFileUrl.c_str() + strlen( FILE_URL_PREFIX ); + sRet = Path_FixSlashes( sRet ); + return sRet; } else { diff --git a/samples/shared/strtools.cpp b/samples/shared/strtools.cpp index 6166db48..bd999563 100644 --- a/samples/shared/strtools.cpp +++ b/samples/shared/strtools.cpp @@ -140,13 +140,6 @@ std::wstring UTF8to16(const char * in) } -void strcpy_safe( char *pchBuffer, size_t unBufferSizeBytes, const char *pchSource ) -{ - pchBuffer[ unBufferSizeBytes - 1 ] = '\0'; - strncpy( pchBuffer, pchSource, unBufferSizeBytes - 1 ); -} - - // -------------------------------------------------------------------- // Purpose: converts a string to upper case // -------------------------------------------------------------------- diff --git a/src/vrcommon/hmderrors_public.cpp b/src/vrcommon/hmderrors_public.cpp index 5a217421..6710f6d9 100644 --- a/src/vrcommon/hmderrors_public.cpp +++ b/src/vrcommon/hmderrors_public.cpp @@ -164,6 +164,7 @@ const char *GetIDForVRInitError( vr::EVRInitError eError ) RETURN_ENUM_AS_STRING( VRInitError_Init_FirmwareRecoveryBusy ); RETURN_ENUM_AS_STRING( VRInitError_Init_USBServiceBusy ); RETURN_ENUM_AS_STRING( VRInitError_Init_VRWebHelperStartupFailed ); + RETURN_ENUM_AS_STRING( VRInitError_Init_TrackerManagerInitFailed ); RETURN_ENUM_AS_STRING( VRInitError_Driver_Failed ); RETURN_ENUM_AS_STRING( VRInitError_Driver_Unknown ); diff --git a/src/vrcommon/pathtools_public.cpp b/src/vrcommon/pathtools_public.cpp index c9be6c79..28855444 100644 --- a/src/vrcommon/pathtools_public.cpp +++ b/src/vrcommon/pathtools_public.cpp @@ -759,6 +759,7 @@ std::string Path_FilePathToUrl( const std::string & sRelativePath, const std::st std::string sAbsolute = Path_MakeAbsolute( sRelativePath, sBasePath ); if ( sAbsolute.empty() ) return sAbsolute; + sAbsolute = Path_FixSlashes( sAbsolute, '/' ); return std::string( FILE_URL_PREFIX ) + sAbsolute; } } @@ -770,7 +771,9 @@ std::string Path_UrlToFilePath( const std::string & sFileUrl ) { if ( !strnicmp( sFileUrl.c_str(), FILE_URL_PREFIX, strlen( FILE_URL_PREFIX ) ) ) { - return sFileUrl.c_str() + strlen( FILE_URL_PREFIX ); + std::string sRet = sFileUrl.c_str() + strlen( FILE_URL_PREFIX ); + sRet = Path_FixSlashes( sRet ); + return sRet; } else { diff --git a/src/vrcommon/strtools_public.h b/src/vrcommon/strtools_public.h index 534735e7..b817d9f2 100644 --- a/src/vrcommon/strtools_public.h +++ b/src/vrcommon/strtools_public.h @@ -40,11 +40,17 @@ std::string StringToLower( const std::string & sString ); #if defined( OSX ) || defined( LINUX ) #include inline int stricmp(const char *pStr1, const char *pStr2) { return strcasecmp(pStr1,pStr2); } +#ifndef _stricmp #define _stricmp stricmp +#endif inline int strnicmp( const char *pStr1, const char *pStr2, size_t unBufferLen ) { return strncasecmp( pStr1,pStr2, unBufferLen ); } +#ifndef _strnicmp #define _strnicmp strnicmp +#endif +#ifndef _vsnprintf_s #define _vsnprintf_s vsnprintf +#endif #define _TRUNCATE ((size_t)-1)