diff --git a/CMakeLists.txt b/CMakeLists.txt index 556f60e..28716ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,8 @@ project(OpenComposite) include(scripts/pch.cmake) +set(CMAKE_CXX_STANDARD 17) + # === Runtime Switcher === include_external_msproject( RuntimeSwitcher ${CMAKE_SOURCE_DIR}/RuntimeSwitcher/RuntimeSwitcher.csproj @@ -33,14 +35,14 @@ endif() # === LibOVR === if(WIN32) -set(OVRDIR libs/libovr/OculusSDK/LibOVR) -add_library(ovr STATIC - ${OVRDIR}/Shim/OVR_CAPI_Prototypes.h - ${OVRDIR}/Shim/OVR_CAPI_Util.cpp - ${OVRDIR}/Shim/OVR_CAPIShim.c - ${OVRDIR}/Shim/OVR_StereoProjection.cpp -) -target_include_directories(ovr PUBLIC ${OVRDIR}/Include) +#set(OVRDIR libs/libovr/OculusSDK/LibOVR) +#add_library(ovr STATIC +# ${OVRDIR}/Shim/OVR_CAPI_Prototypes.h +# ${OVRDIR}/Shim/OVR_CAPI_Util.cpp +# ${OVRDIR}/Shim/OVR_CAPIShim.c +# ${OVRDIR}/Shim/OVR_StereoProjection.cpp +#) +#target_include_directories(ovr PUBLIC ${OVRDIR}/Include ${OVRDIR}/../Logging) # Resource Processor set(OVR_SHADER_DIR "${CMAKE_CURRENT_BINARY_DIR}/gen_shaders") @@ -65,53 +67,53 @@ endfunction() file(MAKE_DIRECTORY ${OVR_SHADER_DIR}/Shaders) # === LibOVRKernel === -set(OVRKDIR libs/libovr/OculusSDK/LibOVRKernel) -set(OVRKSDIR ${OVRKDIR}/Src/Util/Shaders) -add_library(ovrkernel STATIC - ${OVRKDIR}/../Logging/src/internal/Logging_Tools.cpp - ${OVRKDIR}/../Logging/src/Logging_Library.cpp - ${OVRKDIR}/../Logging/src/Logging_OutputPlugins.cpp - ${OVRKDIR}/Src/GL/CAPI_GLE.cpp - ${OVRKDIR}/Src/Kernel/OVR_Alg.cpp - ${OVRKDIR}/Src/Kernel/OVR_Allocator.cpp - ${OVRKDIR}/Src/Kernel/OVR_Atomic.cpp - ${OVRKDIR}/Src/Kernel/OVR_Callbacks.cpp - ${OVRKDIR}/Src/Kernel/OVR_CRC32.cpp - ${OVRKDIR}/Src/Kernel/OVR_DebugHelp.cpp - ${OVRKDIR}/Src/Kernel/OVR_Error.cpp - ${OVRKDIR}/Src/Kernel/OVR_File.cpp - ${OVRKDIR}/Src/Kernel/OVR_FileFILE.cpp - ${OVRKDIR}/Src/Kernel/OVR_JSON.cpp - ${OVRKDIR}/Src/Kernel/OVR_Log.cpp - ${OVRKDIR}/Src/Kernel/OVR_mach_exc_OSX.c - ${OVRKDIR}/Src/Kernel/OVR_Rand.cpp - ${OVRKDIR}/Src/Kernel/OVR_RefCount.cpp - ${OVRKDIR}/Src/Kernel/OVR_SharedMemory.cpp - ${OVRKDIR}/Src/Kernel/OVR_Std.cpp - ${OVRKDIR}/Src/Kernel/OVR_String.cpp - ${OVRKDIR}/Src/Kernel/OVR_String_FormatUtil.cpp - ${OVRKDIR}/Src/Kernel/OVR_String_PathUtil.cpp - ${OVRKDIR}/Src/Kernel/OVR_SysFile.cpp - ${OVRKDIR}/Src/Kernel/OVR_System.cpp - ${OVRKDIR}/Src/Kernel/OVR_ThreadsPthread.cpp - ${OVRKDIR}/Src/Kernel/OVR_ThreadsWinAPI.cpp - ${OVRKDIR}/Src/Kernel/OVR_Timer.cpp - ${OVRKDIR}/Src/Kernel/OVR_UTF8Util.cpp - ${OVRKDIR}/Src/Util/Util_D3D11_Blitter.cpp - ${OVRKDIR}/Src/Util/Util_Direct3D.cpp - ${OVRKDIR}/Src/Util/Util_GL_Blitter.cpp - ${OVRKDIR}/Src/Util/Util_ImageWindow.cpp - ${OVRKDIR}/Src/Util/Util_LongPollThread.cpp - ${OVRKDIR}/Src/Util/Util_SystemGUI.cpp - ${OVRKDIR}/Src/Util/Util_SystemInfo.cpp - ${OVRKDIR}/Src/Util/Util_Watchdog.cpp -) -target_include_directories(ovrkernel PUBLIC ${OVRKDIR}/Src) -target_include_directories(ovrkernel PRIVATE ${OVRKDIR}/../Logging/include) -target_link_libraries(ovrkernel ovr) +#set(OVRKDIR libs/libovr/OculusSDK/LibOVRKernel) +#set(OVRKSDIR ${OVRKDIR}/Src/Util/Shaders) +#add_library(ovrkernel STATIC +# ${OVRKDIR}/../Logging/src/internal/Logging_Tools.cpp +# ${OVRKDIR}/../Logging/src/Logging_Library.cpp +# ${OVRKDIR}/../Logging/src/Logging_OutputPlugins.cpp +# ${OVRKDIR}/Src/GL/CAPI_GLE.cpp +# ${OVRKDIR}/Src/Kernel/OVR_Alg.cpp +# ${OVRKDIR}/Src/Kernel/OVR_Allocator.cpp +# ${OVRKDIR}/Src/Kernel/OVR_Atomic.cpp +# ${OVRKDIR}/Src/Kernel/OVR_Callbacks.cpp +# ${OVRKDIR}/Src/Kernel/OVR_CRC32.cpp +# ${OVRKDIR}/Src/Kernel/OVR_DebugHelp.cpp +# ${OVRKDIR}/Src/Kernel/OVR_Error.cpp +# ${OVRKDIR}/Src/Kernel/OVR_File.cpp +# ${OVRKDIR}/Src/Kernel/OVR_FileFILE.cpp +# ${OVRKDIR}/Src/Kernel/OVR_JSON.cpp +# ${OVRKDIR}/Src/Kernel/OVR_Log.cpp +# ${OVRKDIR}/Src/Kernel/OVR_mach_exc_OSX.c +# ${OVRKDIR}/Src/Kernel/OVR_Rand.cpp +# ${OVRKDIR}/Src/Kernel/OVR_RefCount.cpp +# ${OVRKDIR}/Src/Kernel/OVR_SharedMemory.cpp +# ${OVRKDIR}/Src/Kernel/OVR_Std.cpp +# ${OVRKDIR}/Src/Kernel/OVR_String.cpp +# ${OVRKDIR}/Src/Kernel/OVR_String_FormatUtil.cpp +# ${OVRKDIR}/Src/Kernel/OVR_String_PathUtil.cpp +# ${OVRKDIR}/Src/Kernel/OVR_SysFile.cpp +# ${OVRKDIR}/Src/Kernel/OVR_System.cpp +# ${OVRKDIR}/Src/Kernel/OVR_ThreadsPthread.cpp +# ${OVRKDIR}/Src/Kernel/OVR_ThreadsWinAPI.cpp +# ${OVRKDIR}/Src/Kernel/OVR_Timer.cpp +# ${OVRKDIR}/Src/Kernel/OVR_UTF8Util.cpp +# ${OVRKDIR}/Src/Util/Util_D3D11_Blitter.cpp +# ${OVRKDIR}/Src/Util/Util_Direct3D.cpp +# ${OVRKDIR}/Src/Util/Util_GL_Blitter.cpp +# ${OVRKDIR}/Src/Util/Util_ImageWindow.cpp +# ${OVRKDIR}/Src/Util/Util_LongPollThread.cpp +# ${OVRKDIR}/Src/Util/Util_SystemGUI.cpp +# ${OVRKDIR}/Src/Util/Util_SystemInfo.cpp +# ${OVRKDIR}/Src/Util/Util_Watchdog.cpp +#) +#target_include_directories(ovrkernel PUBLIC ${OVRKDIR}/Src) +#target_include_directories(ovrkernel PRIVATE ${OVRKDIR}/../Logging/include) +#target_link_libraries(ovrkernel ovr) # Shader configuration -target_include_directories(ovrkernel PRIVATE ${OVR_SHADER_DIR}) +# target_include_directories(ovrkernel PRIVATE ${OVR_SHADER_DIR}) set(OVRK_BLITTER ${OVRKDIR}/Src/Util/Util_D3D11_Blitter.cpp) build_fx(${OVRKSDIR}/Blt_ps.hlsl ps_4_0 ${OVRK_BLITTER}) @@ -119,31 +121,31 @@ build_fx(${OVRKSDIR}/Blt_ps_ms2.hlsl ps_5_0 ${OVRK_BLITTER}) build_fx(${OVRKSDIR}/Blt_vs.hlsl vs_5_0 ${OVRK_BLITTER}) # === DrvOculus === -add_library(DrvOculus STATIC - DrvOculus/DrvOculus.cpp +#add_library(DrvOculus STATIC +# DrvOculus/DrvOculus.cpp - DrvOculus/DrvOculusCommon.h +# DrvOculus/DrvOculusCommon.h - DrvOculus/OculusBackend.cpp - DrvOculus/OculusBackend.h +# DrvOculus/OculusBackend.cpp +# DrvOculus/OculusBackend.h - DrvOculus/OculusBackendSubmit.cpp - DrvOculus/OculusBackendMirror.cpp - DrvOculus/OculusBackendGuardian.cpp +# DrvOculus/OculusBackendSubmit.cpp +# DrvOculus/OculusBackendMirror.cpp +# DrvOculus/OculusBackendGuardian.cpp - DrvOculus/pub/DrvOculus.h +# DrvOculus/pub/DrvOculus.h # Devices - DrvOculus/OculusDevice.cpp - DrvOculus/OculusDevice.h +# DrvOculus/OculusDevice.cpp +# DrvOculus/OculusDevice.h - DrvOculus/OculusHMD.cpp - DrvOculus/OculusHMD.h -) -target_include_directories(DrvOculus PUBLIC DrvOculus/pub) -target_include_directories(DrvOculus PRIVATE DrvOculus) -target_link_libraries(DrvOculus OpenVR ovr ovrkernel) -source_group(Public REGULAR_EXPRESSION DrvOculus/pub/*) +# DrvOculus/OculusHMD.cpp +# DrvOculus/OculusHMD.h +#) +#target_include_directories(DrvOculus PUBLIC DrvOculus/pub) +#target_include_directories(DrvOculus PRIVATE DrvOculus) +#target_link_libraries(DrvOculus OpenVR ovr ovrkernel) +#source_group(Public REGULAR_EXPRESSION DrvOculus/pub/*) endif (WIN32) @@ -163,22 +165,22 @@ add_library(OCCore STATIC OpenOVR/stdafx.cpp OpenOVR/API/OCBaseSystem.cpp - OpenOVR/Compositor/compositor.cpp - OpenOVR/Compositor/dx11compositor.cpp - OpenOVR/Compositor/dx10compositor.cpp - OpenOVR/Compositor/dx12compositor.cpp - OpenOVR/Compositor/glcompositor.cpp - OpenOVR/Compositor/vkcompositor.cpp - OpenOVR/convert.cpp - OpenOVR/libovr_wrapper.cpp + #OpenOVR/Compositor/compositor.cpp + #OpenOVR/Compositor/dx11compositor.cpp + #OpenOVR/Compositor/dx10compositor.cpp + #OpenOVR/Compositor/dx12compositor.cpp + #OpenOVR/Compositor/glcompositor.cpp + #OpenOVR/Compositor/vkcompositor.cpp + #OpenOVR/convert.cpp + #OpenOVR/libovr_wrapper.cpp OpenOVR/logging.cpp OpenOVR/Misc/audio_override.cpp OpenOVR/Misc/Config.cpp OpenOVR/Misc/debug_helper.cpp - OpenOVR/Misc/Haptics.cpp - OpenOVR/Misc/Keyboard/KeyboardLayout.cpp - OpenOVR/Misc/Keyboard/SudoFontMeta.cpp - OpenOVR/Misc/Keyboard/VRKeyboard.cpp + #OpenOVR/Misc/Haptics.cpp + #OpenOVR/Misc/Keyboard/KeyboardLayout.cpp + #OpenOVR/Misc/Keyboard/SudoFontMeta.cpp + #OpenOVR/Misc/Keyboard/VRKeyboard.cpp OpenOVR/OpenOVR.cpp OpenOVR/Reimpl/BaseApplications.cpp OpenOVR/Reimpl/BaseChaperone.cpp @@ -224,20 +226,20 @@ add_library(OCCore STATIC OpenOVR/API/OCBaseSystem.h OpenOVR/BaseCommon.h OpenOVR/Compositor/compositor.h - OpenOVR/convert.h + #OpenOVR/convert.h OpenOVR/custom_types.h - OpenOVR/libovr_wrapper.h + #OpenOVR/libovr_wrapper.h OpenOVR/logging.h OpenOVR/Misc/audio_override.h OpenOVR/Misc/Config.h OpenOVR/Misc/debug_helper.h - OpenOVR/Misc/Haptics.h + #OpenOVR/Misc/Haptics.h OpenOVR/Misc/ini.h OpenOVR/Misc/json/json-forwards.h OpenOVR/Misc/json/json.h - OpenOVR/Misc/Keyboard/KeyboardLayout.h - OpenOVR/Misc/Keyboard/SudoFontMeta.h - OpenOVR/Misc/Keyboard/VRKeyboard.h + #OpenOVR/Misc/Keyboard/KeyboardLayout.h + #OpenOVR/Misc/Keyboard/SudoFontMeta.h + #OpenOVR/Misc/Keyboard/VRKeyboard.h OpenOVR/Misc/lodepng.h OpenOVR/Misc/ScopeGuard.h OpenOVR/Reimpl/BaseApplications.h @@ -325,7 +327,7 @@ add_library(OCCore STATIC target_include_directories(OCCore PUBLIC OpenOVR) # TODO make this private and put the public headers elsewhere target_include_directories(OCCore PRIVATE BundledLibs) target_compile_definitions(OCCore PRIVATE -DSUPPORT_DX -DSUPPORT_GL -DSUPPORT_VK) -target_link_libraries(OCCore OpenVR ovr ovrkernel Vulkan) +target_link_libraries(OCCore OpenVR ovr Vulkan) # Set up precompiled headers for OCCore if (WIN32) @@ -347,4 +349,4 @@ add_library(OCOVR SHARED # Resources don't get nicely included in a library file ${OVR_RESOURCES} ) -target_link_libraries(OCOVR OCCore DrvOculus) +target_link_libraries(OCOVR OCCore) diff --git a/OCOVR/dllmain.cpp b/OCOVR/dllmain.cpp index 1995b50..3b2c0e8 100644 --- a/OCOVR/dllmain.cpp +++ b/OCOVR/dllmain.cpp @@ -7,24 +7,24 @@ #include "Reimpl/GVRClientCore.gen.h" #include "steamvr_abi.h" -#include "libovr_wrapper.h" +// #include "libovr_wrapper.h" #include "Misc/debug_helper.h" #include "Misc/audio_override.h" #include "Misc/Config.h" #include #include -#include "OVR_CAPI_Audio.h" +// #include "OVR_CAPI_Audio.h" // Specific to OCOVR #include "Drivers/Backend.h" #include "Drivers/DriverManager.h" -#include "DrvOculus.h" +// #include "DrvOculus.h" using namespace std; -static void init_audio(); -static void setup_audio(); +// static void init_audio(); +// static void setup_audio(); HMODULE openovr_module_id; HMODULE chainedImplementation; @@ -41,7 +41,7 @@ BOOL APIENTRY DllMain( HMODULE hModule, #if defined(_DEBUG) DbgSetModule(hModule); #endif - init_audio(); + // init_audio(); case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: break; @@ -206,10 +206,10 @@ VR_INTERFACE uint32_t VR_CALLTYPE VR_InitInternal2(EVRInitError * peError, EVRAp if (running) ERR("Cannot init VR: Already running!"); - ovr::Setup(); - running_ovr = true; + // ovr::Setup(); + // running_ovr = true; - setup_audio(); + // setup_audio(); success: current_apptype = eApplicationType; @@ -217,14 +217,15 @@ VR_INTERFACE uint32_t VR_CALLTYPE VR_InitInternal2(EVRInitError * peError, EVRAp *peError = VRInitError_None; // TODO seperate this from the rest of dllmain - BackendManager::Create(DrvOculus::CreateOculusBackend()); + // BackendManager::Create(DrvOculus::CreateOculusBackend()); // DriverManager::Instance().Register(DrvOculus::CreateOculusDriver()); return current_init_token; } VR_INTERFACE bool VR_CALLTYPE VR_IsHmdPresent() { - return ovr::IsAvailable(); + return true; + // return ovr::IsAvailable(); } VR_INTERFACE bool VR_CALLTYPE VR_IsInterfaceVersionValid(const char * pchInterfaceVersion) { @@ -247,8 +248,8 @@ VR_INTERFACE void VR_CALLTYPE VR_ShutdownInternal() { interfaces.clear(); // Shut down LibOVR - if(running_ovr) - ovr::Shutdown(); + /* if(running_ovr) + ovr::Shutdown(); */ running = false; } @@ -331,7 +332,7 @@ void init_audio() { // This switches over to the audio device returned by LibOVR, which supports // stuff like audio mirroring. This can only be called after LibOVR is initialised, // and thus will work on some games and not on others. -void setup_audio() { +/* void setup_audio() { if (!oovr_global_configuration.EnableAudio()) return; @@ -339,4 +340,4 @@ void setup_audio() { ovrResult r = ovr_GetAudioDeviceOutGuidStr(deviceOutStrBuffer); if (r == ovrSuccess) set_app_default_audio_device(deviceOutStrBuffer); -} +} */ diff --git a/OpenOVR/API/OCBaseSystem.cpp b/OpenOVR/API/OCBaseSystem.cpp index 2659b8f..367854a 100644 --- a/OpenOVR/API/OCBaseSystem.cpp +++ b/OpenOVR/API/OCBaseSystem.cpp @@ -1,14 +1,15 @@ #include "stdafx.h" #include "OCBaseSystem.h" -#include "libovr_wrapper.h" -#include "OVR_CAPI.h" +// #include "libovr_wrapper.h" +// #include "OVR_CAPI.h" #include "ISystem_001.h" using EVRExtendedButtonId = ocapi::IVROCSystem_001::EVRExtendedButtonId; uint64_t OCBaseSystem::GetExtendedButtonStatus() { - uint64_t val = 0; + return 0; + /* uint64_t val = 0; ovrInputState inputState; ovrResult result = ovr_GetInputState(*ovr::session, ovrControllerType_Touch, &inputState); @@ -23,5 +24,5 @@ uint64_t OCBaseSystem::GetExtendedButtonStatus() { val |= vr::ButtonMaskFromId((vr::EVRButtonId) EVRExtendedButtonId::k_EButton_OVRMenu); } - return val; + return val; */ } diff --git a/OpenOVR/BaseCommon.h b/OpenOVR/BaseCommon.h index 1b712be..0f9e774 100644 --- a/OpenOVR/BaseCommon.h +++ b/OpenOVR/BaseCommon.h @@ -1,5 +1,7 @@ #pragma once #include "OpenVR/interfaces/vrtypes.h" +#include +#include class CVRCommon { public: diff --git a/OpenOVR/Compositor/compositor.h b/OpenOVR/Compositor/compositor.h index ce3b06f..13c44fb 100644 --- a/OpenOVR/Compositor/compositor.h +++ b/OpenOVR/Compositor/compositor.h @@ -7,7 +7,7 @@ #include #include -#include +// #include #include #include diff --git a/OpenOVR/Drivers/Backend.h b/OpenOVR/Drivers/Backend.h index f78dcae..ede85ca 100644 --- a/OpenOVR/Drivers/Backend.h +++ b/OpenOVR/Drivers/Backend.h @@ -4,7 +4,46 @@ #include "../OpenOVR/custom_types.h" // TODO move this into the OpenVR tree // for OOVR_Compositor_FrameTiming -#include "../OpenOVR/Reimpl/BaseCompositor.h" +// #include "../OpenOVR/Reimpl/BaseCompositor.h" + +struct OOVR_Compositor_FrameTiming { + uint32_t m_nSize; // Set to sizeof( Compositor_FrameTiming ) + uint32_t m_nFrameIndex; + uint32_t m_nNumFramePresents; // number of times this frame was presented + uint32_t m_nNumMisPresented; // number of times this frame was presented on a vsync other than it was originally predicted to + uint32_t m_nNumDroppedFrames; // number of additional times previous frame was scanned out + uint32_t m_nReprojectionFlags; + + /** Absolute time reference for comparing frames. This aligns with the vsync that running start is relative to. */ + double m_flSystemTimeInSeconds; + + /** These times may include work from other processes due to OS scheduling. + * The fewer packets of work these are broken up into, the less likely this will happen. + * GPU work can be broken up by calling Flush. This can sometimes be useful to get the GPU started + * processing that work earlier in the frame. */ + float m_flPreSubmitGpuMs; // time spent rendering the scene (gpu work submitted between WaitGetPoses and second Submit) + float m_flPostSubmitGpuMs; // additional time spent rendering by application (e.g. companion window) + float m_flTotalRenderGpuMs; // time between work submitted immediately after present (ideally vsync) until the end of compositor submitted work + float m_flCompositorRenderGpuMs; // time spend performing distortion correction, rendering chaperone, overlays, etc. + float m_flCompositorRenderCpuMs; // time spent on cpu submitting the above work for this frame + float m_flCompositorIdleCpuMs; // time spent waiting for running start (application could have used this much more time) + + /** Miscellaneous measured intervals. */ + float m_flClientFrameIntervalMs; // time between calls to WaitGetPoses + float m_flPresentCallCpuMs; // time blocked on call to present (usually 0.0, but can go long) + float m_flWaitForPresentCpuMs; // time spent spin-waiting for frame index to change (not near-zero indicates wait object failure) + float m_flSubmitFrameMs; // time spent in IVRCompositor::Submit (not near-zero indicates driver issue) + + /** The following are all relative to this frame's SystemTimeInSeconds */ + float m_flWaitGetPosesCalledMs; + float m_flNewPosesReadyMs; + float m_flNewFrameReadyMs; // second call to IVRCompositor::Submit + float m_flCompositorUpdateStartMs; + float m_flCompositorUpdateEndMs; + float m_flCompositorRenderStartMs; + + vr::TrackedDevicePose_t m_HmdPose; // pose used by app to render this frame +}; enum ETrackingStateType { /** diff --git a/OpenOVR/Misc/Haptics.cpp b/OpenOVR/Misc/Haptics.cpp index 1b96b47..da3afe7 100644 --- a/OpenOVR/Misc/Haptics.cpp +++ b/OpenOVR/Misc/Haptics.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" #include "Haptics.h" -#include "libovr_wrapper.h" +// #include "libovr_wrapper.h" #include #include #include diff --git a/OpenOVR/Misc/Haptics.h b/OpenOVR/Misc/Haptics.h index 3db8840..8cae47d 100644 --- a/OpenOVR/Misc/Haptics.h +++ b/OpenOVR/Misc/Haptics.h @@ -1,5 +1,5 @@ #pragma once -#include +// #include class Haptics { public: diff --git a/OpenOVR/Misc/Keyboard/VRKeyboard.h b/OpenOVR/Misc/Keyboard/VRKeyboard.h index 29f5eb6..b1b20f0 100644 --- a/OpenOVR/Misc/Keyboard/VRKeyboard.h +++ b/OpenOVR/Misc/Keyboard/VRKeyboard.h @@ -1,5 +1,5 @@ #pragma once -#include "OVR_CAPI.h" +// #include "OVR_CAPI.h" #include diff --git a/OpenOVR/Reimpl/BaseChaperone.cpp b/OpenOVR/Reimpl/BaseChaperone.cpp index 6843cc6..a8f78ff 100644 --- a/OpenOVR/Reimpl/BaseChaperone.cpp +++ b/OpenOVR/Reimpl/BaseChaperone.cpp @@ -2,7 +2,7 @@ #define BASE_IMPL #include "BaseChaperone.h" -#include "Drivers/Backend.h" +// #include "Drivers/Backend.h" #include @@ -58,14 +58,17 @@ void BaseChaperone::GetBoundsColor(HmdColor_t *pOutputColorArray, int nNumOutput STUBBED(); } bool BaseChaperone::AreBoundsVisible() { - return BackendManager::Instance().AreBoundsVisible(); + STUBBED(); + // return BackendManager::Instance().AreBoundsVisible(); } void BaseChaperone::ForceBoundsVisible(bool bForce) { - return BackendManager::Instance().ForceBoundsVisible(bForce); + STUBBED(); + // return BackendManager::Instance().ForceBoundsVisible(bForce); } bool BaseChaperone::GetMinMaxPoints(vr::HmdVector3_t &minPoint, vr::HmdVector3_t &maxPoint) { - int count; + STUBBED(); + /* int count; bool success = BackendManager::Instance().GetPlayAreaPoints(nullptr, &count); if(!success) @@ -90,5 +93,5 @@ bool BaseChaperone::GetMinMaxPoints(vr::HmdVector3_t &minPoint, vr::HmdVector3_t } } - return true; + return true; */ } diff --git a/OpenOVR/Reimpl/BaseChaperoneSetup.cpp b/OpenOVR/Reimpl/BaseChaperoneSetup.cpp index e1b040c..23d429b 100644 --- a/OpenOVR/Reimpl/BaseChaperoneSetup.cpp +++ b/OpenOVR/Reimpl/BaseChaperoneSetup.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" #define BASE_IMPL #include "BaseChaperoneSetup.h" -#include "libovr_wrapper.h" +// #include "libovr_wrapper.h" #include @@ -24,7 +24,8 @@ bool BaseChaperoneSetup::GetWorkingCollisionBoundsInfo(VR_OUT_ARRAY_COUNT(punQua STUBBED(); } bool BaseChaperoneSetup::GetLiveCollisionBoundsInfo(VR_OUT_ARRAY_COUNT(punQuadsCount) HmdQuad_t *pQuadsBuffer, uint32_t* punQuadsCount) { - // TODO better find out what this method does + STUBBED(); // XXX + /* // TODO better find out what this method does ovrVector3f points[4]; int pointsCount; @@ -51,7 +52,7 @@ bool BaseChaperoneSetup::GetLiveCollisionBoundsInfo(VR_OUT_ARRAY_COUNT(punQuadsC if (punQuadsCount) *punQuadsCount = 1; - return true; + return true; */ } bool BaseChaperoneSetup::GetWorkingSeatedZeroPoseToRawTrackingPose(HmdMatrix34_t *pmatSeatedZeroPoseToRawTrackingPose) { STUBBED(); diff --git a/OpenOVR/Reimpl/BaseCompositor.cpp b/OpenOVR/Reimpl/BaseCompositor.cpp index 62a1c82..25516b4 100644 --- a/OpenOVR/Reimpl/BaseCompositor.cpp +++ b/OpenOVR/Reimpl/BaseCompositor.cpp @@ -3,14 +3,14 @@ #include "Misc/Config.h" -#include "OVR_CAPI.h" -#include "libovr_wrapper.h" -#include "convert.h" +// #include "OVR_CAPI.h" +// #include "libovr_wrapper.h" +// #include "convert.h" -#include "Extras/OVR_Math.h" -using namespace OVR; +// #include "Extras/OVR_Math.h" +// using namespace OVR; -using namespace std; +// using namespace std; #include "BaseCompositor.h" #include "BaseOverlay.h" @@ -21,14 +21,14 @@ using namespace std; // Need the LibOVR Vulkan headers for the GetVulkan[Device|Instance]ExtensionsRequired methods #if defined(SUPPORT_VK) -#include "OVR_CAPI_Vk.h" +// #include "OVR_CAPI_Vk.h" #endif #if defined(SUPPORT_DX) -#include "OVR_CAPI_D3D.h" +// #include "OVR_CAPI_D3D.h" #endif #include "Misc/ScopeGuard.h" -#include "Drivers/Backend.h" +// #include "Drivers/Backend.h" using namespace vr; using namespace IVRCompositor_022; @@ -44,40 +44,45 @@ BaseCompositor::~BaseCompositor() { } void BaseCompositor::SetTrackingSpace(ETrackingUniverseOrigin eOrigin) { - ovrTrackingOrigin origin = ovrTrackingOrigin_FloorLevel; + STUBBED(); + /* ovrTrackingOrigin origin = ovrTrackingOrigin_FloorLevel; if (eOrigin == TrackingUniverseSeated) { origin = ovrTrackingOrigin_EyeLevel; } - OOVR_FAILED_OVR_ABORT(ovr_SetTrackingOriginType(SESS, origin)); + OOVR_FAILED_OVR_ABORT(ovr_SetTrackingOriginType(SESS, origin)); */ } ETrackingUniverseOrigin BaseCompositor::GetTrackingSpace() { - if (ovr_GetTrackingOriginType(SESS) == ovrTrackingOrigin_EyeLevel) { + STUBBED(); + /* if (ovr_GetTrackingOriginType(SESS) == ovrTrackingOrigin_EyeLevel) { return TrackingUniverseSeated; } else { return TrackingUniverseStanding; - } + } */ } ovr_enum_t BaseCompositor::WaitGetPoses(TrackedDevicePose_t * renderPoseArray, uint32_t renderPoseArrayCount, TrackedDevicePose_t * gamePoseArray, uint32_t gamePoseArrayCount) { - // Assume this method isn't being called between frames, b/c it really shouldn't be. + STUBBED(); + + /* // Assume this method isn't being called between frames, b/c it really shouldn't be. leftEyeSubmitted = false; rightEyeSubmitted = false; BackendManager::Instance().WaitForTrackingData(); - return GetLastPoses(renderPoseArray, renderPoseArrayCount, gamePoseArray, gamePoseArrayCount); + return GetLastPoses(renderPoseArray, renderPoseArrayCount, gamePoseArray, gamePoseArrayCount); */ } void BaseCompositor::GetSinglePoseRendering(ETrackingUniverseOrigin origin, TrackedDeviceIndex_t unDeviceIndex, TrackedDevicePose_t * pOutputPose) { - BackendManager::Instance().GetSinglePose(origin, unDeviceIndex, pOutputPose, ETrackingStateType::TrackingStateType_Rendering); + STUBBED(); + // BackendManager::Instance().GetSinglePose(origin, unDeviceIndex, pOutputPose, ETrackingStateType::TrackingStateType_Rendering); } -Matrix4f BaseCompositor::GetHandTransform() { +/* Matrix4f BaseCompositor::GetHandTransform() { float deg_to_rad = math_pi / 180; // The angle offset between the Touch and Vive controllers. @@ -99,7 +104,7 @@ Matrix4f BaseCompositor::GetHandTransform() { transform.SetTranslation(Vector3f(0.0f, 0.0353f, -0.0451f)); return transform; -} +} */ ovr_enum_t BaseCompositor::GetLastPoses(TrackedDevicePose_t * renderPoseArray, uint32_t renderPoseArrayCount, TrackedDevicePose_t * gamePoseArray, uint32_t gamePoseArrayCount) { @@ -150,9 +155,9 @@ ovr_enum_t BaseCompositor::GetLastPoseForTrackedDeviceIndex(TrackedDeviceIndex_t return VRCompositorError_None; } -DX11Compositor *BaseCompositor::dxcomp; +// DX11Compositor *BaseCompositor::dxcomp; -Compositor* BaseCompositor::CreateCompositorAPI(const vr::Texture_t* texture, const OVR::Sizei& fovTextureSize) +/* Compositor* BaseCompositor::CreateCompositorAPI(const vr::Texture_t* texture, const OVR::Sizei& fovTextureSize) { Compositor* comp = nullptr; @@ -197,10 +202,11 @@ Compositor* BaseCompositor::CreateCompositorAPI(const vr::Texture_t* texture, co } return comp; -} +} */ ovr_enum_t BaseCompositor::Submit(EVREye eye, const Texture_t * texture, const VRTextureBounds_t * bounds, EVRSubmitFlags submitFlags) { - bool isFirstEye = !leftEyeSubmitted && !rightEyeSubmitted; + STUBBED(); + /* bool isFirstEye = !leftEyeSubmitted && !rightEyeSubmitted; bool eyeState = false; if (eye == Eye_Left) @@ -237,7 +243,7 @@ ovr_enum_t BaseCompositor::Submit(EVREye eye, const Texture_t * texture, const V leftEyeSubmitted = false; rightEyeSubmitted = false; - } + } */ return VRCompositorError_None; } @@ -261,7 +267,9 @@ void BaseCompositor::PostPresentHandoff() { } bool BaseCompositor::GetFrameTiming(OOVR_Compositor_FrameTiming * pTiming, uint32_t unFramesAgo) { - return BackendManager::Instance().GetFrameTiming(pTiming, unFramesAgo); + STUBBED(); + return false; + // return BackendManager::Instance().GetFrameTiming(pTiming, unFramesAgo); } uint32_t BaseCompositor::GetFrameTimings(OOVR_Compositor_FrameTiming * pTiming, uint32_t nFrames) { @@ -305,11 +313,14 @@ float BaseCompositor::GetCurrentGridAlpha() { } ovr_enum_t BaseCompositor::SetSkyboxOverride(const Texture_t * pTextures, uint32_t unTextureCount) { - return BackendManager::Instance().SetSkyboxOverride(pTextures, unTextureCount); + STUBBED(); + return VRCompositorError_None; + // return BackendManager::Instance().SetSkyboxOverride(pTextures, unTextureCount); } void BaseCompositor::ClearSkyboxOverride() { - BackendManager::Instance().ClearSkyboxOverride(); + STUBBED(); + // BackendManager::Instance().ClearSkyboxOverride(); } void BaseCompositor::CompositorBringToFront() { @@ -378,7 +389,9 @@ void BaseCompositor::SuspendRendering(bool bSuspend) { #if defined(SUPPORT_DX) ovr_enum_t BaseCompositor::GetMirrorTextureD3D11(EVREye eEye, void * pD3D11DeviceOrResource, void ** ppD3D11ShaderResourceView) { - return BackendManager::Instance().GetMirrorTextureD3D11(eEye, pD3D11DeviceOrResource, ppD3D11ShaderResourceView); + STUBBED(); + return VRCompositorError_None; + // return BackendManager::Instance().GetMirrorTextureD3D11(eEye, pD3D11DeviceOrResource, ppD3D11ShaderResourceView); } #else ovr_enum_t BaseCompositor::GetMirrorTextureD3D11(EVREye eEye, void * pD3D11DeviceOrResource, void ** ppD3D11ShaderResourceView) { @@ -387,7 +400,8 @@ ovr_enum_t BaseCompositor::GetMirrorTextureD3D11(EVREye eEye, void * pD3D11Devic #endif void BaseCompositor::ReleaseMirrorTextureD3D11(void * pD3D11ShaderResourceView) { - return BackendManager::Instance().ReleaseMirrorTextureD3D11(pD3D11ShaderResourceView); + STUBBED(); + // return BackendManager::Instance().ReleaseMirrorTextureD3D11(pD3D11ShaderResourceView); } ovr_enum_t BaseCompositor::GetMirrorTextureGL(EVREye eEye, glUInt_t * pglTextureId, glSharedTextureHandle_t * pglSharedTextureHandle) { @@ -409,7 +423,7 @@ void BaseCompositor::UnlockGLSharedTextureForAccess(glSharedTextureHandle_t glSh uint32_t BaseCompositor::GetVulkanInstanceExtensionsRequired(VR_OUT_STRING() char * pchValue, uint32_t unBufferSize) { #if defined(SUPPORT_VK) // Whaddya know, the Oculus and Valve methods work almost identically... - OOVR_FAILED_OVR_ABORT(ovr_GetInstanceExtensionsVk(*ovr::luid, pchValue, &unBufferSize)); + // OOVR_FAILED_OVR_ABORT(ovr_GetInstanceExtensionsVk(*ovr::luid, pchValue, &unBufferSize)); return unBufferSize; #else STUBBED(); @@ -419,7 +433,7 @@ uint32_t BaseCompositor::GetVulkanInstanceExtensionsRequired(VR_OUT_STRING() cha uint32_t BaseCompositor::GetVulkanDeviceExtensionsRequired(VkPhysicalDevice_T * pPhysicalDevice, char * pchValue, uint32_t unBufferSize) { #if defined(SUPPORT_VK) // Use the default LUID, even if another physical device is passed in. TODO. - OOVR_FAILED_OVR_ABORT(ovr_GetDeviceExtensionsVk(*ovr::luid, pchValue, &unBufferSize)); + // OOVR_FAILED_OVR_ABORT(ovr_GetDeviceExtensionsVk(*ovr::luid, pchValue, &unBufferSize)); return unBufferSize; #else STUBBED(); diff --git a/OpenOVR/Reimpl/BaseCompositor.h b/OpenOVR/Reimpl/BaseCompositor.h index 319708a..d64435b 100644 --- a/OpenOVR/Reimpl/BaseCompositor.h +++ b/OpenOVR/Reimpl/BaseCompositor.h @@ -2,14 +2,14 @@ #include "../BaseCommon.h" // TODO don't import from OCOVR, and remove the "../" #include "OpenVR/interfaces/IVRCompositor_022.h" -#include "Extras/OVR_Math.h" +// #include "Extras/OVR_Math.h" -#include "../Compositor/compositor.h" // TODO don't import from OCOVR, and remove the "../" +// #include "../Compositor/compositor.h" // TODO don't import from OCOVR, and remove the "../" #include #ifdef SUPPORT_DX -#include "OVR_CAPI_D3D.h" +// #include "OVR_CAPI_D3D.h" // Let's really hope noone tries to use DX10 #include "d3d11.h" #include "d3d12.h" @@ -110,13 +110,13 @@ class BaseCompositor { // Used in CVRSystem void GetSinglePoseRendering(vr::ETrackingUniverseOrigin origin, vr::TrackedDeviceIndex_t index, vr::TrackedDevicePose_t* pose); - static OVR::Matrix4f GetHandTransform(); + // static OVR::Matrix4f GetHandTransform(); /** Creates API specific Compositor */ - static Compositor* CreateCompositorAPI(const vr::Texture_t* texture, const OVR::Sizei& fovTextureSize); + // static Compositor* CreateCompositorAPI(const vr::Texture_t* texture, const OVR::Sizei& fovTextureSize); // TODO clean this up, and make the keyboard work with OpenGL and Vulkan too - static DX11Compositor *dxcomp; + // static DX11Compositor *dxcomp; public: // OpenVR interface methods from here on: diff --git a/OpenOVR/Reimpl/BaseExtendedDisplay.cpp b/OpenOVR/Reimpl/BaseExtendedDisplay.cpp index 4102bf7..b236898 100644 --- a/OpenOVR/Reimpl/BaseExtendedDisplay.cpp +++ b/OpenOVR/Reimpl/BaseExtendedDisplay.cpp @@ -2,13 +2,14 @@ #define BASE_IMPL #include "BaseExtendedDisplay.h" -#include "libovr_wrapper.h" -#include "OVR_CAPI.h" +// #include "libovr_wrapper.h" +// #include "OVR_CAPI.h" #include // Unreal Engine uses this for some silly reason void BaseExtendedDisplay::GetWindowBounds(int32_t * pnX, int32_t * pnY, uint32_t * pnWidth, uint32_t * pnHeight) { - ovrSizei size = ovr_GetFovTextureSize( + STUBBED(); + /* ovrSizei size = ovr_GetFovTextureSize( *ovr::session, ovrEye_Left, // Resolutions are done per-eye in LibOVR, no particular reason for left eye ovr::hmdDesc.DefaultEyeFov[ovrEye_Left], @@ -19,7 +20,7 @@ void BaseExtendedDisplay::GetWindowBounds(int32_t * pnX, int32_t * pnY, uint32_t *pnX = 0; *pnY = 0; *pnWidth = size.w * 2; - *pnHeight = size.h; + *pnHeight = size.h; */ } void BaseExtendedDisplay::GetEyeOutputViewport(vr::EVREye eEye, uint32_t * pnX, uint32_t * pnY, uint32_t * pnWidth, uint32_t * pnHeight) { diff --git a/OpenOVR/Reimpl/BaseOverlay.cpp b/OpenOVR/Reimpl/BaseOverlay.cpp index 3113150..3475769 100644 --- a/OpenOVR/Reimpl/BaseOverlay.cpp +++ b/OpenOVR/Reimpl/BaseOverlay.cpp @@ -2,19 +2,19 @@ #define BASE_IMPL #include "BaseOverlay.h" #include "BaseSystem.h" -#include "OVR_CAPI.h" +// #include "OVR_CAPI.h" #include -#include "Compositor/compositor.h" -#include "libovr_wrapper.h" -#include "convert.h" +// #include "Compositor/compositor.h" +// #include "libovr_wrapper.h" +// #include "convert.h" #include "BaseCompositor.h" #include "static_bases.gen.h" #include "Misc/Config.h" #include "Misc/ScopeGuard.h" using namespace std; -using Vec3 = OVR::Vector3f; -using Mat4 = OVR::Matrix4f; +// using Vec3 = OVR::Vector3f; +// using Mat4 = OVR::Matrix4f; // Class to represent an overlay class BaseOverlay::OverlayData { @@ -38,8 +38,8 @@ class BaseOverlay::OverlayData { // Rendering Texture_t texture = {}; - ovrLayerQuad layerQuad = {}; - std::unique_ptr compositor; + // ovrLayerQuad layerQuad = {}; + // std::unique_ptr compositor; // Transform VROverlayTransformType transformType = VROverlayTransform_Absolute; @@ -77,7 +77,7 @@ BaseOverlay::~BaseOverlay() { } } -int BaseOverlay::_BuildLayers(ovrLayerHeader_ * sceneLayer, ovrLayerHeader_ const* const*& layers) { +/* int BaseOverlay::_BuildLayers(ovrLayerHeader_ * sceneLayer, ovrLayerHeader_ const* const*& layers) { // Note that at least on MSVC, this shouldn't be doing any memory allocations // unless the list is expanding from new layers. layerHeaders.clear(); @@ -151,17 +151,19 @@ int BaseOverlay::_BuildLayers(ovrLayerHeader_ * sceneLayer, ovrLayerHeader_ cons usingInput = checkUsingInput; layers = layerHeaders.data(); return static_cast(layerHeaders.size()); -} +} */ bool BaseOverlay::_HandleOverlayInput(EVREye side, TrackedDeviceIndex_t index, VRControllerState_t state) { - if (!usingInput) + STUBBED(); + return false; + /* if (!usingInput) return true; if (!keyboard) return true; keyboard->HandleOverlayInput(side, state, (float)ovr_GetTimeInSeconds()); - return false; + return false; */ } EVROverlayError BaseOverlay::FindOverlay(const char *pchOverlayKey, VROverlayHandle_t * pOverlayHandle) { @@ -174,7 +176,8 @@ EVROverlayError BaseOverlay::FindOverlay(const char *pchOverlayKey, VROverlayHan return VROverlayError_InvalidParameter; } EVROverlayError BaseOverlay::CreateOverlay(const char *pchOverlayKey, const char *pchOverlayName, VROverlayHandle_t * pOverlayHandle) { - if (overlays.count(pchOverlayKey)) { + STUBBED(); + /* if (overlays.count(pchOverlayKey)) { return VROverlayError_KeyInUse; } @@ -202,7 +205,7 @@ EVROverlayError BaseOverlay::CreateOverlay(const char *pchOverlayKey, const char // Contents texture starts at 0,0 - this is not overridden data->layerQuad.Viewport.Pos.x = 0; - data->layerQuad.Viewport.Pos.y = 0; + data->layerQuad.Viewport.Pos.y = 0; */ return VROverlayError_None; } @@ -477,14 +480,15 @@ EVROverlayError BaseOverlay::GetOverlayTransformType(VROverlayHandle_t ulOverlay *peTransformType = overlay->transformType; } EVROverlayError BaseOverlay::SetOverlayTransformAbsolute(VROverlayHandle_t ulOverlayHandle, ETrackingUniverseOrigin eTrackingOrigin, const HmdMatrix34_t *pmatTrackingOriginToOverlayTransform) { - USEH(); + STUBBED(); + /* USEH(); // TODO account for the universe origin, and if it doesn't match that currently in use then add or // subtract the floor position to match it. This shouldn't usually be an issue though, as I can't // imagine many apps will use a different origin for their overlays. overlay->transformType = VROverlayTransform_Absolute; - overlay->layerQuad.QuadPoseCenter = S2O_om34_pose(*pmatTrackingOriginToOverlayTransform); + overlay->layerQuad.QuadPoseCenter = S2O_om34_pose(*pmatTrackingOriginToOverlayTransform); */ return VROverlayError_None; } @@ -607,7 +611,8 @@ EVROverlayError BaseOverlay::GetOverlayDualAnalogTransform(VROverlayHandle_t ulO STUBBED(); } EVROverlayError BaseOverlay::SetOverlayTexture(VROverlayHandle_t ulOverlayHandle, const Texture_t *pTexture) { - USEH(); + STUBBED(); + /* USEH(); overlay->texture = *pTexture; if (!oovr_global_configuration.EnableLayers()) @@ -628,15 +633,16 @@ EVROverlayError BaseOverlay::SetOverlayTexture(VROverlayHandle_t ulOverlayHandle overlay->layerQuad.Viewport.Size = overlay->compositor->GetSrcSize(); overlay->layerQuad.ColorTexture = overlay->compositor->GetSwapChain(); - OOVR_FAILED_OVR_ABORT(ovr_CommitTextureSwapChain(*ovr::session, overlay->layerQuad.ColorTexture)); + OOVR_FAILED_OVR_ABORT(ovr_CommitTextureSwapChain(*ovr::session, overlay->layerQuad.ColorTexture)); */ return VROverlayError_None; } EVROverlayError BaseOverlay::ClearOverlayTexture(VROverlayHandle_t ulOverlayHandle) { - USEH(); + STUBBED(); + /* USEH(); overlay->texture = {}; - overlay->compositor.reset(); + overlay->compositor.reset(); */ return VROverlayError_None; } EVROverlayError BaseOverlay::SetOverlayRaw(VROverlayHandle_t ulOverlayHandle, void *pvBuffer, uint32_t unWidth, uint32_t unHeight, uint32_t unDepth) { @@ -677,7 +683,7 @@ void BaseOverlay::ShowDashboard(const char *pchOverlayToShow) { TrackedDeviceIndex_t BaseOverlay::GetPrimaryDashboardDevice() { STUBBED(); } -EVROverlayError BaseOverlay::ShowKeyboardWithDispatch(EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, +/* EVROverlayError BaseOverlay::ShowKeyboardWithDispatch(EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char * pchDescription, uint32_t unCharMax, const char * pchExistingText, bool bUseMinimalMode, uint64_t uUserValue, VRKeyboard::eventDispatch_t eventDispatch) { @@ -699,34 +705,38 @@ EVROverlayError BaseOverlay::ShowKeyboardWithDispatch(EGamepadTextInputMode eInp } return VROverlayError_None; -} +} */ EVROverlayError BaseOverlay::ShowKeyboard(EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char *pchDescription, uint32_t unCharMax, const char *pchExistingText, bool bUseMinimalMode, uint64_t uUserValue) { - - VRKeyboard::eventDispatch_t dispatch = [](VREvent_t ev) { + STUBBED(); + return VROverlayError_None; + /* VRKeyboard::eventDispatch_t dispatch = [](VREvent_t ev) { BaseSystem *sys = GetUnsafeBaseSystem(); if (sys) { sys->_EnqueueEvent(ev); } }; - return ShowKeyboardWithDispatch(eInputMode, eLineInputMode, pchDescription, unCharMax, pchExistingText, bUseMinimalMode, uUserValue, dispatch); + return ShowKeyboardWithDispatch(eInputMode, eLineInputMode, pchDescription, unCharMax, pchExistingText, bUseMinimalMode, uUserValue, dispatch); */ } EVROverlayError BaseOverlay::ShowKeyboardForOverlay(VROverlayHandle_t ulOverlayHandle, EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char *pchDescription, uint32_t unCharMax, const char *pchExistingText, bool bUseMinimalMode, uint64_t uUserValue) { - - USEH(); + STUBBED(); + return VROverlayError_None; + /* USEH(); VRKeyboard::eventDispatch_t dispatch = [overlay](VREvent_t ev) { overlay->eventQueue.push(ev); }; - return ShowKeyboardWithDispatch(eInputMode, eLineInputMode, pchDescription, unCharMax, pchExistingText, bUseMinimalMode, uUserValue, dispatch); + return ShowKeyboardWithDispatch(eInputMode, eLineInputMode, pchDescription, unCharMax, pchExistingText, bUseMinimalMode, uUserValue, dispatch); */ } uint32_t BaseOverlay::GetKeyboardText(char *pchText, uint32_t cchText) { - string str = keyboard ? VRKeyboard::CHAR_CONV.to_bytes(keyboard->contents()) : keyboardCache; + STUBBED(); + return 0; + /* string str = keyboard ? VRKeyboard::CHAR_CONV.to_bytes(keyboard->contents()) : keyboardCache; // FFS, strncpy is secure. strncpy_s(pchText, cchText, str.c_str(), cchText); @@ -735,10 +745,11 @@ uint32_t BaseOverlay::GetKeyboardText(char *pchText, uint32_t cchText) { pchText[cchText - 1] = 0; // TODO is this supposed to return the length of the string including or excluding the cchText limit? - return (uint32_t)strlen(pchText); + return (uint32_t)strlen(pchText); */ } void BaseOverlay::HideKeyboard() { - // First, if the keyboard is currently open, cache it's contents + STUBBED(); + /* // First, if the keyboard is currently open, cache it's contents if (keyboard) { keyboardCache = VRKeyboard::CHAR_CONV.to_bytes(keyboard->contents()); } @@ -749,10 +760,11 @@ void BaseOverlay::HideKeyboard() { BaseSystem *system = GetUnsafeBaseSystem(); if (system) { system->_BlockInputsUntilReleased(); - } + } */ } void BaseOverlay::SetKeyboardTransformAbsolute(ETrackingUniverseOrigin eTrackingOrigin, const HmdMatrix34_t *pmatTrackingOriginToKeyboardTransform) { - if (!keyboard) + STUBBED(); + /* if (!keyboard) OOVR_ABORT("Cannot set keyboard position when the keyboard is closed!"); BaseCompositor *compositor = GetUnsafeBaseCompositor(); @@ -760,7 +772,7 @@ void BaseOverlay::SetKeyboardTransformAbsolute(ETrackingUniverseOrigin eTracking OOVR_ABORTF("Origin mismatch - current %d, requested %d", compositor->GetTrackingSpace(), eTrackingOrigin); } - keyboard->SetTransform(*pmatTrackingOriginToKeyboardTransform); + keyboard->SetTransform(*pmatTrackingOriginToKeyboardTransform); */ } void BaseOverlay::SetKeyboardPositionForOverlay(VROverlayHandle_t ulOverlayHandle, HmdRect2_t avoidRect) { STUBBED(); diff --git a/OpenOVR/Reimpl/BaseOverlay.h b/OpenOVR/Reimpl/BaseOverlay.h index 92e6eed..78d25c8 100644 --- a/OpenOVR/Reimpl/BaseOverlay.h +++ b/OpenOVR/Reimpl/BaseOverlay.h @@ -1,6 +1,6 @@ #pragma once #include "../BaseCommon.h" // TODO don't import from OCOVR, and remove the "../" -#include "../Misc/Keyboard/VRKeyboard.h" // TODO don't import from OCOVR, and remove the "../" +// #include "../Misc/Keyboard/VRKeyboard.h" // TODO don't import from OCOVR, and remove the "../" #include #include #include @@ -166,7 +166,7 @@ class BaseOverlay { std::vector layerHeaders; // Virtual Keyboard - std::unique_ptr keyboard; + // std::unique_ptr keyboard; // Cached copy of the keyboard contents, available after it is closed std::string keyboardCache; @@ -174,18 +174,18 @@ class BaseOverlay { // True if we're modifying the input in any way bool usingInput; - virtual EVROverlayError ShowKeyboardWithDispatch( + /* virtual EVROverlayError ShowKeyboardWithDispatch( EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char *pchDescription, uint32_t unCharMax, const char *pchExistingText, bool bUseMinimalMode, uint64_t uUserValue, - VRKeyboard::eventDispatch_t eventDispatch); + VRKeyboard::eventDispatch_t eventDispatch); */ public: // Destructor, since we have a map of pointers ~BaseOverlay(); // Builds the collection of layers to be submitted to LibOVR - int _BuildLayers(ovrLayerHeader_ *sceneLayer, ovrLayerHeader_ const* const*& result); + // int _BuildLayers(ovrLayerHeader_ *sceneLayer, ovrLayerHeader_ const* const*& result); // If an overlay needs input, this grabs the input and returns whether the input should preceed to the application bool _HandleOverlayInput(vr::EVREye role, vr::TrackedDeviceIndex_t controllerDeviceIndex, vr::VRControllerState_t state); diff --git a/OpenOVR/Reimpl/BaseRenderModels.cpp b/OpenOVR/Reimpl/BaseRenderModels.cpp index beea4fa..46cd84d 100644 --- a/OpenOVR/Reimpl/BaseRenderModels.cpp +++ b/OpenOVR/Reimpl/BaseRenderModels.cpp @@ -2,7 +2,7 @@ #define BASE_IMPL #include "BaseRenderModels.h" #include "resources.h" -#include "convert.h" +// #include "convert.h" #include "Misc/Config.h" // Used for the hand offsets @@ -13,7 +13,7 @@ #include using namespace std; -using namespace OVR; +// using namespace OVR; #pragma region structs @@ -142,7 +142,8 @@ static OOVR_RenderModel_Vertex_t split_face( } EVRRenderModelError BaseRenderModels::LoadRenderModel_Async(const char * pchRenderModelName, RenderModel_t ** renderModel) { - string name = pchRenderModelName; + STUBBED(); + /* string name = pchRenderModelName; int rid; int sided; @@ -248,7 +249,7 @@ EVRRenderModelError BaseRenderModels::LoadRenderModel_Async(const char * pchRend rm.unTriangleCount = rm.unVertexCount / 3; // Texture - rm.diffuseTextureId = -1; // Disabled for now + rm.diffuseTextureId = -1; // Disabled for now */ return VRRenderModelError_None; } diff --git a/OpenOVR/Reimpl/BaseSettings.cpp b/OpenOVR/Reimpl/BaseSettings.cpp index e1b8dac..9a8e3cd 100644 --- a/OpenOVR/Reimpl/BaseSettings.cpp +++ b/OpenOVR/Reimpl/BaseSettings.cpp @@ -8,7 +8,7 @@ #include #include -#include "OVR_CAPI_Audio.h" +// #include "OVR_CAPI_Audio.h" #define STUBBED_BASIC() { \ string str = "Hit stubbed file at " __FILE__ " func " " line " + to_string(__LINE__); \ @@ -178,8 +178,8 @@ float BaseSettings::GetFloat(const char * pchSection, const char * pchSettingsK } void BaseSettings::GetString(const char * pchSection, const char * pchSettingsKey, VR_OUT_STRING() char * pchValue, uint32_t unValueLen, EVRSettingsError * peError) { - - if (peError) + STUBBED(); + /* if (peError) *peError = VRSettingsError_None; string section = pchSection; @@ -224,7 +224,7 @@ void BaseSettings::GetString(const char * pchSection, const char * pchSettingsK OOVR_ABORT("unValueLen too short!"); } - strcpy_s(pchValue, unValueLen, result.c_str()); + strcpy_s(pchValue, unValueLen, result.c_str()); */ } void BaseSettings::RemoveSection(const char * pchSection, EVRSettingsError * peError) { if (peError) diff --git a/OpenOVR/Reimpl/BaseSystem.cpp b/OpenOVR/Reimpl/BaseSystem.cpp index 7c18ded..0fbd1d2 100644 --- a/OpenOVR/Reimpl/BaseSystem.cpp +++ b/OpenOVR/Reimpl/BaseSystem.cpp @@ -1,15 +1,15 @@ #include "stdafx.h" #define BASE_IMPL #include "BaseSystem.h" -#include "OVR_CAPI.h" -#include "libovr_wrapper.h" -#include "convert.h" +// #include "OVR_CAPI.h" +// #include "libovr_wrapper.h" +// #include "convert.h" #include "BaseCompositor.h" #include "BaseOverlay.h" -#include "Misc/Haptics.h" -#include "Misc/Config.h" +// #include "Misc/Haptics.h" +// #include "Misc/Config.h" #include "static_bases.gen.h" -#include "Drivers/Backend.h" +// #include "Drivers/Backend.h" #include @@ -20,7 +20,7 @@ // Needed for GetOutputDevice if Vulkan is enabled #if defined(SUPPORT_VK) -#include "OVR_CAPI_Vk.h" +// #include "OVR_CAPI_Vk.h" #endif using namespace std; @@ -31,27 +31,33 @@ BaseSystem::BaseSystem() { } void BaseSystem::GetRecommendedRenderTargetSize(uint32_t * width, uint32_t * height) { - BackendManager::Instance().GetPrimaryHMD()->GetRecommendedRenderTargetSize(width, height); + STUBBED(); + // BackendManager::Instance().GetPrimaryHMD()->GetRecommendedRenderTargetSize(width, height); } HmdMatrix44_t BaseSystem::GetProjectionMatrix(EVREye eye, float znear, float zfar) { - return BackendManager::Instance().GetPrimaryHMD()->GetProjectionMatrix(eye, znear, zfar); + STUBBED(); + // return BackendManager::Instance().GetPrimaryHMD()->GetProjectionMatrix(eye, znear, zfar); } void BaseSystem::GetProjectionRaw(EVREye eye, float * pfLeft, float * pfRight, float * pfTop, float * pfBottom) { - return BackendManager::Instance().GetPrimaryHMD()->GetProjectionRaw(eye, pfLeft, pfRight, pfTop, pfBottom); + STUBBED(); + // return BackendManager::Instance().GetPrimaryHMD()->GetProjectionRaw(eye, pfLeft, pfRight, pfTop, pfBottom); } bool BaseSystem::ComputeDistortion(EVREye eEye, float fU, float fV, DistortionCoordinates_t * out) { - return BackendManager::Instance().GetPrimaryHMD()->ComputeDistortion(eEye, fU, fV, out); + STUBBED(); + // return BackendManager::Instance().GetPrimaryHMD()->ComputeDistortion(eEye, fU, fV, out); } HmdMatrix34_t BaseSystem::GetEyeToHeadTransform(EVREye ovr_eye) { - return BackendManager::Instance().GetPrimaryHMD()->GetEyeToHeadTransform(ovr_eye); + STUBBED(); + // return BackendManager::Instance().GetPrimaryHMD()->GetEyeToHeadTransform(ovr_eye); } bool BaseSystem::GetTimeSinceLastVsync(float * pfSecondsSinceLastVsync, uint64_t * pulFrameCounter) { - return BackendManager::Instance().GetPrimaryHMD()->GetTimeSinceLastVsync(pfSecondsSinceLastVsync, pulFrameCounter); + STUBBED(); + // return BackendManager::Instance().GetPrimaryHMD()->GetTimeSinceLastVsync(pfSecondsSinceLastVsync, pulFrameCounter); } int32_t BaseSystem::GetD3D9AdapterIndex() { @@ -59,7 +65,8 @@ int32_t BaseSystem::GetD3D9AdapterIndex() { } void BaseSystem::GetDXGIOutputInfo(int32_t * adapterIndex) { -#ifdef SUPPORT_DX + STUBBED(); +/* #ifdef SUPPORT_DX #define VALIDATE(x, msg) if (!(x)) { MessageBoxA(nullptr, (msg), "CVRSystem", MB_ICONERROR | MB_OK); exit(-1); } LUID* luid = reinterpret_cast(ovr::luid); @@ -95,12 +102,12 @@ void BaseSystem::GetDXGIOutputInfo(int32_t * adapterIndex) { #undef VALIDATE #else OOVR_ABORT("DX not supported - build with SUPPORT_DX defined"); -#endif +#endif */ } void BaseSystem::GetOutputDevice(uint64_t * pnDevice, ETextureType textureType, VkInstance_T * pInstance) { - - switch (textureType) { + STUBBED(); + /* switch (textureType) { case TextureType_Vulkan: { #if defined(SUPPORT_VK) ovrResult res = ovr_GetSessionPhysicalDeviceVk(*ovr::session, *ovr::luid, pInstance, (VkPhysicalDevice*)pnDevice); @@ -113,8 +120,7 @@ void BaseSystem::GetOutputDevice(uint64_t * pnDevice, ETextureType textureType, } default: OOVR_LOGF("Unsupported texture type for GetOutputDevice %d", textureType); - } - + } */ } bool BaseSystem::IsDisplayOnDesktop() { @@ -127,26 +133,32 @@ bool BaseSystem::SetDisplayVisibility(bool bIsVisibleOnDesktop) { void BaseSystem::GetDeviceToAbsoluteTrackingPose(ETrackingUniverseOrigin toOrigin, float predictedSecondsToPhotonsFromNow, TrackedDevicePose_t * poseArray, uint32_t poseArrayCount) { - - BackendManager::Instance().GetDeviceToAbsoluteTrackingPose(toOrigin, predictedSecondsToPhotonsFromNow, poseArray, poseArrayCount); + STUBBED(); + // BackendManager::Instance().GetDeviceToAbsoluteTrackingPose(toOrigin, predictedSecondsToPhotonsFromNow, poseArray, poseArrayCount); } HmdMatrix34_t BaseSystem::GetSeatedZeroPoseToStandingAbsoluteTrackingPose() { - // TODO can we discover the player's seated height somehow? + STUBBED(); + HmdMatrix34_t res; + return res; + /* // TODO can we discover the player's seated height somehow? // For now just add 0.5 meters OVR::Matrix4f in; in.Translation(OVR::Vector3f(0, 0.5, 0)); HmdMatrix34_t res; O2S_om34(in, res); - return res; + return res; */ } HmdMatrix34_t BaseSystem::GetRawZeroPoseToStandingAbsoluteTrackingPose() { - // These *are* the same coordinate systems + STUBBED(); + HmdMatrix34_t res; + return res; + /* // These *are* the same coordinate systems HmdMatrix34_t res; O2S_om34(OVR::Matrix4f::Identity(), res); - return res; + return res; */ } uint32_t BaseSystem::GetSortedTrackedDeviceIndicesOfClass(ETrackedDeviceClass targetClass, @@ -228,86 +240,95 @@ ETrackedDeviceClass BaseSystem::GetTrackedDeviceClass(vr::TrackedDeviceIndex_t d } bool BaseSystem::IsTrackedDeviceConnected(vr::TrackedDeviceIndex_t deviceIndex) { - return BackendManager::Instance().GetDevice(deviceIndex) != nullptr; + STUBBED(); + // return BackendManager::Instance().GetDevice(deviceIndex) != nullptr; } bool BaseSystem::GetBoolTrackedDeviceProperty(vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError * pErrorL) { - ITrackedDevice *dev = BackendManager::Instance().GetDevice(unDeviceIndex); + STUBBED(); + return false; + /* ITrackedDevice *dev = BackendManager::Instance().GetDevice(unDeviceIndex); if (!dev) { *pErrorL = TrackedProp_InvalidDevice; return false; } - return dev->GetBoolTrackedDeviceProperty(prop, pErrorL); + return dev->GetBoolTrackedDeviceProperty(prop, pErrorL); */ } float BaseSystem::GetFloatTrackedDeviceProperty(vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError * pErrorL) { - ITrackedDevice *dev = BackendManager::Instance().GetDevice(unDeviceIndex); + STUBBED(); + /* ITrackedDevice *dev = BackendManager::Instance().GetDevice(unDeviceIndex); if (!dev) { *pErrorL = TrackedProp_InvalidDevice; return 0; } - return dev->GetFloatTrackedDeviceProperty(prop, pErrorL); + return dev->GetFloatTrackedDeviceProperty(prop, pErrorL); */ } int32_t BaseSystem::GetInt32TrackedDeviceProperty(vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError * pErrorL) { - ITrackedDevice *dev = BackendManager::Instance().GetDevice(unDeviceIndex); + STUBBED(); + /* ITrackedDevice *dev = BackendManager::Instance().GetDevice(unDeviceIndex); if (!dev) { *pErrorL = TrackedProp_InvalidDevice; return 0; } - return dev->GetInt32TrackedDeviceProperty(prop, pErrorL); + return dev->GetInt32TrackedDeviceProperty(prop, pErrorL); */ } uint64_t BaseSystem::GetUint64TrackedDeviceProperty(vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError * pErrorL) { - ITrackedDevice *dev = BackendManager::Instance().GetDevice(unDeviceIndex); + STUBBED(); + /* ITrackedDevice *dev = BackendManager::Instance().GetDevice(unDeviceIndex); if (!dev) { *pErrorL = TrackedProp_InvalidDevice; return 0; } - return dev->GetUint64TrackedDeviceProperty(prop, pErrorL); + return dev->GetUint64TrackedDeviceProperty(prop, pErrorL); */ } HmdMatrix34_t BaseSystem::GetMatrix34TrackedDeviceProperty(vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError * pErrorL) { - ITrackedDevice *dev = BackendManager::Instance().GetDevice(unDeviceIndex); + STUBBED(); + /* ITrackedDevice *dev = BackendManager::Instance().GetDevice(unDeviceIndex); if (!dev) { *pErrorL = TrackedProp_InvalidDevice; return { 0 }; } - return dev->GetMatrix34TrackedDeviceProperty(prop, pErrorL); + return dev->GetMatrix34TrackedDeviceProperty(prop, pErrorL); */ } uint32_t BaseSystem::GetArrayTrackedDeviceProperty(vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, PropertyTypeTag_t propType, void * pBuffer, uint32_t unBufferSize, ETrackedPropertyError * pError) { - ITrackedDevice *dev = BackendManager::Instance().GetDevice(unDeviceIndex); + STUBBED(); + /* ITrackedDevice *dev = BackendManager::Instance().GetDevice(unDeviceIndex); if (!dev) { *pError = TrackedProp_InvalidDevice; return { 0 }; } - return dev->GetArrayTrackedDeviceProperty(prop, propType, pBuffer, unBufferSize, pError); + return dev->GetArrayTrackedDeviceProperty(prop, propType, pBuffer, unBufferSize, pError); */ } uint32_t BaseSystem::GetStringTrackedDeviceProperty(vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, VR_OUT_STRING() char * value, uint32_t bufferSize, ETrackedPropertyError * pErrorL) { - ITrackedDevice *dev = BackendManager::Instance().GetDevice(unDeviceIndex); + STUBBED(); + /* ITrackedDevice *dev = BackendManager::Instance().GetDevice(unDeviceIndex); if (!dev) { *pErrorL = TrackedProp_InvalidDevice; return 0; } - return dev->GetStringTrackedDeviceProperty(prop, value, bufferSize, pErrorL); + return dev->GetStringTrackedDeviceProperty(prop, value, bufferSize, pErrorL); */ } const char * BaseSystem::GetPropErrorNameFromEnum(ETrackedPropertyError error) { @@ -315,23 +336,32 @@ const char * BaseSystem::GetPropErrorNameFromEnum(ETrackedPropertyError error) { } bool BaseSystem::IsInputAvailable() { - return lastStatus.HasInputFocus; + STUBBED(); + return false; + // return lastStatus.HasInputFocus; } bool BaseSystem::IsSteamVRDrawingControllers() { - return !lastStatus.HasInputFocus; + STUBBED(); + return false; + // return !lastStatus.HasInputFocus; } bool BaseSystem::ShouldApplicationPause() { - return !lastStatus.HasInputFocus; + STUBBED(); + return false; + // return !lastStatus.HasInputFocus; } bool BaseSystem::ShouldApplicationReduceRenderingWork() { - return lastStatus.OverlayPresent; + STUBBED(); + return false; + // return lastStatus.OverlayPresent; } void BaseSystem::_OnPostFrame() { - ovrSessionStatus status; + STUBBED(); + /* ovrSessionStatus status; ovr_GetSessionStatus(*ovr::session, &status); if (status.ShouldQuit && !lastStatus.ShouldQuit) { @@ -364,7 +394,7 @@ void BaseSystem::_OnPostFrame() { // Note this isn't called if handle_event is called, preventing one // event from firing despite another event also being changed in the same poll call - lastStatus = status; + lastStatus = status; */ } void BaseSystem::_EnqueueEvent(const VREvent_t &e) { @@ -377,10 +407,12 @@ void BaseSystem::_BlockInputsUntilReleased() { } float BaseSystem::SGetIpd() { - ovrPosef &left = ovr::hmdToEyeViewPose[ovrEye_Left]; + STUBBED(); + return 0.62f; + /* ovrPosef &left = ovr::hmdToEyeViewPose[ovrEye_Left]; ovrPosef &right = ovr::hmdToEyeViewPose[ovrEye_Right]; - return abs(left.Position.x - right.Position.x); + return abs(left.Position.x - right.Position.x); */ } void BaseSystem::CheckControllerEvents(TrackedDeviceIndex_t hand, VRControllerState_t &last) { @@ -465,11 +497,16 @@ const char * BaseSystem::GetEventTypeNameFromEnum(EVREventType eType) { } HiddenAreaMesh_t BaseSystem::GetHiddenAreaMesh(EVREye eEye, EHiddenAreaMeshType type) { - return BackendManager::Instance().GetPrimaryHMD()->GetHiddenAreaMesh(eEye, type); + STUBBED(); + HiddenAreaMesh_t res; + return res; + // return BackendManager::Instance().GetPrimaryHMD()->GetHiddenAreaMesh(eEye, type); } bool BaseSystem::GetControllerState(vr::TrackedDeviceIndex_t controllerDeviceIndex, vr::VRControllerState_t * controllerState, uint32_t controllerStateSize) { - if (sizeof(VRControllerState_t) != controllerStateSize) + STUBBED(); + return false; + /* if (sizeof(VRControllerState_t) != controllerStateSize) OOVR_ABORT("Bad controller state size - was the host compiled with an older version of OpenVR?"); memset(controllerState, 0, controllerStateSize); @@ -524,19 +561,22 @@ bool BaseSystem::GetControllerState(vr::TrackedDeviceIndex_t controllerDeviceInd uint32_t packetNum = controllerState->unPacketNum; memset(controllerState, 0, controllerStateSize); controllerState->unPacketNum = packetNum; - return true; + return true; */ } bool BaseSystem::GetControllerStateWithPose(ETrackingUniverseOrigin eOrigin, vr::TrackedDeviceIndex_t unControllerDeviceIndex, vr::VRControllerState_t * pControllerState, uint32_t unControllerStateSize, TrackedDevicePose_t * pTrackedDevicePose) { - BackendManager::Instance().GetSinglePose(eOrigin, unControllerDeviceIndex, pTrackedDevicePose, ETrackingStateType::TrackingStateType_Now); + STUBBED(); + return false; + + /* BackendManager::Instance().GetSinglePose(eOrigin, unControllerDeviceIndex, pTrackedDevicePose, ETrackingStateType::TrackingStateType_Now); - return GetControllerState(unControllerDeviceIndex, pControllerState, unControllerStateSize); + return GetControllerState(unControllerDeviceIndex, pControllerState, unControllerStateSize); */ } void BaseSystem::TriggerHapticPulse(vr::TrackedDeviceIndex_t unControllerDeviceIndex, uint32_t unAxisId, unsigned short usDurationMicroSec) { - if (!oovr_global_configuration.Haptics()) + /* if (!oovr_global_configuration.Haptics()) return; if (unControllerDeviceIndex == leftHandIndex || unControllerDeviceIndex == rightHandIndex) { @@ -545,7 +585,7 @@ void BaseSystem::TriggerHapticPulse(vr::TrackedDeviceIndex_t unControllerDeviceI haptics.StartSimplePulse(unControllerDeviceIndex == leftHandIndex ? ovrControllerType_LTouch : ovrControllerType_RTouch, usDurationMicroSec); return; - } + } */ // Invalid controller STUBBED(); @@ -568,7 +608,9 @@ void BaseSystem::ReleaseInputFocus() { } bool BaseSystem::IsInputFocusCapturedByAnotherProcess() { - return !lastStatus.HasInputFocus; + STUBBED(); + return false; + // return !lastStatus.HasInputFocus; } uint32_t BaseSystem::DriverDebugRequest(vr::TrackedDeviceIndex_t unDeviceIndex, const char * pchRequest, char * pchResponseBuffer, uint32_t unResponseBufferSize) { @@ -594,7 +636,10 @@ DistortionCoordinates_t BaseSystem::ComputeDistortion(EVREye eEye, float fU, flo } HmdMatrix44_t BaseSystem::GetProjectionMatrix(EVREye eye, float znear, float zfar, EGraphicsAPIConvention convention) { - return BackendManager::Instance().GetPrimaryHMD()->GetProjectionMatrix(eye, znear, zfar, convention); + STUBBED(); + HmdMatrix44_t res; + return res; + // return BackendManager::Instance().GetPrimaryHMD()->GetProjectionMatrix(eye, znear, zfar, convention); } void BaseSystem::PerformanceTestEnableCapture(bool bEnable) { @@ -607,7 +652,8 @@ void BaseSystem::PerformanceTestReportFidelityLevelChange(int nFidelityLevel) { // Tracking origin stuff void BaseSystem::_SetTrackingOrigin(ETrackingUniverseOrigin eOrigin) { - origin = eOrigin; + STUBBED(); + /* origin = eOrigin; ovrTrackingOrigin ovrOrigin = ovrTrackingOrigin_FloorLevel; if (eOrigin == TrackingUniverseSeated) { @@ -619,14 +665,14 @@ void BaseSystem::_SetTrackingOrigin(ETrackingUniverseOrigin eOrigin) { ovrOrigin = ovrTrackingOrigin_FloorLevel; } - OOVR_FAILED_OVR_ABORT(ovr_SetTrackingOriginType(*ovr::session, ovrOrigin)); + OOVR_FAILED_OVR_ABORT(ovr_SetTrackingOriginType(*ovr::session, ovrOrigin)); */ } ETrackingUniverseOrigin BaseSystem::_GetTrackingOrigin() { return origin; } -HmdMatrix34_t BaseSystem::_PoseToTrackingSpace(ETrackingUniverseOrigin toOrigin, ovrPosef pose) { +/* HmdMatrix34_t BaseSystem::_PoseToTrackingSpace(ETrackingUniverseOrigin toOrigin, ovrPosef pose) { // Standard path, most games only use the origin they have selected if (toOrigin == origin && !usingDualOriginMode) { goto result; @@ -657,22 +703,24 @@ HmdMatrix34_t BaseSystem::_PoseToTrackingSpace(ETrackingUniverseOrigin toOrigin, HmdMatrix34_t result; O2S_om34(hmdTransform, result); return result; -} +} */ ETrackingUniverseOrigin BaseSystem::_GetRenderTrackingOrigin() { return usingDualOriginMode ? TrackingUniverseStanding : origin; } void BaseSystem::_ResetFakeSeatedHeight() { - ovrTrackingState state = ovr_GetTrackingState(*ovr::session, ovr_GetTimeInSeconds(), false); + STUBBED(); + /* ovrTrackingState state = ovr_GetTrackingState(*ovr::session, ovr_GetTimeInSeconds(), false); - fakeOriginHeight = state.HeadPose.ThePose.Position.y; + fakeOriginHeight = state.HeadPose.ThePose.Position.y; */ } void BaseSystem::ResetSeatedZeroPose() { - // TODO should this only work when seated or whatever? + STUBBED(); + /* // TODO should this only work when seated or whatever? ovr_RecenterTrackingOrigin(*ovr::session); if (usingDualOriginMode) - _ResetFakeSeatedHeight(); + _ResetFakeSeatedHeight(); */ } diff --git a/OpenOVR/Reimpl/BaseSystem.h b/OpenOVR/Reimpl/BaseSystem.h index 5c23a92..02c7070 100644 --- a/OpenOVR/Reimpl/BaseSystem.h +++ b/OpenOVR/Reimpl/BaseSystem.h @@ -1,7 +1,7 @@ #pragma once #include "../BaseCommon.h" // TODO don't import from OCOVR, and remove the "../" #include "OpenVR/interfaces/IVRSystem_017.h" -#include +// #include #include using namespace vr; @@ -18,7 +18,7 @@ class BaseSystem { event_info_t(VREvent_t ev, TrackedDevicePose_t pose) : ev(ev), pose(pose) {} }; - ovrSessionStatus lastStatus; + // ovrSessionStatus lastStatus; std::queue events; VRControllerState_t lastLeftHandState = { 0 }; @@ -38,7 +38,7 @@ class BaseSystem { void _SetTrackingOrigin(ETrackingUniverseOrigin origin); ETrackingUniverseOrigin _GetTrackingOrigin(); - HmdMatrix34_t _PoseToTrackingSpace(ETrackingUniverseOrigin origin, ovrPosef pose); + // HmdMatrix34_t _PoseToTrackingSpace(ETrackingUniverseOrigin origin, ovrPosef pose); ETrackingUniverseOrigin _GetRenderTrackingOrigin(); private: void CheckControllerEvents(vr::TrackedDeviceIndex_t hand, VRControllerState_t &last); diff --git a/OpenOVR/convert.h b/OpenOVR/convert.h index ecdd830..32e32f7 100644 --- a/OpenOVR/convert.h +++ b/OpenOVR/convert.h @@ -1,6 +1,6 @@ #pragma once #include "OVR_CAPI.h" -#include "Extras/OVR_Math.h" +// #include "Extras/OVR_Math.h" vr::HmdMatrix44_t O2S_m4(ovrMatrix4f input); ovrEyeType S2O_eye(vr::EVREye eye); // TODO inline without link errors diff --git a/OpenOVR/libovr_wrapper.h b/OpenOVR/libovr_wrapper.h deleted file mode 100644 index 3191844..0000000 --- a/OpenOVR/libovr_wrapper.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once -#include "OVR_CAPI.h" - -namespace ovr { - extern ovrSession *session; - extern ovrGraphicsLuid *luid; - extern ovrHmdDesc hmdDesc; - - extern ovrEyeRenderDesc eyeRenderDesc[2]; - extern ovrPosef hmdToEyeViewPose[2]; - - extern int dxDeviceId; - - void Setup(); - bool IsAvailable(); - void Shutdown(); -};