diff --git a/L4D2VR/hooks.cpp b/L4D2VR/hooks.cpp index 72dedfb..1b8508f 100644 --- a/L4D2VR/hooks.cpp +++ b/L4D2VR/hooks.cpp @@ -84,14 +84,9 @@ void __fastcall Hooks::dRenderView(void *ecx, void *edx, CViewSetup &setup, CVie { IMatRenderContext *rndrContext = m_Game->m_MaterialSystem->GetRenderContext(); - int clearflags = 0; - CViewSetup leftEyeView = setup; CViewSetup rightEyeView = setup; - int width_VR = m_VR->m_FrameBufferWidth / 2; - int height_VR = m_VR->m_FrameBufferHeight; - // Left eye CViewSetup leftEyeView.x = 0; leftEyeView.width = m_VR->m_RenderWidth; diff --git a/L4D2VR/vr.cpp b/L4D2VR/vr.cpp index 4b49f13..89bbb06 100644 --- a/L4D2VR/vr.cpp +++ b/L4D2VR/vr.cpp @@ -101,20 +101,6 @@ int VR::SetActionManifest(const char *fileName) { m_ActiveActionSet = {}; m_ActiveActionSet.ulActionSet = m_ActionSet; - // Get index for each controller - vr::VRInputValueHandle_t leftControllerHandle{}; - vr::VRInputValueHandle_t rightControllerHandle{}; - m_Input->GetInputSourceHandle("/user/hand/left", &leftControllerHandle); - m_Input->GetInputSourceHandle("/user/hand/right", &rightControllerHandle); - - vr::InputOriginInfo_t leftOriginInfo{}; - vr::InputOriginInfo_t rightOriginInfo{}; - m_Input->GetOriginTrackedDeviceInfo(leftControllerHandle, &leftOriginInfo, sizeof(leftOriginInfo)); - m_Input->GetOriginTrackedDeviceInfo(rightControllerHandle, &rightOriginInfo, sizeof(rightOriginInfo)); - - m_LeftControllerIndex = leftOriginInfo.trackedDeviceIndex; - m_RightControllerIndex = rightOriginInfo.trackedDeviceIndex; - return 0; } @@ -209,8 +195,12 @@ void VR::GetPoses() vr::TrackedDevicePose_t pose; vr::TrackedDevicePose_t hmdPose = m_Poses[vr::k_unTrackedDeviceIndex_Hmd]; - vr::TrackedDevicePose_t leftControllerPose = m_Poses[m_LeftControllerIndex]; - vr::TrackedDevicePose_t rightControllerPose = m_Poses[m_RightControllerIndex]; + + vr::TrackedDeviceIndex_t leftControllerIndex = m_System->GetTrackedDeviceIndexForControllerRole(vr::TrackedControllerRole_LeftHand); + vr::TrackedDevicePose_t leftControllerPose = m_Poses[leftControllerIndex]; + + vr::TrackedDeviceIndex_t rightControllerIndex = m_System->GetTrackedDeviceIndexForControllerRole(vr::TrackedControllerRole_RightHand); + vr::TrackedDevicePose_t rightControllerPose = m_Poses[rightControllerIndex]; GetPoseData(hmdPose, m_HmdPose); GetPoseData(leftControllerPose, m_LeftControllerPose); diff --git a/L4D2VR/vr.h b/L4D2VR/vr.h index ffc4868..bbb5537 100644 --- a/L4D2VR/vr.h +++ b/L4D2VR/vr.h @@ -21,7 +21,7 @@ struct TrackedDevicePoseData { struct SharedTextureHolder { vr::VRVulkanTextureData_t m_VulkanData; - vr::Texture_t m_VRTexture; + vr::Texture_t m_VRTexture; }; @@ -32,6 +32,7 @@ class VR vr::IVRSystem *m_System = nullptr; vr::IVRInput *m_Input = nullptr; + float m_HorizontalOffsetLeft; float m_VerticalOffsetLeft; float m_HorizontalOffsetRight; @@ -76,9 +77,6 @@ class VR Vector m_RightControllerPosAbs; QAngle m_RightControllerAngAbs; - int m_FrameBufferWidth; - int m_FrameBufferHeight; - float m_Ipd; float m_EyeZ; @@ -87,9 +85,6 @@ class VR ITexture *m_LeftEyeTexture; ITexture *m_RightEyeTexture; - IDirect3DTexture9 *m_D9LeftEyeTexture; - IDirect3DTexture9 *m_D9RightEyeTexture; - IDirect3DSurface9 *m_D9LeftEyeSurface; IDirect3DSurface9 *m_D9RightEyeSurface; @@ -128,9 +123,6 @@ class VR vr::VRActionHandle_t m_ActionFlashlight; vr::VRActionHandle_t m_ActionActivateVR; - int m_LeftControllerIndex; - int m_RightControllerIndex; - TrackedDevicePoseData m_HmdPose; TrackedDevicePoseData m_LeftControllerPose; TrackedDevicePoseData m_RightControllerPose;