Skip to content

Commit 0d45be0

Browse files
committed
OpenVR 1.10.30 SDK, fixes axis and pos
1 parent 65a5bba commit 0d45be0

File tree

7 files changed

+1373
-534
lines changed

7 files changed

+1373
-534
lines changed

OpenVR/FreeTrack/headers/openvr.h

Lines changed: 354 additions & 94 deletions
Large diffs are not rendered by default.

OpenVR/FreeTrack/headers/openvr_api.cs

Lines changed: 397 additions & 107 deletions
Large diffs are not rendered by default.

OpenVR/FreeTrack/headers/openvr_api.json

Lines changed: 267 additions & 101 deletions
Large diffs are not rendered by default.

OpenVR/FreeTrack/headers/openvr_capi.h

Lines changed: 130 additions & 70 deletions
Large diffs are not rendered by default.

OpenVR/FreeTrack/headers/openvr_driver.h

Lines changed: 83 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
namespace vr
1616
{
1717
static const uint32_t k_nSteamVRVersionMajor = 1;
18-
static const uint32_t k_nSteamVRVersionMinor = 9;
19-
static const uint32_t k_nSteamVRVersionBuild = 16;
18+
static const uint32_t k_nSteamVRVersionMinor = 10;
19+
static const uint32_t k_nSteamVRVersionBuild = 30;
2020
} // namespace vr
2121

2222
// vrtypes.h
@@ -206,7 +206,7 @@ enum ETrackedControllerRole
206206
TrackedControllerRole_LeftHand = 1, // Tracked device associated with the left hand
207207
TrackedControllerRole_RightHand = 2, // Tracked device associated with the right hand
208208
TrackedControllerRole_OptOut = 3, // Tracked device is opting out of left/right hand selection
209-
TrackedControllerRole_Treadmill = 4, // Tracked device is a treadmill
209+
TrackedControllerRole_Treadmill = 4, // Tracked device is a treadmill or other locomotion device
210210
TrackedControllerRole_Stylus = 5, // Tracked device is a stylus
211211
TrackedControllerRole_Max = 5
212212
};
@@ -278,6 +278,7 @@ static const PropertyTypeTag_t k_unUint64PropertyTag = 3;
278278
static const PropertyTypeTag_t k_unBoolPropertyTag = 4;
279279
static const PropertyTypeTag_t k_unStringPropertyTag = 5;
280280
static const PropertyTypeTag_t k_unErrorPropertyTag = 6;
281+
static const PropertyTypeTag_t k_unDoublePropertyTag = 7;
281282

282283
static const PropertyTypeTag_t k_unHmdMatrix34PropertyTag = 20;
283284
static const PropertyTypeTag_t k_unHmdMatrix44PropertyTag = 21;
@@ -450,7 +451,7 @@ enum ETrackedDeviceProperty
450451
Prop_DisplayMinAnalogGain_Float = 2086,
451452
Prop_DisplayMaxAnalogGain_Float = 2087,
452453

453-
Prop_DashboardLayoutPathName_String = 2090,
454+
// Prop_DashboardLayoutPathName_String = 2090, // DELETED
454455
Prop_DashboardScale_Float = 2091,
455456
Prop_IpdUIRangeMinMeters_Float = 2100,
456457
Prop_IpdUIRangeMaxMeters_Float = 2101,
@@ -629,6 +630,10 @@ enum EVRSubmitFlags
629630
// Set to indicate that pTexture is a pointer to a VRTextureWithDepth_t.
630631
// This flag can be combined with Submit_TextureWithPose to pass a VRTextureWithPoseAndDepth_t.
631632
Submit_TextureWithDepth = 0x10,
633+
634+
// Set to indicate a discontinuity between this and the last frame.
635+
// This will prevent motion smoothing from attempting to extrapolate using the pair.
636+
Submit_FrameDiscontinuty = 0x20,
632637
};
633638

634639
/** Data required for passing Vulkan textures to IVRCompositor::Submit.
@@ -693,14 +698,14 @@ enum EVREventType
693698
VREvent_ButtonTouch = 202, // data is controller
694699
VREvent_ButtonUntouch = 203, // data is controller
695700

696-
VREvent_DualAnalog_Press = 250, // data is dualAnalog
697-
VREvent_DualAnalog_Unpress = 251, // data is dualAnalog
698-
VREvent_DualAnalog_Touch = 252, // data is dualAnalog
699-
VREvent_DualAnalog_Untouch = 253, // data is dualAnalog
700-
VREvent_DualAnalog_Move = 254, // data is dualAnalog
701-
VREvent_DualAnalog_ModeSwitch1 = 255, // data is dualAnalog
702-
VREvent_DualAnalog_ModeSwitch2 = 256, // data is dualAnalog
703-
VREvent_DualAnalog_Cancel = 257, // data is dualAnalog
701+
// VREvent_DualAnalog_Press = 250, // No longer sent
702+
// VREvent_DualAnalog_Unpress = 251, // No longer sent
703+
// VREvent_DualAnalog_Touch = 252, // No longer sent
704+
// VREvent_DualAnalog_Untouch = 253, // No longer sent
705+
// VREvent_DualAnalog_Move = 254, // No longer sent
706+
// VREvent_DualAnalog_ModeSwitch1 = 255, // No longer sent
707+
// VREvent_DualAnalog_ModeSwitch2 = 256, // No longer sent
708+
VREvent_Modal_Cancel = 257, // Sent to overlays with the
704709

705710
VREvent_MouseMove = 300, // data is mouse
706711
VREvent_MouseButtonDown = 301, // data is mouse
@@ -712,6 +717,8 @@ enum EVREventType
712717
VREvent_OverlayFocusChanged = 307, // data is overlay, global event
713718
VREvent_ReloadOverlays = 308,
714719
VREvent_ScrollSmooth = 309, // data is scroll
720+
VREvent_LockMousePosition = 310,
721+
VREvent_UnlockMousePosition = 311,
715722

716723
VREvent_InputFocusCaptured = 400, // data is process DEPRECATED
717724
VREvent_InputFocusReleased = 401, // data is process DEPRECATED
@@ -1092,19 +1099,6 @@ struct VREvent_Property_t
10921099
ETrackedDeviceProperty prop;
10931100
};
10941101

1095-
enum EDualAnalogWhich
1096-
{
1097-
k_EDualAnalog_Left = 0,
1098-
k_EDualAnalog_Right = 1,
1099-
};
1100-
1101-
struct VREvent_DualAnalog_t
1102-
{
1103-
float x, y; // coordinates are -1..1 analog values
1104-
float transformedX, transformedY; // transformed by the center and radius numbers provided by the overlay
1105-
EDualAnalogWhich which;
1106-
};
1107-
11081102
struct VREvent_HapticVibration_t
11091103
{
11101104
uint64_t containerHandle; // property container handle of the device with the haptic component
@@ -1159,6 +1153,7 @@ enum EShowUIType
11591153
ShowUI_Settings = 4,
11601154
ShowUI_DebugCommands = 5,
11611155
ShowUI_FullControllerBinding = 6,
1156+
ShowUI_ManageDrivers = 7,
11621157
};
11631158

11641159
struct VREvent_ShowUI_t
@@ -1207,7 +1202,6 @@ typedef union
12071202
VREvent_EditingCameraSurface_t cameraSurface;
12081203
VREvent_MessageOverlay_t messageOverlay;
12091204
VREvent_Property_t property;
1210-
VREvent_DualAnalog_t dualAnalog;
12111205
VREvent_HapticVibration_t hapticVibration;
12121206
VREvent_WebConsole_t webConsole;
12131207
VREvent_InputBindingLoad_t inputBinding;
@@ -1241,6 +1235,28 @@ struct VREvent_t
12411235
#pragma pack( pop )
12421236
#endif
12431237

1238+
typedef uint32_t VRComponentProperties;
1239+
1240+
enum EVRComponentProperty
1241+
{
1242+
VRComponentProperty_IsStatic = (1 << 0),
1243+
VRComponentProperty_IsVisible = (1 << 1),
1244+
VRComponentProperty_IsTouched = (1 << 2),
1245+
VRComponentProperty_IsPressed = (1 << 3),
1246+
VRComponentProperty_IsScrolled = (1 << 4),
1247+
VRComponentProperty_IsHighlighted = (1 << 5),
1248+
};
1249+
1250+
1251+
/** Describes state information about a render-model component, including transforms and other dynamic properties */
1252+
struct RenderModel_ComponentState_t
1253+
{
1254+
HmdMatrix34_t mTrackingToComponentRenderModel; // Transform required when drawing the component render model
1255+
HmdMatrix34_t mTrackingToComponentLocal; // Transform available for attaching to a local component coordinate system (-Z out from surface )
1256+
VRComponentProperties uProperties;
1257+
};
1258+
1259+
12441260
enum EVRInputError
12451261
{
12461262
VRInputError_None = 0,
@@ -1261,6 +1277,9 @@ enum EVRInputError
12611277
VRInputError_MismatchedActionManifest = 15,
12621278
VRInputError_MissingSkeletonData = 16,
12631279
VRInputError_InvalidBoneIndex = 17,
1280+
VRInputError_InvalidPriority = 18,
1281+
VRInputError_PermissionDenied = 19,
1282+
VRInputError_InvalidRenderModel = 20,
12641283
};
12651284

12661285
enum EVRSpatialAnchorError
@@ -1377,17 +1396,6 @@ enum ECollisionBoundsStyle
13771396
COLLISION_BOUNDS_STYLE_COUNT
13781397
};
13791398

1380-
/** Allows the application to customize how the overlay appears in the compositor */
1381-
struct Compositor_OverlaySettings
1382-
{
1383-
uint32_t size; // sizeof(Compositor_OverlaySettings)
1384-
bool curved, antialias;
1385-
float scale, distance, alpha;
1386-
float uOffset, vOffset, uScale, vScale;
1387-
float gridDivs, gridWidth, gridScale;
1388-
HmdMatrix44_t transform;
1389-
};
1390-
13911399
/** used to refer to a single VR overlay */
13921400
typedef uint64_t VROverlayHandle_t;
13931401

@@ -1486,11 +1494,11 @@ enum EVRSkeletalTrackingLevel
14861494
// body part location can be measured directly but with fewer degrees of freedom than the actual body
14871495
// part. Certain body part positions may be unmeasured by the device and estimated from other input data.
14881496
// E.g. Index Controllers, gloves that only measure finger curl
1489-
VRSkeletalTracking_Partial,
1497+
VRSkeletalTracking_Partial = 1,
14901498

14911499
// Body part location can be measured directly throughout the entire range of motion of the body part.
14921500
// E.g. Mocap suit for the full body, gloves that measure rotation of each finger segment
1493-
VRSkeletalTracking_Full,
1501+
VRSkeletalTracking_Full = 2,
14941502

14951503
VRSkeletalTrackingLevel_Count,
14961504
VRSkeletalTrackingLevel_Max = VRSkeletalTrackingLevel_Count - 1
@@ -1674,15 +1682,18 @@ enum EVRInitError
16741682
VRInitError_Compositor_CreateFallbackSyncTexture = 477,
16751683
VRInitError_Compositor_ShareFallbackSyncTexture = 478,
16761684
VRInitError_Compositor_CreateOverlayIndexBuffer = 479,
1677-
VRInitError_Compositor_CreateOverlayVertextBuffer = 480,
1685+
VRInitError_Compositor_CreateOverlayVertexBuffer = 480,
16781686
VRInitError_Compositor_CreateTextVertexBuffer = 481,
16791687
VRInitError_Compositor_CreateTextIndexBuffer = 482,
16801688
VRInitError_Compositor_CreateMirrorTextures = 483,
16811689
VRInitError_Compositor_CreateLastFrameRenderTexture = 484,
16821690
VRInitError_Compositor_CreateMirrorOverlay = 485,
16831691
VRInitError_Compositor_FailedToCreateVirtualDisplayBackbuffer = 486,
16841692
VRInitError_Compositor_DisplayModeNotSupported = 487,
1685-
1693+
VRInitError_Compositor_CreateOverlayInvalidCall = 488,
1694+
VRInitError_Compositor_CreateOverlayAlreadyInitialized = 489,
1695+
VRInitError_Compositor_FailedToCreateMailbox = 490,
1696+
16861697
VRInitError_VendorSpecific_UnableToConnectToOculusRuntime = 1000,
16871698
VRInitError_VendorSpecific_WindowsNotInDevMode = 1001,
16881699

@@ -1862,6 +1873,13 @@ struct Compositor_FrameTiming
18621873
uint32_t m_nNumVSyncsToFirstView;
18631874
};
18641875

1876+
/** Provides compositor benchmark results to the app */
1877+
struct Compositor_BenchmarkResults
1878+
{
1879+
float m_flMegaPixelsPerSecond; // Measurement of GPU MP/s performed by compositor benchmark
1880+
float m_flHmdRecommendedMegaPixelsPerSecond; // Recommended default MP/s given the HMD resolution, refresh, and panel mask.
1881+
};
1882+
18651883
/** Frame timing data provided by direct mode drivers. */
18661884
struct DriverDirectMode_FrameTiming
18671885
{
@@ -1872,6 +1890,12 @@ struct DriverDirectMode_FrameTiming
18721890
uint32_t m_nReprojectionFlags;
18731891
};
18741892

1893+
/** These flags will be set on DriverDirectMode_FrameTiming::m_nReprojectionFlags when IVRDriverDirectModeComponent::GetFrameTiming is called for drivers to optionally respond to. */
1894+
const uint32_t VRCompositor_ReprojectionMotion_Enabled = 0x100; // Motion Smoothing is enabled in the UI for the currently running application
1895+
const uint32_t VRCompositor_ReprojectionMotion_ForcedOn = 0x200; // Motion Smoothing is forced on in the UI for the currently running application
1896+
const uint32_t VRCompositor_ReprojectionMotion_AppThrottled = 0x400; // Application is requesting throttling via ForceInterleavedReprojectionOn
1897+
1898+
18751899
enum EVSync
18761900
{
18771901
VSync_None,
@@ -2254,6 +2278,8 @@ namespace vr
22542278
static const char * const k_pch_SteamVR_CustomIconStyle_String = "customIconStyle";
22552279
static const char * const k_pch_SteamVR_CustomOffIconStyle_String = "customOffIconStyle";
22562280
static const char * const k_pch_SteamVR_CustomIconForceUpdate_String = "customIconForceUpdate";
2281+
static const char * const k_pch_SteamVR_AllowGlobalActionSetPriority = "globalActionSetPriority";
2282+
static const char * const k_pch_SteamVR_OverlayRenderQuality = "overlayRenderQuality_2";
22572283

22582284
//-----------------------------------------------------------------------------
22592285
// direct mode keys
@@ -2387,7 +2413,6 @@ namespace vr
23872413
static const char * const k_pch_Dashboard_Section = "dashboard";
23882414
static const char * const k_pch_Dashboard_EnableDashboard_Bool = "enableDashboard";
23892415
static const char * const k_pch_Dashboard_ArcadeMode_Bool = "arcadeMode";
2390-
static const char * const k_pch_Dashboard_UseWebKeyboard = "useWebKeyboard";
23912416
static const char * const k_pch_Dashboard_UseWebSettings = "useWebSettings";
23922417
static const char * const k_pch_Dashboard_Position = "position";
23932418
static const char * const k_pch_Dashboard_DesktopScale = "desktopScale";
@@ -2400,6 +2425,7 @@ namespace vr
24002425
//-----------------------------------------------------------------------------
24012426
// driver keys - These could be checked in any driver_<name> section
24022427
static const char * const k_pch_Driver_Enable_Bool = "enable";
2428+
static const char * const k_pch_Driver_BlockedBySafemode_Bool = "blocked_by_safe_mode";
24032429
static const char * const k_pch_Driver_LoadPriority_Int32 = "loadPriority";
24042430

24052431
//-----------------------------------------------------------------------------
@@ -2420,9 +2446,12 @@ namespace vr
24202446
//-----------------------------------------------------------------------------
24212447
// per-app keys - the section name for these is the app key itself. Some of these are prefixed by the controller type
24222448
static const char* const k_pch_App_BindingAutosaveURLSuffix_String = "AutosaveURL";
2449+
static const char* const k_pch_App_BindingLegacyAPISuffix_String = "_legacy";
2450+
static const char* const k_pch_App_BindingSteamVRInputAPISuffix_String = "_steamvrinput";
24232451
static const char* const k_pch_App_BindingCurrentURLSuffix_String = "CurrentURL";
24242452
static const char* const k_pch_App_BindingPreviousURLSuffix_String = "PreviousURL";
24252453
static const char* const k_pch_App_NeedToUpdateAutosaveSuffix_Bool = "NeedToUpdateAutosave";
2454+
static const char* const k_pch_App_DominantHand_Int32 = "DominantHand";
24262455

24272456
//-----------------------------------------------------------------------------
24282457
// configuration for trackers
@@ -2915,6 +2944,7 @@ class CVRPropertyHelpers
29152944
HmdVector2_t GetVec2Property( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L );
29162945
HmdVector3_t GetVec3Property( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L );
29172946
HmdVector4_t GetVec4Property( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L );
2947+
double GetDoubleProperty( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L );
29182948

29192949
/** Returns a single typed property. If the device index is not valid or the property is not a string type this function will
29202950
* return 0. Otherwise it returns the length of the number of bytes necessary to hold this string including the trailing
@@ -2943,6 +2973,7 @@ class CVRPropertyHelpers
29432973
ETrackedPropertyError SetVec2Property( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, const HmdVector2_t & vNewValue );
29442974
ETrackedPropertyError SetVec3Property( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, const HmdVector3_t & vNewValue );
29452975
ETrackedPropertyError SetVec4Property( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, const HmdVector4_t & vNewValue );
2976+
ETrackedPropertyError SetDoubleProperty( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, double vNewValue );
29462977

29472978
/** Sets a string property. The new value will be returned on any subsequent call to get this property in any process. */
29482979
ETrackedPropertyError SetStringProperty( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, const char *pchNewValue );
@@ -3125,6 +3156,11 @@ inline float CVRPropertyHelpers::GetFloatProperty( PropertyContainerHandle_t ulC
31253156
return GetPropertyHelper<float>( ulContainerHandle, prop, pError, 0.f, k_unFloatPropertyTag );
31263157
}
31273158

3159+
inline double CVRPropertyHelpers::GetDoubleProperty( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, ETrackedPropertyError *pError )
3160+
{
3161+
return GetPropertyHelper<double>( ulContainerHandle, prop, pError, 0., k_unDoublePropertyTag );
3162+
}
3163+
31283164
inline int32_t CVRPropertyHelpers::GetInt32Property( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, ETrackedPropertyError *pError )
31293165
{
31303166
return GetPropertyHelper<int32_t>( ulContainerHandle, prop, pError, 0, k_unInt32PropertyTag );
@@ -3163,6 +3199,11 @@ inline ETrackedPropertyError CVRPropertyHelpers::SetFloatProperty( PropertyConta
31633199
return SetProperty( ulContainerHandle, prop, &fNewValue, sizeof( fNewValue ), k_unFloatPropertyTag );
31643200
}
31653201

3202+
inline ETrackedPropertyError CVRPropertyHelpers::SetDoubleProperty( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, double fNewValue )
3203+
{
3204+
return SetProperty( ulContainerHandle, prop, &fNewValue, sizeof( fNewValue ), k_unDoublePropertyTag );
3205+
}
3206+
31663207
inline ETrackedPropertyError CVRPropertyHelpers::SetInt32Property( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, int32_t nNewValue )
31673208
{
31683209
return SetProperty( ulContainerHandle, prop, &nNewValue, sizeof( nNewValue ), k_unInt32PropertyTag );

OpenVR/FreeTrack/samples/driver_sample/driver_sample.cpp

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,25 @@ FTData *FreeTrack;
126126
bool HMDConnected = false;
127127
std::thread *pFTthread = NULL;
128128

129+
inline vr::HmdQuaternion_t EulerAngleToQuaternion(double Yaw, double Pitch, double Roll)
130+
{
131+
vr::HmdQuaternion_t q;
132+
// Abbreviations for the various angular functions
133+
double cy = cos(Yaw * 0.5);
134+
double sy = sin(Yaw * 0.5);
135+
double cp = cos(Pitch * 0.5);
136+
double sp = sin(Pitch * 0.5);
137+
double cr = cos(Roll * 0.5);
138+
double sr = sin(Roll * 0.5);
139+
140+
q.w = cr * cp * cy + sr * sp * sy;
141+
q.x = sr * cp * cy - cr * sp * sy;
142+
q.y = cr * sp * cy + sr * cp * sy;
143+
q.z = cr * cp * sy - sr * sp * cy;
144+
145+
return q;
146+
}
147+
129148
//FreeTrack implementation from OpenTrack (https://github.com/opentrack/opentrack/tree/unstable/freetrackclient)
130149
static BOOL impl_create_mapping(void)
131150
{
@@ -402,15 +421,12 @@ class CSampleDeviceDriver : public vr::ITrackedDeviceServerDriver, public vr::IV
402421

403422
if (HMDConnected) {
404423
//Set head tracking rotation
405-
pose.qRotation.w = cos(FreeTrack->Yaw * 0.5) * cos(FreeTrack->Roll * 0.5) * cos(FreeTrack->Pitch * 0.5) + sin(FreeTrack->Yaw * 0.5) * sin(FreeTrack->Roll * 0.5) * sin(FreeTrack->Pitch * 0.5);
406-
pose.qRotation.x = cos(FreeTrack->Yaw * 0.5) * sin(FreeTrack->Roll * 0.5) * cos(FreeTrack->Pitch * 0.5) - sin(FreeTrack->Yaw * 0.5) * cos(FreeTrack->Roll * 0.5) * sin(FreeTrack->Pitch * 0.5);
407-
pose.qRotation.y = cos(FreeTrack->Yaw * 0.5) * cos(FreeTrack->Roll * 0.5) * sin(FreeTrack->Pitch * 0.5) + sin(FreeTrack->Yaw * 0.5) * sin(FreeTrack->Roll * 0.5) * cos(FreeTrack->Pitch * 0.5);
408-
pose.qRotation.z = sin(FreeTrack->Yaw * 0.5) * cos(FreeTrack->Roll * 0.5) * cos(FreeTrack->Pitch * 0.5) - cos(FreeTrack->Yaw * 0.5) * sin(FreeTrack->Roll * 0.5) * sin(FreeTrack->Pitch * 0.5);
424+
pose.qRotation = EulerAngleToQuaternion(FreeTrack->Roll, -FreeTrack->Yaw, FreeTrack->Pitch);
409425

410426
//Set position tracking
411427
pose.vecPosition[0] = FreeTrack->X * 0.001; //millimeters to meters
412-
pose.vecPosition[1] = FreeTrack->Y * 0.001; //millimeters to meters
413-
pose.vecPosition[2] = FreeTrack->Z * 0.001; //millimeters to meters
428+
pose.vecPosition[1] = FreeTrack->Z * 0.001; //millimeters to meters
429+
pose.vecPosition[2] = FreeTrack->Y * 0.001; //millimeters to meters
414430
}
415431

416432
return pose;

0 commit comments

Comments
 (0)