diff --git a/examples/SharedMemory/CMakeLists.txt b/examples/SharedMemory/CMakeLists.txt index 35dab54eb..f053d2c1e 100644 --- a/examples/SharedMemory/CMakeLists.txt +++ b/examples/SharedMemory/CMakeLists.txt @@ -202,5 +202,81 @@ IF (INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES) ENDIF(INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES) +IF (WIN32) - \ No newline at end of file +INCLUDE_DIRECTORIES( + ${BULLET_PHYSICS_SOURCE_DIR}/src + ${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs + ${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/Glew + ${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/openvr/headers + ${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/openvr/samples/shared +) + +ADD_DEFINITIONS(-DB3_USE_STANDALONE_EXAMPLE -DBT_ENABLE_VR) + +LINK_LIBRARIES( + openvr_api Bullet3Common BulletWorldImporter BulletInverseDynamicsUtils BulletInverseDynamics BulletDynamics BulletCollision LinearMath BussIK OpenGLWindow +) + + + + + ADD_DEFINITIONS(-DGLEW_STATIC) + LINK_LIBRARIES( ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ) + IF (CMAKE_CL_64) + LINK_DIRECTORIES(${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/openvr/lib/win64) + ELSE(CMAKE_CL_64) + LINK_DIRECTORIES(${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/openvr/lib/win32) + ENDIF(CMAKE_CL_64) + ADD_EXECUTABLE(App_SharedMemoryPhysics_VR + ${SharedMemory_SRCS} + ../StandaloneMain/hellovr_opengl_main.cpp + ../ExampleBrowser/OpenGLGuiHelper.cpp + ../ExampleBrowser/GL_ShapeDrawer.cpp + ../ExampleBrowser/CollisionShape2TriangleMesh.cpp + ../RenderingExamples/TinyVRGui.cpp + ../RenderingExamples/TimeSeriesCanvas.cpp + ../RenderingExamples/TimeSeriesFontData.cpp + ../ThirdPartyLibs/openvr/samples/shared/lodepng.cpp + ../ThirdPartyLibs/openvr/samples/shared/lodepng.h + ../ThirdPartyLibs/openvr/samples/shared/Matrices.cpp + ../ThirdPartyLibs/openvr/samples/shared/Matrices.h + ../ThirdPartyLibs/openvr/samples/shared/pathtools.cpp + ../ThirdPartyLibs/openvr/samples/shared/pathtools.h + ../ThirdPartyLibs/openvr/samples/shared/Vectors.h + ../MultiThreading/b3Win32ThreadSupport.cpp + ../MultiThreading/b3Win32ThreadSupport.h + ${BULLET_PHYSICS_SOURCE_DIR}/build3/bullet.rc + ) + + +IF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES) + IF (CMAKE_CL_64) + ADD_CUSTOM_COMMAND( + TARGET App_SharedMemoryPhysics_VR + POST_BUILD + COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/openvr/bin/win64/openvr_api.dll ${CMAKE_CURRENT_BINARY_DIR}/openvr_api.dll + ) + ELSE(CMAKE_CL_64) + ADD_CUSTOM_COMMAND( + TARGET App_SharedMemoryPhysics_VR + POST_BUILD + COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${BULLET_PHYSICS_SOURCE_DIR}/examples/ThirdPartyLibs/openvr/bin/win32/openvr_api.dll ${CMAKE_CURRENT_BINARY_DIR}/openvr_api.dll + ) + ENDIF(CMAKE_CL_64) + + ADD_CUSTOM_COMMAND( + TARGET App_SharedMemoryPhysics_VR + POST_BUILD + COMMAND ${CMAKE_COMMAND} ARGS -E copy_directory ${BULLET_PHYSICS_SOURCE_DIR}/data ${PROJECT_BINARY_DIR}/data + ) +ENDIF (NOT INTERNAL_CREATE_DISTRIBUTABLE_MSVC_PROJECTFILES) + + +IF (INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES) + SET_TARGET_PROPERTIES(App_SharedMemoryPhysics_VR PROPERTIES DEBUG_POSTFIX "_Debug") + SET_TARGET_PROPERTIES(App_SharedMemoryPhysics_VR PROPERTIES MINSIZEREL_POSTFIX "_MinsizeRel") + SET_TARGET_PROPERTIES(App_SharedMemoryPhysics_VR PROPERTIES RELWITHDEBINFO_POSTFIX "_RelWithDebugInfo") +ENDIF(INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES) + +ENDIF(WIN32) \ No newline at end of file diff --git a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp index b735718ff..26619153a 100644 --- a/examples/SharedMemory/PhysicsServerCommandProcessor.cpp +++ b/examples/SharedMemory/PhysicsServerCommandProcessor.cpp @@ -4943,7 +4943,7 @@ void PhysicsServerCommandProcessor::createDefaultRobotAssets() loadUrdf("husky/husky.urdf", btVector3(2, -5, 1), btQuaternion(0, 0, 0, 1), true, false, &bodyId, &gBufferServerToClient[0], gBufferServerToClient.size()); m_data->m_huskyId = bodyId; - m_data->m_dynamicsWorld->setGravity(btVector3(0, 0, 0)); + m_data->m_dynamicsWorld->setGravity(btVector3(0, 0, -10)); } diff --git a/examples/SharedMemory/PhysicsServerExample.cpp b/examples/SharedMemory/PhysicsServerExample.cpp index 07b980dcb..c940624cf 100644 --- a/examples/SharedMemory/PhysicsServerExample.cpp +++ b/examples/SharedMemory/PhysicsServerExample.cpp @@ -77,22 +77,22 @@ static void loadCurrentSettingsVR(b3CommandLineArgs& args) }; - -#if B3_USE_MIDI //remember the settings (you don't want to re-tune again and again...) static void saveCurrentSettingsVR() { FILE* f = fopen(startFileNameVR, "w"); if (f) { - fprintf(f, "--camPosX= %f\n", gVRTeleportPosLocal[0]); - fprintf(f, "--camPosY= %f\n", gVRTeleportPosLocal[1]); - fprintf(f, "--camPosZ= %f\n", gVRTeleportPosLocal[2]); + fprintf(f, "--camPosX= %f\n", gVRTeleportPos1[0]); + fprintf(f, "--camPosY= %f\n", gVRTeleportPos1[1]); + fprintf(f, "--camPosZ= %f\n", gVRTeleportPos1[2]); fprintf(f, "--camRotZ= %f\n", gVRTeleportRotZ); fclose(f); } }; +#if B3_USE_MIDI + static float getParamf(float rangeMin, float rangeMax, int midiVal) @@ -116,7 +116,7 @@ void midiCallback(double deltatime, std::vector< unsigned char > *message, void if (message->at(1) == 16) { gVRTeleportRotZ= getParamf(-3.1415, 3.1415, message->at(2)); - gVRTeleportOrnLocal = btQuaternion(btVector3(0, 0, 1), gVRTeleportRotZ); + gVRTeleportOrn = btQuaternion(btVector3(0, 0, 1), gVRTeleportRotZ); saveCurrentSettingsVR(); // b3Printf("gVRTeleportOrnLocal rotZ = %f\n", gVRTeleportRotZ); } @@ -130,7 +130,7 @@ void midiCallback(double deltatime, std::vector< unsigned char > *message, void { if (message->at(1) == i) { - gVRTeleportPosLocal[i] = getParamf(-2, 2, message->at(2)); + gVRTeleportPos1[i] = getParamf(-2, 2, message->at(2)); saveCurrentSettingsVR(); // b3Printf("gVRTeleportPos[%d] = %f\n", i,gVRTeleportPosLocal[i]); @@ -1071,7 +1071,46 @@ public: //printf("button=%d, state=%d\n",button,state); return false; } - virtual bool keyboardCallback(int key, int state){return false;} + virtual bool keyboardCallback(int key, int state){ + if (key=='w' && state) + { + gVRTeleportPos1[0]+=0.1; + saveCurrentSettingsVR(); + } + if (key=='s' && state) + { + gVRTeleportPos1[0]-=0.1; + saveCurrentSettingsVR(); + } + if (key=='a' && state) + { + gVRTeleportPos1[1]-=0.1; + saveCurrentSettingsVR(); + } + if (key=='d' && state) + { + gVRTeleportPos1[1]+=0.1; + saveCurrentSettingsVR(); + } + if (key=='q' && state) + { + gVRTeleportPos1[2]+=0.1; + saveCurrentSettingsVR(); + } + if (key=='e' && state) + { + gVRTeleportPos1[2]-=0.1; + saveCurrentSettingsVR(); + } + if (key=='z' && state) + { + gVRTeleportRotZ+=0.1; + gVRTeleportOrn = btQuaternion(btVector3(0, 0, 1), gVRTeleportRotZ); + saveCurrentSettingsVR(); + } + + return false; + } virtual void setSharedMemoryKey(int key) { @@ -1089,19 +1128,19 @@ public: setSharedMemoryKey(shmemKey); } - if (args.GetCmdLineArgument("camPosX", gVRTeleportPosLocal[0])) + if (args.GetCmdLineArgument("camPosX", gVRTeleportPos1[0])) { - printf("camPosX=%f\n", gVRTeleportPosLocal[0]); + printf("camPosX=%f\n", gVRTeleportPos1[0]); } - if (args.GetCmdLineArgument("camPosY", gVRTeleportPosLocal[1])) + if (args.GetCmdLineArgument("camPosY", gVRTeleportPos1[1])) { - printf("camPosY=%f\n", gVRTeleportPosLocal[1]); + printf("camPosY=%f\n", gVRTeleportPos1[1]); } - if (args.GetCmdLineArgument("camPosZ", gVRTeleportPosLocal[2])) + if (args.GetCmdLineArgument("camPosZ", gVRTeleportPos1[2])) { - printf("camPosZ=%f\n", gVRTeleportPosLocal[2]); + printf("camPosZ=%f\n", gVRTeleportPos1[2]); } float camRotZ = 0.f; @@ -1109,7 +1148,7 @@ public: { printf("camRotZ = %f\n", camRotZ); btQuaternion ornZ(btVector3(0, 0, 1), camRotZ); - gVRTeleportOrnLocal = ornZ; + gVRTeleportOrn = ornZ; } if (args.CheckCmdLineFlag("robotassets")) diff --git a/examples/StandaloneMain/hellovr_opengl_main.cpp b/examples/StandaloneMain/hellovr_opengl_main.cpp index 7ef40476c..232ddd1f9 100644 --- a/examples/StandaloneMain/hellovr_opengl_main.cpp +++ b/examples/StandaloneMain/hellovr_opengl_main.cpp @@ -21,12 +21,9 @@ #include "LinearMath/btIDebugDraw.h" int gSharedMemoryKey = -1; int gDebugDrawFlags = 0; -bool gDisplayDistortion = false; +bool gDisplayDistortion = true; bool gDisableDesktopGL = false; -//how can you try typing on a keyboard, without seeing it? -//it is pretty funny, to see the desktop in VR! - #include #include @@ -343,6 +340,19 @@ std::string GetTrackedDeviceString( vr::IVRSystem *pHmd, vr::TrackedDeviceIndex_ } +b3KeyboardCallback prevKeyboardCallback = 0; + +void MyKeyboardCallback(int key, int state) +{ + if (sExample) + { + sExample->keyboardCallback(key,state); + } + + if (prevKeyboardCallback) + prevKeyboardCallback(key,state); + +} //----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- @@ -398,7 +408,9 @@ bool CMainApplication::BInit() //sGuiPtr = new DummyGUIHelper; - + prevKeyboardCallback = m_app->m_window->getKeyboardCallback(); + m_app->m_window->setKeyboardCallback(MyKeyboardCallback); + CommonExampleOptions options(sGuiPtr); sExample = StandaloneExampleCreateFunc(options); @@ -843,6 +855,8 @@ void CMainApplication::RenderFrame() RenderDistortion(); } else { + //todo: should use framebuffer_multisample_blit_scaled + //See https://twitter.com/id_aa_carmack/status/268488838425481217?lang=en glBindFramebuffer( GL_FRAMEBUFFER, 0 ); glDisable( GL_MULTISAMPLE ); glBindFramebuffer(GL_READ_FRAMEBUFFER, rightEyeDesc.m_nRenderFramebufferId ); @@ -857,9 +871,9 @@ void CMainApplication::RenderFrame() } } - vr::Texture_t leftEyeTexture = {(void*)leftEyeDesc.m_nResolveTextureId, vr::API_OpenGL, vr::ColorSpace_Gamma }; + vr::Texture_t leftEyeTexture = {(void*)leftEyeDesc.m_nResolveTextureId, vr::TextureType_OpenGL, vr::ColorSpace_Gamma }; vr::VRCompositor()->Submit(vr::Eye_Left, &leftEyeTexture ); - vr::Texture_t rightEyeTexture = {(void*)rightEyeDesc.m_nResolveTextureId, vr::API_OpenGL, vr::ColorSpace_Gamma }; + vr::Texture_t rightEyeTexture = {(void*)rightEyeDesc.m_nResolveTextureId, vr::TextureType_OpenGL, vr::ColorSpace_Gamma }; vr::VRCompositor()->Submit(vr::Eye_Right, &rightEyeTexture ); } @@ -1629,7 +1643,7 @@ void CMainApplication::RenderStereoTargets() B3_PROFILE("CMainApplication::RenderStereoTargets"); btScalar dtSec = btScalar(m_clock.getTimeInSeconds()); - dtSec = b3Min(dtSec,0.1); + dtSec = btMin(dtSec,btScalar(0.1)); sExample->stepSimulation(dtSec); m_clock.reset(); @@ -1879,7 +1893,7 @@ Matrix4 CMainApplication::GetHMDMatrixProjectionEye( vr::Hmd_Eye nEye ) if ( !m_pHMD ) return Matrix4(); - vr::HmdMatrix44_t mat = m_pHMD->GetProjectionMatrix( nEye, m_fNearClip, m_fFarClip, vr::API_OpenGL); + vr::HmdMatrix44_t mat = m_pHMD->GetProjectionMatrix( nEye, m_fNearClip, m_fFarClip); return Matrix4( mat.m[0][0], mat.m[1][0], mat.m[2][0], mat.m[3][0], @@ -1959,7 +1973,6 @@ void CMainApplication::UpdateHMDMatrixPose() case vr::TrackedDeviceClass_Controller: m_rDevClassChar[nDevice] = 'C'; break; case vr::TrackedDeviceClass_HMD: m_rDevClassChar[nDevice] = 'H'; break; case vr::TrackedDeviceClass_Invalid: m_rDevClassChar[nDevice] = 'I'; break; - case vr::TrackedDeviceClass_Other: m_rDevClassChar[nDevice] = 'O'; break; case vr::TrackedDeviceClass_TrackingReference: m_rDevClassChar[nDevice] = 'T'; break; default: m_rDevClassChar[nDevice] = '?'; break; } @@ -2246,13 +2259,11 @@ int main(int argc, char *argv[]) if (sExample) { //until we have a proper VR gui, always assume we want the hard-coded default robot assets -#if 0 char* newargv[2]; char* t0 = (char*)"--robotassets"; newargv[0] = t0; newargv[1] = t0; sExample->processCommandLineArgs(2,newargv); -#endif sExample->processCommandLineArgs(argc,argv); } diff --git a/examples/ThirdPartyLibs/openvr/bin/linux64/libopenvr_api.so b/examples/ThirdPartyLibs/openvr/bin/linux64/libopenvr_api.so index a7d57c658..7b6f2d2de 100644 Binary files a/examples/ThirdPartyLibs/openvr/bin/linux64/libopenvr_api.so and b/examples/ThirdPartyLibs/openvr/bin/linux64/libopenvr_api.so differ diff --git a/examples/ThirdPartyLibs/openvr/bin/osx32/libopenvr_api.dylib b/examples/ThirdPartyLibs/openvr/bin/osx32/libopenvr_api.dylib index 2ac282b69..647ec3fa9 100644 Binary files a/examples/ThirdPartyLibs/openvr/bin/osx32/libopenvr_api.dylib and b/examples/ThirdPartyLibs/openvr/bin/osx32/libopenvr_api.dylib differ diff --git a/examples/ThirdPartyLibs/openvr/bin/win32/openvr_api.dll b/examples/ThirdPartyLibs/openvr/bin/win32/openvr_api.dll index 0b0cc0ef9..7aa2b993a 100644 Binary files a/examples/ThirdPartyLibs/openvr/bin/win32/openvr_api.dll and b/examples/ThirdPartyLibs/openvr/bin/win32/openvr_api.dll differ diff --git a/examples/ThirdPartyLibs/openvr/bin/win64/openvr_api.dll b/examples/ThirdPartyLibs/openvr/bin/win64/openvr_api.dll index 8b33ebb2d..bbcccde55 100644 Binary files a/examples/ThirdPartyLibs/openvr/bin/win64/openvr_api.dll and b/examples/ThirdPartyLibs/openvr/bin/win64/openvr_api.dll differ diff --git a/examples/ThirdPartyLibs/openvr/headers/openvr.h b/examples/ThirdPartyLibs/openvr/headers/openvr.h index d9d7deed7..6617b4d34 100644 --- a/examples/ThirdPartyLibs/openvr/headers/openvr.h +++ b/examples/ThirdPartyLibs/openvr/headers/openvr.h @@ -111,10 +111,11 @@ enum EVREye Eye_Right = 1 }; -enum EGraphicsAPIConvention +enum ETextureType { - API_DirectX = 0, // Normalized Z goes from 0 at the viewer to 1 at the far clip plane - API_OpenGL = 1, // Normalized Z goes from 1 at the viewer to -1 at the far clip plane + TextureType_DirectX = 0, // Handle is an ID3D11Texture + TextureType_OpenGL = 1, // Handle is an OpenGL texture name or an OpenGL render buffer name, depending on submit flags + TextureType_Vulkan = 2, // Handle is a pointer to a VRVulkanTextureData_t structure }; enum EColorSpace @@ -126,8 +127,8 @@ enum EColorSpace struct Texture_t { - void* handle; // Native d3d texture pointer or GL texture id. - EGraphicsAPIConvention eType; + void* handle; // See ETextureType definition above + ETextureType eType; EColorSpace eColorSpace; }; @@ -161,11 +162,8 @@ enum ETrackedDeviceClass TrackedDeviceClass_Invalid = 0, // the ID was not valid. TrackedDeviceClass_HMD = 1, // Head-Mounted Displays TrackedDeviceClass_Controller = 2, // Tracked controllers + TrackedDeviceClass_GenericTracker = 3, // Generic trackers, similar to controllers TrackedDeviceClass_TrackingReference = 4, // Camera and base stations that serve as tracking reference points - - TrackedDeviceClass_Count, // This isn't a class that will ever be returned. It is used for allocating arrays and such - - TrackedDeviceClass_Other = 1000, }; @@ -198,7 +196,7 @@ enum ETrackingUniverseOrigin { TrackingUniverseSeated = 0, // Poses are provided relative to the seated zero pose TrackingUniverseStanding = 1, // Poses are provided relative to the safe bounds configured by the user - TrackingUniverseRawAndUncalibrated = 2, // Poses are provided in the coordinate system defined by the driver. You probably don't want this one. + TrackingUniverseRawAndUncalibrated = 2, // Poses are provided in the coordinate system defined by the driver. It has Y up and is unified for devices of the same driver. You usually don't want this one. }; @@ -206,6 +204,8 @@ enum ETrackingUniverseOrigin * tracked device. Many fields are only valid for one ETrackedDeviceClass. */ enum ETrackedDeviceProperty { + Prop_Invalid = 0, + // general properties that apply to all device classes Prop_TrackingSystemName_String = 1000, Prop_ModelNumber_String = 1001, @@ -333,6 +333,7 @@ enum ETrackedPropertyError TrackedProp_ValueNotProvidedByDevice = 7, TrackedProp_StringExceedsMaximumLength = 8, TrackedProp_NotYetAvailable = 9, // The property value isn't known yet, but is expected soon. Call again later. + TrackedProp_PermissionDenied = 10, }; /** Allows the application to control what part of the provided texture will be used in the @@ -358,13 +359,13 @@ 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, - // Handle is pointer to VulkanData_t - Submit_VulkanTexture = 0x04, + // Do not use + Submit_Reserved = 0x04, }; /** Data required for passing Vulkan textures to IVRCompositor::Submit. * Be sure to call OpenVR_Shutdown before destroying these resources. */ -struct VulkanData_t +struct VRVulkanTextureData_t { uint64_t m_nImage; // VkImage VkDevice_T *m_pDevice; @@ -517,6 +518,8 @@ enum EVREventType VREvent_PerformanceTest_EnableCapture = 1600, VREvent_PerformanceTest_DisableCapture = 1601, VREvent_PerformanceTest_FidelityLevel = 1602, + + VREvent_MessageOverlay_Closed = 1650, // Vendors are free to expose private events in this reserved region VREvent_VendorSpecific_Reserved_Start = 10000, @@ -703,6 +706,11 @@ struct VREvent_EditingCameraSurface_t uint32_t nVisualMode; }; +struct VREvent_MessageOverlay_t +{ + uint32_t unVRMessageOverlayResponse; // vr::VRMessageOverlayResponse enum +}; + /** NOTE!!! If you change this you MUST manually update openvr_interop.cs.py */ typedef union { @@ -724,6 +732,7 @@ typedef union VREvent_ScreenshotProgress_t screenshotProgress; VREvent_ApplicationLaunch_t applicationLaunch; VREvent_EditingCameraSurface_t cameraSurface; + VREvent_MessageOverlay_t messageOverlay; } VREvent_Data_t; /** An event posted by the server to all running applications */ @@ -944,6 +953,8 @@ enum EVRInitError VRInitError_Init_InvalidApplicationType = 130, VRInitError_Init_NotAvailableToWatchdogApps = 131, VRInitError_Init_WatchdogDisabledInSettings = 132, + VRInitError_Init_VRDashboardNotFound = 133, + VRInitError_Init_VRDashboardStartupFailed = 134, VRInitError_Driver_Failed = 200, VRInitError_Driver_Unknown = 201, @@ -1131,7 +1142,7 @@ public: virtual void GetRecommendedRenderTargetSize( uint32_t *pnWidth, uint32_t *pnHeight ) = 0; /** The projection matrix for the specified eye */ - virtual HmdMatrix44_t GetProjectionMatrix( EVREye eEye, float fNearZ, float fFarZ, EGraphicsAPIConvention eProjType ) = 0; + virtual HmdMatrix44_t GetProjectionMatrix( EVREye eEye, float fNearZ, float fFarZ ) = 0; /** The components necessary to build your own projection matrix in case your * application is doing something fancy like infinite Z */ @@ -1384,7 +1395,7 @@ public: }; -static const char * const IVRSystem_Version = "IVRSystem_014"; +static const char * const IVRSystem_Version = "IVRSystem_015"; } @@ -1640,7 +1651,6 @@ namespace vr //----------------------------------------------------------------------------- // steamvr keys - static const char * const k_pch_SteamVR_Section = "steamvr"; static const char * const k_pch_SteamVR_RequireHmd_String = "requireHmd"; static const char * const k_pch_SteamVR_ForcedDriverKey_String = "forcedDriver"; @@ -1677,27 +1687,26 @@ namespace vr static const char * const k_pch_SteamVR_ShowMirrorView_Bool = "showMirrorView"; static const char * const k_pch_SteamVR_MirrorViewGeometry_String = "mirrorViewGeometry"; static const char * const k_pch_SteamVR_StartMonitorFromAppLaunch = "startMonitorFromAppLaunch"; + static const char * const k_pch_SteamVR_StartCompositorFromAppLaunch_Bool = "startCompositorFromAppLaunch"; + static const char * const k_pch_SteamVR_StartDashboardFromAppLaunch_Bool = "startDashboardFromAppLaunch"; + static const char * const k_pch_SteamVR_StartOverlayAppsFromDashboard_Bool = "startOverlayAppsFromDashboard"; static const char * const k_pch_SteamVR_EnableHomeApp = "enableHomeApp"; static const char * const k_pch_SteamVR_SetInitialDefaultHomeApp = "setInitialDefaultHomeApp"; static const char * const k_pch_SteamVR_CycleBackgroundImageTimeSec_Int32 = "CycleBackgroundImageTimeSec"; static const char * const k_pch_SteamVR_RetailDemo_Bool = "retailDemo"; static const char * const k_pch_SteamVR_IpdOffset_Float = "ipdOffset"; - //----------------------------------------------------------------------------- // lighthouse keys - static const char * const k_pch_Lighthouse_Section = "driver_lighthouse"; static const char * const k_pch_Lighthouse_DisableIMU_Bool = "disableimu"; static const char * const k_pch_Lighthouse_UseDisambiguation_String = "usedisambiguation"; static const char * const k_pch_Lighthouse_DisambiguationDebug_Int32 = "disambiguationdebug"; - static const char * const k_pch_Lighthouse_PrimaryBasestation_Int32 = "primarybasestation"; static const char * const k_pch_Lighthouse_DBHistory_Bool = "dbhistory"; //----------------------------------------------------------------------------- // null keys - static const char * const k_pch_Null_Section = "driver_null"; static const char * const k_pch_Null_EnableNullDriver_Bool = "enable"; static const char * const k_pch_Null_SerialNumber_String = "serialNumber"; @@ -1830,7 +1839,7 @@ enum ChaperoneCalibrationState // Errors ChaperoneCalibrationState_Error = 200, // The UniverseID is invalid - ChaperoneCalibrationState_Error_BaseStationUninitalized = 201, // Tracking center hasn't be calibrated for at least one of the base stations + ChaperoneCalibrationState_Error_BaseStationUninitialized = 201, // Tracking center hasn't be calibrated for at least one of the base stations ChaperoneCalibrationState_Error_BaseStationConflict = 202, // Tracking center is calibrated, but base stations disagree on the tracking space ChaperoneCalibrationState_Error_PlayAreaInvalid = 203, // Play Area hasn't been calibrated for the current tracking center ChaperoneCalibrationState_Error_CollisionBoundsInvalid = 204, // Collision Bounds haven't been calibrated for the current tracking center @@ -2236,9 +2245,20 @@ public: virtual bool ReleaseSharedGLTexture( vr::glUInt_t glTextureId, vr::glSharedTextureHandle_t glSharedTextureHandle ) = 0; virtual void LockGLSharedTextureForAccess( vr::glSharedTextureHandle_t glSharedTextureHandle ) = 0; virtual void UnlockGLSharedTextureForAccess( vr::glSharedTextureHandle_t glSharedTextureHandle ) = 0; + + /** [Vulkan Only] + * return 0. Otherwise it returns the length of the number of bytes necessary to hold this string including the trailing + * null. The string will be a space separated list of-required instance extensions to enable in VkCreateInstance */ + virtual uint32_t GetVulkanInstanceExtensionsRequired( VR_OUT_STRING() char *pchValue, uint32_t unBufferSize ) = 0; + + /** [Vulkan only] + * return 0. Otherwise it returns the length of the number of bytes necessary to hold this string including the trailing + * null. The string will be a space separated list of required device extensions to enable in VkCreateDevice */ + virtual uint32_t GetVulkanDeviceExtensionsRequired( VkPhysicalDevice_T *pPhysicalDevice, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize ) = 0; + }; -static const char * const IVRCompositor_Version = "IVRCompositor_018"; +static const char * const IVRCompositor_Version = "IVRCompositor_019"; } // namespace vr @@ -2414,6 +2434,20 @@ namespace vr // If this is set on an overlay owned by the scene application that overlay // will be sorted with the "Other" overlays on top of all other scene overlays VROverlayFlags_SortWithNonSceneOverlays = 14, + + // If set, the overlay will be shown in the dashboard, otherwise it will be hidden. + VROverlayFlags_VisibleInDashboard = 15, + }; + + enum VRMessageOverlayResponse + { + VRMessageOverlayResponse_ButtonPress_0 = 0, + VRMessageOverlayResponse_ButtonPress_1 = 1, + VRMessageOverlayResponse_ButtonPress_2 = 2, + VRMessageOverlayResponse_ButtonPress_3 = 3, + VRMessageOverlayResponse_CouldntFindSystemOverlay = 4, + VRMessageOverlayResponse_CouldntFindOrCreateClientOverlay= 5, + VRMessageOverlayResponse_ApplicationQuit = 6 }; struct VROverlayIntersectionParams_t @@ -2731,7 +2765,7 @@ namespace vr * pNativeTextureHandle is an OUTPUT, it will be a pointer to a ID3D11ShaderResourceView *. * pNativeTextureRef is an INPUT and should be a ID3D11Resource *. The device used by pNativeTextureRef will be used to bind pNativeTextureHandle. */ - virtual EVROverlayError GetOverlayTexture( VROverlayHandle_t ulOverlayHandle, void **pNativeTextureHandle, void *pNativeTextureRef, uint32_t *pWidth, uint32_t *pHeight, uint32_t *pNativeFormat, EGraphicsAPIConvention *pAPI, EColorSpace *pColorSpace ) = 0; + virtual EVROverlayError GetOverlayTexture( VROverlayHandle_t ulOverlayHandle, void **pNativeTextureHandle, void *pNativeTextureRef, uint32_t *pWidth, uint32_t *pHeight, uint32_t *pNativeFormat, ETextureType *pAPIType, EColorSpace *pColorSpace, VRTextureBounds_t *pTextureBounds ) = 0; /** Release the pNativeTextureHandle provided from the GetOverlayTexture call, this allows the system to free the underlying GPU resources for this object, * so only do it once you stop rendering this texture. @@ -2794,9 +2828,18 @@ namespace vr /** Sets a list of primitives to be used for controller ray intersection * typically the size of the underlying UI in pixels (not in world space). */ virtual EVROverlayError SetOverlayIntersectionMask( VROverlayHandle_t ulOverlayHandle, VROverlayIntersectionMaskPrimitive_t *pMaskPrimitives, uint32_t unNumMaskPrimitives, uint32_t unPrimitiveSize = sizeof( VROverlayIntersectionMaskPrimitive_t ) ) = 0; + + virtual EVROverlayError GetOverlayFlags( VROverlayHandle_t ulOverlayHandle, uint32_t *pFlags ) = 0; + + // --------------------------------------------- + // Message box methods + // --------------------------------------------- + + /** Show the message overlay. This will block and return you a result. **/ + virtual VRMessageOverlayResponse ShowMessageOverlay( const char* pchText, const char* pchCaption, const char* pchButton0Text, const char* pchButton1Text = nullptr, const char* pchButton2Text = nullptr, const char* pchButton3Text = nullptr ) = 0; }; - static const char * const IVROverlay_Version = "IVROverlay_013"; + static const char * const IVROverlay_Version = "IVROverlay_014"; } // namespace vr @@ -3041,7 +3084,7 @@ public: /** Gets size of the image frame. */ virtual vr::EVRTrackedCameraError GetCameraFrameSize( vr::TrackedDeviceIndex_t nDeviceIndex, vr::EVRTrackedCameraFrameType eFrameType, uint32_t *pnWidth, uint32_t *pnHeight, uint32_t *pnFrameBufferSize ) = 0; - virtual vr::EVRTrackedCameraError GetCameraIntrinisics( vr::TrackedDeviceIndex_t nDeviceIndex, vr::EVRTrackedCameraFrameType eFrameType, vr::HmdVector2_t *pFocalLength, vr::HmdVector2_t *pCenter ) = 0; + virtual vr::EVRTrackedCameraError GetCameraIntrinsics( vr::TrackedDeviceIndex_t nDeviceIndex, vr::EVRTrackedCameraFrameType eFrameType, vr::HmdVector2_t *pFocalLength, vr::HmdVector2_t *pCenter ) = 0; virtual vr::EVRTrackedCameraError GetCameraProjection( vr::TrackedDeviceIndex_t nDeviceIndex, vr::EVRTrackedCameraFrameType eFrameType, float flZNear, float flZFar, vr::HmdMatrix44_t *pProjection ) = 0; @@ -3062,7 +3105,12 @@ public: /** Gets size of the image frame. */ virtual vr::EVRTrackedCameraError GetVideoStreamTextureSize( vr::TrackedDeviceIndex_t nDeviceIndex, vr::EVRTrackedCameraFrameType eFrameType, vr::VRTextureBounds_t *pTextureBounds, uint32_t *pnWidth, uint32_t *pnHeight ) = 0; - /** Access a shared D3D11 texture for the specified tracked camera stream */ + /** Access a shared D3D11 texture for the specified tracked camera stream. + * The camera frame type VRTrackedCameraFrameType_Undistorted is not supported directly as a shared texture. It is an interior subregion of the shared texture VRTrackedCameraFrameType_MaximumUndistorted. + * Instead, use GetVideoStreamTextureSize() with VRTrackedCameraFrameType_Undistorted to determine the proper interior subregion bounds along with GetVideoStreamTextureD3D11() with + * VRTrackedCameraFrameType_MaximumUndistorted to provide the texture. The VRTrackedCameraFrameType_MaximumUndistorted will yield an image where the invalid regions are decoded + * by the alpha channel having a zero component. The valid regions all have a non-zero alpha component. The subregion as described by VRTrackedCameraFrameType_Undistorted + * guarantees a rectangle where all pixels are valid. */ virtual vr::EVRTrackedCameraError GetVideoStreamTextureD3D11( vr::TrackedCameraHandle_t hTrackedCamera, vr::EVRTrackedCameraFrameType eFrameType, void *pD3D11DeviceOrResource, void **ppD3D11ShaderResourceView, vr::CameraVideoStreamFrameHeader_t *pFrameHeader, uint32_t nFrameHeaderSize ) = 0; /** Access a shared GL texture for the specified tracked camera stream */ @@ -3263,7 +3311,6 @@ namespace vr // They will go away in the future. typedef EVRInitError HmdError; typedef EVREye Hmd_Eye; - typedef EGraphicsAPIConvention GraphicsAPIConvention; typedef EColorSpace ColorSpace; typedef ETrackingResult HmdTrackingResult; typedef ETrackedDeviceClass TrackedDeviceClass; diff --git a/examples/ThirdPartyLibs/openvr/headers/openvr_api.cs b/examples/ThirdPartyLibs/openvr/headers/openvr_api.cs index 517e2af93..98e09ef0b 100644 --- a/examples/ThirdPartyLibs/openvr/headers/openvr_api.cs +++ b/examples/ThirdPartyLibs/openvr/headers/openvr_api.cs @@ -21,7 +21,7 @@ public struct IVRSystem internal _GetRecommendedRenderTargetSize GetRecommendedRenderTargetSize; [UnmanagedFunctionPointer(CallingConvention.StdCall)] - internal delegate HmdMatrix44_t _GetProjectionMatrix(EVREye eEye, float fNearZ, float fFarZ, EGraphicsAPIConvention eProjType); + internal delegate HmdMatrix44_t _GetProjectionMatrix(EVREye eEye, float fNearZ, float fFarZ); [MarshalAs(UnmanagedType.FunctionPtr)] internal _GetProjectionMatrix GetProjectionMatrix; @@ -276,9 +276,9 @@ public struct IVRTrackedCamera internal _GetCameraFrameSize GetCameraFrameSize; [UnmanagedFunctionPointer(CallingConvention.StdCall)] - internal delegate EVRTrackedCameraError _GetCameraIntrinisics(uint nDeviceIndex, EVRTrackedCameraFrameType eFrameType, ref HmdVector2_t pFocalLength, ref HmdVector2_t pCenter); + internal delegate EVRTrackedCameraError _GetCameraIntrinsics(uint nDeviceIndex, EVRTrackedCameraFrameType eFrameType, ref HmdVector2_t pFocalLength, ref HmdVector2_t pCenter); [MarshalAs(UnmanagedType.FunctionPtr)] - internal _GetCameraIntrinisics GetCameraIntrinisics; + internal _GetCameraIntrinsics GetCameraIntrinsics; [UnmanagedFunctionPointer(CallingConvention.StdCall)] internal delegate EVRTrackedCameraError _GetCameraProjection(uint nDeviceIndex, EVRTrackedCameraFrameType eFrameType, float flZNear, float flZFar, ref HmdMatrix44_t pProjection); @@ -820,6 +820,16 @@ public struct IVRCompositor [MarshalAs(UnmanagedType.FunctionPtr)] internal _UnlockGLSharedTextureForAccess UnlockGLSharedTextureForAccess; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetVulkanInstanceExtensionsRequired(System.Text.StringBuilder pchValue, uint unBufferSize); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetVulkanInstanceExtensionsRequired GetVulkanInstanceExtensionsRequired; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetVulkanDeviceExtensionsRequired(IntPtr pPhysicalDevice, System.Text.StringBuilder pchValue, uint unBufferSize); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetVulkanDeviceExtensionsRequired GetVulkanDeviceExtensionsRequired; + } [StructLayout(LayoutKind.Sequential)] @@ -1106,7 +1116,7 @@ public struct IVROverlay internal _SetOverlayFromFile SetOverlayFromFile; [UnmanagedFunctionPointer(CallingConvention.StdCall)] - internal delegate EVROverlayError _GetOverlayTexture(ulong ulOverlayHandle, ref IntPtr pNativeTextureHandle, IntPtr pNativeTextureRef, ref uint pWidth, ref uint pHeight, ref uint pNativeFormat, ref EGraphicsAPIConvention pAPI, ref EColorSpace pColorSpace); + internal delegate EVROverlayError _GetOverlayTexture(ulong ulOverlayHandle, ref IntPtr pNativeTextureHandle, IntPtr pNativeTextureRef, ref uint pWidth, ref uint pHeight, ref uint pNativeFormat, ref ETextureType pAPIType, ref EColorSpace pColorSpace, ref VRTextureBounds_t pTextureBounds); [MarshalAs(UnmanagedType.FunctionPtr)] internal _GetOverlayTexture GetOverlayTexture; @@ -1190,6 +1200,16 @@ public struct IVROverlay [MarshalAs(UnmanagedType.FunctionPtr)] internal _SetOverlayIntersectionMask SetOverlayIntersectionMask; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _GetOverlayFlags(ulong ulOverlayHandle, ref uint pFlags); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetOverlayFlags GetOverlayFlags; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate VRMessageOverlayResponse _ShowMessageOverlay(string pchText, string pchCaption, string pchButton0Text, string pchButton1Text, string pchButton2Text, string pchButton3Text); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ShowMessageOverlay ShowMessageOverlay; + } [StructLayout(LayoutKind.Sequential)] @@ -1436,9 +1456,9 @@ public class CVRSystem pnHeight = 0; FnTable.GetRecommendedRenderTargetSize(ref pnWidth,ref pnHeight); } - public HmdMatrix44_t GetProjectionMatrix(EVREye eEye,float fNearZ,float fFarZ,EGraphicsAPIConvention eProjType) + public HmdMatrix44_t GetProjectionMatrix(EVREye eEye,float fNearZ,float fFarZ) { - HmdMatrix44_t result = FnTable.GetProjectionMatrix(eEye,fNearZ,fFarZ,eProjType); + HmdMatrix44_t result = FnTable.GetProjectionMatrix(eEye,fNearZ,fFarZ); return result; } public void GetProjectionRaw(EVREye eEye,ref float pfLeft,ref float pfRight,ref float pfTop,ref float pfBottom) @@ -1710,9 +1730,9 @@ public class CVRTrackedCamera EVRTrackedCameraError result = FnTable.GetCameraFrameSize(nDeviceIndex,eFrameType,ref pnWidth,ref pnHeight,ref pnFrameBufferSize); return result; } - public EVRTrackedCameraError GetCameraIntrinisics(uint nDeviceIndex,EVRTrackedCameraFrameType eFrameType,ref HmdVector2_t pFocalLength,ref HmdVector2_t pCenter) + public EVRTrackedCameraError GetCameraIntrinsics(uint nDeviceIndex,EVRTrackedCameraFrameType eFrameType,ref HmdVector2_t pFocalLength,ref HmdVector2_t pCenter) { - EVRTrackedCameraError result = FnTable.GetCameraIntrinisics(nDeviceIndex,eFrameType,ref pFocalLength,ref pCenter); + EVRTrackedCameraError result = FnTable.GetCameraIntrinsics(nDeviceIndex,eFrameType,ref pFocalLength,ref pCenter); return result; } public EVRTrackedCameraError GetCameraProjection(uint nDeviceIndex,EVRTrackedCameraFrameType eFrameType,float flZNear,float flZFar,ref HmdMatrix44_t pProjection) @@ -2268,6 +2288,16 @@ public class CVRCompositor { FnTable.UnlockGLSharedTextureForAccess(glSharedTextureHandle); } + public uint GetVulkanInstanceExtensionsRequired(System.Text.StringBuilder pchValue,uint unBufferSize) + { + uint result = FnTable.GetVulkanInstanceExtensionsRequired(pchValue,unBufferSize); + return result; + } + public uint GetVulkanDeviceExtensionsRequired(IntPtr pPhysicalDevice,System.Text.StringBuilder pchValue,uint unBufferSize) + { + uint result = FnTable.GetVulkanDeviceExtensionsRequired(pPhysicalDevice,pchValue,unBufferSize); + return result; + } } @@ -2574,12 +2604,12 @@ public class CVROverlay EVROverlayError result = FnTable.SetOverlayFromFile(ulOverlayHandle,pchFilePath); return result; } - public EVROverlayError GetOverlayTexture(ulong ulOverlayHandle,ref IntPtr pNativeTextureHandle,IntPtr pNativeTextureRef,ref uint pWidth,ref uint pHeight,ref uint pNativeFormat,ref EGraphicsAPIConvention pAPI,ref EColorSpace pColorSpace) + public EVROverlayError GetOverlayTexture(ulong ulOverlayHandle,ref IntPtr pNativeTextureHandle,IntPtr pNativeTextureRef,ref uint pWidth,ref uint pHeight,ref uint pNativeFormat,ref ETextureType pAPIType,ref EColorSpace pColorSpace,ref VRTextureBounds_t pTextureBounds) { pWidth = 0; pHeight = 0; pNativeFormat = 0; - EVROverlayError result = FnTable.GetOverlayTexture(ulOverlayHandle,ref pNativeTextureHandle,pNativeTextureRef,ref pWidth,ref pHeight,ref pNativeFormat,ref pAPI,ref pColorSpace); + EVROverlayError result = FnTable.GetOverlayTexture(ulOverlayHandle,ref pNativeTextureHandle,pNativeTextureRef,ref pWidth,ref pHeight,ref pNativeFormat,ref pAPIType,ref pColorSpace,ref pTextureBounds); return result; } public EVROverlayError ReleaseNativeOverlayHandle(ulong ulOverlayHandle,IntPtr pNativeTextureHandle) @@ -2663,6 +2693,17 @@ public class CVROverlay EVROverlayError result = FnTable.SetOverlayIntersectionMask(ulOverlayHandle,ref pMaskPrimitives,unNumMaskPrimitives,unPrimitiveSize); return result; } + public EVROverlayError GetOverlayFlags(ulong ulOverlayHandle,ref uint pFlags) + { + pFlags = 0; + EVROverlayError result = FnTable.GetOverlayFlags(ulOverlayHandle,ref pFlags); + return result; + } + public VRMessageOverlayResponse ShowMessageOverlay(string pchText,string pchCaption,string pchButton0Text,string pchButton1Text,string pchButton2Text,string pchButton3Text) + { + VRMessageOverlayResponse result = FnTable.ShowMessageOverlay(pchText,pchCaption,pchButton0Text,pchButton1Text,pchButton2Text,pchButton3Text); + return result; + } } @@ -2940,10 +2981,11 @@ public enum EVREye Eye_Left = 0, Eye_Right = 1, } -public enum EGraphicsAPIConvention +public enum ETextureType { - API_DirectX = 0, - API_OpenGL = 1, + DirectX = 0, + OpenGL = 1, + Vulkan = 2, } public enum EColorSpace { @@ -2964,9 +3006,8 @@ public enum ETrackedDeviceClass Invalid = 0, HMD = 1, Controller = 2, + GenericTracker = 3, TrackingReference = 4, - Count = 5, - Other = 1000, } public enum ETrackedControllerRole { @@ -2982,6 +3023,7 @@ public enum ETrackingUniverseOrigin } public enum ETrackedDeviceProperty { + Prop_Invalid = 0, Prop_TrackingSystemName_String = 1000, Prop_ModelNumber_String = 1001, Prop_SerialNumber_String = 1002, @@ -3093,13 +3135,14 @@ public enum ETrackedPropertyError TrackedProp_ValueNotProvidedByDevice = 7, TrackedProp_StringExceedsMaximumLength = 8, TrackedProp_NotYetAvailable = 9, + TrackedProp_PermissionDenied = 10, } public enum EVRSubmitFlags { Submit_Default = 0, Submit_LensDistortionAlreadyApplied = 1, Submit_GlRenderBuffer = 2, - Submit_VulkanTexture = 4, + Submit_Reserved = 4, } public enum EVRState { @@ -3218,6 +3261,7 @@ public enum EVREventType VREvent_PerformanceTest_EnableCapture = 1600, VREvent_PerformanceTest_DisableCapture = 1601, VREvent_PerformanceTest_FidelityLevel = 1602, + VREvent_MessageOverlay_Closed = 1650, VREvent_VendorSpecific_Reserved_Start = 10000, VREvent_VendorSpecific_Reserved_End = 19999, } @@ -3369,6 +3413,8 @@ public enum EVRInitError Init_InvalidApplicationType = 130, Init_NotAvailableToWatchdogApps = 131, Init_WatchdogDisabledInSettings = 132, + Init_VRDashboardNotFound = 133, + Init_VRDashboardStartupFailed = 134, Driver_Failed = 200, Driver_Unknown = 201, Driver_HmdUnknown = 202, @@ -3507,7 +3553,7 @@ public enum ChaperoneCalibrationState Warning_BaseStationRemoved = 102, Warning_SeatedBoundsInvalid = 103, Error = 200, - Error_BaseStationUninitalized = 201, + Error_BaseStationUninitialized = 201, Error_BaseStationConflict = 202, Error_PlayAreaInvalid = 203, Error_CollisionBoundsInvalid = 204, @@ -3564,6 +3610,17 @@ public enum VROverlayFlags Panorama = 12, StereoPanorama = 13, SortWithNonSceneOverlays = 14, + VisibleInDashboard = 15, +} +public enum VRMessageOverlayResponse +{ + ButtonPress_0 = 0, + ButtonPress_1 = 1, + ButtonPress_2 = 2, + ButtonPress_3 = 3, + CouldntFindSystemOverlay = 4, + CouldntFindOrCreateClientOverlay = 5, + ApplicationQuit = 6, } public enum EGamepadTextInputMode { @@ -3662,6 +3719,10 @@ public enum EVRScreenshotError [FieldOffset(0)] public VREvent_TouchPadMove_t touchPadMove; [FieldOffset(0)] public VREvent_SeatedZeroPoseReset_t seatedZeroPoseReset; [FieldOffset(0)] public VREvent_Screenshot_t screenshot; + [FieldOffset(0)] public VREvent_ScreenshotProgress_t screenshotProgress; + [FieldOffset(0)] public VREvent_ApplicationLaunch_t applicationLaunch; + [FieldOffset(0)] public VREvent_EditingCameraSurface_t cameraSurface; + [FieldOffset(0)] public VREvent_MessageOverlay_t messageOverlay; [FieldOffset(0)] public VREvent_Keyboard_t keyboard; // This has to be at the end due to a mono bug } @@ -3768,7 +3829,7 @@ public enum EVRScreenshotError [StructLayout(LayoutKind.Sequential)] public struct Texture_t { public IntPtr handle; // void * - public EGraphicsAPIConvention eType; + public ETextureType eType; public EColorSpace eColorSpace; } [StructLayout(LayoutKind.Sequential)] public struct TrackedDevicePose_t @@ -3789,7 +3850,7 @@ public enum EVRScreenshotError public float uMax; public float vMax; } -[StructLayout(LayoutKind.Sequential)] public struct VulkanData_t +[StructLayout(LayoutKind.Sequential)] public struct VRVulkanTextureData_t { public ulong m_nImage; public IntPtr m_pDevice; // struct VkDevice_T * @@ -3895,6 +3956,10 @@ public enum EVRScreenshotError public ulong overlayHandle; public uint nVisualMode; } +[StructLayout(LayoutKind.Sequential)] public struct VREvent_MessageOverlay_t +{ + public uint unVRMessageOverlayResponse; +} [StructLayout(LayoutKind.Sequential)] public struct VREvent_t { public uint eventType; @@ -4139,7 +4204,7 @@ public class OpenVR public const uint k_unControllerStateAxisCount = 5; public const ulong k_ulOverlayHandleInvalid = 0; public const uint k_unScreenshotHandleInvalid = 0; - public const string IVRSystem_Version = "IVRSystem_014"; + public const string IVRSystem_Version = "IVRSystem_015"; public const string IVRExtendedDisplay_Version = "IVRExtendedDisplay_001"; public const string IVRTrackedCamera_Version = "IVRTrackedCamera_003"; public const uint k_unMaxApplicationKeyLength = 128; @@ -4148,12 +4213,12 @@ public class OpenVR public const string IVRApplications_Version = "IVRApplications_006"; public const string IVRChaperone_Version = "IVRChaperone_003"; public const string IVRChaperoneSetup_Version = "IVRChaperoneSetup_005"; - public const string IVRCompositor_Version = "IVRCompositor_018"; + public const string IVRCompositor_Version = "IVRCompositor_019"; public const uint k_unVROverlayMaxKeyLength = 128; public const uint k_unVROverlayMaxNameLength = 128; public const uint k_unMaxOverlayCount = 64; public const uint k_unMaxOverlayIntersectionMaskPrimitivesCount = 32; - public const string IVROverlay_Version = "IVROverlay_013"; + public const string IVROverlay_Version = "IVROverlay_014"; public const string k_pch_Controller_Component_GDC2015 = "gdc2015"; public const string k_pch_Controller_Component_Base = "base"; public const string k_pch_Controller_Component_Tip = "tip"; @@ -4200,6 +4265,9 @@ public class OpenVR public const string k_pch_SteamVR_ShowMirrorView_Bool = "showMirrorView"; public const string k_pch_SteamVR_MirrorViewGeometry_String = "mirrorViewGeometry"; public const string k_pch_SteamVR_StartMonitorFromAppLaunch = "startMonitorFromAppLaunch"; + public const string k_pch_SteamVR_StartCompositorFromAppLaunch_Bool = "startCompositorFromAppLaunch"; + public const string k_pch_SteamVR_StartDashboardFromAppLaunch_Bool = "startDashboardFromAppLaunch"; + public const string k_pch_SteamVR_StartOverlayAppsFromDashboard_Bool = "startOverlayAppsFromDashboard"; public const string k_pch_SteamVR_EnableHomeApp = "enableHomeApp"; public const string k_pch_SteamVR_SetInitialDefaultHomeApp = "setInitialDefaultHomeApp"; public const string k_pch_SteamVR_CycleBackgroundImageTimeSec_Int32 = "CycleBackgroundImageTimeSec"; diff --git a/examples/ThirdPartyLibs/openvr/headers/openvr_api.json b/examples/ThirdPartyLibs/openvr/headers/openvr_api.json index d16771ddf..24509ee00 100644 --- a/examples/ThirdPartyLibs/openvr/headers/openvr_api.json +++ b/examples/ThirdPartyLibs/openvr/headers/openvr_api.json @@ -14,7 +14,6 @@ ,{"typedef": "vr::VRNotificationId","type": "uint32_t"} ,{"typedef": "vr::HmdError","type": "enum vr::EVRInitError"} ,{"typedef": "vr::Hmd_Eye","type": "enum vr::EVREye"} -,{"typedef": "vr::GraphicsAPIConvention","type": "enum vr::EGraphicsAPIConvention"} ,{"typedef": "vr::ColorSpace","type": "enum vr::EColorSpace"} ,{"typedef": "vr::HmdTrackingResult","type": "enum vr::ETrackingResult"} ,{"typedef": "vr::TrackedDeviceClass","type": "enum vr::ETrackedDeviceClass"} @@ -34,9 +33,10 @@ {"name": "Eye_Left","value": "0"} ,{"name": "Eye_Right","value": "1"} ]} -, {"enumname": "vr::EGraphicsAPIConvention","values": [ - {"name": "API_DirectX","value": "0"} - ,{"name": "API_OpenGL","value": "1"} +, {"enumname": "vr::ETextureType","values": [ + {"name": "TextureType_DirectX","value": "0"} + ,{"name": "TextureType_OpenGL","value": "1"} + ,{"name": "TextureType_Vulkan","value": "2"} ]} , {"enumname": "vr::EColorSpace","values": [ {"name": "ColorSpace_Auto","value": "0"} @@ -54,9 +54,8 @@ {"name": "TrackedDeviceClass_Invalid","value": "0"} ,{"name": "TrackedDeviceClass_HMD","value": "1"} ,{"name": "TrackedDeviceClass_Controller","value": "2"} + ,{"name": "TrackedDeviceClass_GenericTracker","value": "3"} ,{"name": "TrackedDeviceClass_TrackingReference","value": "4"} - ,{"name": "TrackedDeviceClass_Count","value": "5"} - ,{"name": "TrackedDeviceClass_Other","value": "1000"} ]} , {"enumname": "vr::ETrackedControllerRole","values": [ {"name": "TrackedControllerRole_Invalid","value": "0"} @@ -69,7 +68,8 @@ ,{"name": "TrackingUniverseRawAndUncalibrated","value": "2"} ]} , {"enumname": "vr::ETrackedDeviceProperty","values": [ - {"name": "Prop_TrackingSystemName_String","value": "1000"} + {"name": "Prop_Invalid","value": "0"} + ,{"name": "Prop_TrackingSystemName_String","value": "1000"} ,{"name": "Prop_ModelNumber_String","value": "1001"} ,{"name": "Prop_SerialNumber_String","value": "1002"} ,{"name": "Prop_RenderModelName_String","value": "1003"} @@ -179,12 +179,13 @@ ,{"name": "TrackedProp_ValueNotProvidedByDevice","value": "7"} ,{"name": "TrackedProp_StringExceedsMaximumLength","value": "8"} ,{"name": "TrackedProp_NotYetAvailable","value": "9"} + ,{"name": "TrackedProp_PermissionDenied","value": "10"} ]} , {"enumname": "vr::EVRSubmitFlags","values": [ {"name": "Submit_Default","value": "0"} ,{"name": "Submit_LensDistortionAlreadyApplied","value": "1"} ,{"name": "Submit_GlRenderBuffer","value": "2"} - ,{"name": "Submit_VulkanTexture","value": "4"} + ,{"name": "Submit_Reserved","value": "4"} ]} , {"enumname": "vr::EVRState","values": [ {"name": "VRState_Undefined","value": "-1"} @@ -301,6 +302,7 @@ ,{"name": "VREvent_PerformanceTest_EnableCapture","value": "1600"} ,{"name": "VREvent_PerformanceTest_DisableCapture","value": "1601"} ,{"name": "VREvent_PerformanceTest_FidelityLevel","value": "1602"} + ,{"name": "VREvent_MessageOverlay_Closed","value": "1650"} ,{"name": "VREvent_VendorSpecific_Reserved_Start","value": "10000"} ,{"name": "VREvent_VendorSpecific_Reserved_End","value": "19999"} ]} @@ -440,6 +442,8 @@ ,{"name": "VRInitError_Init_InvalidApplicationType","value": "130"} ,{"name": "VRInitError_Init_NotAvailableToWatchdogApps","value": "131"} ,{"name": "VRInitError_Init_WatchdogDisabledInSettings","value": "132"} + ,{"name": "VRInitError_Init_VRDashboardNotFound","value": "133"} + ,{"name": "VRInitError_Init_VRDashboardStartupFailed","value": "134"} ,{"name": "VRInitError_Driver_Failed","value": "200"} ,{"name": "VRInitError_Driver_Unknown","value": "201"} ,{"name": "VRInitError_Driver_HmdUnknown","value": "202"} @@ -570,7 +574,7 @@ ,{"name": "ChaperoneCalibrationState_Warning_BaseStationRemoved","value": "102"} ,{"name": "ChaperoneCalibrationState_Warning_SeatedBoundsInvalid","value": "103"} ,{"name": "ChaperoneCalibrationState_Error","value": "200"} - ,{"name": "ChaperoneCalibrationState_Error_BaseStationUninitalized","value": "201"} + ,{"name": "ChaperoneCalibrationState_Error_BaseStationUninitialized","value": "201"} ,{"name": "ChaperoneCalibrationState_Error_BaseStationConflict","value": "202"} ,{"name": "ChaperoneCalibrationState_Error_PlayAreaInvalid","value": "203"} ,{"name": "ChaperoneCalibrationState_Error_CollisionBoundsInvalid","value": "204"} @@ -621,6 +625,16 @@ ,{"name": "VROverlayFlags_Panorama","value": "12"} ,{"name": "VROverlayFlags_StereoPanorama","value": "13"} ,{"name": "VROverlayFlags_SortWithNonSceneOverlays","value": "14"} + ,{"name": "VROverlayFlags_VisibleInDashboard","value": "15"} +]} +, {"enumname": "vr::VRMessageOverlayResponse","values": [ + {"name": "VRMessageOverlayResponse_ButtonPress_0","value": "0"} + ,{"name": "VRMessageOverlayResponse_ButtonPress_1","value": "1"} + ,{"name": "VRMessageOverlayResponse_ButtonPress_2","value": "2"} + ,{"name": "VRMessageOverlayResponse_ButtonPress_3","value": "3"} + ,{"name": "VRMessageOverlayResponse_CouldntFindSystemOverlay","value": "4"} + ,{"name": "VRMessageOverlayResponse_CouldntFindOrCreateClientOverlay","value": "5"} + ,{"name": "VRMessageOverlayResponse_ApplicationQuit","value": "6"} ]} , {"enumname": "vr::EGamepadTextInputMode","values": [ {"name": "k_EGamepadTextInputModeNormal","value": "0"} @@ -712,7 +726,7 @@ ,{ "constname": "k_unScreenshotHandleInvalid","consttype": "const uint32_t", "constval": "0"} ,{ - "constname": "IVRSystem_Version","consttype": "const char *const", "constval": "IVRSystem_014"} + "constname": "IVRSystem_Version","consttype": "const char *const", "constval": "IVRSystem_015"} ,{ "constname": "IVRExtendedDisplay_Version","consttype": "const char *const", "constval": "IVRExtendedDisplay_001"} ,{ @@ -730,7 +744,7 @@ ,{ "constname": "IVRChaperoneSetup_Version","consttype": "const char *const", "constval": "IVRChaperoneSetup_005"} ,{ - "constname": "IVRCompositor_Version","consttype": "const char *const", "constval": "IVRCompositor_018"} + "constname": "IVRCompositor_Version","consttype": "const char *const", "constval": "IVRCompositor_019"} ,{ "constname": "k_unVROverlayMaxKeyLength","consttype": "const uint32_t", "constval": "128"} ,{ @@ -740,7 +754,7 @@ ,{ "constname": "k_unMaxOverlayIntersectionMaskPrimitivesCount","consttype": "const uint32_t", "constval": "32"} ,{ - "constname": "IVROverlay_Version","consttype": "const char *const", "constval": "IVROverlay_013"} + "constname": "IVROverlay_Version","consttype": "const char *const", "constval": "IVROverlay_014"} ,{ "constname": "k_pch_Controller_Component_GDC2015","consttype": "const char *const", "constval": "gdc2015"} ,{ @@ -833,6 +847,12 @@ "constname": "k_pch_SteamVR_MirrorViewGeometry_String","consttype": "const char *const", "constval": "mirrorViewGeometry"} ,{ "constname": "k_pch_SteamVR_StartMonitorFromAppLaunch","consttype": "const char *const", "constval": "startMonitorFromAppLaunch"} +,{ + "constname": "k_pch_SteamVR_StartCompositorFromAppLaunch_Bool","consttype": "const char *const", "constval": "startCompositorFromAppLaunch"} +,{ + "constname": "k_pch_SteamVR_StartDashboardFromAppLaunch_Bool","consttype": "const char *const", "constval": "startDashboardFromAppLaunch"} +,{ + "constname": "k_pch_SteamVR_StartOverlayAppsFromDashboard_Bool","consttype": "const char *const", "constval": "startOverlayAppsFromDashboard"} ,{ "constname": "k_pch_SteamVR_EnableHomeApp","consttype": "const char *const", "constval": "enableHomeApp"} ,{ @@ -1035,7 +1055,7 @@ { "fieldname": "rfBlue", "fieldtype": "float [2]"}]} ,{"struct": "vr::Texture_t","fields": [ { "fieldname": "handle", "fieldtype": "void *"}, -{ "fieldname": "eType", "fieldtype": "enum vr::EGraphicsAPIConvention"}, +{ "fieldname": "eType", "fieldtype": "enum vr::ETextureType"}, { "fieldname": "eColorSpace", "fieldtype": "enum vr::EColorSpace"}]} ,{"struct": "vr::TrackedDevicePose_t","fields": [ { "fieldname": "mDeviceToAbsoluteTracking", "fieldtype": "struct vr::HmdMatrix34_t"}, @@ -1049,7 +1069,7 @@ { "fieldname": "vMin", "fieldtype": "float"}, { "fieldname": "uMax", "fieldtype": "float"}, { "fieldname": "vMax", "fieldtype": "float"}]} -,{"struct": "vr::VulkanData_t","fields": [ +,{"struct": "vr::VRVulkanTextureData_t","fields": [ { "fieldname": "m_nImage", "fieldtype": "uint64_t"}, { "fieldname": "m_pDevice", "fieldtype": "struct VkDevice_T *"}, { "fieldname": "m_pPhysicalDevice", "fieldtype": "struct VkPhysicalDevice_T *"}, @@ -1114,6 +1134,8 @@ ,{"struct": "vr::VREvent_EditingCameraSurface_t","fields": [ { "fieldname": "overlayHandle", "fieldtype": "uint64_t"}, { "fieldname": "nVisualMode", "fieldtype": "uint32_t"}]} +,{"struct": "vr::VREvent_MessageOverlay_t","fields": [ +{ "fieldname": "unVRMessageOverlayResponse", "fieldtype": "uint32_t"}]} ,{"struct": "vr::(anonymous)","fields": [ { "fieldname": "reserved", "fieldtype": "struct vr::VREvent_Reserved_t"}, { "fieldname": "controller", "fieldtype": "struct vr::VREvent_Controller_t"}, @@ -1132,7 +1154,8 @@ { "fieldname": "screenshot", "fieldtype": "struct vr::VREvent_Screenshot_t"}, { "fieldname": "screenshotProgress", "fieldtype": "struct vr::VREvent_ScreenshotProgress_t"}, { "fieldname": "applicationLaunch", "fieldtype": "struct vr::VREvent_ApplicationLaunch_t"}, -{ "fieldname": "cameraSurface", "fieldtype": "struct vr::VREvent_EditingCameraSurface_t"}]} +{ "fieldname": "cameraSurface", "fieldtype": "struct vr::VREvent_EditingCameraSurface_t"}, +{ "fieldname": "messageOverlay", "fieldtype": "struct vr::VREvent_MessageOverlay_t"}]} ,{"struct": "vr::VREvent_t","fields": [ { "fieldname": "eventType", "fieldtype": "uint32_t"}, { "fieldname": "trackedDeviceIndex", "fieldtype": "TrackedDeviceIndex_t"}, @@ -1294,8 +1317,7 @@ "params": [ { "paramname": "eEye" ,"paramtype": "vr::EVREye"}, { "paramname": "fNearZ" ,"paramtype": "float"}, -{ "paramname": "fFarZ" ,"paramtype": "float"}, -{ "paramname": "eProjType" ,"paramtype": "vr::EGraphicsAPIConvention"} +{ "paramname": "fFarZ" ,"paramtype": "float"} ] } ,{ @@ -1713,7 +1735,7 @@ } ,{ "classname": "vr::IVRTrackedCamera", - "methodname": "GetCameraIntrinisics", + "methodname": "GetCameraIntrinsics", "returntype": "vr::EVRTrackedCameraError", "params": [ { "paramname": "nDeviceIndex" ,"paramtype": "vr::TrackedDeviceIndex_t"}, @@ -2572,6 +2594,25 @@ { "paramname": "glSharedTextureHandle" ,"paramtype": "vr::glSharedTextureHandle_t"} ] } +,{ + "classname": "vr::IVRCompositor", + "methodname": "GetVulkanInstanceExtensionsRequired", + "returntype": "uint32_t", + "params": [ +{ "paramname": "pchValue" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "unBufferSize" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "GetVulkanDeviceExtensionsRequired", + "returntype": "uint32_t", + "params": [ +{ "paramname": "pPhysicalDevice" ,"paramtype": "struct VkPhysicalDevice_T *"}, +{ "paramname": "pchValue" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "unBufferSize" ,"paramtype": "uint32_t"} + ] +} ,{ "classname": "vr::IVROverlay", "methodname": "FindOverlay", @@ -3100,8 +3141,9 @@ { "paramname": "pWidth" ,"paramtype": "uint32_t *"}, { "paramname": "pHeight" ,"paramtype": "uint32_t *"}, { "paramname": "pNativeFormat" ,"paramtype": "uint32_t *"}, -{ "paramname": "pAPI" ,"paramtype": "vr::EGraphicsAPIConvention *"}, -{ "paramname": "pColorSpace" ,"paramtype": "vr::EColorSpace *"} +{ "paramname": "pAPIType" ,"paramtype": "vr::ETextureType *"}, +{ "paramname": "pColorSpace" ,"paramtype": "vr::EColorSpace *"}, +{ "paramname": "pTextureBounds" ,"paramtype": "struct vr::VRTextureBounds_t *"} ] } ,{ @@ -3250,6 +3292,28 @@ { "paramname": "unPrimitiveSize" ,"paramtype": "uint32_t"} ] } +,{ + "classname": "vr::IVROverlay", + "methodname": "GetOverlayFlags", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "pFlags" ,"paramtype": "uint32_t *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "ShowMessageOverlay", + "returntype": "vr::VRMessageOverlayResponse", + "params": [ +{ "paramname": "pchText" ,"paramtype": "const char *"}, +{ "paramname": "pchCaption" ,"paramtype": "const char *"}, +{ "paramname": "pchButton0Text" ,"paramtype": "const char *"}, +{ "paramname": "pchButton1Text" ,"paramtype": "const char *"}, +{ "paramname": "pchButton2Text" ,"paramtype": "const char *"}, +{ "paramname": "pchButton3Text" ,"paramtype": "const char *"} + ] +} ,{ "classname": "vr::IVRRenderModels", "methodname": "LoadRenderModel_Async", diff --git a/examples/ThirdPartyLibs/openvr/headers/openvr_capi.h b/examples/ThirdPartyLibs/openvr/headers/openvr_capi.h index 6ecbffd0b..daffdfb22 100644 --- a/examples/ThirdPartyLibs/openvr/headers/openvr_capi.h +++ b/examples/ThirdPartyLibs/openvr/headers/openvr_capi.h @@ -62,7 +62,7 @@ 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_014"; +static const char * IVRSystem_Version = "IVRSystem_015"; static const char * IVRExtendedDisplay_Version = "IVRExtendedDisplay_001"; static const char * IVRTrackedCamera_Version = "IVRTrackedCamera_003"; static const unsigned int k_unMaxApplicationKeyLength = 128; @@ -71,12 +71,12 @@ static const char * k_pch_MimeType_GameTheater = "vr/game_theater"; static const char * IVRApplications_Version = "IVRApplications_006"; static const char * IVRChaperone_Version = "IVRChaperone_003"; static const char * IVRChaperoneSetup_Version = "IVRChaperoneSetup_005"; -static const char * IVRCompositor_Version = "IVRCompositor_018"; +static const char * IVRCompositor_Version = "IVRCompositor_019"; static const unsigned int k_unVROverlayMaxKeyLength = 128; static const unsigned int k_unVROverlayMaxNameLength = 128; static const unsigned int k_unMaxOverlayCount = 64; static const unsigned int k_unMaxOverlayIntersectionMaskPrimitivesCount = 32; -static const char * IVROverlay_Version = "IVROverlay_013"; +static const char * IVROverlay_Version = "IVROverlay_014"; static const char * k_pch_Controller_Component_GDC2015 = "gdc2015"; static const char * k_pch_Controller_Component_Base = "base"; static const char * k_pch_Controller_Component_Tip = "tip"; @@ -123,6 +123,9 @@ static const char * k_pch_SteamVR_DefaultMirrorView_Int32 = "defaultMirrorView"; static const char * k_pch_SteamVR_ShowMirrorView_Bool = "showMirrorView"; static const char * k_pch_SteamVR_MirrorViewGeometry_String = "mirrorViewGeometry"; static const char * k_pch_SteamVR_StartMonitorFromAppLaunch = "startMonitorFromAppLaunch"; +static const char * k_pch_SteamVR_StartCompositorFromAppLaunch_Bool = "startCompositorFromAppLaunch"; +static const char * k_pch_SteamVR_StartDashboardFromAppLaunch_Bool = "startDashboardFromAppLaunch"; +static const char * k_pch_SteamVR_StartOverlayAppsFromDashboard_Bool = "startOverlayAppsFromDashboard"; static const char * k_pch_SteamVR_EnableHomeApp = "enableHomeApp"; static const char * k_pch_SteamVR_SetInitialDefaultHomeApp = "setInitialDefaultHomeApp"; static const char * k_pch_SteamVR_CycleBackgroundImageTimeSec_Int32 = "CycleBackgroundImageTimeSec"; @@ -216,11 +219,12 @@ typedef enum EVREye EVREye_Eye_Right = 1, } EVREye; -typedef enum EGraphicsAPIConvention +typedef enum ETextureType { - EGraphicsAPIConvention_API_DirectX = 0, - EGraphicsAPIConvention_API_OpenGL = 1, -} EGraphicsAPIConvention; + ETextureType_TextureType_DirectX = 0, + ETextureType_TextureType_OpenGL = 1, + ETextureType_TextureType_Vulkan = 2, +} ETextureType; typedef enum EColorSpace { @@ -243,9 +247,8 @@ typedef enum ETrackedDeviceClass ETrackedDeviceClass_TrackedDeviceClass_Invalid = 0, ETrackedDeviceClass_TrackedDeviceClass_HMD = 1, ETrackedDeviceClass_TrackedDeviceClass_Controller = 2, + ETrackedDeviceClass_TrackedDeviceClass_GenericTracker = 3, ETrackedDeviceClass_TrackedDeviceClass_TrackingReference = 4, - ETrackedDeviceClass_TrackedDeviceClass_Count = 5, - ETrackedDeviceClass_TrackedDeviceClass_Other = 1000, } ETrackedDeviceClass; typedef enum ETrackedControllerRole @@ -264,6 +267,7 @@ typedef enum ETrackingUniverseOrigin typedef enum ETrackedDeviceProperty { + ETrackedDeviceProperty_Prop_Invalid = 0, ETrackedDeviceProperty_Prop_TrackingSystemName_String = 1000, ETrackedDeviceProperty_Prop_ModelNumber_String = 1001, ETrackedDeviceProperty_Prop_SerialNumber_String = 1002, @@ -376,6 +380,7 @@ typedef enum ETrackedPropertyError ETrackedPropertyError_TrackedProp_ValueNotProvidedByDevice = 7, ETrackedPropertyError_TrackedProp_StringExceedsMaximumLength = 8, ETrackedPropertyError_TrackedProp_NotYetAvailable = 9, + ETrackedPropertyError_TrackedProp_PermissionDenied = 10, } ETrackedPropertyError; typedef enum EVRSubmitFlags @@ -383,7 +388,7 @@ typedef enum EVRSubmitFlags EVRSubmitFlags_Submit_Default = 0, EVRSubmitFlags_Submit_LensDistortionAlreadyApplied = 1, EVRSubmitFlags_Submit_GlRenderBuffer = 2, - EVRSubmitFlags_Submit_VulkanTexture = 4, + EVRSubmitFlags_Submit_Reserved = 4, } EVRSubmitFlags; typedef enum EVRState @@ -504,6 +509,7 @@ typedef enum EVREventType EVREventType_VREvent_PerformanceTest_EnableCapture = 1600, EVREventType_VREvent_PerformanceTest_DisableCapture = 1601, EVREventType_VREvent_PerformanceTest_FidelityLevel = 1602, + EVREventType_VREvent_MessageOverlay_Closed = 1650, EVREventType_VREvent_VendorSpecific_Reserved_Start = 10000, EVREventType_VREvent_VendorSpecific_Reserved_End = 19999, } EVREventType; @@ -667,6 +673,8 @@ typedef enum EVRInitError EVRInitError_VRInitError_Init_InvalidApplicationType = 130, EVRInitError_VRInitError_Init_NotAvailableToWatchdogApps = 131, EVRInitError_VRInitError_Init_WatchdogDisabledInSettings = 132, + EVRInitError_VRInitError_Init_VRDashboardNotFound = 133, + EVRInitError_VRInitError_Init_VRDashboardStartupFailed = 134, EVRInitError_VRInitError_Driver_Failed = 200, EVRInitError_VRInitError_Driver_Unknown = 201, EVRInitError_VRInitError_Driver_HmdUnknown = 202, @@ -813,7 +821,7 @@ typedef enum ChaperoneCalibrationState ChaperoneCalibrationState_Warning_BaseStationRemoved = 102, ChaperoneCalibrationState_Warning_SeatedBoundsInvalid = 103, ChaperoneCalibrationState_Error = 200, - ChaperoneCalibrationState_Error_BaseStationUninitalized = 201, + ChaperoneCalibrationState_Error_BaseStationUninitialized = 201, ChaperoneCalibrationState_Error_BaseStationConflict = 202, ChaperoneCalibrationState_Error_PlayAreaInvalid = 203, ChaperoneCalibrationState_Error_CollisionBoundsInvalid = 204, @@ -876,8 +884,20 @@ typedef enum VROverlayFlags VROverlayFlags_Panorama = 12, VROverlayFlags_StereoPanorama = 13, VROverlayFlags_SortWithNonSceneOverlays = 14, + VROverlayFlags_VisibleInDashboard = 15, } VROverlayFlags; +typedef enum VRMessageOverlayResponse +{ + VRMessageOverlayResponse_ButtonPress_0 = 0, + VRMessageOverlayResponse_ButtonPress_1 = 1, + VRMessageOverlayResponse_ButtonPress_2 = 2, + VRMessageOverlayResponse_ButtonPress_3 = 3, + VRMessageOverlayResponse_CouldntFindSystemOverlay = 4, + VRMessageOverlayResponse_CouldntFindOrCreateClientOverlay = 5, + VRMessageOverlayResponse_ApplicationQuit = 6, +} VRMessageOverlayResponse; + typedef enum EGamepadTextInputMode { EGamepadTextInputMode_k_EGamepadTextInputModeNormal = 0, @@ -987,7 +1007,6 @@ typedef int32_t TextureID_t; typedef uint32_t VRNotificationId; typedef EVRInitError HmdError; typedef EVREye Hmd_Eye; -typedef EGraphicsAPIConvention GraphicsAPIConvention; typedef EColorSpace ColorSpace; typedef ETrackingResult HmdTrackingResult; typedef ETrackedDeviceClass TrackedDeviceClass; @@ -1071,7 +1090,7 @@ typedef struct DistortionCoordinates_t typedef struct Texture_t { void * handle; // void * - enum EGraphicsAPIConvention eType; + enum ETextureType eType; enum EColorSpace eColorSpace; } Texture_t; @@ -1093,7 +1112,7 @@ typedef struct VRTextureBounds_t float vMax; } VRTextureBounds_t; -typedef struct VulkanData_t +typedef struct VRVulkanTextureData_t { uint64_t m_nImage; struct VkDevice_T * m_pDevice; // struct VkDevice_T * @@ -1105,7 +1124,7 @@ typedef struct VulkanData_t uint32_t m_nHeight; uint32_t m_nFormat; uint32_t m_nSampleCount; -} VulkanData_t; +} VRVulkanTextureData_t; typedef struct VREvent_Controller_t { @@ -1215,6 +1234,11 @@ typedef struct VREvent_EditingCameraSurface_t uint32_t nVisualMode; } VREvent_EditingCameraSurface_t; +typedef struct VREvent_MessageOverlay_t +{ + uint32_t unVRMessageOverlayResponse; +} VREvent_MessageOverlay_t; + typedef struct HiddenAreaMesh_t { struct HmdVector2_t * pVertexData; // const struct vr::HmdVector2_t * @@ -1453,7 +1477,7 @@ struct VROverlayIntersectionMaskPrimitive_t struct VR_IVRSystem_FnTable { void (OPENVR_FNTABLE_CALLTYPE *GetRecommendedRenderTargetSize)(uint32_t * pnWidth, uint32_t * pnHeight); - struct HmdMatrix44_t (OPENVR_FNTABLE_CALLTYPE *GetProjectionMatrix)(EVREye eEye, float fNearZ, float fFarZ, EGraphicsAPIConvention eProjType); + struct HmdMatrix44_t (OPENVR_FNTABLE_CALLTYPE *GetProjectionMatrix)(EVREye eEye, float fNearZ, float fFarZ); void (OPENVR_FNTABLE_CALLTYPE *GetProjectionRaw)(EVREye eEye, float * pfLeft, float * pfRight, float * pfTop, float * pfBottom); bool (OPENVR_FNTABLE_CALLTYPE *ComputeDistortion)(EVREye eEye, float fU, float fV, struct DistortionCoordinates_t * pDistortionCoordinates); struct HmdMatrix34_t (OPENVR_FNTABLE_CALLTYPE *GetEyeToHeadTransform)(EVREye eEye); @@ -1510,7 +1534,7 @@ struct VR_IVRTrackedCamera_FnTable char * (OPENVR_FNTABLE_CALLTYPE *GetCameraErrorNameFromEnum)(EVRTrackedCameraError eCameraError); EVRTrackedCameraError (OPENVR_FNTABLE_CALLTYPE *HasCamera)(TrackedDeviceIndex_t nDeviceIndex, bool * pHasCamera); EVRTrackedCameraError (OPENVR_FNTABLE_CALLTYPE *GetCameraFrameSize)(TrackedDeviceIndex_t nDeviceIndex, EVRTrackedCameraFrameType eFrameType, uint32_t * pnWidth, uint32_t * pnHeight, uint32_t * pnFrameBufferSize); - EVRTrackedCameraError (OPENVR_FNTABLE_CALLTYPE *GetCameraIntrinisics)(TrackedDeviceIndex_t nDeviceIndex, EVRTrackedCameraFrameType eFrameType, HmdVector2_t * pFocalLength, HmdVector2_t * pCenter); + EVRTrackedCameraError (OPENVR_FNTABLE_CALLTYPE *GetCameraIntrinsics)(TrackedDeviceIndex_t nDeviceIndex, EVRTrackedCameraFrameType eFrameType, HmdVector2_t * pFocalLength, HmdVector2_t * pCenter); EVRTrackedCameraError (OPENVR_FNTABLE_CALLTYPE *GetCameraProjection)(TrackedDeviceIndex_t nDeviceIndex, EVRTrackedCameraFrameType eFrameType, float flZNear, float flZFar, HmdMatrix44_t * pProjection); EVRTrackedCameraError (OPENVR_FNTABLE_CALLTYPE *AcquireVideoStreamingService)(TrackedDeviceIndex_t nDeviceIndex, TrackedCameraHandle_t * pHandle); EVRTrackedCameraError (OPENVR_FNTABLE_CALLTYPE *ReleaseVideoStreamingService)(TrackedCameraHandle_t hTrackedCamera); @@ -1631,6 +1655,8 @@ struct VR_IVRCompositor_FnTable bool (OPENVR_FNTABLE_CALLTYPE *ReleaseSharedGLTexture)(glUInt_t glTextureId, glSharedTextureHandle_t glSharedTextureHandle); void (OPENVR_FNTABLE_CALLTYPE *LockGLSharedTextureForAccess)(glSharedTextureHandle_t glSharedTextureHandle); void (OPENVR_FNTABLE_CALLTYPE *UnlockGLSharedTextureForAccess)(glSharedTextureHandle_t glSharedTextureHandle); + uint32_t (OPENVR_FNTABLE_CALLTYPE *GetVulkanInstanceExtensionsRequired)(char * pchValue, uint32_t unBufferSize); + uint32_t (OPENVR_FNTABLE_CALLTYPE *GetVulkanDeviceExtensionsRequired)(struct VkPhysicalDevice_T * pPhysicalDevice, char * pchValue, uint32_t unBufferSize); }; struct VR_IVROverlay_FnTable @@ -1691,7 +1717,7 @@ struct VR_IVROverlay_FnTable EVROverlayError (OPENVR_FNTABLE_CALLTYPE *ClearOverlayTexture)(VROverlayHandle_t ulOverlayHandle); EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayRaw)(VROverlayHandle_t ulOverlayHandle, void * pvBuffer, uint32_t unWidth, uint32_t unHeight, uint32_t unDepth); EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayFromFile)(VROverlayHandle_t ulOverlayHandle, char * pchFilePath); - EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayTexture)(VROverlayHandle_t ulOverlayHandle, void ** pNativeTextureHandle, void * pNativeTextureRef, uint32_t * pWidth, uint32_t * pHeight, uint32_t * pNativeFormat, EGraphicsAPIConvention * pAPI, EColorSpace * pColorSpace); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayTexture)(VROverlayHandle_t ulOverlayHandle, void ** pNativeTextureHandle, void * pNativeTextureRef, uint32_t * pWidth, uint32_t * pHeight, uint32_t * pNativeFormat, ETextureType * pAPIType, EColorSpace * pColorSpace, struct VRTextureBounds_t * pTextureBounds); EVROverlayError (OPENVR_FNTABLE_CALLTYPE *ReleaseNativeOverlayHandle)(VROverlayHandle_t ulOverlayHandle, void * pNativeTextureHandle); EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayTextureSize)(VROverlayHandle_t ulOverlayHandle, uint32_t * pWidth, uint32_t * pHeight); EVROverlayError (OPENVR_FNTABLE_CALLTYPE *CreateDashboardOverlay)(char * pchOverlayKey, char * pchOverlayFriendlyName, VROverlayHandle_t * pMainHandle, VROverlayHandle_t * pThumbnailHandle); @@ -1708,6 +1734,8 @@ struct VR_IVROverlay_FnTable void (OPENVR_FNTABLE_CALLTYPE *SetKeyboardTransformAbsolute)(ETrackingUniverseOrigin eTrackingOrigin, struct HmdMatrix34_t * pmatTrackingOriginToKeyboardTransform); void (OPENVR_FNTABLE_CALLTYPE *SetKeyboardPositionForOverlay)(VROverlayHandle_t ulOverlayHandle, struct HmdRect2_t avoidRect); EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayIntersectionMask)(VROverlayHandle_t ulOverlayHandle, struct VROverlayIntersectionMaskPrimitive_t * pMaskPrimitives, uint32_t unNumMaskPrimitives, uint32_t unPrimitiveSize); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayFlags)(VROverlayHandle_t ulOverlayHandle, uint32_t * pFlags); + VRMessageOverlayResponse (OPENVR_FNTABLE_CALLTYPE *ShowMessageOverlay)(char * pchText, char * pchCaption, char * pchButton0Text, char * pchButton1Text, char * pchButton2Text, char * pchButton3Text); }; struct VR_IVRRenderModels_FnTable diff --git a/examples/ThirdPartyLibs/openvr/headers/openvr_driver.h b/examples/ThirdPartyLibs/openvr/headers/openvr_driver.h index ae778b877..c2d550eba 100644 --- a/examples/ThirdPartyLibs/openvr/headers/openvr_driver.h +++ b/examples/ThirdPartyLibs/openvr/headers/openvr_driver.h @@ -111,10 +111,11 @@ enum EVREye Eye_Right = 1 }; -enum EGraphicsAPIConvention +enum ETextureType { - API_DirectX = 0, // Normalized Z goes from 0 at the viewer to 1 at the far clip plane - API_OpenGL = 1, // Normalized Z goes from 1 at the viewer to -1 at the far clip plane + TextureType_DirectX = 0, // Handle is an ID3D11Texture + TextureType_OpenGL = 1, // Handle is an OpenGL texture name or an OpenGL render buffer name, depending on submit flags + TextureType_Vulkan = 2, // Handle is a pointer to a VRVulkanTextureData_t structure }; enum EColorSpace @@ -126,8 +127,8 @@ enum EColorSpace struct Texture_t { - void* handle; // Native d3d texture pointer or GL texture id. - EGraphicsAPIConvention eType; + void* handle; // See ETextureType definition above + ETextureType eType; EColorSpace eColorSpace; }; @@ -161,11 +162,8 @@ enum ETrackedDeviceClass TrackedDeviceClass_Invalid = 0, // the ID was not valid. TrackedDeviceClass_HMD = 1, // Head-Mounted Displays TrackedDeviceClass_Controller = 2, // Tracked controllers + TrackedDeviceClass_GenericTracker = 3, // Generic trackers, similar to controllers TrackedDeviceClass_TrackingReference = 4, // Camera and base stations that serve as tracking reference points - - TrackedDeviceClass_Count, // This isn't a class that will ever be returned. It is used for allocating arrays and such - - TrackedDeviceClass_Other = 1000, }; @@ -198,7 +196,7 @@ enum ETrackingUniverseOrigin { TrackingUniverseSeated = 0, // Poses are provided relative to the seated zero pose TrackingUniverseStanding = 1, // Poses are provided relative to the safe bounds configured by the user - TrackingUniverseRawAndUncalibrated = 2, // Poses are provided in the coordinate system defined by the driver. You probably don't want this one. + TrackingUniverseRawAndUncalibrated = 2, // Poses are provided in the coordinate system defined by the driver. It has Y up and is unified for devices of the same driver. You usually don't want this one. }; @@ -206,6 +204,8 @@ enum ETrackingUniverseOrigin * tracked device. Many fields are only valid for one ETrackedDeviceClass. */ enum ETrackedDeviceProperty { + Prop_Invalid = 0, + // general properties that apply to all device classes Prop_TrackingSystemName_String = 1000, Prop_ModelNumber_String = 1001, @@ -333,6 +333,7 @@ enum ETrackedPropertyError TrackedProp_ValueNotProvidedByDevice = 7, TrackedProp_StringExceedsMaximumLength = 8, TrackedProp_NotYetAvailable = 9, // The property value isn't known yet, but is expected soon. Call again later. + TrackedProp_PermissionDenied = 10, }; /** Allows the application to control what part of the provided texture will be used in the @@ -358,13 +359,13 @@ 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, - // Handle is pointer to VulkanData_t - Submit_VulkanTexture = 0x04, + // Do not use + Submit_Reserved = 0x04, }; /** Data required for passing Vulkan textures to IVRCompositor::Submit. * Be sure to call OpenVR_Shutdown before destroying these resources. */ -struct VulkanData_t +struct VRVulkanTextureData_t { uint64_t m_nImage; // VkImage VkDevice_T *m_pDevice; @@ -517,6 +518,8 @@ enum EVREventType VREvent_PerformanceTest_EnableCapture = 1600, VREvent_PerformanceTest_DisableCapture = 1601, VREvent_PerformanceTest_FidelityLevel = 1602, + + VREvent_MessageOverlay_Closed = 1650, // Vendors are free to expose private events in this reserved region VREvent_VendorSpecific_Reserved_Start = 10000, @@ -703,6 +706,11 @@ struct VREvent_EditingCameraSurface_t uint32_t nVisualMode; }; +struct VREvent_MessageOverlay_t +{ + uint32_t unVRMessageOverlayResponse; // vr::VRMessageOverlayResponse enum +}; + /** NOTE!!! If you change this you MUST manually update openvr_interop.cs.py */ typedef union { @@ -724,6 +732,7 @@ typedef union VREvent_ScreenshotProgress_t screenshotProgress; VREvent_ApplicationLaunch_t applicationLaunch; VREvent_EditingCameraSurface_t cameraSurface; + VREvent_MessageOverlay_t messageOverlay; } VREvent_Data_t; /** An event posted by the server to all running applications */ @@ -944,6 +953,8 @@ enum EVRInitError VRInitError_Init_InvalidApplicationType = 130, VRInitError_Init_NotAvailableToWatchdogApps = 131, VRInitError_Init_WatchdogDisabledInSettings = 132, + VRInitError_Init_VRDashboardNotFound = 133, + VRInitError_Init_VRDashboardStartupFailed = 134, VRInitError_Driver_Failed = 200, VRInitError_Driver_Unknown = 201, @@ -1257,7 +1268,6 @@ namespace vr //----------------------------------------------------------------------------- // steamvr keys - static const char * const k_pch_SteamVR_Section = "steamvr"; static const char * const k_pch_SteamVR_RequireHmd_String = "requireHmd"; static const char * const k_pch_SteamVR_ForcedDriverKey_String = "forcedDriver"; @@ -1294,27 +1304,26 @@ namespace vr static const char * const k_pch_SteamVR_ShowMirrorView_Bool = "showMirrorView"; static const char * const k_pch_SteamVR_MirrorViewGeometry_String = "mirrorViewGeometry"; static const char * const k_pch_SteamVR_StartMonitorFromAppLaunch = "startMonitorFromAppLaunch"; + static const char * const k_pch_SteamVR_StartCompositorFromAppLaunch_Bool = "startCompositorFromAppLaunch"; + static const char * const k_pch_SteamVR_StartDashboardFromAppLaunch_Bool = "startDashboardFromAppLaunch"; + static const char * const k_pch_SteamVR_StartOverlayAppsFromDashboard_Bool = "startOverlayAppsFromDashboard"; static const char * const k_pch_SteamVR_EnableHomeApp = "enableHomeApp"; static const char * const k_pch_SteamVR_SetInitialDefaultHomeApp = "setInitialDefaultHomeApp"; static const char * const k_pch_SteamVR_CycleBackgroundImageTimeSec_Int32 = "CycleBackgroundImageTimeSec"; static const char * const k_pch_SteamVR_RetailDemo_Bool = "retailDemo"; static const char * const k_pch_SteamVR_IpdOffset_Float = "ipdOffset"; - //----------------------------------------------------------------------------- // lighthouse keys - static const char * const k_pch_Lighthouse_Section = "driver_lighthouse"; static const char * const k_pch_Lighthouse_DisableIMU_Bool = "disableimu"; static const char * const k_pch_Lighthouse_UseDisambiguation_String = "usedisambiguation"; static const char * const k_pch_Lighthouse_DisambiguationDebug_Int32 = "disambiguationdebug"; - static const char * const k_pch_Lighthouse_PrimaryBasestation_Int32 = "primarybasestation"; static const char * const k_pch_Lighthouse_DBHistory_Bool = "dbhistory"; //----------------------------------------------------------------------------- // null keys - static const char * const k_pch_Null_Section = "driver_null"; static const char * const k_pch_Null_EnableNullDriver_Bool = "enable"; static const char * const k_pch_Null_SerialNumber_String = "serialNumber"; diff --git a/examples/ThirdPartyLibs/openvr/lib/linux64/libopenvr_api.so b/examples/ThirdPartyLibs/openvr/lib/linux64/libopenvr_api.so index d3b8cc764..46470254e 100644 Binary files a/examples/ThirdPartyLibs/openvr/lib/linux64/libopenvr_api.so and b/examples/ThirdPartyLibs/openvr/lib/linux64/libopenvr_api.so differ diff --git a/examples/ThirdPartyLibs/openvr/lib/win32/openvr_api.lib b/examples/ThirdPartyLibs/openvr/lib/win32/openvr_api.lib index ca1946aaa..1521479a9 100644 Binary files a/examples/ThirdPartyLibs/openvr/lib/win32/openvr_api.lib and b/examples/ThirdPartyLibs/openvr/lib/win32/openvr_api.lib differ diff --git a/examples/ThirdPartyLibs/openvr/lib/win64/openvr_api.lib b/examples/ThirdPartyLibs/openvr/lib/win64/openvr_api.lib index 89e078486..fc16c9496 100644 Binary files a/examples/ThirdPartyLibs/openvr/lib/win64/openvr_api.lib and b/examples/ThirdPartyLibs/openvr/lib/win64/openvr_api.lib differ diff --git a/examples/ThirdPartyLibs/openvr/samples/shared/compat.h b/examples/ThirdPartyLibs/openvr/samples/shared/compat.h new file mode 100644 index 000000000..0163b08f2 --- /dev/null +++ b/examples/ThirdPartyLibs/openvr/samples/shared/compat.h @@ -0,0 +1,27 @@ +#ifndef OPENVR_SAMPLES_SHARED_COMPAT_H_ +#define OPENVR_SAMPLES_SHARED_COMPAT_H_ + +#include +#include +#include + +// Handle non standard code. +#ifndef _WIN32 + +#include +#include + +#define sprintf_s snprintf +#define vsprintf_s sprintf +#define _stricmp strcmp +#define stricmp strcmp +#define strcpy_s(dst, n, src) int(strncpy(dst, src, n) != nullptr) +#define fopen_s(fd, path, mode) int((*fd = fopen(path, mode)) != nullptr) +#define _vsnprintf_s(buffer, size, fmt, ap) vsnprintf(buffer, size, fmt, ap) +#define OutputDebugStringA(x) fprintf(stderr, "%s\n", x) + +typedef int errno_t; + +#endif // _WIN32 + +#endif // OPENVR_SAMPLES_SHARED_COMPAT_H_ \ No newline at end of file