cmake build support for VR demo (WIN32 only)

update to latest OpenVR 1.05 SDK from https://github.com/ValveSoftware/openvr
add keyboard support to tune default camera VR position
VR revert to double 'distorted' views on Desktop, since the single view isn't showing full scene
This commit is contained in:
Erwin Coumans
2017-01-25 19:17:57 -08:00
parent a230c941f9
commit 94c768bea8
17 changed files with 503 additions and 134 deletions

View File

@@ -21,7 +21,7 @@ public struct IVRSystem
internal _GetRecommendedRenderTargetSize GetRecommendedRenderTargetSize;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate HmdMatrix44_t _GetProjectionMatrix(EVREye eEye, float fNearZ, float fFarZ, EGraphicsAPIConvention eProjType);
internal delegate HmdMatrix44_t _GetProjectionMatrix(EVREye eEye, float fNearZ, float fFarZ);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetProjectionMatrix GetProjectionMatrix;
@@ -276,9 +276,9 @@ public struct IVRTrackedCamera
internal _GetCameraFrameSize GetCameraFrameSize;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRTrackedCameraError _GetCameraIntrinisics(uint nDeviceIndex, EVRTrackedCameraFrameType eFrameType, ref HmdVector2_t pFocalLength, ref HmdVector2_t pCenter);
internal delegate EVRTrackedCameraError _GetCameraIntrinsics(uint nDeviceIndex, EVRTrackedCameraFrameType eFrameType, ref HmdVector2_t pFocalLength, ref HmdVector2_t pCenter);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetCameraIntrinisics GetCameraIntrinisics;
internal _GetCameraIntrinsics GetCameraIntrinsics;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVRTrackedCameraError _GetCameraProjection(uint nDeviceIndex, EVRTrackedCameraFrameType eFrameType, float flZNear, float flZFar, ref HmdMatrix44_t pProjection);
@@ -820,6 +820,16 @@ public struct IVRCompositor
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _UnlockGLSharedTextureForAccess UnlockGLSharedTextureForAccess;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetVulkanInstanceExtensionsRequired(System.Text.StringBuilder pchValue, uint unBufferSize);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetVulkanInstanceExtensionsRequired GetVulkanInstanceExtensionsRequired;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate uint _GetVulkanDeviceExtensionsRequired(IntPtr pPhysicalDevice, System.Text.StringBuilder pchValue, uint unBufferSize);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetVulkanDeviceExtensionsRequired GetVulkanDeviceExtensionsRequired;
}
[StructLayout(LayoutKind.Sequential)]
@@ -1106,7 +1116,7 @@ public struct IVROverlay
internal _SetOverlayFromFile SetOverlayFromFile;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _GetOverlayTexture(ulong ulOverlayHandle, ref IntPtr pNativeTextureHandle, IntPtr pNativeTextureRef, ref uint pWidth, ref uint pHeight, ref uint pNativeFormat, ref EGraphicsAPIConvention pAPI, ref EColorSpace pColorSpace);
internal delegate EVROverlayError _GetOverlayTexture(ulong ulOverlayHandle, ref IntPtr pNativeTextureHandle, IntPtr pNativeTextureRef, ref uint pWidth, ref uint pHeight, ref uint pNativeFormat, ref ETextureType pAPIType, ref EColorSpace pColorSpace, ref VRTextureBounds_t pTextureBounds);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOverlayTexture GetOverlayTexture;
@@ -1190,6 +1200,16 @@ public struct IVROverlay
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _SetOverlayIntersectionMask SetOverlayIntersectionMask;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate EVROverlayError _GetOverlayFlags(ulong ulOverlayHandle, ref uint pFlags);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetOverlayFlags GetOverlayFlags;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
internal delegate VRMessageOverlayResponse _ShowMessageOverlay(string pchText, string pchCaption, string pchButton0Text, string pchButton1Text, string pchButton2Text, string pchButton3Text);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ShowMessageOverlay ShowMessageOverlay;
}
[StructLayout(LayoutKind.Sequential)]
@@ -1436,9 +1456,9 @@ public class CVRSystem
pnHeight = 0;
FnTable.GetRecommendedRenderTargetSize(ref pnWidth,ref pnHeight);
}
public HmdMatrix44_t GetProjectionMatrix(EVREye eEye,float fNearZ,float fFarZ,EGraphicsAPIConvention eProjType)
public HmdMatrix44_t GetProjectionMatrix(EVREye eEye,float fNearZ,float fFarZ)
{
HmdMatrix44_t result = FnTable.GetProjectionMatrix(eEye,fNearZ,fFarZ,eProjType);
HmdMatrix44_t result = FnTable.GetProjectionMatrix(eEye,fNearZ,fFarZ);
return result;
}
public void GetProjectionRaw(EVREye eEye,ref float pfLeft,ref float pfRight,ref float pfTop,ref float pfBottom)
@@ -1710,9 +1730,9 @@ public class CVRTrackedCamera
EVRTrackedCameraError result = FnTable.GetCameraFrameSize(nDeviceIndex,eFrameType,ref pnWidth,ref pnHeight,ref pnFrameBufferSize);
return result;
}
public EVRTrackedCameraError GetCameraIntrinisics(uint nDeviceIndex,EVRTrackedCameraFrameType eFrameType,ref HmdVector2_t pFocalLength,ref HmdVector2_t pCenter)
public EVRTrackedCameraError GetCameraIntrinsics(uint nDeviceIndex,EVRTrackedCameraFrameType eFrameType,ref HmdVector2_t pFocalLength,ref HmdVector2_t pCenter)
{
EVRTrackedCameraError result = FnTable.GetCameraIntrinisics(nDeviceIndex,eFrameType,ref pFocalLength,ref pCenter);
EVRTrackedCameraError result = FnTable.GetCameraIntrinsics(nDeviceIndex,eFrameType,ref pFocalLength,ref pCenter);
return result;
}
public EVRTrackedCameraError GetCameraProjection(uint nDeviceIndex,EVRTrackedCameraFrameType eFrameType,float flZNear,float flZFar,ref HmdMatrix44_t pProjection)
@@ -2268,6 +2288,16 @@ public class CVRCompositor
{
FnTable.UnlockGLSharedTextureForAccess(glSharedTextureHandle);
}
public uint GetVulkanInstanceExtensionsRequired(System.Text.StringBuilder pchValue,uint unBufferSize)
{
uint result = FnTable.GetVulkanInstanceExtensionsRequired(pchValue,unBufferSize);
return result;
}
public uint GetVulkanDeviceExtensionsRequired(IntPtr pPhysicalDevice,System.Text.StringBuilder pchValue,uint unBufferSize)
{
uint result = FnTable.GetVulkanDeviceExtensionsRequired(pPhysicalDevice,pchValue,unBufferSize);
return result;
}
}
@@ -2574,12 +2604,12 @@ public class CVROverlay
EVROverlayError result = FnTable.SetOverlayFromFile(ulOverlayHandle,pchFilePath);
return result;
}
public EVROverlayError GetOverlayTexture(ulong ulOverlayHandle,ref IntPtr pNativeTextureHandle,IntPtr pNativeTextureRef,ref uint pWidth,ref uint pHeight,ref uint pNativeFormat,ref EGraphicsAPIConvention pAPI,ref EColorSpace pColorSpace)
public EVROverlayError GetOverlayTexture(ulong ulOverlayHandle,ref IntPtr pNativeTextureHandle,IntPtr pNativeTextureRef,ref uint pWidth,ref uint pHeight,ref uint pNativeFormat,ref ETextureType pAPIType,ref EColorSpace pColorSpace,ref VRTextureBounds_t pTextureBounds)
{
pWidth = 0;
pHeight = 0;
pNativeFormat = 0;
EVROverlayError result = FnTable.GetOverlayTexture(ulOverlayHandle,ref pNativeTextureHandle,pNativeTextureRef,ref pWidth,ref pHeight,ref pNativeFormat,ref pAPI,ref pColorSpace);
EVROverlayError result = FnTable.GetOverlayTexture(ulOverlayHandle,ref pNativeTextureHandle,pNativeTextureRef,ref pWidth,ref pHeight,ref pNativeFormat,ref pAPIType,ref pColorSpace,ref pTextureBounds);
return result;
}
public EVROverlayError ReleaseNativeOverlayHandle(ulong ulOverlayHandle,IntPtr pNativeTextureHandle)
@@ -2663,6 +2693,17 @@ public class CVROverlay
EVROverlayError result = FnTable.SetOverlayIntersectionMask(ulOverlayHandle,ref pMaskPrimitives,unNumMaskPrimitives,unPrimitiveSize);
return result;
}
public EVROverlayError GetOverlayFlags(ulong ulOverlayHandle,ref uint pFlags)
{
pFlags = 0;
EVROverlayError result = FnTable.GetOverlayFlags(ulOverlayHandle,ref pFlags);
return result;
}
public VRMessageOverlayResponse ShowMessageOverlay(string pchText,string pchCaption,string pchButton0Text,string pchButton1Text,string pchButton2Text,string pchButton3Text)
{
VRMessageOverlayResponse result = FnTable.ShowMessageOverlay(pchText,pchCaption,pchButton0Text,pchButton1Text,pchButton2Text,pchButton3Text);
return result;
}
}
@@ -2940,10 +2981,11 @@ public enum EVREye
Eye_Left = 0,
Eye_Right = 1,
}
public enum EGraphicsAPIConvention
public enum ETextureType
{
API_DirectX = 0,
API_OpenGL = 1,
DirectX = 0,
OpenGL = 1,
Vulkan = 2,
}
public enum EColorSpace
{
@@ -2964,9 +3006,8 @@ public enum ETrackedDeviceClass
Invalid = 0,
HMD = 1,
Controller = 2,
GenericTracker = 3,
TrackingReference = 4,
Count = 5,
Other = 1000,
}
public enum ETrackedControllerRole
{
@@ -2982,6 +3023,7 @@ public enum ETrackingUniverseOrigin
}
public enum ETrackedDeviceProperty
{
Prop_Invalid = 0,
Prop_TrackingSystemName_String = 1000,
Prop_ModelNumber_String = 1001,
Prop_SerialNumber_String = 1002,
@@ -3093,13 +3135,14 @@ public enum ETrackedPropertyError
TrackedProp_ValueNotProvidedByDevice = 7,
TrackedProp_StringExceedsMaximumLength = 8,
TrackedProp_NotYetAvailable = 9,
TrackedProp_PermissionDenied = 10,
}
public enum EVRSubmitFlags
{
Submit_Default = 0,
Submit_LensDistortionAlreadyApplied = 1,
Submit_GlRenderBuffer = 2,
Submit_VulkanTexture = 4,
Submit_Reserved = 4,
}
public enum EVRState
{
@@ -3218,6 +3261,7 @@ public enum EVREventType
VREvent_PerformanceTest_EnableCapture = 1600,
VREvent_PerformanceTest_DisableCapture = 1601,
VREvent_PerformanceTest_FidelityLevel = 1602,
VREvent_MessageOverlay_Closed = 1650,
VREvent_VendorSpecific_Reserved_Start = 10000,
VREvent_VendorSpecific_Reserved_End = 19999,
}
@@ -3369,6 +3413,8 @@ public enum EVRInitError
Init_InvalidApplicationType = 130,
Init_NotAvailableToWatchdogApps = 131,
Init_WatchdogDisabledInSettings = 132,
Init_VRDashboardNotFound = 133,
Init_VRDashboardStartupFailed = 134,
Driver_Failed = 200,
Driver_Unknown = 201,
Driver_HmdUnknown = 202,
@@ -3507,7 +3553,7 @@ public enum ChaperoneCalibrationState
Warning_BaseStationRemoved = 102,
Warning_SeatedBoundsInvalid = 103,
Error = 200,
Error_BaseStationUninitalized = 201,
Error_BaseStationUninitialized = 201,
Error_BaseStationConflict = 202,
Error_PlayAreaInvalid = 203,
Error_CollisionBoundsInvalid = 204,
@@ -3564,6 +3610,17 @@ public enum VROverlayFlags
Panorama = 12,
StereoPanorama = 13,
SortWithNonSceneOverlays = 14,
VisibleInDashboard = 15,
}
public enum VRMessageOverlayResponse
{
ButtonPress_0 = 0,
ButtonPress_1 = 1,
ButtonPress_2 = 2,
ButtonPress_3 = 3,
CouldntFindSystemOverlay = 4,
CouldntFindOrCreateClientOverlay = 5,
ApplicationQuit = 6,
}
public enum EGamepadTextInputMode
{
@@ -3662,6 +3719,10 @@ public enum EVRScreenshotError
[FieldOffset(0)] public VREvent_TouchPadMove_t touchPadMove;
[FieldOffset(0)] public VREvent_SeatedZeroPoseReset_t seatedZeroPoseReset;
[FieldOffset(0)] public VREvent_Screenshot_t screenshot;
[FieldOffset(0)] public VREvent_ScreenshotProgress_t screenshotProgress;
[FieldOffset(0)] public VREvent_ApplicationLaunch_t applicationLaunch;
[FieldOffset(0)] public VREvent_EditingCameraSurface_t cameraSurface;
[FieldOffset(0)] public VREvent_MessageOverlay_t messageOverlay;
[FieldOffset(0)] public VREvent_Keyboard_t keyboard; // This has to be at the end due to a mono bug
}
@@ -3768,7 +3829,7 @@ public enum EVRScreenshotError
[StructLayout(LayoutKind.Sequential)] public struct Texture_t
{
public IntPtr handle; // void *
public EGraphicsAPIConvention eType;
public ETextureType eType;
public EColorSpace eColorSpace;
}
[StructLayout(LayoutKind.Sequential)] public struct TrackedDevicePose_t
@@ -3789,7 +3850,7 @@ public enum EVRScreenshotError
public float uMax;
public float vMax;
}
[StructLayout(LayoutKind.Sequential)] public struct VulkanData_t
[StructLayout(LayoutKind.Sequential)] public struct VRVulkanTextureData_t
{
public ulong m_nImage;
public IntPtr m_pDevice; // struct VkDevice_T *
@@ -3895,6 +3956,10 @@ public enum EVRScreenshotError
public ulong overlayHandle;
public uint nVisualMode;
}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_MessageOverlay_t
{
public uint unVRMessageOverlayResponse;
}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_t
{
public uint eventType;
@@ -4139,7 +4204,7 @@ public class OpenVR
public const uint k_unControllerStateAxisCount = 5;
public const ulong k_ulOverlayHandleInvalid = 0;
public const uint k_unScreenshotHandleInvalid = 0;
public const string IVRSystem_Version = "IVRSystem_014";
public const string IVRSystem_Version = "IVRSystem_015";
public const string IVRExtendedDisplay_Version = "IVRExtendedDisplay_001";
public const string IVRTrackedCamera_Version = "IVRTrackedCamera_003";
public const uint k_unMaxApplicationKeyLength = 128;
@@ -4148,12 +4213,12 @@ public class OpenVR
public const string IVRApplications_Version = "IVRApplications_006";
public const string IVRChaperone_Version = "IVRChaperone_003";
public const string IVRChaperoneSetup_Version = "IVRChaperoneSetup_005";
public const string IVRCompositor_Version = "IVRCompositor_018";
public const string IVRCompositor_Version = "IVRCompositor_019";
public const uint k_unVROverlayMaxKeyLength = 128;
public const uint k_unVROverlayMaxNameLength = 128;
public const uint k_unMaxOverlayCount = 64;
public const uint k_unMaxOverlayIntersectionMaskPrimitivesCount = 32;
public const string IVROverlay_Version = "IVROverlay_013";
public const string IVROverlay_Version = "IVROverlay_014";
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";
@@ -4200,6 +4265,9 @@ public class OpenVR
public const string k_pch_SteamVR_ShowMirrorView_Bool = "showMirrorView";
public const string k_pch_SteamVR_MirrorViewGeometry_String = "mirrorViewGeometry";
public const string k_pch_SteamVR_StartMonitorFromAppLaunch = "startMonitorFromAppLaunch";
public const string k_pch_SteamVR_StartCompositorFromAppLaunch_Bool = "startCompositorFromAppLaunch";
public const string k_pch_SteamVR_StartDashboardFromAppLaunch_Bool = "startDashboardFromAppLaunch";
public const string k_pch_SteamVR_StartOverlayAppsFromDashboard_Bool = "startOverlayAppsFromDashboard";
public const string k_pch_SteamVR_EnableHomeApp = "enableHomeApp";
public const string k_pch_SteamVR_SetInitialDefaultHomeApp = "setInitialDefaultHomeApp";
public const string k_pch_SteamVR_CycleBackgroundImageTimeSec_Int32 = "CycleBackgroundImageTimeSec";