Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ValveSoftware/openvr.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Ludwig <joe@valvesoftware.com>2016-06-10 22:13:33 +0300
committerJoe Ludwig <joe@valvesoftware.com>2016-06-10 22:13:33 +0300
commit0b0e7fb77d5f9c558be2af1c80d1eacf84d4f603 (patch)
tree1d94ca16e04049f7cdddd4a35d5844ef335bdc15
parent0373425bbab6e4d1c03de28715bee90ebd3943c2 (diff)
OpenVR SDK 1.0.1:
IVROverlay: * Added event VREvent_ImageFailed which is sent when SetOverlayFromFile is called and the file load fails. IVRScreenshots: Added a new API via IVRScreenshots for screenshot support in VR. This feature is still being developed and is currently in a beta state. You can enable screenshot capture by selecting Enable Screenshots in the general settings of the VRMonitor. Documentation for this new API is available at, https://github.com/ValveSoftware/openvr/wiki/IVRScreenshots_Overview Driver API: * Split Oculus driver direct mode into a new component and out of IVRDisplayComponent. Other drivers generally don't need to implement this component. [git-p4: depot-paths = "//vr/steamvr/sdk_release/": change = 3492473]
-rwxr-xr-xbin/linux64/libopenvr_api.sobin383497 -> 383669 bytes
-rwxr-xr-xbin/linux64/libopenvr_api.so.dbgbin3119996 -> 3135320 bytes
-rwxr-xr-xbin/osx32/libopenvr_api.dylibbin299972 -> 299972 bytes
-rw-r--r--bin/osx32/libopenvr_api.dylib.dSYM/Contents/Resources/DWARF/libopenvr_api.dylibbin2193362 -> 2194435 bytes
-rw-r--r--bin/win32/openvr_api.dllbin265024 -> 265024 bytes
-rw-r--r--bin/win32/openvr_api.pdbbin4575232 -> 4632576 bytes
-rw-r--r--bin/win64/openvr_api.dllbin311104 -> 311616 bytes
-rw-r--r--bin/win64/openvr_api.pdbbin4337664 -> 4403200 bytes
-rw-r--r--headers/openvr.h76
-rw-r--r--headers/openvr_api.cs160
-rw-r--r--headers/openvr_api.json121
-rw-r--r--headers/openvr_capi.h59
-rw-r--r--headers/openvr_driver.h66
-rwxr-xr-xlib/linux64/libopenvr_api.sobin3114652 -> 3129824 bytes
-rw-r--r--lib/win32/openvr_api.libbin4864 -> 4864 bytes
-rw-r--r--lib/win64/openvr_api.libbin4806 -> 4806 bytes
-rw-r--r--samples/bin/win32/openvr_api.dllbin265024 -> 265024 bytes
-rw-r--r--samples/bin/win64/openvr_api.dllbin311104 -> 311616 bytes
-rw-r--r--unity_package/Assets/Plugins/openvr_api.cs160
-rw-r--r--unity_package/Assets/SteamVR/Editor/SteamVR_Editor.cs2
-rw-r--r--unity_package/Assets/SteamVR/Editor/SteamVR_RenderModelEditor.cs2
-rw-r--r--unity_package/Assets/SteamVR/Editor/SteamVR_Settings.cs2
-rw-r--r--unity_package/Assets/SteamVR/Editor/SteamVR_SkyboxEditor.cs2
-rw-r--r--unity_package/Assets/SteamVR/Editor/SteamVR_Update.cs2
-rw-r--r--unity_package/Assets/SteamVR/Extras/SteamVR_GazeTracker.cs3
-rw-r--r--unity_package/Assets/SteamVR/Extras/SteamVR_LaserPointer.cs3
-rw-r--r--unity_package/Assets/SteamVR/Extras/SteamVR_Teleporter.cs3
-rw-r--r--unity_package/Assets/SteamVR/Extras/SteamVR_TestThrow.cs3
-rw-r--r--unity_package/Assets/SteamVR/Extras/SteamVR_TrackedController.cs3
-rw-r--r--unity_package/Assets/SteamVR/Scripts/SteamVR.cs2
-rw-r--r--unity_package/Assets/SteamVR/Scripts/SteamVR_Camera.cs2
-rw-r--r--unity_package/Assets/SteamVR/Scripts/SteamVR_CameraFlip.cs2
-rw-r--r--unity_package/Assets/SteamVR/Scripts/SteamVR_CameraMask.cs2
-rw-r--r--unity_package/Assets/SteamVR/Scripts/SteamVR_Controller.cs2
-rw-r--r--unity_package/Assets/SteamVR/Scripts/SteamVR_ControllerManager.cs2
-rw-r--r--unity_package/Assets/SteamVR/Scripts/SteamVR_Ears.cs2
-rw-r--r--unity_package/Assets/SteamVR/Scripts/SteamVR_ExternalCamera.cs2
-rw-r--r--unity_package/Assets/SteamVR/Scripts/SteamVR_Fade.cs2
-rw-r--r--unity_package/Assets/SteamVR/Scripts/SteamVR_Frustum.cs2
-rw-r--r--unity_package/Assets/SteamVR/Scripts/SteamVR_GameView.cs28
-rw-r--r--unity_package/Assets/SteamVR/Scripts/SteamVR_IK.cs2
-rw-r--r--unity_package/Assets/SteamVR/Scripts/SteamVR_LoadLevel.cs2
-rw-r--r--unity_package/Assets/SteamVR/Scripts/SteamVR_Menu.cs2
-rw-r--r--unity_package/Assets/SteamVR/Scripts/SteamVR_Overlay.cs2
-rw-r--r--unity_package/Assets/SteamVR/Scripts/SteamVR_PlayArea.cs2
-rw-r--r--unity_package/Assets/SteamVR/Scripts/SteamVR_Render.cs69
-rw-r--r--unity_package/Assets/SteamVR/Scripts/SteamVR_RenderModel.cs2
-rw-r--r--unity_package/Assets/SteamVR/Scripts/SteamVR_Skybox.cs2
-rw-r--r--unity_package/Assets/SteamVR/Scripts/SteamVR_SphericalProjection.cs2
-rw-r--r--unity_package/Assets/SteamVR/Scripts/SteamVR_Stats.cs2
-rw-r--r--unity_package/Assets/SteamVR/Scripts/SteamVR_Status.cs2
-rw-r--r--unity_package/Assets/SteamVR/Scripts/SteamVR_StatusText.cs2
-rw-r--r--unity_package/Assets/SteamVR/Scripts/SteamVR_TestController.cs2
-rw-r--r--unity_package/Assets/SteamVR/Scripts/SteamVR_TrackedObject.cs2
-rw-r--r--unity_package/Assets/SteamVR/Scripts/SteamVR_UpdatePoses.cs2
-rw-r--r--unity_package/Assets/SteamVR/Scripts/SteamVR_Utils.cs1168
-rw-r--r--unity_package/Assets/SteamVR/readme.txt2
57 files changed, 1396 insertions, 586 deletions
diff --git a/bin/linux64/libopenvr_api.so b/bin/linux64/libopenvr_api.so
index 80afcab..c3c6d47 100755
--- a/bin/linux64/libopenvr_api.so
+++ b/bin/linux64/libopenvr_api.so
Binary files differ
diff --git a/bin/linux64/libopenvr_api.so.dbg b/bin/linux64/libopenvr_api.so.dbg
index 19081c5..052fd03 100755
--- a/bin/linux64/libopenvr_api.so.dbg
+++ b/bin/linux64/libopenvr_api.so.dbg
Binary files differ
diff --git a/bin/osx32/libopenvr_api.dylib b/bin/osx32/libopenvr_api.dylib
index a22d3f0..b296e20 100755
--- a/bin/osx32/libopenvr_api.dylib
+++ b/bin/osx32/libopenvr_api.dylib
Binary files 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 9c14f65..ddd0d45 100644
--- 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
Binary files differ
diff --git a/bin/win32/openvr_api.dll b/bin/win32/openvr_api.dll
index d908e09..d2b37d5 100644
--- a/bin/win32/openvr_api.dll
+++ b/bin/win32/openvr_api.dll
Binary files differ
diff --git a/bin/win32/openvr_api.pdb b/bin/win32/openvr_api.pdb
index 2675402..550f13e 100644
--- a/bin/win32/openvr_api.pdb
+++ b/bin/win32/openvr_api.pdb
Binary files differ
diff --git a/bin/win64/openvr_api.dll b/bin/win64/openvr_api.dll
index 904723c..d13791a 100644
--- a/bin/win64/openvr_api.dll
+++ b/bin/win64/openvr_api.dll
Binary files differ
diff --git a/bin/win64/openvr_api.pdb b/bin/win64/openvr_api.pdb
index 01e7b4d..fb428a0 100644
--- a/bin/win64/openvr_api.pdb
+++ b/bin/win64/openvr_api.pdb
Binary files differ
diff --git a/headers/openvr.h b/headers/openvr.h
index 19f4a22..148306a 100644
--- a/headers/openvr.h
+++ b/headers/openvr.h
@@ -267,6 +267,7 @@ enum ETrackedDeviceProperty
Prop_CameraCompatibilityMode_Int32 = 2033,
Prop_ScreenshotHorizontalFieldOfViewDegrees_Float = 2034,
Prop_ScreenshotVerticalFieldOfViewDegrees_Float = 2035,
+ Prop_DisplaySuppressed_Bool = 2036,
// Properties that are unique to TrackedDeviceClass_Controller
Prop_AttachedDeviceId_String = 3000,
@@ -318,7 +319,7 @@ struct VRTextureBounds_t
};
-/** Allows the applicaiton to control how scene textures are used by the compositor when calling Submit. */
+/** Allows the application to control how scene textures are used by the compositor when calling Submit. */
enum EVRSubmitFlags
{
// Simple render path. App submits rendered left and right eye images with no lens distortion correction applied.
@@ -331,10 +332,6 @@ enum EVRSubmitFlags
// If the texture pointer passed in is actually a renderbuffer (e.g. for MSAA in OpenGL) then set this flag.
Submit_GlRenderBuffer = 0x02,
-
- // If you application receives a screenshot request, submit with this flag to let the compositor this submission
- // is in the response to the screenshot
- Submit_Screenshot = 0x04
};
@@ -386,6 +383,7 @@ enum EVREventType
VREvent_SceneApplicationChanged = 404, // data is process - The App actually drawing the scene changed (usually to or from the compositor)
VREvent_SceneFocusChanged = 405, // data is process - New app got access to draw the scene
VREvent_InputFocusChanged = 406, // data is process
+ VREvent_SceneApplicationSecondaryRenderingStarted = 407, // data is process
VREvent_HideRenderModels = 410, // Sent to the scene application to request hiding render models temporarily
VREvent_ShowRenderModels = 411, // Sent to the scene application to request restoring render model visibility
@@ -407,11 +405,13 @@ enum EVREventType
VREvent_DashboardGuideButtonDown = 514,
VREvent_DashboardGuideButtonUp = 515,
VREvent_ScreenshotTriggered = 516, // Screenshot button combo was pressed, Dashboard should request a screenshot
+ VREvent_ImageFailed = 517, // Sent to overlays when a SetOverlayRaw or SetOverlayfromFail fails to load
// Screenshot API
VREvent_RequestScreenshot = 520, // Sent by vrclient application to compositor to take a screenshot
VREvent_ScreenshotTaken = 521, // Sent by compositor to the application that the screenshot has been taken
VREvent_ScreenshotFailed = 522, // Sent by compositor to the application that the screenshot failed to be taken
+ VREvent_SubmitScreenshotToDashboard = 523, // Sent by compositor to the dashboard that a completed screenshot was submitted
VREvent_Notification_Shown = 600,
VREvent_Notification_Hidden = 601,
@@ -628,6 +628,12 @@ struct VREvent_SeatedZeroPoseReset_t
bool bResetBySystemMenu;
};
+struct VREvent_Screenshot_t
+{
+ uint32_t handle;
+ uint32_t type;
+};
+
/** If you change this you must manually update openvr_interop.cs.py */
typedef union
{
@@ -645,6 +651,7 @@ typedef union
VREvent_PerformanceTest_t performanceTest;
VREvent_TouchPadMove_t touchPadMove;
VREvent_SeatedZeroPoseReset_t seatedZeroPoseReset;
+ VREvent_Screenshot_t screenshot;
} VREvent_Data_t;
/** An event posted by the server to all running applications */
@@ -865,6 +872,8 @@ enum EVRInitError
VRInitError_Compositor_Failed = 400,
VRInitError_Compositor_D3D11HardwareRequired = 401,
VRInitError_Compositor_FirmwareRequiresUpdate = 402,
+ VRInitError_Compositor_OverlayInitFailed = 403,
+ VRInitError_Compositor_ScreenshotsInitFailed = 404,
VRInitError_VendorSpecific_UnableToConnectToOculusRuntime = 1000,
@@ -891,7 +900,14 @@ enum EVRScreenshotType
VRScreenshotType_Mono = 1, // left eye only
VRScreenshotType_Stereo = 2,
VRScreenshotType_Cubemap = 3,
- VRScreenshotType_StereoPanorama = 4
+ VRScreenshotType_MonoPanorama = 4,
+ VRScreenshotType_StereoPanorama = 5
+};
+
+enum EVRScreenshotPropertyFilenames
+{
+ VRScreenshotPropertyFilenames_Preview = 0,
+ VRScreenshotPropertyFilenames_VR = 1,
};
enum EVRTrackedCameraError
@@ -923,7 +939,7 @@ enum EVRTrackedCameraFrameType
MAX_CAMERA_FRAME_TYPES
};
-typedef void* TrackedCameraHandle_t;
+typedef uint64_t TrackedCameraHandle_t;
#define INVALID_TRACKED_CAMERA_HANDLE ((vr::TrackedCameraHandle_t)0)
struct CameraVideoStreamFrameHeader_t
@@ -939,6 +955,11 @@ struct CameraVideoStreamFrameHeader_t
TrackedDevicePose_t standingTrackedDevicePose;
};
+// Screenshot types
+typedef uint32_t ScreenshotHandle_t;
+
+static const uint32_t k_unScreenshotHandleInvalid = 0;
+
#pragma pack( pop )
// figure out how to import from the VR API dll
@@ -1523,6 +1544,10 @@ namespace vr
static const char * const k_pch_SteamVR_NeverKillProcesses_Bool = "neverKillProcesses";
static const char * const k_pch_SteamVR_RenderTargetMultiplier_Float = "renderTargetMultiplier";
static const char * const k_pch_SteamVR_AllowReprojection_Bool = "allowReprojection";
+ static const char * const k_pch_SteamVR_ForceReprojection_Bool = "forceReprojection";
+ static const char * const k_pch_SteamVR_ForceFadeOnBadTracking_Bool = "forceFadeOnBadTracking";
+ static const char * const k_pch_SteamVR_DefaultMirrorView_Int32 = "defaultMirrorView";
+ static const char * const k_pch_SteamVR_ShowMirrorView_Bool = "showMirrorView";
//-----------------------------------------------------------------------------
// lighthouse keys
@@ -1825,7 +1850,6 @@ enum EVRCompositorError
VRCompositorError_TextureUsesUnsupportedFormat = 105,
VRCompositorError_SharedTexturesNotSupported = 106,
VRCompositorError_IndexOutOfRange = 107,
- VRCompositorError_ScreenshotAlreadyInProgress = 108,
};
const uint32_t VRCompositor_ReprojectionReason_Cpu = 0x01;
@@ -2021,21 +2045,12 @@ public:
/** Temporarily suspends rendering (useful for finer control over scene transitions). */
virtual void SuspendRendering( bool bSuspend ) = 0;
- /** Request a screenshot of the requested type, application
- * will get an event that the screen shot has started. The
- * application should turn off any stenciling and max out
- * quality for the next frames and include the Screenshot flag
- * when calling Submit so that the compositor knows the
- * screenshot. The application should keep the higher qualtity
- * and submitted with the ScreenShot flag until gets a
- * screenshot End event. It can take several frames for a
- * cubemap to be capture for example. The first file is a
- * boring 2D view used for preview, the second is the actual
- * capture of the requested type. They are the same for
- * VRScreenshotType_Mono */
- virtual vr::EVRCompositorError RequestScreenshot( vr::EVRScreenshotType type, const char *pchDestinationFileName, const char *pchVRDestinationFileName ) = 0;
+ /** Screenshot support */
- /** Returns the current screenshot type if a screenshot is currently being captured **/
+ /** These functions are no longer used and will be removed in
+ * a future update. Use the functions via the
+ * IVRScreenshots interface */
+ virtual vr::EVRCompositorError RequestScreenshot( vr::EVRScreenshotType type, const char *pchDestinationFileName, const char *pchVRDestinationFileName ) = 0;
virtual vr::EVRScreenshotType GetCurrentScreenshotType() = 0;
/** Opens a shared D3D11 texture with the undistorted composited image for each eye. */
@@ -2802,7 +2817,7 @@ public:
virtual vr::EVRTrackedCameraError GetVideoStreamFrameBuffer( vr::TrackedCameraHandle_t hTrackedCamera, vr::EVRTrackedCameraFrameType eFrameType, void *pFrameBuffer, uint32_t nFrameBufferSize, vr::CameraVideoStreamFrameHeader_t *pFrameHeader, uint32_t nFrameHeaderSize ) = 0;
};
-static const char * const IVRTrackedCamera_Version = "IVRTrackedCamera_002";
+static const char * const IVRTrackedCamera_Version = "IVRTrackedCamera_003";
} // namespace vr
@@ -2874,6 +2889,7 @@ namespace vr
typedef EVROverlayError VROverlayError;
typedef EVRFirmwareError VRFirmwareError;
typedef EVRCompositorError VRCompositorError;
+ typedef EVRScreenshotError VRScreenshotsError;
inline uint32_t &VRToken()
{
@@ -2950,6 +2966,17 @@ namespace vr
return m_pVROverlay;
}
+ IVRScreenshots *VRScreenshots()
+ {
+ CheckClear();
+ if ( m_pVRScreenshots == nullptr )
+ {
+ EVRInitError eError;
+ m_pVRScreenshots = ( IVRScreenshots * )VR_GetGenericInterface( IVRScreenshots_Version, &eError );
+ }
+ return m_pVRScreenshots;
+ }
+
IVRRenderModels *VRRenderModels()
{
CheckClear();
@@ -3016,6 +3043,7 @@ namespace vr
IVRSettings *m_pVRSettings;
IVRApplications *m_pVRApplications;
IVRTrackedCamera *m_pVRTrackedCamera;
+ IVRScreenshots *m_pVRScreenshots;
};
inline COpenVRContext &OpenVRInternal_ModuleContext()
@@ -3029,6 +3057,7 @@ namespace vr
inline IVRChaperoneSetup *VR_CALLTYPE VRChaperoneSetup() { return OpenVRInternal_ModuleContext().VRChaperoneSetup(); }
inline IVRCompositor *VR_CALLTYPE VRCompositor() { return OpenVRInternal_ModuleContext().VRCompositor(); }
inline IVROverlay *VR_CALLTYPE VROverlay() { return OpenVRInternal_ModuleContext().VROverlay(); }
+ inline IVRScreenshots *VR_CALLTYPE VRScreenshots() { return OpenVRInternal_ModuleContext().VRScreenshots(); }
inline IVRRenderModels *VR_CALLTYPE VRRenderModels() { return OpenVRInternal_ModuleContext().VRRenderModels(); }
inline IVRApplications *VR_CALLTYPE VRApplications() { return OpenVRInternal_ModuleContext().VRApplications(); }
inline IVRSettings *VR_CALLTYPE VRSettings() { return OpenVRInternal_ModuleContext().VRSettings(); }
@@ -3047,6 +3076,7 @@ namespace vr
m_pVRSettings = nullptr;
m_pVRApplications = nullptr;
m_pVRTrackedCamera = nullptr;
+ m_pVRScreenshots = nullptr;
}
VR_INTERFACE uint32_t VR_CALLTYPE VR_InitInternal( EVRInitError *peError, EVRApplicationType eApplicationType );
diff --git a/headers/openvr_api.cs b/headers/openvr_api.cs
index 6d1c8ed..a4d71f8 100644
--- a/headers/openvr_api.cs
+++ b/headers/openvr_api.cs
@@ -1,4 +1,4 @@
-//======= Copyright 1996-2014, Valve Corporation, All rights reserved. ========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: This file contains C#/managed code bindings for the OpenVR interfaces
// This file is auto-generated, do not edit it.
@@ -286,17 +286,17 @@ public struct IVRTrackedCamera
internal _GetCameraProjection GetCameraProjection;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
- internal delegate EVRTrackedCameraError _AcquireVideoStreamingService(uint nDeviceIndex, IntPtr pHandle);
+ internal delegate EVRTrackedCameraError _AcquireVideoStreamingService(uint nDeviceIndex, ref ulong pHandle);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _AcquireVideoStreamingService AcquireVideoStreamingService;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
- internal delegate EVRTrackedCameraError _ReleaseVideoStreamingService(IntPtr hTrackedCamera);
+ internal delegate EVRTrackedCameraError _ReleaseVideoStreamingService(ulong hTrackedCamera);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ReleaseVideoStreamingService ReleaseVideoStreamingService;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
- internal delegate EVRTrackedCameraError _GetVideoStreamFrameBuffer(IntPtr hTrackedCamera, EVRTrackedCameraFrameType eFrameType, IntPtr pFrameBuffer, uint nFrameBufferSize, ref CameraVideoStreamFrameHeader_t pFrameHeader, uint nFrameHeaderSize);
+ internal delegate EVRTrackedCameraError _GetVideoStreamFrameBuffer(ulong hTrackedCamera, EVRTrackedCameraFrameType eFrameType, IntPtr pFrameBuffer, uint nFrameBufferSize, ref CameraVideoStreamFrameHeader_t pFrameHeader, uint nFrameHeaderSize);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetVideoStreamFrameBuffer GetVideoStreamFrameBuffer;
@@ -1287,6 +1287,46 @@ public struct IVRSettings
}
+[StructLayout(LayoutKind.Sequential)]
+public struct IVRScreenshots
+{
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ internal delegate EVRScreenshotError _RequestScreenshot(ref uint pOutScreenshotHandle, EVRScreenshotType type, string pchPreviewFilename, string pchVRFilename);
+ [MarshalAs(UnmanagedType.FunctionPtr)]
+ internal _RequestScreenshot RequestScreenshot;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ internal delegate EVRScreenshotError _HookScreenshot([In, Out] EVRScreenshotType[] pSupportedTypes, int numTypes);
+ [MarshalAs(UnmanagedType.FunctionPtr)]
+ internal _HookScreenshot HookScreenshot;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ internal delegate EVRScreenshotType _GetScreenshotPropertyType(uint screenshotHandle, ref EVRScreenshotError pError);
+ [MarshalAs(UnmanagedType.FunctionPtr)]
+ internal _GetScreenshotPropertyType GetScreenshotPropertyType;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ internal delegate uint _GetScreenshotPropertyFilename(uint screenshotHandle, EVRScreenshotPropertyFilenames filenameType, System.Text.StringBuilder pchFilename, uint cchFilename, ref EVRScreenshotError pError);
+ [MarshalAs(UnmanagedType.FunctionPtr)]
+ internal _GetScreenshotPropertyFilename GetScreenshotPropertyFilename;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ internal delegate EVRScreenshotError _UpdateScreenshotProgress(uint screenshotHandle, float flProgress);
+ [MarshalAs(UnmanagedType.FunctionPtr)]
+ internal _UpdateScreenshotProgress UpdateScreenshotProgress;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ internal delegate EVRScreenshotError _TakeStereoScreenshot(ref uint pOutScreenshotHandle, string pchPreviewFilename, string pchVRFilename);
+ [MarshalAs(UnmanagedType.FunctionPtr)]
+ internal _TakeStereoScreenshot TakeStereoScreenshot;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ internal delegate EVRScreenshotError _SubmitScreenshot(uint screenshotHandle, EVRScreenshotType type, string pchSourcePreviewFilename, string pchSourceVRFilename);
+ [MarshalAs(UnmanagedType.FunctionPtr)]
+ internal _SubmitScreenshot SubmitScreenshot;
+
+}
+
public class CVRSystem
{
@@ -1585,17 +1625,18 @@ public class CVRTrackedCamera
EVRTrackedCameraError result = FnTable.GetCameraProjection(nDeviceIndex,eFrameType,flZNear,flZFar,ref pProjection);
return result;
}
- public EVRTrackedCameraError AcquireVideoStreamingService(uint nDeviceIndex,IntPtr pHandle)
+ public EVRTrackedCameraError AcquireVideoStreamingService(uint nDeviceIndex,ref ulong pHandle)
{
- EVRTrackedCameraError result = FnTable.AcquireVideoStreamingService(nDeviceIndex,pHandle);
+ pHandle = 0;
+ EVRTrackedCameraError result = FnTable.AcquireVideoStreamingService(nDeviceIndex,ref pHandle);
return result;
}
- public EVRTrackedCameraError ReleaseVideoStreamingService(IntPtr hTrackedCamera)
+ public EVRTrackedCameraError ReleaseVideoStreamingService(ulong hTrackedCamera)
{
EVRTrackedCameraError result = FnTable.ReleaseVideoStreamingService(hTrackedCamera);
return result;
}
- public EVRTrackedCameraError GetVideoStreamFrameBuffer(IntPtr hTrackedCamera,EVRTrackedCameraFrameType eFrameType,IntPtr pFrameBuffer,uint nFrameBufferSize,ref CameraVideoStreamFrameHeader_t pFrameHeader,uint nFrameHeaderSize)
+ public EVRTrackedCameraError GetVideoStreamFrameBuffer(ulong hTrackedCamera,EVRTrackedCameraFrameType eFrameType,IntPtr pFrameBuffer,uint nFrameBufferSize,ref CameraVideoStreamFrameHeader_t pFrameHeader,uint nFrameHeaderSize)
{
EVRTrackedCameraError result = FnTable.GetVideoStreamFrameBuffer(hTrackedCamera,eFrameType,pFrameBuffer,nFrameBufferSize,ref pFrameHeader,nFrameHeaderSize);
return result;
@@ -2626,6 +2667,53 @@ public class CVRSettings
}
+public class CVRScreenshots
+{
+ IVRScreenshots FnTable;
+ internal CVRScreenshots(IntPtr pInterface)
+ {
+ FnTable = (IVRScreenshots)Marshal.PtrToStructure(pInterface, typeof(IVRScreenshots));
+ }
+ public EVRScreenshotError RequestScreenshot(ref uint pOutScreenshotHandle,EVRScreenshotType type,string pchPreviewFilename,string pchVRFilename)
+ {
+ pOutScreenshotHandle = 0;
+ EVRScreenshotError result = FnTable.RequestScreenshot(ref pOutScreenshotHandle,type,pchPreviewFilename,pchVRFilename);
+ return result;
+ }
+ public EVRScreenshotError HookScreenshot(EVRScreenshotType [] pSupportedTypes)
+ {
+ EVRScreenshotError result = FnTable.HookScreenshot(pSupportedTypes,(int) pSupportedTypes.Length);
+ return result;
+ }
+ public EVRScreenshotType GetScreenshotPropertyType(uint screenshotHandle,ref EVRScreenshotError pError)
+ {
+ EVRScreenshotType result = FnTable.GetScreenshotPropertyType(screenshotHandle,ref pError);
+ return result;
+ }
+ public uint GetScreenshotPropertyFilename(uint screenshotHandle,EVRScreenshotPropertyFilenames filenameType,System.Text.StringBuilder pchFilename,uint cchFilename,ref EVRScreenshotError pError)
+ {
+ uint result = FnTable.GetScreenshotPropertyFilename(screenshotHandle,filenameType,pchFilename,cchFilename,ref pError);
+ return result;
+ }
+ public EVRScreenshotError UpdateScreenshotProgress(uint screenshotHandle,float flProgress)
+ {
+ EVRScreenshotError result = FnTable.UpdateScreenshotProgress(screenshotHandle,flProgress);
+ return result;
+ }
+ public EVRScreenshotError TakeStereoScreenshot(ref uint pOutScreenshotHandle,string pchPreviewFilename,string pchVRFilename)
+ {
+ pOutScreenshotHandle = 0;
+ EVRScreenshotError result = FnTable.TakeStereoScreenshot(ref pOutScreenshotHandle,pchPreviewFilename,pchVRFilename);
+ return result;
+ }
+ public EVRScreenshotError SubmitScreenshot(uint screenshotHandle,EVRScreenshotType type,string pchSourcePreviewFilename,string pchSourceVRFilename)
+ {
+ EVRScreenshotError result = FnTable.SubmitScreenshot(screenshotHandle,type,pchSourcePreviewFilename,pchSourceVRFilename);
+ return result;
+ }
+}
+
+
public class OpenVRInterop
{
[DllImportAttribute("openvr_api", EntryPoint = "VR_InitInternal")]
@@ -2762,6 +2850,7 @@ public enum ETrackedDeviceProperty
Prop_CameraCompatibilityMode_Int32 = 2033,
Prop_ScreenshotHorizontalFieldOfViewDegrees_Float = 2034,
Prop_ScreenshotVerticalFieldOfViewDegrees_Float = 2035,
+ Prop_DisplaySuppressed_Bool = 2036,
Prop_AttachedDeviceId_String = 3000,
Prop_SupportedButtons_Uint64 = 3001,
Prop_Axis0Type_Int32 = 3002,
@@ -2797,7 +2886,6 @@ public enum EVRSubmitFlags
Submit_Default = 0,
Submit_LensDistortionAlreadyApplied = 1,
Submit_GlRenderBuffer = 2,
- Submit_Screenshot = 4,
}
public enum EVRState
{
@@ -2840,6 +2928,7 @@ public enum EVREventType
VREvent_SceneApplicationChanged = 404,
VREvent_SceneFocusChanged = 405,
VREvent_InputFocusChanged = 406,
+ VREvent_SceneApplicationSecondaryRenderingStarted = 407,
VREvent_HideRenderModels = 410,
VREvent_ShowRenderModels = 411,
VREvent_OverlayShown = 500,
@@ -2859,9 +2948,11 @@ public enum EVREventType
VREvent_DashboardGuideButtonDown = 514,
VREvent_DashboardGuideButtonUp = 515,
VREvent_ScreenshotTriggered = 516,
+ VREvent_ImageFailed = 517,
VREvent_RequestScreenshot = 520,
VREvent_ScreenshotTaken = 521,
VREvent_ScreenshotFailed = 522,
+ VREvent_SubmitScreenshotToDashboard = 523,
VREvent_Notification_Shown = 600,
VREvent_Notification_Hidden = 601,
VREvent_Notification_BeginInteraction = 602,
@@ -3054,6 +3145,8 @@ public enum EVRInitError
Compositor_Failed = 400,
Compositor_D3D11HardwareRequired = 401,
Compositor_FirmwareRequiresUpdate = 402,
+ Compositor_OverlayInitFailed = 403,
+ Compositor_ScreenshotsInitFailed = 404,
VendorSpecific_UnableToConnectToOculusRuntime = 1000,
VendorSpecific_HmdFound_CantOpenDevice = 1101,
VendorSpecific_HmdFound_UnableToRequestConfigStart = 1102,
@@ -3076,7 +3169,13 @@ public enum EVRScreenshotType
Mono = 1,
Stereo = 2,
Cubemap = 3,
- StereoPanorama = 4,
+ MonoPanorama = 4,
+ StereoPanorama = 5,
+}
+public enum EVRScreenshotPropertyFilenames
+{
+ Preview = 0,
+ VR = 1,
}
public enum EVRTrackedCameraError
{
@@ -3186,7 +3285,6 @@ public enum EVRCompositorError
TextureUsesUnsupportedFormat = 105,
SharedTexturesNotSupported = 106,
IndexOutOfRange = 107,
- ScreenshotAlreadyInProgress = 108,
}
public enum VROverlayInputMethod
{
@@ -3281,6 +3379,15 @@ public enum EVRSettingsError
WriteFailed = 2,
ReadFailed = 3,
}
+public enum EVRScreenshotError
+{
+ None = 0,
+ RequestFailed = 1,
+ IncompatibleVersion = 100,
+ NotFound = 101,
+ BufferTooSmall = 102,
+ ScreenshotAlreadyInProgress = 108,
+}
[StructLayout(LayoutKind.Explicit)] public struct VREvent_Data_t
{
@@ -3297,6 +3404,7 @@ public enum EVRSettingsError
[FieldOffset(0)] public VREvent_PerformanceTest_t performanceTest;
[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_Keyboard_t keyboard; // This has to be at the end due to a mono bug
}
@@ -3491,6 +3599,11 @@ public enum EVRSettingsError
[MarshalAs(UnmanagedType.I1)]
public bool bResetBySystemMenu;
}
+[StructLayout(LayoutKind.Sequential)] public struct VREvent_Screenshot_t
+{
+ public uint handle;
+ public uint type;
+}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_t
{
public uint eventType;
@@ -3660,6 +3773,7 @@ public enum EVRSettingsError
public IntPtr m_pVRSettings; // class vr::IVRSettings *
public IntPtr m_pVRApplications; // class vr::IVRApplications *
public IntPtr m_pVRTrackedCamera; // class vr::IVRTrackedCamera *
+ public IntPtr m_pVRScreenshots; // class vr::IVRScreenshots *
}
public class OpenVR
@@ -3714,9 +3828,10 @@ public class OpenVR
public const uint k_unMaxPropertyStringSize = 32768;
public const uint k_unControllerStateAxisCount = 5;
public const ulong k_ulOverlayHandleInvalid = 0;
+ public const uint k_unScreenshotHandleInvalid = 0;
public const string IVRSystem_Version = "IVRSystem_012";
public const string IVRExtendedDisplay_Version = "IVRExtendedDisplay_001";
- public const string IVRTrackedCamera_Version = "IVRTrackedCamera_002";
+ public const string IVRTrackedCamera_Version = "IVRTrackedCamera_003";
public const uint k_unMaxApplicationKeyLength = 128;
public const string IVRApplications_Version = "IVRApplications_005";
public const string IVRChaperone_Version = "IVRChaperone_003";
@@ -3768,6 +3883,10 @@ public class OpenVR
public const string k_pch_SteamVR_NeverKillProcesses_Bool = "neverKillProcesses";
public const string k_pch_SteamVR_RenderTargetMultiplier_Float = "renderTargetMultiplier";
public const string k_pch_SteamVR_AllowReprojection_Bool = "allowReprojection";
+ public const string k_pch_SteamVR_ForceReprojection_Bool = "forceReprojection";
+ public const string k_pch_SteamVR_ForceFadeOnBadTracking_Bool = "forceFadeOnBadTracking";
+ public const string k_pch_SteamVR_DefaultMirrorView_Int32 = "defaultMirrorView";
+ public const string k_pch_SteamVR_ShowMirrorView_Bool = "showMirrorView";
public const string k_pch_Lighthouse_Section = "driver_lighthouse";
public const string k_pch_Lighthouse_DisableIMU_Bool = "disableimu";
public const string k_pch_Lighthouse_UseDisambiguation_String = "usedisambiguation";
@@ -3836,6 +3955,7 @@ public class OpenVR
public const string k_pch_audio_OffRecordDevice_String = "offRecordDevice";
public const string k_pch_audio_VIVEHDMIGain = "viveHDMIGain";
public const string k_pch_modelskin_Section = "modelskins";
+ public const string IVRScreenshots_Version = "IVRScreenshots_001";
static uint VRToken { get; set; }
@@ -3856,6 +3976,7 @@ public class OpenVR
m_pVRExtendedDisplay = null;
m_pVRSettings = null;
m_pVRApplications = null;
+ m_pVRScreenshots = null;
}
void CheckClear()
@@ -3984,6 +4105,19 @@ public class OpenVR
return m_pVRApplications;
}
+ public CVRScreenshots VRScreenshots()
+ {
+ CheckClear();
+ if (m_pVRScreenshots == null)
+ {
+ var eError = EVRInitError.None;
+ var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRScreenshots_Version, ref eError);
+ if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
+ m_pVRScreenshots = new CVRScreenshots(pInterface);
+ }
+ return m_pVRScreenshots;
+ }
+
private CVRSystem m_pVRSystem;
private CVRChaperone m_pVRChaperone;
private CVRChaperoneSetup m_pVRChaperoneSetup;
@@ -3993,6 +4127,7 @@ public class OpenVR
private CVRExtendedDisplay m_pVRExtendedDisplay;
private CVRSettings m_pVRSettings;
private CVRApplications m_pVRApplications;
+ private CVRScreenshots m_pVRScreenshots;
};
private static COpenVRContext _OpenVRInternal_ModuleContext = null;
@@ -4015,6 +4150,7 @@ public class OpenVR
public static CVRApplications Applications { get { return OpenVRInternal_ModuleContext.VRApplications(); } }
public static CVRSettings Settings { get { return OpenVRInternal_ModuleContext.VRSettings(); } }
public static CVRExtendedDisplay ExtendedDisplay { get { return OpenVRInternal_ModuleContext.VRExtendedDisplay(); } }
+ public static CVRScreenshots Screenshots { get { return OpenVRInternal_ModuleContext.VRScreenshots(); } }
/** Finds the active installation of vrclient.dll and initializes it */
public static CVRSystem Init(ref EVRInitError peError, EVRApplicationType eApplicationType = EVRApplicationType.VRApplication_Scene)
diff --git a/headers/openvr_api.json b/headers/openvr_api.json
index e64e945..c72b2c4 100644
--- a/headers/openvr_api.json
+++ b/headers/openvr_api.json
@@ -5,7 +5,8 @@
,{"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"}
-,{"typedef": "vr::TrackedCameraHandle_t","type": "void *"}
+,{"typedef": "vr::TrackedCameraHandle_t","type": "uint64_t"}
+,{"typedef": "vr::ScreenshotHandle_t","type": "uint32_t"}
,{"typedef": "vr::VRComponentProperties","type": "uint32_t"}
,{"typedef": "vr::TextureID_t","type": "int32_t"}
,{"typedef": "vr::VRNotificationId","type": "uint32_t"}
@@ -24,6 +25,7 @@
,{"typedef": "vr::VROverlayError","type": "enum vr::EVROverlayError"}
,{"typedef": "vr::VRFirmwareError","type": "enum vr::EVRFirmwareError"}
,{"typedef": "vr::VRCompositorError","type": "enum vr::EVRCompositorError"}
+,{"typedef": "vr::VRScreenshotsError","type": "enum vr::EVRScreenshotError"}
],
"enums":[
{"enumname": "vr::EVREye","values": [
@@ -133,6 +135,7 @@
,{"name": "Prop_CameraCompatibilityMode_Int32","value": "2033"}
,{"name": "Prop_ScreenshotHorizontalFieldOfViewDegrees_Float","value": "2034"}
,{"name": "Prop_ScreenshotVerticalFieldOfViewDegrees_Float","value": "2035"}
+ ,{"name": "Prop_DisplaySuppressed_Bool","value": "2036"}
,{"name": "Prop_AttachedDeviceId_String","value": "3000"}
,{"name": "Prop_SupportedButtons_Uint64","value": "3001"}
,{"name": "Prop_Axis0Type_Int32","value": "3002"}
@@ -166,7 +169,6 @@
{"name": "Submit_Default","value": "0"}
,{"name": "Submit_LensDistortionAlreadyApplied","value": "1"}
,{"name": "Submit_GlRenderBuffer","value": "2"}
- ,{"name": "Submit_Screenshot","value": "4"}
]}
, {"enumname": "vr::EVRState","values": [
{"name": "VRState_Undefined","value": "-1"}
@@ -207,6 +209,7 @@
,{"name": "VREvent_SceneApplicationChanged","value": "404"}
,{"name": "VREvent_SceneFocusChanged","value": "405"}
,{"name": "VREvent_InputFocusChanged","value": "406"}
+ ,{"name": "VREvent_SceneApplicationSecondaryRenderingStarted","value": "407"}
,{"name": "VREvent_HideRenderModels","value": "410"}
,{"name": "VREvent_ShowRenderModels","value": "411"}
,{"name": "VREvent_OverlayShown","value": "500"}
@@ -226,9 +229,11 @@
,{"name": "VREvent_DashboardGuideButtonDown","value": "514"}
,{"name": "VREvent_DashboardGuideButtonUp","value": "515"}
,{"name": "VREvent_ScreenshotTriggered","value": "516"}
+ ,{"name": "VREvent_ImageFailed","value": "517"}
,{"name": "VREvent_RequestScreenshot","value": "520"}
,{"name": "VREvent_ScreenshotTaken","value": "521"}
,{"name": "VREvent_ScreenshotFailed","value": "522"}
+ ,{"name": "VREvent_SubmitScreenshotToDashboard","value": "523"}
,{"name": "VREvent_Notification_Shown","value": "600"}
,{"name": "VREvent_Notification_Hidden","value": "601"}
,{"name": "VREvent_Notification_BeginInteraction","value": "602"}
@@ -410,6 +415,8 @@
,{"name": "VRInitError_Compositor_Failed","value": "400"}
,{"name": "VRInitError_Compositor_D3D11HardwareRequired","value": "401"}
,{"name": "VRInitError_Compositor_FirmwareRequiresUpdate","value": "402"}
+ ,{"name": "VRInitError_Compositor_OverlayInitFailed","value": "403"}
+ ,{"name": "VRInitError_Compositor_ScreenshotsInitFailed","value": "404"}
,{"name": "VRInitError_VendorSpecific_UnableToConnectToOculusRuntime","value": "1000"}
,{"name": "VRInitError_VendorSpecific_HmdFound_CantOpenDevice","value": "1101"}
,{"name": "VRInitError_VendorSpecific_HmdFound_UnableToRequestConfigStart","value": "1102"}
@@ -431,7 +438,12 @@
,{"name": "VRScreenshotType_Mono","value": "1"}
,{"name": "VRScreenshotType_Stereo","value": "2"}
,{"name": "VRScreenshotType_Cubemap","value": "3"}
- ,{"name": "VRScreenshotType_StereoPanorama","value": "4"}
+ ,{"name": "VRScreenshotType_MonoPanorama","value": "4"}
+ ,{"name": "VRScreenshotType_StereoPanorama","value": "5"}
+]}
+, {"enumname": "vr::EVRScreenshotPropertyFilenames","values": [
+ {"name": "VRScreenshotPropertyFilenames_Preview","value": "0"}
+ ,{"name": "VRScreenshotPropertyFilenames_VR","value": "1"}
]}
, {"enumname": "vr::EVRTrackedCameraError","values": [
{"name": "VRTrackedCameraError_None","value": "0"}
@@ -532,7 +544,6 @@
,{"name": "VRCompositorError_TextureUsesUnsupportedFormat","value": "105"}
,{"name": "VRCompositorError_SharedTexturesNotSupported","value": "106"}
,{"name": "VRCompositorError_IndexOutOfRange","value": "107"}
- ,{"name": "VRCompositorError_ScreenshotAlreadyInProgress","value": "108"}
]}
, {"enumname": "vr::VROverlayInputMethod","values": [
{"name": "VROverlayInputMethod_None","value": "0"}
@@ -616,6 +627,14 @@
,{"name": "VRSettingsError_WriteFailed","value": "2"}
,{"name": "VRSettingsError_ReadFailed","value": "3"}
]}
+, {"enumname": "vr::EVRScreenshotError","values": [
+ {"name": "VRScreenshotError_None","value": "0"}
+ ,{"name": "VRScreenshotError_RequestFailed","value": "1"}
+ ,{"name": "VRScreenshotError_IncompatibleVersion","value": "100"}
+ ,{"name": "VRScreenshotError_NotFound","value": "101"}
+ ,{"name": "VRScreenshotError_BufferTooSmall","value": "102"}
+ ,{"name": "VRScreenshotError_ScreenshotAlreadyInProgress","value": "108"}
+]}
],
"consts":[{
"constname": "k_unTrackingStringSize","consttype": "const uint32_t", "constval": "32"}
@@ -636,11 +655,13 @@
,{
"constname": "k_ulOverlayHandleInvalid","consttype": "const VROverlayHandle_t", "constval": "0"}
,{
+ "constname": "k_unScreenshotHandleInvalid","consttype": "const uint32_t", "constval": "0"}
+,{
"constname": "IVRSystem_Version","consttype": "const char *const", "constval": "IVRSystem_012"}
,{
"constname": "IVRExtendedDisplay_Version","consttype": "const char *const", "constval": "IVRExtendedDisplay_001"}
,{
- "constname": "IVRTrackedCamera_Version","consttype": "const char *const", "constval": "IVRTrackedCamera_002"}
+ "constname": "IVRTrackedCamera_Version","consttype": "const char *const", "constval": "IVRTrackedCamera_003"}
,{
"constname": "k_unMaxApplicationKeyLength","consttype": "const uint32_t", "constval": "128"}
,{
@@ -744,6 +765,14 @@
,{
"constname": "k_pch_SteamVR_AllowReprojection_Bool","consttype": "const char *const", "constval": "allowReprojection"}
,{
+ "constname": "k_pch_SteamVR_ForceReprojection_Bool","consttype": "const char *const", "constval": "forceReprojection"}
+,{
+ "constname": "k_pch_SteamVR_ForceFadeOnBadTracking_Bool","consttype": "const char *const", "constval": "forceFadeOnBadTracking"}
+,{
+ "constname": "k_pch_SteamVR_DefaultMirrorView_Int32","consttype": "const char *const", "constval": "defaultMirrorView"}
+,{
+ "constname": "k_pch_SteamVR_ShowMirrorView_Bool","consttype": "const char *const", "constval": "showMirrorView"}
+,{
"constname": "k_pch_Lighthouse_Section","consttype": "const char *const", "constval": "driver_lighthouse"}
,{
"constname": "k_pch_Lighthouse_DisableIMU_Bool","consttype": "const char *const", "constval": "disableimu"}
@@ -879,6 +908,8 @@
"constname": "k_pch_audio_VIVEHDMIGain","consttype": "const char *const", "constval": "viveHDMIGain"}
,{
"constname": "k_pch_modelskin_Section","consttype": "const char *const", "constval": "modelskins"}
+,{
+ "constname": "IVRScreenshots_Version","consttype": "const char *const", "constval": "IVRScreenshots_001"}
],
"structs":[{"struct": "vr::HmdMatrix34_t","fields": [
{ "fieldname": "m", "fieldtype": "float [3][4]"}]}
@@ -970,6 +1001,9 @@
{ "fieldname": "m_nFidelityLevel", "fieldtype": "uint32_t"}]}
,{"struct": "vr::VREvent_SeatedZeroPoseReset_t","fields": [
{ "fieldname": "bResetBySystemMenu", "fieldtype": "_Bool"}]}
+,{"struct": "vr::VREvent_Screenshot_t","fields": [
+{ "fieldname": "handle", "fieldtype": "uint32_t"},
+{ "fieldname": "type", "fieldtype": "uint32_t"}]}
,{"struct": "vr::(anonymous)","fields": [
{ "fieldname": "reserved", "fieldtype": "struct vr::VREvent_Reserved_t"},
{ "fieldname": "controller", "fieldtype": "struct vr::VREvent_Controller_t"},
@@ -984,7 +1018,8 @@
{ "fieldname": "chaperone", "fieldtype": "struct vr::VREvent_Chaperone_t"},
{ "fieldname": "performanceTest", "fieldtype": "struct vr::VREvent_PerformanceTest_t"},
{ "fieldname": "touchPadMove", "fieldtype": "struct vr::VREvent_TouchPadMove_t"},
-{ "fieldname": "seatedZeroPoseReset", "fieldtype": "struct vr::VREvent_SeatedZeroPoseReset_t"}]}
+{ "fieldname": "seatedZeroPoseReset", "fieldtype": "struct vr::VREvent_SeatedZeroPoseReset_t"},
+{ "fieldname": "screenshot", "fieldtype": "struct vr::VREvent_Screenshot_t"}]}
,{"struct": "vr::VREvent_t","fields": [
{ "fieldname": "eventType", "fieldtype": "uint32_t"},
{ "fieldname": "trackedDeviceIndex", "fieldtype": "TrackedDeviceIndex_t"},
@@ -1110,7 +1145,8 @@
{ "fieldname": "m_pVRExtendedDisplay", "fieldtype": "class vr::IVRExtendedDisplay *"},
{ "fieldname": "m_pVRSettings", "fieldtype": "class vr::IVRSettings *"},
{ "fieldname": "m_pVRApplications", "fieldtype": "class vr::IVRApplications *"},
-{ "fieldname": "m_pVRTrackedCamera", "fieldtype": "class vr::IVRTrackedCamera *"}]}
+{ "fieldname": "m_pVRTrackedCamera", "fieldtype": "class vr::IVRTrackedCamera *"},
+{ "fieldname": "m_pVRScreenshots", "fieldtype": "class vr::IVRScreenshots *"}]}
],
"methods":[{
"classname": "vr::IVRSystem",
@@ -3236,5 +3272,76 @@
{ "paramname": "peError" ,"paramtype": "vr::EVRSettingsError *"}
]
}
+,{
+ "classname": "vr::IVRScreenshots",
+ "methodname": "RequestScreenshot",
+ "returntype": "vr::EVRScreenshotError",
+ "params": [
+{ "paramname": "pOutScreenshotHandle" ,"paramtype": "vr::ScreenshotHandle_t *"},
+{ "paramname": "type" ,"paramtype": "vr::EVRScreenshotType"},
+{ "paramname": "pchPreviewFilename" ,"paramtype": "const char *"},
+{ "paramname": "pchVRFilename" ,"paramtype": "const char *"}
+ ]
+}
+,{
+ "classname": "vr::IVRScreenshots",
+ "methodname": "HookScreenshot",
+ "returntype": "vr::EVRScreenshotError",
+ "params": [
+{ "paramname": "pSupportedTypes" ,"array_count": "numTypes" ,"paramtype": "const vr::EVRScreenshotType *"},
+{ "paramname": "numTypes" ,"paramtype": "int"}
+ ]
+}
+,{
+ "classname": "vr::IVRScreenshots",
+ "methodname": "GetScreenshotPropertyType",
+ "returntype": "vr::EVRScreenshotType",
+ "params": [
+{ "paramname": "screenshotHandle" ,"paramtype": "vr::ScreenshotHandle_t"},
+{ "paramname": "pError" ,"paramtype": "vr::EVRScreenshotError *"}
+ ]
+}
+,{
+ "classname": "vr::IVRScreenshots",
+ "methodname": "GetScreenshotPropertyFilename",
+ "returntype": "uint32_t",
+ "params": [
+{ "paramname": "screenshotHandle" ,"paramtype": "vr::ScreenshotHandle_t"},
+{ "paramname": "filenameType" ,"paramtype": "vr::EVRScreenshotPropertyFilenames"},
+{ "paramname": "pchFilename" ,"out_string": " " ,"paramtype": "char *"},
+{ "paramname": "cchFilename" ,"paramtype": "uint32_t"},
+{ "paramname": "pError" ,"paramtype": "vr::EVRScreenshotError *"}
+ ]
+}
+,{
+ "classname": "vr::IVRScreenshots",
+ "methodname": "UpdateScreenshotProgress",
+ "returntype": "vr::EVRScreenshotError",
+ "params": [
+{ "paramname": "screenshotHandle" ,"paramtype": "vr::ScreenshotHandle_t"},
+{ "paramname": "flProgress" ,"paramtype": "float"}
+ ]
+}
+,{
+ "classname": "vr::IVRScreenshots",
+ "methodname": "TakeStereoScreenshot",
+ "returntype": "vr::EVRScreenshotError",
+ "params": [
+{ "paramname": "pOutScreenshotHandle" ,"paramtype": "vr::ScreenshotHandle_t *"},
+{ "paramname": "pchPreviewFilename" ,"paramtype": "const char *"},
+{ "paramname": "pchVRFilename" ,"paramtype": "const char *"}
+ ]
+}
+,{
+ "classname": "vr::IVRScreenshots",
+ "methodname": "SubmitScreenshot",
+ "returntype": "vr::EVRScreenshotError",
+ "params": [
+{ "paramname": "screenshotHandle" ,"paramtype": "vr::ScreenshotHandle_t"},
+{ "paramname": "type" ,"paramtype": "vr::EVRScreenshotType"},
+{ "paramname": "pchSourcePreviewFilename" ,"paramtype": "const char *"},
+{ "paramname": "pchSourceVRFilename" ,"paramtype": "const char *"}
+ ]
+}
]
} \ No newline at end of file
diff --git a/headers/openvr_capi.h b/headers/openvr_capi.h
index 3f1f58a..76eafd4 100644
--- a/headers/openvr_capi.h
+++ b/headers/openvr_capi.h
@@ -1,4 +1,4 @@
-//======= Copyright 1996-2016, Valve Corporation, All rights reserved. ========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Header for flatted SteamAPI. Use this for binding to other languages.
// This file is auto-generated, do not edit it.
@@ -60,9 +60,10 @@ static const unsigned int k_unTrackedDeviceIndexInvalid = 4294967295;
static const unsigned int k_unMaxPropertyStringSize = 32768;
static const unsigned int k_unControllerStateAxisCount = 5;
static const unsigned long k_ulOverlayHandleInvalid = 0;
+static const unsigned int k_unScreenshotHandleInvalid = 0;
static const char * IVRSystem_Version = "IVRSystem_012";
static const char * IVRExtendedDisplay_Version = "IVRExtendedDisplay_001";
-static const char * IVRTrackedCamera_Version = "IVRTrackedCamera_002";
+static const char * IVRTrackedCamera_Version = "IVRTrackedCamera_003";
static const unsigned int k_unMaxApplicationKeyLength = 128;
static const char * IVRApplications_Version = "IVRApplications_005";
static const char * IVRChaperone_Version = "IVRChaperone_003";
@@ -114,6 +115,10 @@ static const char * k_pch_SteamVR_BaseStationPowerManagement_Bool = "basestation
static const char * k_pch_SteamVR_NeverKillProcesses_Bool = "neverKillProcesses";
static const char * k_pch_SteamVR_RenderTargetMultiplier_Float = "renderTargetMultiplier";
static const char * k_pch_SteamVR_AllowReprojection_Bool = "allowReprojection";
+static const char * k_pch_SteamVR_ForceReprojection_Bool = "forceReprojection";
+static const char * k_pch_SteamVR_ForceFadeOnBadTracking_Bool = "forceFadeOnBadTracking";
+static const char * k_pch_SteamVR_DefaultMirrorView_Int32 = "defaultMirrorView";
+static const char * k_pch_SteamVR_ShowMirrorView_Bool = "showMirrorView";
static const char * k_pch_Lighthouse_Section = "driver_lighthouse";
static const char * k_pch_Lighthouse_DisableIMU_Bool = "disableimu";
static const char * k_pch_Lighthouse_UseDisambiguation_String = "usedisambiguation";
@@ -182,6 +187,7 @@ static const char * k_pch_audio_OffPlaybackDevice_String = "offPlaybackDevice";
static const char * k_pch_audio_OffRecordDevice_String = "offRecordDevice";
static const char * k_pch_audio_VIVEHDMIGain = "viveHDMIGain";
static const char * k_pch_modelskin_Section = "modelskins";
+static const char * IVRScreenshots_Version = "IVRScreenshots_001";
// OpenVR Enums
@@ -307,6 +313,7 @@ typedef enum ETrackedDeviceProperty
ETrackedDeviceProperty_Prop_CameraCompatibilityMode_Int32 = 2033,
ETrackedDeviceProperty_Prop_ScreenshotHorizontalFieldOfViewDegrees_Float = 2034,
ETrackedDeviceProperty_Prop_ScreenshotVerticalFieldOfViewDegrees_Float = 2035,
+ ETrackedDeviceProperty_Prop_DisplaySuppressed_Bool = 2036,
ETrackedDeviceProperty_Prop_AttachedDeviceId_String = 3000,
ETrackedDeviceProperty_Prop_SupportedButtons_Uint64 = 3001,
ETrackedDeviceProperty_Prop_Axis0Type_Int32 = 3002,
@@ -344,7 +351,6 @@ typedef enum EVRSubmitFlags
EVRSubmitFlags_Submit_Default = 0,
EVRSubmitFlags_Submit_LensDistortionAlreadyApplied = 1,
EVRSubmitFlags_Submit_GlRenderBuffer = 2,
- EVRSubmitFlags_Submit_Screenshot = 4,
} EVRSubmitFlags;
typedef enum EVRState
@@ -389,6 +395,7 @@ typedef enum EVREventType
EVREventType_VREvent_SceneApplicationChanged = 404,
EVREventType_VREvent_SceneFocusChanged = 405,
EVREventType_VREvent_InputFocusChanged = 406,
+ EVREventType_VREvent_SceneApplicationSecondaryRenderingStarted = 407,
EVREventType_VREvent_HideRenderModels = 410,
EVREventType_VREvent_ShowRenderModels = 411,
EVREventType_VREvent_OverlayShown = 500,
@@ -408,9 +415,11 @@ typedef enum EVREventType
EVREventType_VREvent_DashboardGuideButtonDown = 514,
EVREventType_VREvent_DashboardGuideButtonUp = 515,
EVREventType_VREvent_ScreenshotTriggered = 516,
+ EVREventType_VREvent_ImageFailed = 517,
EVREventType_VREvent_RequestScreenshot = 520,
EVREventType_VREvent_ScreenshotTaken = 521,
EVREventType_VREvent_ScreenshotFailed = 522,
+ EVREventType_VREvent_SubmitScreenshotToDashboard = 523,
EVREventType_VREvent_Notification_Shown = 600,
EVREventType_VREvent_Notification_Hidden = 601,
EVREventType_VREvent_Notification_BeginInteraction = 602,
@@ -614,6 +623,8 @@ typedef enum EVRInitError
EVRInitError_VRInitError_Compositor_Failed = 400,
EVRInitError_VRInitError_Compositor_D3D11HardwareRequired = 401,
EVRInitError_VRInitError_Compositor_FirmwareRequiresUpdate = 402,
+ EVRInitError_VRInitError_Compositor_OverlayInitFailed = 403,
+ EVRInitError_VRInitError_Compositor_ScreenshotsInitFailed = 404,
EVRInitError_VRInitError_VendorSpecific_UnableToConnectToOculusRuntime = 1000,
EVRInitError_VRInitError_VendorSpecific_HmdFound_CantOpenDevice = 1101,
EVRInitError_VRInitError_VendorSpecific_HmdFound_UnableToRequestConfigStart = 1102,
@@ -637,9 +648,16 @@ typedef enum EVRScreenshotType
EVRScreenshotType_VRScreenshotType_Mono = 1,
EVRScreenshotType_VRScreenshotType_Stereo = 2,
EVRScreenshotType_VRScreenshotType_Cubemap = 3,
- EVRScreenshotType_VRScreenshotType_StereoPanorama = 4,
+ EVRScreenshotType_VRScreenshotType_MonoPanorama = 4,
+ EVRScreenshotType_VRScreenshotType_StereoPanorama = 5,
} EVRScreenshotType;
+typedef enum EVRScreenshotPropertyFilenames
+{
+ EVRScreenshotPropertyFilenames_VRScreenshotPropertyFilenames_Preview = 0,
+ EVRScreenshotPropertyFilenames_VRScreenshotPropertyFilenames_VR = 1,
+} EVRScreenshotPropertyFilenames;
+
typedef enum EVRTrackedCameraError
{
EVRTrackedCameraError_VRTrackedCameraError_None = 0,
@@ -756,7 +774,6 @@ typedef enum EVRCompositorError
EVRCompositorError_VRCompositorError_TextureUsesUnsupportedFormat = 105,
EVRCompositorError_VRCompositorError_SharedTexturesNotSupported = 106,
EVRCompositorError_VRCompositorError_IndexOutOfRange = 107,
- EVRCompositorError_VRCompositorError_ScreenshotAlreadyInProgress = 108,
} EVRCompositorError;
typedef enum VROverlayInputMethod
@@ -863,6 +880,16 @@ typedef enum EVRSettingsError
EVRSettingsError_VRSettingsError_ReadFailed = 3,
} EVRSettingsError;
+typedef enum EVRScreenshotError
+{
+ EVRScreenshotError_VRScreenshotError_None = 0,
+ EVRScreenshotError_VRScreenshotError_RequestFailed = 1,
+ EVRScreenshotError_VRScreenshotError_IncompatibleVersion = 100,
+ EVRScreenshotError_VRScreenshotError_NotFound = 101,
+ EVRScreenshotError_VRScreenshotError_BufferTooSmall = 102,
+ EVRScreenshotError_VRScreenshotError_ScreenshotAlreadyInProgress = 108,
+} EVRScreenshotError;
+
// OpenVR typedefs
@@ -874,7 +901,8 @@ typedef int32_t glInt_t;
typedef uint32_t glUInt_t;
typedef uint32_t TrackedDeviceIndex_t;
typedef uint64_t VROverlayHandle_t;
-typedef void * TrackedCameraHandle_t;
+typedef uint64_t TrackedCameraHandle_t;
+typedef uint32_t ScreenshotHandle_t;
typedef uint32_t VRComponentProperties;
typedef int32_t TextureID_t;
typedef uint32_t VRNotificationId;
@@ -893,6 +921,7 @@ typedef ECollisionBoundsStyle CollisionBoundsStyle_t;
typedef EVROverlayError VROverlayError;
typedef EVRFirmwareError VRFirmwareError;
typedef EVRCompositorError VRCompositorError;
+typedef EVRScreenshotError VRScreenshotsError;
// OpenVR Structs
@@ -1070,6 +1099,12 @@ typedef struct VREvent_SeatedZeroPoseReset_t
bool bResetBySystemMenu;
} VREvent_SeatedZeroPoseReset_t;
+typedef struct VREvent_Screenshot_t
+{
+ uint32_t handle;
+ uint32_t type;
+} VREvent_Screenshot_t;
+
typedef struct HiddenAreaMesh_t
{
struct HmdVector2_t * pVertexData; // const struct vr::HmdVector2_t *
@@ -1240,6 +1275,7 @@ typedef struct COpenVRContext
intptr_t m_pVRSettings; // class vr::IVRSettings *
intptr_t m_pVRApplications; // class vr::IVRApplications *
intptr_t m_pVRTrackedCamera; // class vr::IVRTrackedCamera *
+ intptr_t m_pVRScreenshots; // class vr::IVRScreenshots *
} COpenVRContext;
@@ -1562,6 +1598,17 @@ struct VR_IVRSettings_FnTable
void (OPENVR_FNTABLE_CALLTYPE *RemoveKeyInSection)(char * pchSection, char * pchSettingsKey, EVRSettingsError * peError);
};
+struct VR_IVRScreenshots_FnTable
+{
+ EVRScreenshotError (OPENVR_FNTABLE_CALLTYPE *RequestScreenshot)(ScreenshotHandle_t * pOutScreenshotHandle, EVRScreenshotType type, char * pchPreviewFilename, char * pchVRFilename);
+ EVRScreenshotError (OPENVR_FNTABLE_CALLTYPE *HookScreenshot)(EVRScreenshotType * pSupportedTypes, int numTypes);
+ EVRScreenshotType (OPENVR_FNTABLE_CALLTYPE *GetScreenshotPropertyType)(ScreenshotHandle_t screenshotHandle, EVRScreenshotError * pError);
+ uint32_t (OPENVR_FNTABLE_CALLTYPE *GetScreenshotPropertyFilename)(ScreenshotHandle_t screenshotHandle, EVRScreenshotPropertyFilenames filenameType, char * pchFilename, uint32_t cchFilename, EVRScreenshotError * pError);
+ EVRScreenshotError (OPENVR_FNTABLE_CALLTYPE *UpdateScreenshotProgress)(ScreenshotHandle_t screenshotHandle, float flProgress);
+ EVRScreenshotError (OPENVR_FNTABLE_CALLTYPE *TakeStereoScreenshot)(ScreenshotHandle_t * pOutScreenshotHandle, char * pchPreviewFilename, char * pchVRFilename);
+ EVRScreenshotError (OPENVR_FNTABLE_CALLTYPE *SubmitScreenshot)(ScreenshotHandle_t screenshotHandle, EVRScreenshotType type, char * pchSourcePreviewFilename, char * pchSourceVRFilename);
+};
+
#if 0
// Global entry points
diff --git a/headers/openvr_driver.h b/headers/openvr_driver.h
index 767521b..3f2a21d 100644
--- a/headers/openvr_driver.h
+++ b/headers/openvr_driver.h
@@ -267,6 +267,7 @@ enum ETrackedDeviceProperty
Prop_CameraCompatibilityMode_Int32 = 2033,
Prop_ScreenshotHorizontalFieldOfViewDegrees_Float = 2034,
Prop_ScreenshotVerticalFieldOfViewDegrees_Float = 2035,
+ Prop_DisplaySuppressed_Bool = 2036,
// Properties that are unique to TrackedDeviceClass_Controller
Prop_AttachedDeviceId_String = 3000,
@@ -318,7 +319,7 @@ struct VRTextureBounds_t
};
-/** Allows the applicaiton to control how scene textures are used by the compositor when calling Submit. */
+/** Allows the application to control how scene textures are used by the compositor when calling Submit. */
enum EVRSubmitFlags
{
// Simple render path. App submits rendered left and right eye images with no lens distortion correction applied.
@@ -331,10 +332,6 @@ enum EVRSubmitFlags
// If the texture pointer passed in is actually a renderbuffer (e.g. for MSAA in OpenGL) then set this flag.
Submit_GlRenderBuffer = 0x02,
-
- // If you application receives a screenshot request, submit with this flag to let the compositor this submission
- // is in the response to the screenshot
- Submit_Screenshot = 0x04
};
@@ -386,6 +383,7 @@ enum EVREventType
VREvent_SceneApplicationChanged = 404, // data is process - The App actually drawing the scene changed (usually to or from the compositor)
VREvent_SceneFocusChanged = 405, // data is process - New app got access to draw the scene
VREvent_InputFocusChanged = 406, // data is process
+ VREvent_SceneApplicationSecondaryRenderingStarted = 407, // data is process
VREvent_HideRenderModels = 410, // Sent to the scene application to request hiding render models temporarily
VREvent_ShowRenderModels = 411, // Sent to the scene application to request restoring render model visibility
@@ -407,11 +405,13 @@ enum EVREventType
VREvent_DashboardGuideButtonDown = 514,
VREvent_DashboardGuideButtonUp = 515,
VREvent_ScreenshotTriggered = 516, // Screenshot button combo was pressed, Dashboard should request a screenshot
+ VREvent_ImageFailed = 517, // Sent to overlays when a SetOverlayRaw or SetOverlayfromFail fails to load
// Screenshot API
VREvent_RequestScreenshot = 520, // Sent by vrclient application to compositor to take a screenshot
VREvent_ScreenshotTaken = 521, // Sent by compositor to the application that the screenshot has been taken
VREvent_ScreenshotFailed = 522, // Sent by compositor to the application that the screenshot failed to be taken
+ VREvent_SubmitScreenshotToDashboard = 523, // Sent by compositor to the dashboard that a completed screenshot was submitted
VREvent_Notification_Shown = 600,
VREvent_Notification_Hidden = 601,
@@ -628,6 +628,12 @@ struct VREvent_SeatedZeroPoseReset_t
bool bResetBySystemMenu;
};
+struct VREvent_Screenshot_t
+{
+ uint32_t handle;
+ uint32_t type;
+};
+
/** If you change this you must manually update openvr_interop.cs.py */
typedef union
{
@@ -645,6 +651,7 @@ typedef union
VREvent_PerformanceTest_t performanceTest;
VREvent_TouchPadMove_t touchPadMove;
VREvent_SeatedZeroPoseReset_t seatedZeroPoseReset;
+ VREvent_Screenshot_t screenshot;
} VREvent_Data_t;
/** An event posted by the server to all running applications */
@@ -865,6 +872,8 @@ enum EVRInitError
VRInitError_Compositor_Failed = 400,
VRInitError_Compositor_D3D11HardwareRequired = 401,
VRInitError_Compositor_FirmwareRequiresUpdate = 402,
+ VRInitError_Compositor_OverlayInitFailed = 403,
+ VRInitError_Compositor_ScreenshotsInitFailed = 404,
VRInitError_VendorSpecific_UnableToConnectToOculusRuntime = 1000,
@@ -891,7 +900,14 @@ enum EVRScreenshotType
VRScreenshotType_Mono = 1, // left eye only
VRScreenshotType_Stereo = 2,
VRScreenshotType_Cubemap = 3,
- VRScreenshotType_StereoPanorama = 4
+ VRScreenshotType_MonoPanorama = 4,
+ VRScreenshotType_StereoPanorama = 5
+};
+
+enum EVRScreenshotPropertyFilenames
+{
+ VRScreenshotPropertyFilenames_Preview = 0,
+ VRScreenshotPropertyFilenames_VR = 1,
};
enum EVRTrackedCameraError
@@ -923,7 +939,7 @@ enum EVRTrackedCameraFrameType
MAX_CAMERA_FRAME_TYPES
};
-typedef void* TrackedCameraHandle_t;
+typedef uint64_t TrackedCameraHandle_t;
#define INVALID_TRACKED_CAMERA_HANDLE ((vr::TrackedCameraHandle_t)0)
struct CameraVideoStreamFrameHeader_t
@@ -939,6 +955,11 @@ struct CameraVideoStreamFrameHeader_t
TrackedDevicePose_t standingTrackedDevicePose;
};
+// Screenshot types
+typedef uint32_t ScreenshotHandle_t;
+
+static const uint32_t k_unScreenshotHandleInvalid = 0;
+
#pragma pack( pop )
// figure out how to import from the VR API dll
@@ -1048,6 +1069,8 @@ VR_CAMERA_DECL_ALIGN( 8 ) struct CameraVideoStreamFrame_t
uint32_t m_nSyncCounter;
uint32_t m_nCamSyncEvents;
+ uint32_t m_nISPSyncEvents;
+
double m_flReferenceCamSyncTime;
double m_flFrameElapsedTime; // Starts from 0 when stream starts. In seconds.
@@ -1062,7 +1085,7 @@ VR_CAMERA_DECL_ALIGN( 8 ) struct CameraVideoStreamFrame_t
TrackedDevicePose_t m_StandingTrackedDevicePose; // Supplied by HMD layer when used as a tracked camera
- void *m_pImageData;
+ uint64_t m_pImageData;
};
#pragma pack( pop )
@@ -1143,6 +1166,10 @@ namespace vr
static const char * const k_pch_SteamVR_NeverKillProcesses_Bool = "neverKillProcesses";
static const char * const k_pch_SteamVR_RenderTargetMultiplier_Float = "renderTargetMultiplier";
static const char * const k_pch_SteamVR_AllowReprojection_Bool = "allowReprojection";
+ static const char * const k_pch_SteamVR_ForceReprojection_Bool = "forceReprojection";
+ static const char * const k_pch_SteamVR_ForceFadeOnBadTracking_Bool = "forceFadeOnBadTracking";
+ static const char * const k_pch_SteamVR_DefaultMirrorView_Int32 = "defaultMirrorView";
+ static const char * const k_pch_SteamVR_ShowMirrorView_Bool = "showMirrorView";
//-----------------------------------------------------------------------------
// lighthouse keys
@@ -1435,6 +1462,26 @@ namespace vr
* the upper left of that eye's viewport and 1,1 in the lower right of that eye's viewport. */
virtual DistortionCoordinates_t ComputeDistortion( EVREye eEye, float fU, float fV ) = 0;
+ };
+
+ static const char *IVRDisplayComponent_Version = "IVRDisplayComponent_002";
+
+}
+
+// ivrdriverdirectmodecomponent.h
+namespace vr
+{
+
+
+ // ----------------------------------------------------------------------------------------------
+ // Purpose: This component is used for drivers that implement direct mode entirely on their own
+ // without allowing the VR Compositor to own the window/device. Chances are you don't
+ // need to implement this component in your driver.
+ // ----------------------------------------------------------------------------------------------
+ class IVRDriverDirectModeComponent
+ {
+ public:
+
// -----------------------------------
// Direct mode methods
// -----------------------------------
@@ -1460,7 +1507,7 @@ namespace vr
};
- static const char *IVRDisplayComponent_Version = "IVRDisplayComponent_001";
+ static const char *IVRDriverDirectModeComponent_Version = "IVRDriverDirectModeComponent_001";
}
@@ -1767,6 +1814,7 @@ namespace vr
IVRSettings_Version,
ITrackedDeviceServerDriver_Version,
IVRDisplayComponent_Version,
+ IVRDriverDirectModeComponent_Version,
IVRControllerComponent_Version,
IVRCameraComponent_Version,
IServerTrackedDeviceProvider_Version,
diff --git a/lib/linux64/libopenvr_api.so b/lib/linux64/libopenvr_api.so
index 1fa42d2..52fd227 100755
--- a/lib/linux64/libopenvr_api.so
+++ b/lib/linux64/libopenvr_api.so
Binary files differ
diff --git a/lib/win32/openvr_api.lib b/lib/win32/openvr_api.lib
index 9fe9765..45a41ae 100644
--- a/lib/win32/openvr_api.lib
+++ b/lib/win32/openvr_api.lib
Binary files differ
diff --git a/lib/win64/openvr_api.lib b/lib/win64/openvr_api.lib
index 76a62f3..1234431 100644
--- a/lib/win64/openvr_api.lib
+++ b/lib/win64/openvr_api.lib
Binary files differ
diff --git a/samples/bin/win32/openvr_api.dll b/samples/bin/win32/openvr_api.dll
index d908e09..d2b37d5 100644
--- a/samples/bin/win32/openvr_api.dll
+++ b/samples/bin/win32/openvr_api.dll
Binary files differ
diff --git a/samples/bin/win64/openvr_api.dll b/samples/bin/win64/openvr_api.dll
index 904723c..d13791a 100644
--- a/samples/bin/win64/openvr_api.dll
+++ b/samples/bin/win64/openvr_api.dll
Binary files differ
diff --git a/unity_package/Assets/Plugins/openvr_api.cs b/unity_package/Assets/Plugins/openvr_api.cs
index 6d1c8ed..a4d71f8 100644
--- a/unity_package/Assets/Plugins/openvr_api.cs
+++ b/unity_package/Assets/Plugins/openvr_api.cs
@@ -1,4 +1,4 @@
-//======= Copyright 1996-2014, Valve Corporation, All rights reserved. ========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: This file contains C#/managed code bindings for the OpenVR interfaces
// This file is auto-generated, do not edit it.
@@ -286,17 +286,17 @@ public struct IVRTrackedCamera
internal _GetCameraProjection GetCameraProjection;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
- internal delegate EVRTrackedCameraError _AcquireVideoStreamingService(uint nDeviceIndex, IntPtr pHandle);
+ internal delegate EVRTrackedCameraError _AcquireVideoStreamingService(uint nDeviceIndex, ref ulong pHandle);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _AcquireVideoStreamingService AcquireVideoStreamingService;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
- internal delegate EVRTrackedCameraError _ReleaseVideoStreamingService(IntPtr hTrackedCamera);
+ internal delegate EVRTrackedCameraError _ReleaseVideoStreamingService(ulong hTrackedCamera);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _ReleaseVideoStreamingService ReleaseVideoStreamingService;
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
- internal delegate EVRTrackedCameraError _GetVideoStreamFrameBuffer(IntPtr hTrackedCamera, EVRTrackedCameraFrameType eFrameType, IntPtr pFrameBuffer, uint nFrameBufferSize, ref CameraVideoStreamFrameHeader_t pFrameHeader, uint nFrameHeaderSize);
+ internal delegate EVRTrackedCameraError _GetVideoStreamFrameBuffer(ulong hTrackedCamera, EVRTrackedCameraFrameType eFrameType, IntPtr pFrameBuffer, uint nFrameBufferSize, ref CameraVideoStreamFrameHeader_t pFrameHeader, uint nFrameHeaderSize);
[MarshalAs(UnmanagedType.FunctionPtr)]
internal _GetVideoStreamFrameBuffer GetVideoStreamFrameBuffer;
@@ -1287,6 +1287,46 @@ public struct IVRSettings
}
+[StructLayout(LayoutKind.Sequential)]
+public struct IVRScreenshots
+{
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ internal delegate EVRScreenshotError _RequestScreenshot(ref uint pOutScreenshotHandle, EVRScreenshotType type, string pchPreviewFilename, string pchVRFilename);
+ [MarshalAs(UnmanagedType.FunctionPtr)]
+ internal _RequestScreenshot RequestScreenshot;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ internal delegate EVRScreenshotError _HookScreenshot([In, Out] EVRScreenshotType[] pSupportedTypes, int numTypes);
+ [MarshalAs(UnmanagedType.FunctionPtr)]
+ internal _HookScreenshot HookScreenshot;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ internal delegate EVRScreenshotType _GetScreenshotPropertyType(uint screenshotHandle, ref EVRScreenshotError pError);
+ [MarshalAs(UnmanagedType.FunctionPtr)]
+ internal _GetScreenshotPropertyType GetScreenshotPropertyType;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ internal delegate uint _GetScreenshotPropertyFilename(uint screenshotHandle, EVRScreenshotPropertyFilenames filenameType, System.Text.StringBuilder pchFilename, uint cchFilename, ref EVRScreenshotError pError);
+ [MarshalAs(UnmanagedType.FunctionPtr)]
+ internal _GetScreenshotPropertyFilename GetScreenshotPropertyFilename;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ internal delegate EVRScreenshotError _UpdateScreenshotProgress(uint screenshotHandle, float flProgress);
+ [MarshalAs(UnmanagedType.FunctionPtr)]
+ internal _UpdateScreenshotProgress UpdateScreenshotProgress;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ internal delegate EVRScreenshotError _TakeStereoScreenshot(ref uint pOutScreenshotHandle, string pchPreviewFilename, string pchVRFilename);
+ [MarshalAs(UnmanagedType.FunctionPtr)]
+ internal _TakeStereoScreenshot TakeStereoScreenshot;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ internal delegate EVRScreenshotError _SubmitScreenshot(uint screenshotHandle, EVRScreenshotType type, string pchSourcePreviewFilename, string pchSourceVRFilename);
+ [MarshalAs(UnmanagedType.FunctionPtr)]
+ internal _SubmitScreenshot SubmitScreenshot;
+
+}
+
public class CVRSystem
{
@@ -1585,17 +1625,18 @@ public class CVRTrackedCamera
EVRTrackedCameraError result = FnTable.GetCameraProjection(nDeviceIndex,eFrameType,flZNear,flZFar,ref pProjection);
return result;
}
- public EVRTrackedCameraError AcquireVideoStreamingService(uint nDeviceIndex,IntPtr pHandle)
+ public EVRTrackedCameraError AcquireVideoStreamingService(uint nDeviceIndex,ref ulong pHandle)
{
- EVRTrackedCameraError result = FnTable.AcquireVideoStreamingService(nDeviceIndex,pHandle);
+ pHandle = 0;
+ EVRTrackedCameraError result = FnTable.AcquireVideoStreamingService(nDeviceIndex,ref pHandle);
return result;
}
- public EVRTrackedCameraError ReleaseVideoStreamingService(IntPtr hTrackedCamera)
+ public EVRTrackedCameraError ReleaseVideoStreamingService(ulong hTrackedCamera)
{
EVRTrackedCameraError result = FnTable.ReleaseVideoStreamingService(hTrackedCamera);
return result;
}
- public EVRTrackedCameraError GetVideoStreamFrameBuffer(IntPtr hTrackedCamera,EVRTrackedCameraFrameType eFrameType,IntPtr pFrameBuffer,uint nFrameBufferSize,ref CameraVideoStreamFrameHeader_t pFrameHeader,uint nFrameHeaderSize)
+ public EVRTrackedCameraError GetVideoStreamFrameBuffer(ulong hTrackedCamera,EVRTrackedCameraFrameType eFrameType,IntPtr pFrameBuffer,uint nFrameBufferSize,ref CameraVideoStreamFrameHeader_t pFrameHeader,uint nFrameHeaderSize)
{
EVRTrackedCameraError result = FnTable.GetVideoStreamFrameBuffer(hTrackedCamera,eFrameType,pFrameBuffer,nFrameBufferSize,ref pFrameHeader,nFrameHeaderSize);
return result;
@@ -2626,6 +2667,53 @@ public class CVRSettings
}
+public class CVRScreenshots
+{
+ IVRScreenshots FnTable;
+ internal CVRScreenshots(IntPtr pInterface)
+ {
+ FnTable = (IVRScreenshots)Marshal.PtrToStructure(pInterface, typeof(IVRScreenshots));
+ }
+ public EVRScreenshotError RequestScreenshot(ref uint pOutScreenshotHandle,EVRScreenshotType type,string pchPreviewFilename,string pchVRFilename)
+ {
+ pOutScreenshotHandle = 0;
+ EVRScreenshotError result = FnTable.RequestScreenshot(ref pOutScreenshotHandle,type,pchPreviewFilename,pchVRFilename);
+ return result;
+ }
+ public EVRScreenshotError HookScreenshot(EVRScreenshotType [] pSupportedTypes)
+ {
+ EVRScreenshotError result = FnTable.HookScreenshot(pSupportedTypes,(int) pSupportedTypes.Length);
+ return result;
+ }
+ public EVRScreenshotType GetScreenshotPropertyType(uint screenshotHandle,ref EVRScreenshotError pError)
+ {
+ EVRScreenshotType result = FnTable.GetScreenshotPropertyType(screenshotHandle,ref pError);
+ return result;
+ }
+ public uint GetScreenshotPropertyFilename(uint screenshotHandle,EVRScreenshotPropertyFilenames filenameType,System.Text.StringBuilder pchFilename,uint cchFilename,ref EVRScreenshotError pError)
+ {
+ uint result = FnTable.GetScreenshotPropertyFilename(screenshotHandle,filenameType,pchFilename,cchFilename,ref pError);
+ return result;
+ }
+ public EVRScreenshotError UpdateScreenshotProgress(uint screenshotHandle,float flProgress)
+ {
+ EVRScreenshotError result = FnTable.UpdateScreenshotProgress(screenshotHandle,flProgress);
+ return result;
+ }
+ public EVRScreenshotError TakeStereoScreenshot(ref uint pOutScreenshotHandle,string pchPreviewFilename,string pchVRFilename)
+ {
+ pOutScreenshotHandle = 0;
+ EVRScreenshotError result = FnTable.TakeStereoScreenshot(ref pOutScreenshotHandle,pchPreviewFilename,pchVRFilename);
+ return result;
+ }
+ public EVRScreenshotError SubmitScreenshot(uint screenshotHandle,EVRScreenshotType type,string pchSourcePreviewFilename,string pchSourceVRFilename)
+ {
+ EVRScreenshotError result = FnTable.SubmitScreenshot(screenshotHandle,type,pchSourcePreviewFilename,pchSourceVRFilename);
+ return result;
+ }
+}
+
+
public class OpenVRInterop
{
[DllImportAttribute("openvr_api", EntryPoint = "VR_InitInternal")]
@@ -2762,6 +2850,7 @@ public enum ETrackedDeviceProperty
Prop_CameraCompatibilityMode_Int32 = 2033,
Prop_ScreenshotHorizontalFieldOfViewDegrees_Float = 2034,
Prop_ScreenshotVerticalFieldOfViewDegrees_Float = 2035,
+ Prop_DisplaySuppressed_Bool = 2036,
Prop_AttachedDeviceId_String = 3000,
Prop_SupportedButtons_Uint64 = 3001,
Prop_Axis0Type_Int32 = 3002,
@@ -2797,7 +2886,6 @@ public enum EVRSubmitFlags
Submit_Default = 0,
Submit_LensDistortionAlreadyApplied = 1,
Submit_GlRenderBuffer = 2,
- Submit_Screenshot = 4,
}
public enum EVRState
{
@@ -2840,6 +2928,7 @@ public enum EVREventType
VREvent_SceneApplicationChanged = 404,
VREvent_SceneFocusChanged = 405,
VREvent_InputFocusChanged = 406,
+ VREvent_SceneApplicationSecondaryRenderingStarted = 407,
VREvent_HideRenderModels = 410,
VREvent_ShowRenderModels = 411,
VREvent_OverlayShown = 500,
@@ -2859,9 +2948,11 @@ public enum EVREventType
VREvent_DashboardGuideButtonDown = 514,
VREvent_DashboardGuideButtonUp = 515,
VREvent_ScreenshotTriggered = 516,
+ VREvent_ImageFailed = 517,
VREvent_RequestScreenshot = 520,
VREvent_ScreenshotTaken = 521,
VREvent_ScreenshotFailed = 522,
+ VREvent_SubmitScreenshotToDashboard = 523,
VREvent_Notification_Shown = 600,
VREvent_Notification_Hidden = 601,
VREvent_Notification_BeginInteraction = 602,
@@ -3054,6 +3145,8 @@ public enum EVRInitError
Compositor_Failed = 400,
Compositor_D3D11HardwareRequired = 401,
Compositor_FirmwareRequiresUpdate = 402,
+ Compositor_OverlayInitFailed = 403,
+ Compositor_ScreenshotsInitFailed = 404,
VendorSpecific_UnableToConnectToOculusRuntime = 1000,
VendorSpecific_HmdFound_CantOpenDevice = 1101,
VendorSpecific_HmdFound_UnableToRequestConfigStart = 1102,
@@ -3076,7 +3169,13 @@ public enum EVRScreenshotType
Mono = 1,
Stereo = 2,
Cubemap = 3,
- StereoPanorama = 4,
+ MonoPanorama = 4,
+ StereoPanorama = 5,
+}
+public enum EVRScreenshotPropertyFilenames
+{
+ Preview = 0,
+ VR = 1,
}
public enum EVRTrackedCameraError
{
@@ -3186,7 +3285,6 @@ public enum EVRCompositorError
TextureUsesUnsupportedFormat = 105,
SharedTexturesNotSupported = 106,
IndexOutOfRange = 107,
- ScreenshotAlreadyInProgress = 108,
}
public enum VROverlayInputMethod
{
@@ -3281,6 +3379,15 @@ public enum EVRSettingsError
WriteFailed = 2,
ReadFailed = 3,
}
+public enum EVRScreenshotError
+{
+ None = 0,
+ RequestFailed = 1,
+ IncompatibleVersion = 100,
+ NotFound = 101,
+ BufferTooSmall = 102,
+ ScreenshotAlreadyInProgress = 108,
+}
[StructLayout(LayoutKind.Explicit)] public struct VREvent_Data_t
{
@@ -3297,6 +3404,7 @@ public enum EVRSettingsError
[FieldOffset(0)] public VREvent_PerformanceTest_t performanceTest;
[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_Keyboard_t keyboard; // This has to be at the end due to a mono bug
}
@@ -3491,6 +3599,11 @@ public enum EVRSettingsError
[MarshalAs(UnmanagedType.I1)]
public bool bResetBySystemMenu;
}
+[StructLayout(LayoutKind.Sequential)] public struct VREvent_Screenshot_t
+{
+ public uint handle;
+ public uint type;
+}
[StructLayout(LayoutKind.Sequential)] public struct VREvent_t
{
public uint eventType;
@@ -3660,6 +3773,7 @@ public enum EVRSettingsError
public IntPtr m_pVRSettings; // class vr::IVRSettings *
public IntPtr m_pVRApplications; // class vr::IVRApplications *
public IntPtr m_pVRTrackedCamera; // class vr::IVRTrackedCamera *
+ public IntPtr m_pVRScreenshots; // class vr::IVRScreenshots *
}
public class OpenVR
@@ -3714,9 +3828,10 @@ public class OpenVR
public const uint k_unMaxPropertyStringSize = 32768;
public const uint k_unControllerStateAxisCount = 5;
public const ulong k_ulOverlayHandleInvalid = 0;
+ public const uint k_unScreenshotHandleInvalid = 0;
public const string IVRSystem_Version = "IVRSystem_012";
public const string IVRExtendedDisplay_Version = "IVRExtendedDisplay_001";
- public const string IVRTrackedCamera_Version = "IVRTrackedCamera_002";
+ public const string IVRTrackedCamera_Version = "IVRTrackedCamera_003";
public const uint k_unMaxApplicationKeyLength = 128;
public const string IVRApplications_Version = "IVRApplications_005";
public const string IVRChaperone_Version = "IVRChaperone_003";
@@ -3768,6 +3883,10 @@ public class OpenVR
public const string k_pch_SteamVR_NeverKillProcesses_Bool = "neverKillProcesses";
public const string k_pch_SteamVR_RenderTargetMultiplier_Float = "renderTargetMultiplier";
public const string k_pch_SteamVR_AllowReprojection_Bool = "allowReprojection";
+ public const string k_pch_SteamVR_ForceReprojection_Bool = "forceReprojection";
+ public const string k_pch_SteamVR_ForceFadeOnBadTracking_Bool = "forceFadeOnBadTracking";
+ public const string k_pch_SteamVR_DefaultMirrorView_Int32 = "defaultMirrorView";
+ public const string k_pch_SteamVR_ShowMirrorView_Bool = "showMirrorView";
public const string k_pch_Lighthouse_Section = "driver_lighthouse";
public const string k_pch_Lighthouse_DisableIMU_Bool = "disableimu";
public const string k_pch_Lighthouse_UseDisambiguation_String = "usedisambiguation";
@@ -3836,6 +3955,7 @@ public class OpenVR
public const string k_pch_audio_OffRecordDevice_String = "offRecordDevice";
public const string k_pch_audio_VIVEHDMIGain = "viveHDMIGain";
public const string k_pch_modelskin_Section = "modelskins";
+ public const string IVRScreenshots_Version = "IVRScreenshots_001";
static uint VRToken { get; set; }
@@ -3856,6 +3976,7 @@ public class OpenVR
m_pVRExtendedDisplay = null;
m_pVRSettings = null;
m_pVRApplications = null;
+ m_pVRScreenshots = null;
}
void CheckClear()
@@ -3984,6 +4105,19 @@ public class OpenVR
return m_pVRApplications;
}
+ public CVRScreenshots VRScreenshots()
+ {
+ CheckClear();
+ if (m_pVRScreenshots == null)
+ {
+ var eError = EVRInitError.None;
+ var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRScreenshots_Version, ref eError);
+ if (pInterface != IntPtr.Zero && eError == EVRInitError.None)
+ m_pVRScreenshots = new CVRScreenshots(pInterface);
+ }
+ return m_pVRScreenshots;
+ }
+
private CVRSystem m_pVRSystem;
private CVRChaperone m_pVRChaperone;
private CVRChaperoneSetup m_pVRChaperoneSetup;
@@ -3993,6 +4127,7 @@ public class OpenVR
private CVRExtendedDisplay m_pVRExtendedDisplay;
private CVRSettings m_pVRSettings;
private CVRApplications m_pVRApplications;
+ private CVRScreenshots m_pVRScreenshots;
};
private static COpenVRContext _OpenVRInternal_ModuleContext = null;
@@ -4015,6 +4150,7 @@ public class OpenVR
public static CVRApplications Applications { get { return OpenVRInternal_ModuleContext.VRApplications(); } }
public static CVRSettings Settings { get { return OpenVRInternal_ModuleContext.VRSettings(); } }
public static CVRExtendedDisplay ExtendedDisplay { get { return OpenVRInternal_ModuleContext.VRExtendedDisplay(); } }
+ public static CVRScreenshots Screenshots { get { return OpenVRInternal_ModuleContext.VRScreenshots(); } }
/** Finds the active installation of vrclient.dll and initializes it */
public static CVRSystem Init(ref EVRInitError peError, EVRApplicationType eApplicationType = EVRApplicationType.VRApplication_Scene)
diff --git a/unity_package/Assets/SteamVR/Editor/SteamVR_Editor.cs b/unity_package/Assets/SteamVR/Editor/SteamVR_Editor.cs
index f347231..66a59ff 100644
--- a/unity_package/Assets/SteamVR/Editor/SteamVR_Editor.cs
+++ b/unity_package/Assets/SteamVR/Editor/SteamVR_Editor.cs
@@ -1,4 +1,4 @@
-//========= Copyright 2014, Valve Corporation, All rights reserved. ===========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Custom inspector display for SteamVR_Camera
//
diff --git a/unity_package/Assets/SteamVR/Editor/SteamVR_RenderModelEditor.cs b/unity_package/Assets/SteamVR/Editor/SteamVR_RenderModelEditor.cs
index f0cf463..5e68436 100644
--- a/unity_package/Assets/SteamVR/Editor/SteamVR_RenderModelEditor.cs
+++ b/unity_package/Assets/SteamVR/Editor/SteamVR_RenderModelEditor.cs
@@ -1,4 +1,4 @@
-//========= Copyright 2014, Valve Corporation, All rights reserved. ===========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Custom inspector display for SteamVR_RenderModel
//
diff --git a/unity_package/Assets/SteamVR/Editor/SteamVR_Settings.cs b/unity_package/Assets/SteamVR/Editor/SteamVR_Settings.cs
index ef4278b..b9738d3 100644
--- a/unity_package/Assets/SteamVR/Editor/SteamVR_Settings.cs
+++ b/unity_package/Assets/SteamVR/Editor/SteamVR_Settings.cs
@@ -1,4 +1,4 @@
-//========= Copyright 2015, Valve Corporation, All rights reserved. ===========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Prompt developers to use settings most compatible with SteamVR.
//
diff --git a/unity_package/Assets/SteamVR/Editor/SteamVR_SkyboxEditor.cs b/unity_package/Assets/SteamVR/Editor/SteamVR_SkyboxEditor.cs
index 9723226..bfcbbed 100644
--- a/unity_package/Assets/SteamVR/Editor/SteamVR_SkyboxEditor.cs
+++ b/unity_package/Assets/SteamVR/Editor/SteamVR_SkyboxEditor.cs
@@ -1,4 +1,4 @@
-//========= Copyright 2014, Valve Corporation, All rights reserved. ===========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Custom inspector display for SteamVR_Skybox
//
diff --git a/unity_package/Assets/SteamVR/Editor/SteamVR_Update.cs b/unity_package/Assets/SteamVR/Editor/SteamVR_Update.cs
index b41762a..109c8e8 100644
--- a/unity_package/Assets/SteamVR/Editor/SteamVR_Update.cs
+++ b/unity_package/Assets/SteamVR/Editor/SteamVR_Update.cs
@@ -1,4 +1,4 @@
-//========= Copyright 2015, Valve Corporation, All rights reserved. ===========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Notify developers when a new version of the plugin is available.
//
diff --git a/unity_package/Assets/SteamVR/Extras/SteamVR_GazeTracker.cs b/unity_package/Assets/SteamVR/Extras/SteamVR_GazeTracker.cs
index 37c4d50..c35b783 100644
--- a/unity_package/Assets/SteamVR/Extras/SteamVR_GazeTracker.cs
+++ b/unity_package/Assets/SteamVR/Extras/SteamVR_GazeTracker.cs
@@ -1,4 +1,5 @@
-using UnityEngine;
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
+using UnityEngine;
using System.Collections;
public struct GazeEventArgs
diff --git a/unity_package/Assets/SteamVR/Extras/SteamVR_LaserPointer.cs b/unity_package/Assets/SteamVR/Extras/SteamVR_LaserPointer.cs
index 45f8b7a..d08ddc2 100644
--- a/unity_package/Assets/SteamVR/Extras/SteamVR_LaserPointer.cs
+++ b/unity_package/Assets/SteamVR/Extras/SteamVR_LaserPointer.cs
@@ -1,4 +1,5 @@
-using UnityEngine;
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
+using UnityEngine;
using System.Collections;
public struct PointerEventArgs
diff --git a/unity_package/Assets/SteamVR/Extras/SteamVR_Teleporter.cs b/unity_package/Assets/SteamVR/Extras/SteamVR_Teleporter.cs
index ba94a6c..d72bada 100644
--- a/unity_package/Assets/SteamVR/Extras/SteamVR_Teleporter.cs
+++ b/unity_package/Assets/SteamVR/Extras/SteamVR_Teleporter.cs
@@ -1,4 +1,5 @@
-using UnityEngine;
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
+using UnityEngine;
using System.Collections;
public class SteamVR_Teleporter : MonoBehaviour
diff --git a/unity_package/Assets/SteamVR/Extras/SteamVR_TestThrow.cs b/unity_package/Assets/SteamVR/Extras/SteamVR_TestThrow.cs
index 4f43991..0dd7a94 100644
--- a/unity_package/Assets/SteamVR/Extras/SteamVR_TestThrow.cs
+++ b/unity_package/Assets/SteamVR/Extras/SteamVR_TestThrow.cs
@@ -1,4 +1,5 @@
-using UnityEngine;
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
+using UnityEngine;
using System.Collections;
[RequireComponent(typeof(SteamVR_TrackedObject))]
diff --git a/unity_package/Assets/SteamVR/Extras/SteamVR_TrackedController.cs b/unity_package/Assets/SteamVR/Extras/SteamVR_TrackedController.cs
index ce17544..32e9f5a 100644
--- a/unity_package/Assets/SteamVR/Extras/SteamVR_TrackedController.cs
+++ b/unity_package/Assets/SteamVR/Extras/SteamVR_TrackedController.cs
@@ -1,4 +1,5 @@
-using UnityEngine;
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
+using UnityEngine;
using Valve.VR;
public struct ClickedEventArgs
diff --git a/unity_package/Assets/SteamVR/Scripts/SteamVR.cs b/unity_package/Assets/SteamVR/Scripts/SteamVR.cs
index 9c343c6..3059d6b 100644
--- a/unity_package/Assets/SteamVR/Scripts/SteamVR.cs
+++ b/unity_package/Assets/SteamVR/Scripts/SteamVR.cs
@@ -1,4 +1,4 @@
-//========= Copyright 2014, Valve Corporation, All rights reserved. ===========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Access to SteamVR system (hmd) and compositor (distort) interfaces.
//
diff --git a/unity_package/Assets/SteamVR/Scripts/SteamVR_Camera.cs b/unity_package/Assets/SteamVR/Scripts/SteamVR_Camera.cs
index d041257..21c4b6e 100644
--- a/unity_package/Assets/SteamVR/Scripts/SteamVR_Camera.cs
+++ b/unity_package/Assets/SteamVR/Scripts/SteamVR_Camera.cs
@@ -1,4 +1,4 @@
-//========= Copyright 2014, Valve Corporation, All rights reserved. ===========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Adds SteamVR render support to existing camera objects
//
diff --git a/unity_package/Assets/SteamVR/Scripts/SteamVR_CameraFlip.cs b/unity_package/Assets/SteamVR/Scripts/SteamVR_CameraFlip.cs
index 97e6854..023f3b6 100644
--- a/unity_package/Assets/SteamVR/Scripts/SteamVR_CameraFlip.cs
+++ b/unity_package/Assets/SteamVR/Scripts/SteamVR_CameraFlip.cs
@@ -1,4 +1,4 @@
-//========= Copyright 2015, Valve Corporation, All rights reserved. ===========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Flips the camera output back to normal for D3D.
//
diff --git a/unity_package/Assets/SteamVR/Scripts/SteamVR_CameraMask.cs b/unity_package/Assets/SteamVR/Scripts/SteamVR_CameraMask.cs
index e16205d..654f70a 100644
--- a/unity_package/Assets/SteamVR/Scripts/SteamVR_CameraMask.cs
+++ b/unity_package/Assets/SteamVR/Scripts/SteamVR_CameraMask.cs
@@ -1,4 +1,4 @@
-//========= Copyright 2014, Valve Corporation, All rights reserved. ===========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Masks out pixels that cannot be seen through the connected hmd.
//
diff --git a/unity_package/Assets/SteamVR/Scripts/SteamVR_Controller.cs b/unity_package/Assets/SteamVR/Scripts/SteamVR_Controller.cs
index 95c1ac0..219da8a 100644
--- a/unity_package/Assets/SteamVR/Scripts/SteamVR_Controller.cs
+++ b/unity_package/Assets/SteamVR/Scripts/SteamVR_Controller.cs
@@ -1,4 +1,4 @@
-//========= Copyright 2015, Valve Corporation, All rights reserved. ===========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Wrapper for working with SteamVR controller input
//
diff --git a/unity_package/Assets/SteamVR/Scripts/SteamVR_ControllerManager.cs b/unity_package/Assets/SteamVR/Scripts/SteamVR_ControllerManager.cs
index c2537b0..99f8706 100644
--- a/unity_package/Assets/SteamVR/Scripts/SteamVR_ControllerManager.cs
+++ b/unity_package/Assets/SteamVR/Scripts/SteamVR_ControllerManager.cs
@@ -1,4 +1,4 @@
-//========= Copyright 2016, Valve Corporation, All rights reserved. ===========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Enables/disables objects based on connectivity and assigned roles.
//
diff --git a/unity_package/Assets/SteamVR/Scripts/SteamVR_Ears.cs b/unity_package/Assets/SteamVR/Scripts/SteamVR_Ears.cs
index 6428b1f..90f4ec0 100644
--- a/unity_package/Assets/SteamVR/Scripts/SteamVR_Ears.cs
+++ b/unity_package/Assets/SteamVR/Scripts/SteamVR_Ears.cs
@@ -1,4 +1,4 @@
-//========= Copyright 2016, Valve Corporation, All rights reserved. ===========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Handles aligning audio listener when using speakers.
//
diff --git a/unity_package/Assets/SteamVR/Scripts/SteamVR_ExternalCamera.cs b/unity_package/Assets/SteamVR/Scripts/SteamVR_ExternalCamera.cs
index 48c3ae8..55486e7 100644
--- a/unity_package/Assets/SteamVR/Scripts/SteamVR_ExternalCamera.cs
+++ b/unity_package/Assets/SteamVR/Scripts/SteamVR_ExternalCamera.cs
@@ -1,4 +1,4 @@
-//========= Copyright 2016, Valve Corporation, All rights reserved. ===========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Used to render an external camera of vr player (split front/back).
//
diff --git a/unity_package/Assets/SteamVR/Scripts/SteamVR_Fade.cs b/unity_package/Assets/SteamVR/Scripts/SteamVR_Fade.cs
index ee294bc..50e7a6f 100644
--- a/unity_package/Assets/SteamVR/Scripts/SteamVR_Fade.cs
+++ b/unity_package/Assets/SteamVR/Scripts/SteamVR_Fade.cs
@@ -1,5 +1,5 @@
//#define TEST_FADE_VIEW
-//========= Copyright 2014, Valve Corporation, All rights reserved. ===========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: CameraFade script adapted to work with SteamVR.
//
diff --git a/unity_package/Assets/SteamVR/Scripts/SteamVR_Frustum.cs b/unity_package/Assets/SteamVR/Scripts/SteamVR_Frustum.cs
index db0520d..97c0236 100644
--- a/unity_package/Assets/SteamVR/Scripts/SteamVR_Frustum.cs
+++ b/unity_package/Assets/SteamVR/Scripts/SteamVR_Frustum.cs
@@ -1,4 +1,4 @@
-//========= Copyright 2014, Valve Corporation, All rights reserved. ===========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Generates a mesh based on field of view.
//
diff --git a/unity_package/Assets/SteamVR/Scripts/SteamVR_GameView.cs b/unity_package/Assets/SteamVR/Scripts/SteamVR_GameView.cs
index b06a945..df5b895 100644
--- a/unity_package/Assets/SteamVR/Scripts/SteamVR_GameView.cs
+++ b/unity_package/Assets/SteamVR/Scripts/SteamVR_GameView.cs
@@ -1,10 +1,11 @@
-//========= Copyright 2014, Valve Corporation, All rights reserved. ===========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Handles rendering to the game view window
//
//=============================================================================
using UnityEngine;
+using Valve.VR;
[RequireComponent(typeof(Camera))]
public class SteamVR_GameView : MonoBehaviour
@@ -14,6 +15,7 @@ public class SteamVR_GameView : MonoBehaviour
public bool drawOverlay = true;
static Material overlayMaterial;
+ static Texture2D mirrorTexture;
void OnEnable()
{
@@ -21,6 +23,24 @@ public class SteamVR_GameView : MonoBehaviour
{
overlayMaterial = new Material(Shader.Find("Custom/SteamVR_Overlay"));
}
+
+ // Use OpenVR's mirror texture if available.
+ if (mirrorTexture == null)
+ {
+ var compositor = OpenVR.Compositor;
+ if (compositor != null)
+ {
+ //!! need to handle GL case as well
+ var tex = new Texture2D(2, 2);
+ var nativeTex = System.IntPtr.Zero;
+ if (compositor.GetMirrorTextureD3D11(EVREye.Eye_Right, tex.GetNativeTexturePtr(), ref nativeTex) == EVRCompositorError.None)
+ {
+ uint width = 0, height = 0;
+ OpenVR.System.GetRecommendedRenderTargetSize(ref width, ref height);
+ mirrorTexture = Texture2D.CreateExternalTexture((int)width, (int)height, TextureFormat.RGBA32, false, false, nativeTex);
+ }
+ }
+ }
}
void OnPostRender()
@@ -35,7 +55,11 @@ public class SteamVR_GameView : MonoBehaviour
var y1 = -aspect;
var blitMaterial = SteamVR_Camera.blitMaterial;
- blitMaterial.mainTexture = SteamVR_Camera.GetSceneTexture(camera.hdr);
+
+ if (mirrorTexture != null)
+ blitMaterial.mainTexture = mirrorTexture;
+ else
+ blitMaterial.mainTexture = SteamVR_Camera.GetSceneTexture(camera.hdr);
GL.PushMatrix();
GL.LoadOrtho();
diff --git a/unity_package/Assets/SteamVR/Scripts/SteamVR_IK.cs b/unity_package/Assets/SteamVR/Scripts/SteamVR_IK.cs
index 96493f1..f4ad940 100644
--- a/unity_package/Assets/SteamVR/Scripts/SteamVR_IK.cs
+++ b/unity_package/Assets/SteamVR/Scripts/SteamVR_IK.cs
@@ -1,4 +1,4 @@
-//========= Copyright 2015, Valve Corporation, All rights reserved. ===========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Simple two bone ik solver.
//
diff --git a/unity_package/Assets/SteamVR/Scripts/SteamVR_LoadLevel.cs b/unity_package/Assets/SteamVR/Scripts/SteamVR_LoadLevel.cs
index 77320cf..b64a55a 100644
--- a/unity_package/Assets/SteamVR/Scripts/SteamVR_LoadLevel.cs
+++ b/unity_package/Assets/SteamVR/Scripts/SteamVR_LoadLevel.cs
@@ -1,4 +1,4 @@
-//========= Copyright 2015, Valve Corporation, All rights reserved. ===========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Helper for smoothing over transitions between levels.
//
diff --git a/unity_package/Assets/SteamVR/Scripts/SteamVR_Menu.cs b/unity_package/Assets/SteamVR/Scripts/SteamVR_Menu.cs
index 12e2aec..4a75343 100644
--- a/unity_package/Assets/SteamVR/Scripts/SteamVR_Menu.cs
+++ b/unity_package/Assets/SteamVR/Scripts/SteamVR_Menu.cs
@@ -1,4 +1,4 @@
-//========= Copyright 2014, Valve Corporation, All rights reserved. ===========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Example menu using OnGUI with SteamVR_Camera's overlay support
//
diff --git a/unity_package/Assets/SteamVR/Scripts/SteamVR_Overlay.cs b/unity_package/Assets/SteamVR/Scripts/SteamVR_Overlay.cs
index 42bd035..d2505c0 100644
--- a/unity_package/Assets/SteamVR/Scripts/SteamVR_Overlay.cs
+++ b/unity_package/Assets/SteamVR/Scripts/SteamVR_Overlay.cs
@@ -1,4 +1,4 @@
-//========= Copyright 2014, Valve Corporation, All rights reserved. ===========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Displays 2d content on a large virtual screen.
//
diff --git a/unity_package/Assets/SteamVR/Scripts/SteamVR_PlayArea.cs b/unity_package/Assets/SteamVR/Scripts/SteamVR_PlayArea.cs
index 550b932..054f9c0 100644
--- a/unity_package/Assets/SteamVR/Scripts/SteamVR_PlayArea.cs
+++ b/unity_package/Assets/SteamVR/Scripts/SteamVR_PlayArea.cs
@@ -1,4 +1,4 @@
-//========= Copyright 2015, Valve Corporation, All rights reserved. ===========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Draws different sized room-scale play areas for targeting content
//
diff --git a/unity_package/Assets/SteamVR/Scripts/SteamVR_Render.cs b/unity_package/Assets/SteamVR/Scripts/SteamVR_Render.cs
index d1c49ba..c943fa4 100644
--- a/unity_package/Assets/SteamVR/Scripts/SteamVR_Render.cs
+++ b/unity_package/Assets/SteamVR/Scripts/SteamVR_Render.cs
@@ -1,4 +1,4 @@
-//========= Copyright 2014, Valve Corporation, All rights reserved. ===========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Handles rendering of all SteamVR_Cameras
//
@@ -262,9 +262,9 @@ public class SteamVR_Render : MonoBehaviour
float sceneResolutionScale = 1.0f, timeScale = 1.0f;
- private void OnInputFocus(params object[] args)
- {
- bool hasFocus = (bool)args[0];
+ private void OnInputFocus(params object[] args)
+ {
+ bool hasFocus = (bool)args[0];
if (hasFocus)
{
if (pauseGameWhenDashboardIsVisible)
@@ -304,17 +304,72 @@ public class SteamVR_Render : MonoBehaviour
#endif
}
- void OnEnable()
+ private string GetScreenshotFilename(uint screenshotHandle, EVRScreenshotPropertyFilenames screenshotPropertyFilename)
+ {
+ var error = EVRScreenshotError.None;
+ var capacity = OpenVR.Screenshots.GetScreenshotPropertyFilename(screenshotHandle, screenshotPropertyFilename, null, 0, ref error);
+ if (error != EVRScreenshotError.None && error != EVRScreenshotError.BufferTooSmall )
+ return null;
+ if (capacity > 1)
+ {
+ var result = new System.Text.StringBuilder((int)capacity);
+ OpenVR.Screenshots.GetScreenshotPropertyFilename(screenshotHandle, screenshotPropertyFilename, result, capacity, ref error);
+ if (error != EVRScreenshotError.None)
+ return null;
+ return result.ToString();
+ }
+ return null;
+ }
+
+ private void OnRequestScreenshot(params object[] args)
+ {
+ var vrEvent = (VREvent_t)args[0];
+ var screenshotHandle = vrEvent.data.screenshot.handle;
+ var screenshotType = (EVRScreenshotType)vrEvent.data.screenshot.type;
+
+ if ( screenshotType == EVRScreenshotType.StereoPanorama )
+ {
+ string previewFilename = GetScreenshotFilename(screenshotHandle, EVRScreenshotPropertyFilenames.Preview);
+ string VRFilename = GetScreenshotFilename(screenshotHandle, EVRScreenshotPropertyFilenames.VR);
+
+ if (previewFilename == null || VRFilename == null)
+ return;
+
+ // Do the stereo panorama screenshot
+ // Figure out where the view is
+ GameObject screenshotPosition = new GameObject("screenshotPosition");
+ screenshotPosition.transform.position = SteamVR_Render.Top().transform.position;
+ screenshotPosition.transform.rotation = SteamVR_Render.Top().transform.rotation;
+ screenshotPosition.transform.localScale = SteamVR_Render.Top().transform.lossyScale;
+ SteamVR_Utils.TakeStereoScreenshot(screenshotPosition, 32, 0.064f, ref previewFilename, ref VRFilename);
+
+ // and submit it
+ OpenVR.Screenshots.SubmitScreenshot(screenshotHandle, screenshotType, previewFilename, VRFilename);
+ }
+ }
+
+ void OnEnable()
{
- StartCoroutine("RenderLoop");
+ StartCoroutine("RenderLoop");
SteamVR_Utils.Event.Listen("input_focus", OnInputFocus);
SteamVR_Utils.Event.Listen("Quit", OnQuit);
+ SteamVR_Utils.Event.Listen("RequestScreenshot", OnRequestScreenshot);
+
+ var vr = SteamVR.instance;
+ if (vr == null)
+ {
+ enabled = false;
+ return;
+ }
+ var types = new EVRScreenshotType[] { EVRScreenshotType.StereoPanorama };
+ OpenVR.Screenshots.HookScreenshot(types);
}
void OnDisable()
{
StopAllCoroutines();
- SteamVR_Utils.Event.Remove("input_focus", OnInputFocus);
+ SteamVR_Utils.Event.Remove("RequestScreenshot", OnRequestScreenshot);
+ SteamVR_Utils.Event.Remove("input_focus", OnInputFocus);
SteamVR_Utils.Event.Remove("Quit", OnQuit);
}
diff --git a/unity_package/Assets/SteamVR/Scripts/SteamVR_RenderModel.cs b/unity_package/Assets/SteamVR/Scripts/SteamVR_RenderModel.cs
index 990de7a..ba16347 100644
--- a/unity_package/Assets/SteamVR/Scripts/SteamVR_RenderModel.cs
+++ b/unity_package/Assets/SteamVR/Scripts/SteamVR_RenderModel.cs
@@ -1,4 +1,4 @@
-//========= Copyright 2014, Valve Corporation, All rights reserved. ===========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Render model of associated tracked object
//
diff --git a/unity_package/Assets/SteamVR/Scripts/SteamVR_Skybox.cs b/unity_package/Assets/SteamVR/Scripts/SteamVR_Skybox.cs
index a0e9e23..5701bec 100644
--- a/unity_package/Assets/SteamVR/Scripts/SteamVR_Skybox.cs
+++ b/unity_package/Assets/SteamVR/Scripts/SteamVR_Skybox.cs
@@ -1,4 +1,4 @@
-//========= Copyright 2015, Valve Corporation, All rights reserved. ===========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Sets cubemap to use in the compositor.
//
diff --git a/unity_package/Assets/SteamVR/Scripts/SteamVR_SphericalProjection.cs b/unity_package/Assets/SteamVR/Scripts/SteamVR_SphericalProjection.cs
index 0cc3fea..8c69c23 100644
--- a/unity_package/Assets/SteamVR/Scripts/SteamVR_SphericalProjection.cs
+++ b/unity_package/Assets/SteamVR/Scripts/SteamVR_SphericalProjection.cs
@@ -1,4 +1,4 @@
-//========= Copyright 2016, Valve Corporation, All rights reserved. ===========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Applies spherical projection to output.
//
diff --git a/unity_package/Assets/SteamVR/Scripts/SteamVR_Stats.cs b/unity_package/Assets/SteamVR/Scripts/SteamVR_Stats.cs
index 29dffa7..932f20c 100644
--- a/unity_package/Assets/SteamVR/Scripts/SteamVR_Stats.cs
+++ b/unity_package/Assets/SteamVR/Scripts/SteamVR_Stats.cs
@@ -1,4 +1,4 @@
-//========= Copyright 2014, Valve Corporation, All rights reserved. ===========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Helper to display various hmd stats via GUIText
//
diff --git a/unity_package/Assets/SteamVR/Scripts/SteamVR_Status.cs b/unity_package/Assets/SteamVR/Scripts/SteamVR_Status.cs
index 57952a1..075a771 100644
--- a/unity_package/Assets/SteamVR/Scripts/SteamVR_Status.cs
+++ b/unity_package/Assets/SteamVR/Scripts/SteamVR_Status.cs
@@ -1,4 +1,4 @@
-//========= Copyright 2014, Valve Corporation, All rights reserved. ===========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Base class for fading things based on SteamVR events
//
diff --git a/unity_package/Assets/SteamVR/Scripts/SteamVR_StatusText.cs b/unity_package/Assets/SteamVR/Scripts/SteamVR_StatusText.cs
index 0c7a6bf..23187c7 100644
--- a/unity_package/Assets/SteamVR/Scripts/SteamVR_StatusText.cs
+++ b/unity_package/Assets/SteamVR/Scripts/SteamVR_StatusText.cs
@@ -1,4 +1,4 @@
-//========= Copyright 2014, Valve Corporation, All rights reserved. ===========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Used to display SteamVR status messages
//
diff --git a/unity_package/Assets/SteamVR/Scripts/SteamVR_TestController.cs b/unity_package/Assets/SteamVR/Scripts/SteamVR_TestController.cs
index a7429ca..009494e 100644
--- a/unity_package/Assets/SteamVR/Scripts/SteamVR_TestController.cs
+++ b/unity_package/Assets/SteamVR/Scripts/SteamVR_TestController.cs
@@ -1,4 +1,4 @@
-//========= Copyright 2015, Valve Corporation, All rights reserved. ===========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Test SteamVR_Controller support.
//
diff --git a/unity_package/Assets/SteamVR/Scripts/SteamVR_TrackedObject.cs b/unity_package/Assets/SteamVR/Scripts/SteamVR_TrackedObject.cs
index 133602b..4c65615 100644
--- a/unity_package/Assets/SteamVR/Scripts/SteamVR_TrackedObject.cs
+++ b/unity_package/Assets/SteamVR/Scripts/SteamVR_TrackedObject.cs
@@ -1,4 +1,4 @@
-//========= Copyright 2014, Valve Corporation, All rights reserved. ===========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: For controlling in-game objects with tracked devices.
//
diff --git a/unity_package/Assets/SteamVR/Scripts/SteamVR_UpdatePoses.cs b/unity_package/Assets/SteamVR/Scripts/SteamVR_UpdatePoses.cs
index 4079993..fa04192 100644
--- a/unity_package/Assets/SteamVR/Scripts/SteamVR_UpdatePoses.cs
+++ b/unity_package/Assets/SteamVR/Scripts/SteamVR_UpdatePoses.cs
@@ -1,4 +1,4 @@
-//========= Copyright 2016, Valve Corporation, All rights reserved. ===========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Helper to update poses when using native OpenVR integration.
//
diff --git a/unity_package/Assets/SteamVR/Scripts/SteamVR_Utils.cs b/unity_package/Assets/SteamVR/Scripts/SteamVR_Utils.cs
index 7f1d182..45e63a8 100644
--- a/unity_package/Assets/SteamVR/Scripts/SteamVR_Utils.cs
+++ b/unity_package/Assets/SteamVR/Scripts/SteamVR_Utils.cs
@@ -1,4 +1,4 @@
-//========= Copyright 2014, Valve Corporation, All rights reserved. ===========
+//======= Copyright (c) Valve Corporation, All rights reserved. ===============
//
// Purpose: Utilities for working with SteamVR
//
@@ -11,482 +11,704 @@ using Valve.VR;
public static class SteamVR_Utils
{
- public class Event
- {
- public delegate void Handler(params object[] args);
-
- public static void Listen(string message, Handler action)
- {
- var actions = listeners[message] as Handler;
- if (actions != null)
- {
- listeners[message] = actions + action;
- }
- else
- {
- listeners[message] = action;
- }
- }
-
- public static void Remove(string message, Handler action)
- {
- var actions = listeners[message] as Handler;
- if (actions != null)
- {
- listeners[message] = actions - action;
- }
- }
-
- public static void Send(string message, params object[] args)
- {
- var actions = listeners[message] as Handler;
- if (actions != null)
- {
- actions(args);
- }
- }
-
- private static Hashtable listeners = new Hashtable();
- }
-
- // this version does not clamp [0..1]
- public static Quaternion Slerp(Quaternion A, Quaternion B, float t)
- {
- var cosom = Mathf.Clamp(A.x * B.x + A.y * B.y + A.z * B.z + A.w * B.w, -1.0f, 1.0f);
- if (cosom < 0.0f)
- {
- B = new Quaternion(-B.x, -B.y, -B.z, -B.w);
- cosom = -cosom;
- }
-
- float sclp, sclq;
- if ((1.0f - cosom) > 0.0001f)
- {
- var omega = Mathf.Acos(cosom);
- var sinom = Mathf.Sin(omega);
- sclp = Mathf.Sin((1.0f - t) * omega) / sinom;
- sclq = Mathf.Sin(t * omega) / sinom;
- }
- else
- {
- // "from" and "to" very close, so do linear interp
- sclp = 1.0f - t;
- sclq = t;
- }
-
- return new Quaternion(
- sclp * A.x + sclq * B.x,
- sclp * A.y + sclq * B.y,
- sclp * A.z + sclq * B.z,
- sclp * A.w + sclq * B.w);
- }
-
- public static Vector3 Lerp(Vector3 A, Vector3 B, float t)
- {
- return new Vector3(
- Lerp(A.x, B.x, t),
- Lerp(A.y, B.y, t),
- Lerp(A.z, B.z, t));
- }
-
- public static float Lerp(float A, float B, float t)
- {
- return A + (B - A) * t;
- }
-
- public static double Lerp(double A, double B, double t)
- {
- return A + (B - A) * t;
- }
-
- public static float InverseLerp(Vector3 A, Vector3 B, Vector3 result)
- {
- return Vector3.Dot(result - A, B - A);
- }
-
- public static float InverseLerp(float A, float B, float result)
- {
- return (result - A) / (B - A);
- }
-
- public static double InverseLerp(double A, double B, double result)
- {
- return (result - A) / (B - A);
- }
-
- public static float Saturate(float A)
- {
- return (A < 0) ? 0 : (A > 1) ? 1 : A;
- }
-
- public static Vector2 Saturate(Vector2 A)
- {
- return new Vector2(Saturate(A.x), Saturate(A.y));
- }
-
- public static float Abs(float A)
- {
- return (A < 0) ? -A : A;
- }
-
- public static Vector2 Abs(Vector2 A)
- {
- return new Vector2(Abs(A.x), Abs(A.y));
- }
-
- private static float _copysign(float sizeval, float signval)
- {
- return Mathf.Sign(signval) == 1 ? Mathf.Abs(sizeval) : -Mathf.Abs(sizeval);
- }
-
- public static Quaternion GetRotation(this Matrix4x4 matrix)
- {
- Quaternion q = new Quaternion();
- q.w = Mathf.Sqrt(Mathf.Max(0, 1 + matrix.m00 + matrix.m11 + matrix.m22)) / 2;
- q.x = Mathf.Sqrt(Mathf.Max(0, 1 + matrix.m00 - matrix.m11 - matrix.m22)) / 2;
- q.y = Mathf.Sqrt(Mathf.Max(0, 1 - matrix.m00 + matrix.m11 - matrix.m22)) / 2;
- q.z = Mathf.Sqrt(Mathf.Max(0, 1 - matrix.m00 - matrix.m11 + matrix.m22)) / 2;
- q.x = _copysign(q.x, matrix.m21 - matrix.m12);
- q.y = _copysign(q.y, matrix.m02 - matrix.m20);
- q.z = _copysign(q.z, matrix.m10 - matrix.m01);
- return q;
- }
-
- public static Vector3 GetPosition(this Matrix4x4 matrix)
- {
- var x = matrix.m03;
- var y = matrix.m13;
- var z = matrix.m23;
-
- return new Vector3(x, y, z);
- }
-
- public static Vector3 GetScale(this Matrix4x4 m)
- {
- var x = Mathf.Sqrt(m.m00 * m.m00 + m.m01 * m.m01 + m.m02 * m.m02);
- var y = Mathf.Sqrt(m.m10 * m.m10 + m.m11 * m.m11 + m.m12 * m.m12);
- var z = Mathf.Sqrt(m.m20 * m.m20 + m.m21 * m.m21 + m.m22 * m.m22);
-
- return new Vector3(x, y, z);
- }
-
- [System.Serializable]
- public struct RigidTransform
- {
- public Vector3 pos;
- public Quaternion rot;
-
- public static RigidTransform identity
- {
- get { return new RigidTransform(Vector3.zero, Quaternion.identity); }
- }
-
- public static RigidTransform FromLocal(Transform t)
- {
- return new RigidTransform(t.localPosition, t.localRotation);
- }
-
- public RigidTransform(Vector3 pos, Quaternion rot)
- {
- this.pos = pos;
- this.rot = rot;
- }
-
- public RigidTransform(Transform t)
- {
- this.pos = t.position;
- this.rot = t.rotation;
- }
-
- public RigidTransform(Transform from, Transform to)
- {
- var inv = Quaternion.Inverse(from.rotation);
- rot = inv * to.rotation;
- pos = inv * (to.position - from.position);
- }
-
- public RigidTransform(HmdMatrix34_t pose)
- {
- var m = Matrix4x4.identity;
-
- m[0, 0] = pose.m0;
- m[0, 1] = pose.m1;
- m[0, 2] = -pose.m2;
- m[0, 3] = pose.m3;
-
- m[1, 0] = pose.m4;
- m[1, 1] = pose.m5;
- m[1, 2] = -pose.m6;
- m[1, 3] = pose.m7;
-
- m[2, 0] = -pose.m8;
- m[2, 1] = -pose.m9;
- m[2, 2] = pose.m10;
- m[2, 3] = -pose.m11;
-
- this.pos = m.GetPosition();
- this.rot = m.GetRotation();
- }
-
- public RigidTransform(HmdMatrix44_t pose)
- {
- var m = Matrix4x4.identity;
-
- m[0, 0] = pose.m0;
- m[0, 1] = pose.m1;
- m[0, 2] = -pose.m2;
- m[0, 3] = pose.m3;
-
- m[1, 0] = pose.m4;
- m[1, 1] = pose.m5;
- m[1, 2] = -pose.m6;
- m[1, 3] = pose.m7;
-
- m[2, 0] = -pose.m8;
- m[2, 1] = -pose.m9;
- m[2, 2] = pose.m10;
- m[2, 3] = -pose.m11;
-
- m[3, 0] = pose.m12;
- m[3, 1] = pose.m13;
- m[3, 2] = -pose.m14;
- m[3, 3] = pose.m15;
-
- this.pos = m.GetPosition();
- this.rot = m.GetRotation();
- }
-
- public HmdMatrix44_t ToHmdMatrix44()
- {
- var m = Matrix4x4.TRS(pos, rot, Vector3.one);
- var pose = new HmdMatrix44_t();
-
- pose.m0 = m[0, 0];
- pose.m1 = m[0, 1];
- pose.m2 = -m[0, 2];
- pose.m3 = m[0, 3];
-
- pose.m4 = m[1, 0];
- pose.m5 = m[1, 1];
- pose.m6 = -m[1, 2];
- pose.m7 = m[1, 3];
-
- pose.m8 = -m[2, 0];
- pose.m9 = -m[2, 1];
- pose.m10 = m[2, 2];
- pose.m11 = -m[2, 3];
-
- pose.m12 = m[3, 0];
- pose.m13 = m[3, 1];
- pose.m14 = -m[3, 2];
- pose.m15 = m[3, 3];
-
- return pose;
- }
-
- public HmdMatrix34_t ToHmdMatrix34()
- {
- var m = Matrix4x4.TRS(pos, rot, Vector3.one);
- var pose = new HmdMatrix34_t();
-
- pose.m0 = m[0, 0];
- pose.m1 = m[0, 1];
- pose.m2 = -m[0, 2];
- pose.m3 = m[0, 3];
-
- pose.m4 = m[1, 0];
- pose.m5 = m[1, 1];
- pose.m6 = -m[1, 2];
- pose.m7 = m[1, 3];
-
- pose.m8 = -m[2, 0];
- pose.m9 = -m[2, 1];
- pose.m10 = m[2, 2];
- pose.m11 = -m[2, 3];
-
- return pose;
- }
-
- public override bool Equals(object o)
- {
- if (o is RigidTransform)
- {
- RigidTransform t = (RigidTransform)o;
- return pos == t.pos && rot == t.rot;
- }
- return false;
- }
-
- public override int GetHashCode()
- {
- return pos.GetHashCode() ^ rot.GetHashCode();
- }
-
- public static bool operator ==(RigidTransform a, RigidTransform b)
- {
- return a.pos == b.pos && a.rot == b.rot;
- }
-
- public static bool operator !=(RigidTransform a, RigidTransform b)
- {
- return a.pos != b.pos || a.rot != b.rot;
- }
-
- public static RigidTransform operator *(RigidTransform a, RigidTransform b)
- {
- return new RigidTransform
- {
- rot = a.rot * b.rot,
- pos = a.pos + a.rot * b.pos
- };
- }
-
- public void Inverse()
- {
- rot = Quaternion.Inverse(rot);
- pos = -(rot * pos);
- }
-
- public RigidTransform GetInverse()
- {
- var t = new RigidTransform(pos, rot);
- t.Inverse();
- return t;
- }
-
- public void Multiply(RigidTransform a, RigidTransform b)
- {
- rot = a.rot * b.rot;
- pos = a.pos + a.rot * b.pos;
- }
-
- public Vector3 InverseTransformPoint(Vector3 point)
- {
- return Quaternion.Inverse(rot) * (point - pos);
- }
-
- public Vector3 TransformPoint(Vector3 point)
- {
- return pos + (rot * point);
- }
-
- public static Vector3 operator *(RigidTransform t, Vector3 v)
- {
- return t.TransformPoint(v);
- }
-
- public static RigidTransform Interpolate(RigidTransform a, RigidTransform b, float t)
- {
- return new RigidTransform(Vector3.Lerp(a.pos, b.pos, t), Quaternion.Slerp(a.rot, b.rot, t));
- }
-
- public void Interpolate(RigidTransform to, float t)
- {
- pos = SteamVR_Utils.Lerp(pos, to.pos, t);
- rot = SteamVR_Utils.Slerp(rot, to.rot, t);
- }
- }
-
- public static Mesh CreateHiddenAreaMesh(HiddenAreaMesh_t src, VRTextureBounds_t bounds)
- {
- if (src.unTriangleCount == 0)
- return null;
-
- var data = new float[src.unTriangleCount * 3 * 2]; //HmdVector2_t
- Marshal.Copy(src.pVertexData, data, 0, data.Length);
-
- var vertices = new Vector3[src.unTriangleCount * 3 + 12];
- var indices = new int[src.unTriangleCount * 3 + 24];
-
- var x0 = 2.0f * bounds.uMin - 1.0f;
- var x1 = 2.0f * bounds.uMax - 1.0f;
- var y0 = 2.0f * bounds.vMin - 1.0f;
- var y1 = 2.0f * bounds.vMax - 1.0f;
-
- for (int i = 0, j = 0; i < src.unTriangleCount * 3; i++)
- {
- var x = Lerp(x0, x1, data[j++]);
- var y = Lerp(y0, y1, data[j++]);
- vertices[i] = new Vector3(x, y, 0.0f);
- indices[i] = i;
- }
-
- // Add border
- var offset = (int)src.unTriangleCount * 3;
- var iVert = offset;
- vertices[iVert++] = new Vector3(-1, -1, 0);
- vertices[iVert++] = new Vector3(x0, -1, 0);
- vertices[iVert++] = new Vector3(-1, 1, 0);
- vertices[iVert++] = new Vector3(x0, 1, 0);
- vertices[iVert++] = new Vector3(x1, -1, 0);
- vertices[iVert++] = new Vector3( 1, -1, 0);
- vertices[iVert++] = new Vector3(x1, 1, 0);
- vertices[iVert++] = new Vector3( 1, 1, 0);
- vertices[iVert++] = new Vector3(x0, y0, 0);
- vertices[iVert++] = new Vector3(x1, y0, 0);
- vertices[iVert++] = new Vector3(x0, y1, 0);
- vertices[iVert++] = new Vector3(x1, y1, 0);
-
- var iTri = offset;
- indices[iTri++] = offset + 0;
- indices[iTri++] = offset + 1;
- indices[iTri++] = offset + 2;
- indices[iTri++] = offset + 2;
- indices[iTri++] = offset + 1;
- indices[iTri++] = offset + 3;
- indices[iTri++] = offset + 4;
- indices[iTri++] = offset + 5;
- indices[iTri++] = offset + 6;
- indices[iTri++] = offset + 6;
- indices[iTri++] = offset + 5;
- indices[iTri++] = offset + 7;
- indices[iTri++] = offset + 1;
- indices[iTri++] = offset + 4;
- indices[iTri++] = offset + 8;
- indices[iTri++] = offset + 8;
- indices[iTri++] = offset + 4;
- indices[iTri++] = offset + 9;
- indices[iTri++] = offset + 10;
- indices[iTri++] = offset + 11;
- indices[iTri++] = offset + 3;
- indices[iTri++] = offset + 3;
- indices[iTri++] = offset + 11;
- indices[iTri++] = offset + 6;
-
- var mesh = new Mesh();
- mesh.vertices = vertices;
- mesh.triangles = indices;
- mesh.bounds = new Bounds( Vector3.zero, new Vector3( float.MaxValue, float.MaxValue, float.MaxValue ) ); // Prevent frustum culling from culling this mesh
- return mesh;
- }
-
- public delegate object SystemFn(CVRSystem system, params object[] args);
-
- public static object CallSystemFn(SystemFn fn, params object[] args)
- {
- var initOpenVR = (!SteamVR.active && !SteamVR.usingNativeSupport);
- if (initOpenVR)
- {
- var error = EVRInitError.None;
- OpenVR.Init(ref error, EVRApplicationType.VRApplication_Other);
- }
-
- var system = OpenVR.System;
- var result = (system != null) ? fn(system, args) : null;
-
- if (initOpenVR)
- OpenVR.Shutdown();
-
- return result;
- }
-
- public static void QueueEventOnRenderThread(int eventID)
- {
+ public class Event
+ {
+ public delegate void Handler(params object[] args);
+
+ public static void Listen(string message, Handler action)
+ {
+ var actions = listeners[message] as Handler;
+ if (actions != null)
+ {
+ listeners[message] = actions + action;
+ }
+ else
+ {
+ listeners[message] = action;
+ }
+ }
+
+ public static void Remove(string message, Handler action)
+ {
+ var actions = listeners[message] as Handler;
+ if (actions != null)
+ {
+ listeners[message] = actions - action;
+ }
+ }
+
+ public static void Send(string message, params object[] args)
+ {
+ var actions = listeners[message] as Handler;
+ if (actions != null)
+ {
+ actions(args);
+ }
+ }
+
+ private static Hashtable listeners = new Hashtable();
+ }
+
+ // this version does not clamp [0..1]
+ public static Quaternion Slerp(Quaternion A, Quaternion B, float t)
+ {
+ var cosom = Mathf.Clamp(A.x * B.x + A.y * B.y + A.z * B.z + A.w * B.w, -1.0f, 1.0f);
+ if (cosom < 0.0f)
+ {
+ B = new Quaternion(-B.x, -B.y, -B.z, -B.w);
+ cosom = -cosom;
+ }
+
+ float sclp, sclq;
+ if ((1.0f - cosom) > 0.0001f)
+ {
+ var omega = Mathf.Acos(cosom);
+ var sinom = Mathf.Sin(omega);
+ sclp = Mathf.Sin((1.0f - t) * omega) / sinom;
+ sclq = Mathf.Sin(t * omega) / sinom;
+ }
+ else
+ {
+ // "from" and "to" very close, so do linear interp
+ sclp = 1.0f - t;
+ sclq = t;
+ }
+
+ return new Quaternion(
+ sclp * A.x + sclq * B.x,
+ sclp * A.y + sclq * B.y,
+ sclp * A.z + sclq * B.z,
+ sclp * A.w + sclq * B.w);
+ }
+
+ public static Vector3 Lerp(Vector3 A, Vector3 B, float t)
+ {
+ return new Vector3(
+ Lerp(A.x, B.x, t),
+ Lerp(A.y, B.y, t),
+ Lerp(A.z, B.z, t));
+ }
+
+ public static float Lerp(float A, float B, float t)
+ {
+ return A + (B - A) * t;
+ }
+
+ public static double Lerp(double A, double B, double t)
+ {
+ return A + (B - A) * t;
+ }
+
+ public static float InverseLerp(Vector3 A, Vector3 B, Vector3 result)
+ {
+ return Vector3.Dot(result - A, B - A);
+ }
+
+ public static float InverseLerp(float A, float B, float result)
+ {
+ return (result - A) / (B - A);
+ }
+
+ public static double InverseLerp(double A, double B, double result)
+ {
+ return (result - A) / (B - A);
+ }
+
+ public static float Saturate(float A)
+ {
+ return (A < 0) ? 0 : (A > 1) ? 1 : A;
+ }
+
+ public static Vector2 Saturate(Vector2 A)
+ {
+ return new Vector2(Saturate(A.x), Saturate(A.y));
+ }
+
+ public static float Abs(float A)
+ {
+ return (A < 0) ? -A : A;
+ }
+
+ public static Vector2 Abs(Vector2 A)
+ {
+ return new Vector2(Abs(A.x), Abs(A.y));
+ }
+
+ private static float _copysign(float sizeval, float signval)
+ {
+ return Mathf.Sign(signval) == 1 ? Mathf.Abs(sizeval) : -Mathf.Abs(sizeval);
+ }
+
+ public static Quaternion GetRotation(this Matrix4x4 matrix)
+ {
+ Quaternion q = new Quaternion();
+ q.w = Mathf.Sqrt(Mathf.Max(0, 1 + matrix.m00 + matrix.m11 + matrix.m22)) / 2;
+ q.x = Mathf.Sqrt(Mathf.Max(0, 1 + matrix.m00 - matrix.m11 - matrix.m22)) / 2;
+ q.y = Mathf.Sqrt(Mathf.Max(0, 1 - matrix.m00 + matrix.m11 - matrix.m22)) / 2;
+ q.z = Mathf.Sqrt(Mathf.Max(0, 1 - matrix.m00 - matrix.m11 + matrix.m22)) / 2;
+ q.x = _copysign(q.x, matrix.m21 - matrix.m12);
+ q.y = _copysign(q.y, matrix.m02 - matrix.m20);
+ q.z = _copysign(q.z, matrix.m10 - matrix.m01);
+ return q;
+ }
+
+ public static Vector3 GetPosition(this Matrix4x4 matrix)
+ {
+ var x = matrix.m03;
+ var y = matrix.m13;
+ var z = matrix.m23;
+
+ return new Vector3(x, y, z);
+ }
+
+ public static Vector3 GetScale(this Matrix4x4 m)
+ {
+ var x = Mathf.Sqrt(m.m00 * m.m00 + m.m01 * m.m01 + m.m02 * m.m02);
+ var y = Mathf.Sqrt(m.m10 * m.m10 + m.m11 * m.m11 + m.m12 * m.m12);
+ var z = Mathf.Sqrt(m.m20 * m.m20 + m.m21 * m.m21 + m.m22 * m.m22);
+
+ return new Vector3(x, y, z);
+ }
+
+ [System.Serializable]
+ public struct RigidTransform
+ {
+ public Vector3 pos;
+ public Quaternion rot;
+
+ public static RigidTransform identity
+ {
+ get { return new RigidTransform(Vector3.zero, Quaternion.identity); }
+ }
+
+ public static RigidTransform FromLocal(Transform t)
+ {
+ return new RigidTransform(t.localPosition, t.localRotation);
+ }
+
+ public RigidTransform(Vector3 pos, Quaternion rot)
+ {
+ this.pos = pos;
+ this.rot = rot;
+ }
+
+ public RigidTransform(Transform t)
+ {
+ this.pos = t.position;
+ this.rot = t.rotation;
+ }
+
+ public RigidTransform(Transform from, Transform to)
+ {
+ var inv = Quaternion.Inverse(from.rotation);
+ rot = inv * to.rotation;
+ pos = inv * (to.position - from.position);
+ }
+
+ public RigidTransform(HmdMatrix34_t pose)
+ {
+ var m = Matrix4x4.identity;
+
+ m[0, 0] = pose.m0;
+ m[0, 1] = pose.m1;
+ m[0, 2] = -pose.m2;
+ m[0, 3] = pose.m3;
+
+ m[1, 0] = pose.m4;
+ m[1, 1] = pose.m5;
+ m[1, 2] = -pose.m6;
+ m[1, 3] = pose.m7;
+
+ m[2, 0] = -pose.m8;
+ m[2, 1] = -pose.m9;
+ m[2, 2] = pose.m10;
+ m[2, 3] = -pose.m11;
+
+ this.pos = m.GetPosition();
+ this.rot = m.GetRotation();
+ }
+
+ public RigidTransform(HmdMatrix44_t pose)
+ {
+ var m = Matrix4x4.identity;
+
+ m[0, 0] = pose.m0;
+ m[0, 1] = pose.m1;
+ m[0, 2] = -pose.m2;
+ m[0, 3] = pose.m3;
+
+ m[1, 0] = pose.m4;
+ m[1, 1] = pose.m5;
+ m[1, 2] = -pose.m6;
+ m[1, 3] = pose.m7;
+
+ m[2, 0] = -pose.m8;
+ m[2, 1] = -pose.m9;
+ m[2, 2] = pose.m10;
+ m[2, 3] = -pose.m11;
+
+ m[3, 0] = pose.m12;
+ m[3, 1] = pose.m13;
+ m[3, 2] = -pose.m14;
+ m[3, 3] = pose.m15;
+
+ this.pos = m.GetPosition();
+ this.rot = m.GetRotation();
+ }
+
+ public HmdMatrix44_t ToHmdMatrix44()
+ {
+ var m = Matrix4x4.TRS(pos, rot, Vector3.one);
+ var pose = new HmdMatrix44_t();
+
+ pose.m0 = m[0, 0];
+ pose.m1 = m[0, 1];
+ pose.m2 = -m[0, 2];
+ pose.m3 = m[0, 3];
+
+ pose.m4 = m[1, 0];
+ pose.m5 = m[1, 1];
+ pose.m6 = -m[1, 2];
+ pose.m7 = m[1, 3];
+
+ pose.m8 = -m[2, 0];
+ pose.m9 = -m[2, 1];
+ pose.m10 = m[2, 2];
+ pose.m11 = -m[2, 3];
+
+ pose.m12 = m[3, 0];
+ pose.m13 = m[3, 1];
+ pose.m14 = -m[3, 2];
+ pose.m15 = m[3, 3];
+
+ return pose;
+ }
+
+ public HmdMatrix34_t ToHmdMatrix34()
+ {
+ var m = Matrix4x4.TRS(pos, rot, Vector3.one);
+ var pose = new HmdMatrix34_t();
+
+ pose.m0 = m[0, 0];
+ pose.m1 = m[0, 1];
+ pose.m2 = -m[0, 2];
+ pose.m3 = m[0, 3];
+
+ pose.m4 = m[1, 0];
+ pose.m5 = m[1, 1];
+ pose.m6 = -m[1, 2];
+ pose.m7 = m[1, 3];
+
+ pose.m8 = -m[2, 0];
+ pose.m9 = -m[2, 1];
+ pose.m10 = m[2, 2];
+ pose.m11 = -m[2, 3];
+
+ return pose;
+ }
+
+ public override bool Equals(object o)
+ {
+ if (o is RigidTransform)
+ {
+ RigidTransform t = (RigidTransform)o;
+ return pos == t.pos && rot == t.rot;
+ }
+ return false;
+ }
+
+ public override int GetHashCode()
+ {
+ return pos.GetHashCode() ^ rot.GetHashCode();
+ }
+
+ public static bool operator ==(RigidTransform a, RigidTransform b)
+ {
+ return a.pos == b.pos && a.rot == b.rot;
+ }
+
+ public static bool operator !=(RigidTransform a, RigidTransform b)
+ {
+ return a.pos != b.pos || a.rot != b.rot;
+ }
+
+ public static RigidTransform operator *(RigidTransform a, RigidTransform b)
+ {
+ return new RigidTransform
+ {
+ rot = a.rot * b.rot,
+ pos = a.pos + a.rot * b.pos
+ };
+ }
+
+ public void Inverse()
+ {
+ rot = Quaternion.Inverse(rot);
+ pos = -(rot * pos);
+ }
+
+ public RigidTransform GetInverse()
+ {
+ var t = new RigidTransform(pos, rot);
+ t.Inverse();
+ return t;
+ }
+
+ public void Multiply(RigidTransform a, RigidTransform b)
+ {
+ rot = a.rot * b.rot;
+ pos = a.pos + a.rot * b.pos;
+ }
+
+ public Vector3 InverseTransformPoint(Vector3 point)
+ {
+ return Quaternion.Inverse(rot) * (point - pos);
+ }
+
+ public Vector3 TransformPoint(Vector3 point)
+ {
+ return pos + (rot * point);
+ }
+
+ public static Vector3 operator *(RigidTransform t, Vector3 v)
+ {
+ return t.TransformPoint(v);
+ }
+
+ public static RigidTransform Interpolate(RigidTransform a, RigidTransform b, float t)
+ {
+ return new RigidTransform(Vector3.Lerp(a.pos, b.pos, t), Quaternion.Slerp(a.rot, b.rot, t));
+ }
+
+ public void Interpolate(RigidTransform to, float t)
+ {
+ pos = SteamVR_Utils.Lerp(pos, to.pos, t);
+ rot = SteamVR_Utils.Slerp(rot, to.rot, t);
+ }
+ }
+
+ public static Mesh CreateHiddenAreaMesh(HiddenAreaMesh_t src, VRTextureBounds_t bounds)
+ {
+ if (src.unTriangleCount == 0)
+ return null;
+
+ var data = new float[src.unTriangleCount * 3 * 2]; //HmdVector2_t
+ Marshal.Copy(src.pVertexData, data, 0, data.Length);
+
+ var vertices = new Vector3[src.unTriangleCount * 3 + 12];
+ var indices = new int[src.unTriangleCount * 3 + 24];
+
+ var x0 = 2.0f * bounds.uMin - 1.0f;
+ var x1 = 2.0f * bounds.uMax - 1.0f;
+ var y0 = 2.0f * bounds.vMin - 1.0f;
+ var y1 = 2.0f * bounds.vMax - 1.0f;
+
+ for (int i = 0, j = 0; i < src.unTriangleCount * 3; i++)
+ {
+ var x = Lerp(x0, x1, data[j++]);
+ var y = Lerp(y0, y1, data[j++]);
+ vertices[i] = new Vector3(x, y, 0.0f);
+ indices[i] = i;
+ }
+
+ // Add border
+ var offset = (int)src.unTriangleCount * 3;
+ var iVert = offset;
+ vertices[iVert++] = new Vector3(-1, -1, 0);
+ vertices[iVert++] = new Vector3(x0, -1, 0);
+ vertices[iVert++] = new Vector3(-1, 1, 0);
+ vertices[iVert++] = new Vector3(x0, 1, 0);
+ vertices[iVert++] = new Vector3(x1, -1, 0);
+ vertices[iVert++] = new Vector3(1, -1, 0);
+ vertices[iVert++] = new Vector3(x1, 1, 0);
+ vertices[iVert++] = new Vector3(1, 1, 0);
+ vertices[iVert++] = new Vector3(x0, y0, 0);
+ vertices[iVert++] = new Vector3(x1, y0, 0);
+ vertices[iVert++] = new Vector3(x0, y1, 0);
+ vertices[iVert++] = new Vector3(x1, y1, 0);
+
+ var iTri = offset;
+ indices[iTri++] = offset + 0;
+ indices[iTri++] = offset + 1;
+ indices[iTri++] = offset + 2;
+ indices[iTri++] = offset + 2;
+ indices[iTri++] = offset + 1;
+ indices[iTri++] = offset + 3;
+ indices[iTri++] = offset + 4;
+ indices[iTri++] = offset + 5;
+ indices[iTri++] = offset + 6;
+ indices[iTri++] = offset + 6;
+ indices[iTri++] = offset + 5;
+ indices[iTri++] = offset + 7;
+ indices[iTri++] = offset + 1;
+ indices[iTri++] = offset + 4;
+ indices[iTri++] = offset + 8;
+ indices[iTri++] = offset + 8;
+ indices[iTri++] = offset + 4;
+ indices[iTri++] = offset + 9;
+ indices[iTri++] = offset + 10;
+ indices[iTri++] = offset + 11;
+ indices[iTri++] = offset + 3;
+ indices[iTri++] = offset + 3;
+ indices[iTri++] = offset + 11;
+ indices[iTri++] = offset + 6;
+
+ var mesh = new Mesh();
+ mesh.vertices = vertices;
+ mesh.triangles = indices;
+ mesh.bounds = new Bounds(Vector3.zero, new Vector3(float.MaxValue, float.MaxValue, float.MaxValue)); // Prevent frustum culling from culling this mesh
+ return mesh;
+ }
+
+ public delegate object SystemFn(CVRSystem system, params object[] args);
+
+ public static object CallSystemFn(SystemFn fn, params object[] args)
+ {
+ var initOpenVR = (!SteamVR.active && !SteamVR.usingNativeSupport);
+ if (initOpenVR)
+ {
+ var error = EVRInitError.None;
+ OpenVR.Init(ref error, EVRApplicationType.VRApplication_Other);
+ }
+
+ var system = OpenVR.System;
+ var result = (system != null) ? fn(system, args) : null;
+
+ if (initOpenVR)
+ OpenVR.Shutdown();
+
+ return result;
+ }
+
+ public static void QueueEventOnRenderThread(int eventID)
+ {
#if (UNITY_5_0 || UNITY_5_1)
GL.IssuePluginEvent(eventID);
#elif (UNITY_5_2 || UNITY_5_3)
GL.IssuePluginEvent(SteamVR.Unity.GetRenderEventFunc(), eventID);
#endif
- }
+ }
+
+ public static void TakeStereoScreenshot(GameObject target, int cellSize, float ipd, ref string previewFilename, ref string VRFilename)
+ {
+ const int width = 4096;
+ const int height = width / 2;
+ const int halfHeight = height / 2;
+
+ var texture = new Texture2D(width, height * 2, TextureFormat.ARGB32, false);
+
+ var timer = new System.Diagnostics.Stopwatch();
+
+ Camera tempCamera = null;
+
+ timer.Start();
+
+ var camera = target.GetComponent<Camera>();
+ if (camera == null)
+ {
+ if (tempCamera == null)
+ tempCamera = new GameObject().AddComponent<Camera>();
+ camera = tempCamera;
+ }
+
+ // Render preview texture
+ const int previewWidth = 2048;
+ const int previewHeight = 2048;
+ var previewTexture = new Texture2D(previewWidth, previewHeight, TextureFormat.ARGB32, false);
+ var targetPreviewTexture = new RenderTexture(previewWidth, previewHeight, 24);
+
+ var oldTargetTexture = camera.targetTexture;
+ var oldOrthographic = camera.orthographic;
+ var oldFieldOfView = camera.fieldOfView;
+ var oldAspect = camera.aspect;
+#if !(UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
+ var oldstereoTargetEye = camera.stereoTargetEye;
+ camera.stereoTargetEye = StereoTargetEyeMask.None;
+#endif
+ camera.fieldOfView = 60.0f;
+ camera.orthographic = false;
+ camera.targetTexture = targetPreviewTexture;
+ camera.aspect = 1.0f;
+ camera.Render();
+
+ // copy preview texture
+ RenderTexture.active = targetPreviewTexture;
+ previewTexture.ReadPixels(new Rect(0, 0, targetPreviewTexture.width, targetPreviewTexture.height), 0, 0);
+ RenderTexture.active = null;
+ camera.targetTexture = null;
+ Object.DestroyImmediate(targetPreviewTexture);
+
+ var fx = camera.gameObject.AddComponent<SteamVR_SphericalProjection>();
+
+ var oldPosition = target.transform.localPosition;
+ var oldRotation = target.transform.localRotation;
+ var basePosition = target.transform.position;
+ var baseRotation = Quaternion.Euler(0, target.transform.rotation.eulerAngles.y, 0);
+
+ var transform = camera.transform;
+
+ int vTotal = halfHeight / cellSize;
+ float dv = 90.0f / vTotal; // vertical degrees per segment
+ float dvHalf = dv / 2.0f;
+
+ var targetTexture = new RenderTexture(cellSize, cellSize, 24);
+ targetTexture.wrapMode = TextureWrapMode.Clamp;
+ targetTexture.antiAliasing = 8;
+
+ camera.fieldOfView = dv;
+ camera.orthographic = false;
+ camera.targetTexture = targetTexture;
+ camera.aspect = oldAspect;
+#if !(UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
+ camera.stereoTargetEye = StereoTargetEyeMask.None;
+#endif
+
+ // Render sections of a sphere using a rectilinear projection
+ // and resample using a sphereical projection into a single panorama
+ // texture per eye. We break into sections in order to keep the eye
+ // separation similar around the sphere. Rendering alternates between
+ // top and bottom sections, sweeping horizontally around the sphere,
+ // alternating left and right eyes.
+ for (int v = 0; v < vTotal; v++)
+ {
+ var pitch = 90.0f - (v * dv) - dvHalf;
+ var uTotal = width / targetTexture.width;
+ var du = 360.0f / uTotal; // horizontal degrees per segment
+ var duHalf = du / 2.0f;
+
+ var vTarget = v * halfHeight / vTotal;
+
+ for (int i = 0; i < 2; i++) // top, bottom
+ {
+ if (i == 1)
+ {
+ pitch = -pitch;
+ vTarget = height - vTarget - cellSize;
+ }
+
+ for (int u = 0; u < uTotal; u++)
+ {
+ var yaw = -180.0f + (u * du) + duHalf;
+
+ var uTarget = u * width / uTotal;
+
+ var xOffset = -ipd / 2 * Mathf.Cos(pitch * Mathf.Deg2Rad);
+
+ for (int j = 0; j < 2; j++) // left, right
+ {
+ if (j == 1)
+ {
+ xOffset = -xOffset;
+ }
+
+ var offset = baseRotation * Quaternion.Euler(0, yaw, 0) * new Vector3(xOffset, 0, 0);
+ transform.position = basePosition + offset;
+
+ var direction = Quaternion.Euler(pitch, yaw, 0.0f);
+ transform.rotation = baseRotation * direction;
+
+ // vector pointing to center of this section
+ var N = direction * Vector3.forward;
+
+ // horizontal span of this section in degrees
+ var phi0 = yaw - (du / 2);
+ var phi1 = phi0 + du;
+
+ // vertical span of this section in degrees
+ var theta0 = pitch + (dv / 2);
+ var theta1 = theta0 - dv;
+
+ var midPhi = (phi0 + phi1) / 2;
+ var baseTheta = Mathf.Abs(theta0) < Mathf.Abs(theta1) ? theta0 : theta1;
+
+ // vectors pointing to corners of image closes to the equator
+ var V00 = Quaternion.Euler(baseTheta, phi0, 0.0f) * Vector3.forward;
+ var V01 = Quaternion.Euler(baseTheta, phi1, 0.0f) * Vector3.forward;
+
+ // vectors pointing to top and bottom midsection of image
+ var V0M = Quaternion.Euler(theta0, midPhi, 0.0f) * Vector3.forward;
+ var V1M = Quaternion.Euler(theta1, midPhi, 0.0f) * Vector3.forward;
+
+ // intersection points for each of the above
+ var P00 = V00 / Vector3.Dot(V00, N);
+ var P01 = V01 / Vector3.Dot(V01, N);
+ var P0M = V0M / Vector3.Dot(V0M, N);
+ var P1M = V1M / Vector3.Dot(V1M, N);
+
+ // calculate basis vectors for plane
+ var P00_P01 = P01 - P00;
+ var P0M_P1M = P1M - P0M;
+
+ var uMag = P00_P01.magnitude;
+ var vMag = P0M_P1M.magnitude;
+
+ var uScale = 1.0f / uMag;
+ var vScale = 1.0f / vMag;
+
+ var uAxis = P00_P01 * uScale;
+ var vAxis = P0M_P1M * vScale;
+
+ // update material constant buffer
+ fx.Set(N, phi0, phi1, theta0, theta1,
+ uAxis, P00, uScale,
+ vAxis, P0M, vScale);
+
+ camera.aspect = uMag / vMag;
+ camera.Render();
+
+ RenderTexture.active = targetTexture;
+ texture.ReadPixels(new Rect(0, 0, targetTexture.width, targetTexture.height), uTarget, vTarget + ~j * height);
+ RenderTexture.active = null;
+ }
+ }
+ }
+ }
+
+ // Save textures to disk.
+ // Add extensions
+ previewFilename += ".png";
+ VRFilename += ".png";
+
+ // Preview
+ previewTexture.Apply();
+ System.IO.File.WriteAllBytes(previewFilename, previewTexture.EncodeToPNG());
+
+ // VR
+ texture.Apply();
+ System.IO.File.WriteAllBytes(VRFilename, texture.EncodeToPNG());
+
+ // Cleanup.
+ if (camera != tempCamera)
+ {
+ camera.targetTexture = oldTargetTexture;
+ camera.orthographic = oldOrthographic;
+ camera.fieldOfView = oldFieldOfView;
+ camera.aspect = oldAspect;
+#if !(UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
+ camera.stereoTargetEye = oldstereoTargetEye;
+#endif
+
+ target.transform.localPosition = oldPosition;
+ target.transform.localRotation = oldRotation;
+ }
+ else
+ {
+ tempCamera.targetTexture = null;
+ }
+
+ Object.DestroyImmediate(targetTexture);
+ Object.DestroyImmediate(fx);
+
+ timer.Stop();
+ Debug.Log(string.Format("Screenshot took {0} seconds.", timer.Elapsed));
+
+ if (tempCamera != null)
+ {
+ Object.DestroyImmediate(tempCamera.gameObject);
+ }
+
+ Object.DestroyImmediate(previewTexture);
+ Object.DestroyImmediate(texture);
+ }
}
diff --git a/unity_package/Assets/SteamVR/readme.txt b/unity_package/Assets/SteamVR/readme.txt
index 6f915dc..f7bf190 100644
--- a/unity_package/Assets/SteamVR/readme.txt
+++ b/unity_package/Assets/SteamVR/readme.txt
@@ -1,5 +1,5 @@
SteamVR plugin for Unity - v1.1.0
-Copyright 2014-2016, Valve Corporation, All rights reserved.
+Copyright (c) Valve Corporation, All rights reserved.
Quickstart: