Updated OpenVR to version 1.0.7.

This commit is contained in:
2017-05-19 19:01:53 +02:00
parent e8948a1545
commit 00276522ee
17 changed files with 432 additions and 123 deletions
+168 -13
View File
@@ -851,7 +851,7 @@ public struct IVROverlay
internal _FindOverlay FindOverlay;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _CreateOverlay(string pchOverlayKey, string pchOverlayFriendlyName, ref ulong pOverlayHandle);
internal delegate EVROverlayError _CreateOverlay(string pchOverlayKey, string pchOverlayName, ref ulong pOverlayHandle);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _CreateOverlay CreateOverlay;
@@ -880,6 +880,11 @@ public struct IVROverlay
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOverlayName GetOverlayName;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _SetOverlayName(ulong ulOverlayHandle, string pchName);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetOverlayName SetOverlayName;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _GetOverlayImageData(ulong ulOverlayHandle, IntPtr pvBuffer, uint unBufferSize, ref uint punWidth, ref uint punHeight);
[MarshalAs(UnmanagedType.FunctionPtr)]
@@ -990,6 +995,16 @@ public struct IVROverlay
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOverlayTextureBounds GetOverlayTextureBounds;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetOverlayRenderModel(ulong ulOverlayHandle, string pchValue, uint unBufferSize, ref HmdColor_t pColor, ref EVROverlayError pError);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOverlayRenderModel GetOverlayRenderModel;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _SetOverlayRenderModel(ulong ulOverlayHandle, string pchRenderModel, ref HmdColor_t pColor);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetOverlayRenderModel SetOverlayRenderModel;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _GetOverlayTransformType(ulong ulOverlayHandle, ref VROverlayTransformType peTransformType);
[MarshalAs(UnmanagedType.FunctionPtr)]
@@ -1025,6 +1040,16 @@ public struct IVROverlay
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOverlayTransformTrackedDeviceComponent GetOverlayTransformTrackedDeviceComponent;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _GetOverlayTransformOverlayRelative(ulong ulOverlayHandle, ref ulong ulOverlayHandleParent, ref HmdMatrix34_t pmatParentOverlayToOverlayTransform);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOverlayTransformOverlayRelative GetOverlayTransformOverlayRelative;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _SetOverlayTransformOverlayRelative(ulong ulOverlayHandle, ulong ulOverlayHandleParent, ref HmdMatrix34_t pmatParentOverlayToOverlayTransform);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetOverlayTransformOverlayRelative SetOverlayTransformOverlayRelative;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _ShowOverlay(ulong ulOverlayHandle);
[MarshalAs(UnmanagedType.FunctionPtr)]
@@ -1603,8 +1628,32 @@ public class CVRSystem
IntPtr result = FnTable.GetPropErrorNameFromEnum(error);
return Marshal.PtrToStringAnsi(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)]
internal delegate bool _PollNextEventPacked(ref VREvent_t_Packed pEvent,uint uncbVREvent);
[StructLayout(LayoutKind.Explicit)]
struct PollNextEventUnion
{
[FieldOffset(0)]
public IVRSystem._PollNextEvent pPollNextEvent;
[FieldOffset(0)]
public _PollNextEventPacked pPollNextEventPacked;
}
public bool PollNextEvent(ref VREvent_t pEvent,uint uncbVREvent)
{
if ((System.Environment.OSVersion.Platform == System.PlatformID.MacOSX) ||
(System.Environment.OSVersion.Platform == System.PlatformID.Unix))
{
PollNextEventUnion u;
VREvent_t_Packed event_packed = new VREvent_t_Packed();
u.pPollNextEventPacked = null;
u.pPollNextEvent = FnTable.PollNextEvent;
bool packed_result = u.pPollNextEventPacked(ref event_packed,(uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(VREvent_t_Packed)));
event_packed.Unpack(ref pEvent);
return packed_result;
}
bool result = FnTable.PollNextEvent(ref pEvent,uncbVREvent);
return result;
}
@@ -1623,7 +1672,7 @@ public class CVRSystem
HiddenAreaMesh_t result = FnTable.GetHiddenAreaMesh(eEye,type);
return result;
}
// This is a terrible hack to workaround the fact that VRControllerState_t was
// 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)]
internal delegate bool _GetControllerStatePacked(uint unControllerDeviceIndex,ref VRControllerState_t_Packed pControllerState,uint unControllerStateSize);
@@ -1641,7 +1690,7 @@ public class CVRSystem
(System.Environment.OSVersion.Platform == System.PlatformID.Unix))
{
GetControllerStateUnion u;
VRControllerState_t_Packed state_packed = new VRControllerState_t_Packed();
VRControllerState_t_Packed state_packed = new VRControllerState_t_Packed(pControllerState);
u.pGetControllerStatePacked = null;
u.pGetControllerState = FnTable.GetControllerState;
bool packed_result = u.pGetControllerStatePacked(unControllerDeviceIndex,ref state_packed,(uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(VRControllerState_t_Packed)));
@@ -1652,7 +1701,7 @@ public class CVRSystem
bool result = FnTable.GetControllerState(unControllerDeviceIndex,ref pControllerState,unControllerStateSize);
return result;
}
// This is a terrible hack to workaround the fact that VRControllerState_t was
// 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)]
internal delegate bool _GetControllerStateWithPosePacked(ETrackingUniverseOrigin eOrigin,uint unControllerDeviceIndex,ref VRControllerState_t_Packed pControllerState,uint unControllerStateSize,ref TrackedDevicePose_t pTrackedDevicePose);
@@ -1670,7 +1719,7 @@ public class CVRSystem
(System.Environment.OSVersion.Platform == System.PlatformID.Unix))
{
GetControllerStateWithPoseUnion u;
VRControllerState_t_Packed state_packed = new VRControllerState_t_Packed();
VRControllerState_t_Packed state_packed = new VRControllerState_t_Packed(pControllerState);
u.pGetControllerStateWithPosePacked = null;
u.pGetControllerStateWithPose = FnTable.GetControllerStateWithPose;
bool packed_result = u.pGetControllerStateWithPosePacked(eOrigin,unControllerDeviceIndex,ref state_packed,(uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(VRControllerState_t_Packed)),ref pTrackedDevicePose);
@@ -2381,10 +2430,10 @@ public class CVROverlay
EVROverlayError result = FnTable.FindOverlay(pchOverlayKey,ref pOverlayHandle);
return result;
}
public EVROverlayError CreateOverlay(string pchOverlayKey,string pchOverlayFriendlyName,ref ulong pOverlayHandle)
public EVROverlayError CreateOverlay(string pchOverlayKey,string pchOverlayName,ref ulong pOverlayHandle)
{
pOverlayHandle = 0;
EVROverlayError result = FnTable.CreateOverlay(pchOverlayKey,pchOverlayFriendlyName,ref pOverlayHandle);
EVROverlayError result = FnTable.CreateOverlay(pchOverlayKey,pchOverlayName,ref pOverlayHandle);
return result;
}
public EVROverlayError DestroyOverlay(ulong ulOverlayHandle)
@@ -2412,6 +2461,11 @@ public class CVROverlay
uint result = FnTable.GetOverlayName(ulOverlayHandle,pchValue,unBufferSize,ref pError);
return result;
}
public EVROverlayError SetOverlayName(ulong ulOverlayHandle,string pchName)
{
EVROverlayError result = FnTable.SetOverlayName(ulOverlayHandle,pchName);
return result;
}
public EVROverlayError GetOverlayImageData(ulong ulOverlayHandle,IntPtr pvBuffer,uint unBufferSize,ref uint punWidth,ref uint punHeight)
{
punWidth = 0;
@@ -2534,6 +2588,16 @@ public class CVROverlay
EVROverlayError result = FnTable.GetOverlayTextureBounds(ulOverlayHandle,ref pOverlayTextureBounds);
return result;
}
public uint GetOverlayRenderModel(ulong ulOverlayHandle,string pchValue,uint unBufferSize,ref HmdColor_t pColor,ref EVROverlayError pError)
{
uint result = FnTable.GetOverlayRenderModel(ulOverlayHandle,pchValue,unBufferSize,ref pColor,ref pError);
return result;
}
public EVROverlayError SetOverlayRenderModel(ulong ulOverlayHandle,string pchRenderModel,ref HmdColor_t pColor)
{
EVROverlayError result = FnTable.SetOverlayRenderModel(ulOverlayHandle,pchRenderModel,ref pColor);
return result;
}
public EVROverlayError GetOverlayTransformType(ulong ulOverlayHandle,ref VROverlayTransformType peTransformType)
{
EVROverlayError result = FnTable.GetOverlayTransformType(ulOverlayHandle,ref peTransformType);
@@ -2571,6 +2635,17 @@ public class CVROverlay
EVROverlayError result = FnTable.GetOverlayTransformTrackedDeviceComponent(ulOverlayHandle,ref punDeviceIndex,pchComponentName,unComponentNameSize);
return result;
}
public EVROverlayError GetOverlayTransformOverlayRelative(ulong ulOverlayHandle,ref ulong ulOverlayHandleParent,ref HmdMatrix34_t pmatParentOverlayToOverlayTransform)
{
ulOverlayHandleParent = 0;
EVROverlayError result = FnTable.GetOverlayTransformOverlayRelative(ulOverlayHandle,ref ulOverlayHandleParent,ref pmatParentOverlayToOverlayTransform);
return result;
}
public EVROverlayError SetOverlayTransformOverlayRelative(ulong ulOverlayHandle,ulong ulOverlayHandleParent,ref HmdMatrix34_t pmatParentOverlayToOverlayTransform)
{
EVROverlayError result = FnTable.SetOverlayTransformOverlayRelative(ulOverlayHandle,ulOverlayHandleParent,ref pmatParentOverlayToOverlayTransform);
return result;
}
public EVROverlayError ShowOverlay(ulong ulOverlayHandle)
{
EVROverlayError result = FnTable.ShowOverlay(ulOverlayHandle);
@@ -2591,8 +2666,32 @@ public class CVROverlay
EVROverlayError result = FnTable.GetTransformForOverlayCoordinates(ulOverlayHandle,eTrackingOrigin,coordinatesInOverlay,ref pmatTransform);
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)]
internal delegate bool _PollNextOverlayEventPacked(ulong ulOverlayHandle,ref VREvent_t_Packed pEvent,uint uncbVREvent);
[StructLayout(LayoutKind.Explicit)]
struct PollNextOverlayEventUnion
{
[FieldOffset(0)]
public IVROverlay._PollNextOverlayEvent pPollNextOverlayEvent;
[FieldOffset(0)]
public _PollNextOverlayEventPacked pPollNextOverlayEventPacked;
}
public bool PollNextOverlayEvent(ulong ulOverlayHandle,ref VREvent_t pEvent,uint uncbVREvent)
{
if ((System.Environment.OSVersion.Platform == System.PlatformID.MacOSX) ||
(System.Environment.OSVersion.Platform == System.PlatformID.Unix))
{
PollNextOverlayEventUnion u;
VREvent_t_Packed event_packed = new VREvent_t_Packed();
u.pPollNextOverlayEventPacked = null;
u.pPollNextOverlayEvent = FnTable.PollNextOverlayEvent;
bool packed_result = u.pPollNextOverlayEventPacked(ulOverlayHandle,ref event_packed,(uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(VREvent_t_Packed)));
event_packed.Unpack(ref pEvent);
return packed_result;
}
bool result = FnTable.PollNextOverlayEvent(ulOverlayHandle,ref pEvent,uncbVREvent);
return result;
}
@@ -2843,7 +2942,7 @@ public class CVRRenderModels
uint result = FnTable.GetComponentRenderModelName(pchRenderModelName,pchComponentName,pchComponentRenderModelName,unComponentRenderModelNameLen);
return result;
}
// This is a terrible hack to workaround the fact that VRControllerState_t was
// 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)]
internal delegate bool _GetComponentStatePacked(string pchRenderModelName,string pchComponentName,ref VRControllerState_t_Packed pControllerState,ref RenderModel_ControllerMode_State_t pState,ref RenderModel_ComponentState_t pComponentState);
@@ -2861,7 +2960,7 @@ public class CVRRenderModels
(System.Environment.OSVersion.Platform == System.PlatformID.Unix))
{
GetComponentStateUnion u;
VRControllerState_t_Packed state_packed = new VRControllerState_t_Packed();
VRControllerState_t_Packed state_packed = new VRControllerState_t_Packed(pControllerState);
u.pGetComponentStatePacked = null;
u.pGetComponentState = FnTable.GetComponentState;
bool packed_result = u.pGetComponentStatePacked(pchRenderModelName,pchComponentName,ref state_packed,ref pState,ref pComponentState);
@@ -3101,6 +3200,7 @@ public enum ETrackedDeviceClass
Controller = 2,
GenericTracker = 3,
TrackingReference = 4,
DisplayRedirect = 5,
}
public enum ETrackedControllerRole
{
@@ -3152,6 +3252,7 @@ public enum ETrackedDeviceProperty
Prop_Firmware_ForceUpdateRequired_Bool = 1032,
Prop_ViveSystemButtonFixRequired_Bool = 1033,
Prop_ParentDriver_Uint64 = 1034,
Prop_ResourceRoot_String = 1035,
Prop_ReportsTimeSinceVSync_Bool = 2000,
Prop_SecondsFromVsyncToPhotons_Float = 2001,
Prop_DisplayFrequency_Float = 2002,
@@ -3194,7 +3295,7 @@ public enum ETrackedDeviceProperty
Prop_DisplayMCImageHeight_Int32 = 2039,
Prop_DisplayMCImageNumChannels_Int32 = 2040,
Prop_DisplayMCImageData_Binary = 2041,
Prop_UsesDriverDirectMode_Bool = 2042,
Prop_SecondsFromPhotonsToVblank_Float = 2042,
Prop_AttachedDeviceId_String = 3000,
Prop_SupportedButtons_Uint64 = 3001,
Prop_Axis0Type_Int32 = 3002,
@@ -3223,6 +3324,11 @@ public enum ETrackedDeviceProperty
Prop_DisplayHiddenArea_Binary_End = 5150,
Prop_UserConfigPath_String = 6000,
Prop_InstallPath_String = 6001,
Prop_HasDisplayComponent_Bool = 6002,
Prop_HasControllerComponent_Bool = 6003,
Prop_HasCameraComponent_Bool = 6004,
Prop_HasDriverDirectModeComponent_Bool = 6005,
Prop_HasVirtualDisplayComponent_Bool = 6006,
Prop_VendorSpecific_Reserved_Start = 10000,
Prop_VendorSpecific_Reserved_End = 10999,
}
@@ -3356,6 +3462,8 @@ public enum EVREventType
VREvent_ApplicationListUpdated = 1303,
VREvent_ApplicationMimeTypeLoad = 1304,
VREvent_ApplicationTransitionNewAppLaunchComplete = 1305,
VREvent_ProcessConnected = 1306,
VREvent_ProcessDisconnected = 1307,
VREvent_Compositor_MirrorWindowShown = 1400,
VREvent_Compositor_MirrorWindowHidden = 1401,
VREvent_Compositor_ChaperoneBoundsShown = 1410,
@@ -3468,7 +3576,8 @@ public enum EVRApplicationType
VRApplication_Utility = 4,
VRApplication_VRMonitor = 5,
VRApplication_SteamWatchdog = 6,
VRApplication_Max = 7,
VRApplication_Bootstrapper = 7,
VRApplication_Max = 8,
}
public enum EVRFirmwareError
{
@@ -4087,6 +4196,28 @@ public enum EVRScreenshotError
public float eventAgeSeconds;
public VREvent_Data_t data;
}
// This structure is for backwards binary compatibility on Linux and OSX only
[StructLayout(LayoutKind.Sequential, Pack = 4)] public struct VREvent_t_Packed
{
public uint eventType;
public uint trackedDeviceIndex;
public float eventAgeSeconds;
public VREvent_Data_t data;
public VREvent_t_Packed(VREvent_t unpacked)
{
this.eventType = unpacked.eventType;
this.trackedDeviceIndex = unpacked.trackedDeviceIndex;
this.eventAgeSeconds = unpacked.eventAgeSeconds;
this.data = unpacked.data;
}
public void Unpack(ref VREvent_t unpacked)
{
unpacked.eventType = this.eventType;
unpacked.trackedDeviceIndex = this.trackedDeviceIndex;
unpacked.eventAgeSeconds = this.eventAgeSeconds;
unpacked.data = this.data;
}
}
[StructLayout(LayoutKind.Sequential)] public struct HiddenAreaMesh_t
{
public IntPtr pVertexData; // const struct vr::HmdVector2_t *
@@ -4119,6 +4250,17 @@ public enum EVRScreenshotError
public VRControllerAxis_t rAxis2;
public VRControllerAxis_t rAxis3;
public VRControllerAxis_t rAxis4;
public VRControllerState_t_Packed(VRControllerState_t unpacked)
{
this.unPacketNum = unpacked.unPacketNum;
this.ulButtonPressed = unpacked.ulButtonPressed;
this.ulButtonTouched = unpacked.ulButtonTouched;
this.rAxis0 = unpacked.rAxis0;
this.rAxis1 = unpacked.rAxis1;
this.rAxis2 = unpacked.rAxis2;
this.rAxis3 = unpacked.rAxis3;
this.rAxis4 = unpacked.rAxis4;
}
public void Unpack(ref VRControllerState_t unpacked)
{
unpacked.unPacketNum = this.unPacketNum;
@@ -4265,6 +4407,12 @@ public enum EVRScreenshotError
public char unWidth;
public char unHeight;
public IntPtr rubTextureMapData; // const uint8_t *
public RenderModel_TextureMap_t_Packed(RenderModel_TextureMap_t unpacked)
{
this.unWidth = unpacked.unWidth;
this.unHeight = unpacked.unHeight;
this.rubTextureMapData = unpacked.rubTextureMapData;
}
public void Unpack(ref RenderModel_TextureMap_t unpacked)
{
unpacked.unWidth = this.unWidth;
@@ -4288,6 +4436,14 @@ public enum EVRScreenshotError
public IntPtr rIndexData; // const uint16_t *
public uint unTriangleCount;
public int diffuseTextureId;
public RenderModel_t_Packed(RenderModel_t unpacked)
{
this.rVertexData = unpacked.rVertexData;
this.unVertexCount = unpacked.unVertexCount;
this.rIndexData = unpacked.rIndexData;
this.unTriangleCount = unpacked.unTriangleCount;
this.diffuseTextureId = unpacked.diffuseTextureId;
}
public void Unpack(ref RenderModel_t unpacked)
{
unpacked.rVertexData = this.rVertexData;
@@ -4405,7 +4561,7 @@ public class OpenVR
public const uint k_unVROverlayMaxNameLength = 128;
public const uint k_unMaxOverlayCount = 64;
public const uint k_unMaxOverlayIntersectionMaskPrimitivesCount = 32;
public const string IVROverlay_Version = "IVROverlay_014";
public const string IVROverlay_Version = "IVROverlay_016";
public const string k_pch_Controller_Component_GDC2015 = "gdc2015";
public const string k_pch_Controller_Component_Base = "base";
public const string k_pch_Controller_Component_Tip = "tip";
@@ -4422,7 +4578,6 @@ public class OpenVR
public const string k_pch_SteamVR_ForcedHmdKey_String = "forcedHmd";
public const string k_pch_SteamVR_DisplayDebug_Bool = "displayDebug";
public const string k_pch_SteamVR_DebugProcessPipe_String = "debugProcessPipe";
public const string k_pch_SteamVR_EnableDistortion_Bool = "enableDistortion";
public const string k_pch_SteamVR_DisplayDebugX_Int32 = "displayDebugX";
public const string k_pch_SteamVR_DisplayDebugY_Int32 = "displayDebugY";
public const string k_pch_SteamVR_SendSystemButtonToAllApps_Bool = "sendSystemButtonToAllApps";