diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 03ac418..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "OculusSDK"] - path = OculusSDK - url = https://github.com/jherico/OculusSDK.git diff --git a/OculusSDK b/OculusSDK deleted file mode 160000 index d765192..0000000 --- a/OculusSDK +++ /dev/null @@ -1 +0,0 @@ -Subproject commit d765192495783dea9bcca452e8bf8369eb2a06a5 diff --git a/Makefile b/ovr/Makefile similarity index 55% rename from Makefile rename to ovr/Makefile index ed524e3..83ec64d 100644 --- a/Makefile +++ b/ovr/Makefile @@ -1,6 +1,6 @@ -LIBOVR_INCLUDE_PATH=OculusSDK/LibOVR/Include/ -LIBOVR_LIB_PATH=OculusSDK/LibOVR/Lib/Linux/Release/x86_64/libovr.a +LIBOVR_INCLUDE_PATH=../thirdparty/OculusSDK/LibOVR/Include/ +LIBOVR_LIB_PATH=../thirdparty/OculusSDK/LibOVR/Lib/Linux/Release/x86_64/libovr.a all: libovr_wrapper.a diff --git a/lib.rs b/ovr/lib.rs similarity index 99% rename from lib.rs rename to ovr/lib.rs index defc59f..b102249 100644 --- a/lib.rs +++ b/ovr/lib.rs @@ -597,7 +597,7 @@ extern "C" fn chan_callback(chan: *c_void, msg: *ll::MessageBodyFrame) } } -pub struct SensorDevice { +/*pub struct SensorDevice { priv ptr: *ll::SensorDevice, priv msg: Option<*ll::MessageHandler> } @@ -634,7 +634,7 @@ impl SensorDevice { } } } -} +}*/ struct MessageBody { acceleration: Vec3, diff --git a/test.rs b/ovr/test.rs similarity index 100% rename from test.rs rename to ovr/test.rs diff --git a/wrapper.cpp b/ovr/wrapper.cpp similarity index 100% rename from wrapper.cpp rename to ovr/wrapper.cpp diff --git a/steam-vr/Makefile b/steam-vr/Makefile new file mode 100644 index 0000000..43c2158 --- /dev/null +++ b/steam-vr/Makefile @@ -0,0 +1,11 @@ + +LIBSTEAMVR_INCLUDE_PATH=../thirdparty/Steamworks/public/steam/ +LIBSTEAMVR_LIB_PATH=../thirdparty/Steamworks/redistributable_bin/linux64/ + +all: libsteamvr_wrapper.a + +libsteamvr_wrapper.a: wrapper.o + ar rcs libovr_wrapper.a wrapper.o + +wrapper.o: wrapper.cpp + g++ -fPIC -I $(LIBSTEAMVR_INCLUDE_PATH) -DGNUC -DSTEAMWORKS -c -o wrapper.o wrapper.cpp \ No newline at end of file diff --git a/steam-vr/wrapper.cpp b/steam-vr/wrapper.cpp new file mode 100644 index 0000000..339b7d3 --- /dev/null +++ b/steam-vr/wrapper.cpp @@ -0,0 +1,94 @@ + +#include "steamvr.h" + +extern "C" +{ + vr::IHmd* VR_Init(vr::HmdError *peError) + { + vr::VR_Init(peError); + } + + void VR_Shutdown(void) + { + vr::VR_Shutdown(); + } + + const char* const VR_IHmd_Version(void) + { + return vr::IHmd_Version; + } + + void VR_IHmd_GetWindowBounds(vr::IHmd *ihmd, int32_t *pnX, int32_t *pnY, uint32_t *pnWidth, uint32_t *pnHeight) + { + ihmd->GetWindowBounds(pnX, pnY, pnWidth, pnHeight); + } + + void VR_IHmd_GetRecommendedRenderTargetSize(vr::IHmd *ihmd, uint32_t *pnWidth, uint32_t *pnHeight) + { + ihmd->GetRecommendedRenderTargetSize(pnWidth, pnHeight); + } + + void VR_IHmd_GetEyeOutputViewport(vr::IHmd *ihmd, vr::Hmd_Eye eEye, uint32_t *pnX, uint32_t *pnY, uint32_t *pnWidth, uint32_t *pnHeight) + { +#ifdef STEAMWORKS + ihmd->GetEyeOutputViewport(eEye, vr::API_OpenGL, pnX, pnY, pnWidth, pnHeight); +#else + ihmd->GetEyeOutputViewport(eEye, pnX, pnY, pnWidth, pnHeight); +#endif + } + + vr::HmdMatrix44_t VR_IHmd_GetProjectionMatrix(vr::IHmd *ihmd, vr::Hmd_Eye eEye, float fNearZ, float fFarZ, vr::GraphicsAPIConvention eProjType) + { + ihmd->GetProjectionMatrix(eEye, fNearZ, fFarZ, eProjType); + } + + void VR_IHmd_GetProjectionRaw(vr::IHmd *ihmd, vr::Hmd_Eye eEye, float *pfLeft, float *pfRight, float *pfTop, float *pfBottom) + { + ihmd->GetProjectionRaw(eEye, pfLeft, pfRight, pfTop, pfBottom); + } + + vr::DistortionCoordinates_t VR_IHmd_ComputeDistortion(vr::IHmd *ihmd, vr::Hmd_Eye eEye, float fU, float fV) + { + ihmd->ComputeDistortion(eEye, fU, fV); + } + + vr::HmdMatrix44_t VR_IHmd_GetEyeMatrix(vr::IHmd *ihmd, vr::Hmd_Eye eEye) + { + return ihmd->GetEyeMatrix(eEye); + } + + bool VR_IHmd_GetViewMatrix(vr::IHmd *ihmd, float fSecondsFromNow, vr::HmdMatrix44_t *pMatLeftView, vr::HmdMatrix44_t *pMatRightView, vr::HmdTrackingResult *peResult) + { + ihmd->GetViewMatrix(fSecondsFromNow, pMatLeftView, pMatRightView, peResult); + } + + bool VR_IHmd_GetWorldFromHeadPose(vr::IHmd *ihmd, float fPredictedSecondsFromNow, vr::HmdMatrix34_t *pmPose, vr::HmdTrackingResult *peResult) + { + ihmd->GetWorldFromHeadPose(fPredictedSecondsFromNow, pmPose, peResult); + } + + bool VR_IHmd_GetLastWorldFromHeadPose(vr::IHmd *ihmd, vr::HmdMatrix34_t *pmPose) + { + ihmd->GetLastWorldFromHeadPose(pmPose); + } + + bool VR_IHmd_WillDriftInYaw(vr::IHmd *ihmd) + { + ihmd->WillDriftInYaw(); + } + + void VR_IHmd_ZeroTracker(vr::IHmd *ihmd) + { + ihmd->ZeroTracker(); + } + + uint32_t VR_IHmd_GetDeviceId(vr::IHmd *ihmd, char *pchBuffer, uint32_t unBufferLen ) + { + ihmd->GetDriverId(pchBuffer, unBufferLen); + } + + uint32_t VR_IHmd_GetDisplayId(vr::IHmd *ihmd, char *pchBuffer, uint32_t unBufferLen ) + { + ihmd->GetDisplayId(pchBuffer, unBufferLen); + } +} \ No newline at end of file