From 2e6893fd48a2ee8b7b7622fa0468c7c0f8bf434b Mon Sep 17 00:00:00 2001 From: kaetemi Date: Tue, 5 Aug 2014 00:51:53 +0200 Subject: [PATCH] OVR: Translate camera --HG-- branch : multipass-stereo --- code/nel/include/nel/3d/stereo_ovr_04.h | 1 + code/nel/src/3d/stereo_ovr_04.cpp | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/code/nel/include/nel/3d/stereo_ovr_04.h b/code/nel/include/nel/3d/stereo_ovr_04.h index 18c7083da..a8f912308 100644 --- a/code/nel/include/nel/3d/stereo_ovr_04.h +++ b/code/nel/include/nel/3d/stereo_ovr_04.h @@ -168,6 +168,7 @@ private: uint m_RenderTargetWidth; uint m_RenderTargetHeight; NLMISC::CVector2f m_EyeUVScaleOffset[NL_OVR_EYE_COUNT][2]; + float m_EyeViewAdjustX[NL_OVR_EYE_COUNT]; CVertexBuffer m_VB; CIndexBuffer m_IB; diff --git a/code/nel/src/3d/stereo_ovr_04.cpp b/code/nel/src/3d/stereo_ovr_04.cpp index 0d0adb449..999a9c9a3 100644 --- a/code/nel/src/3d/stereo_ovr_04.cpp +++ b/code/nel/src/3d/stereo_ovr_04.cpp @@ -220,6 +220,9 @@ CStereoOVR::CStereoOVR(const CStereoOVRDeviceFactory *factory) : m_DevicePtr(NUL for (uint eye = 0; eye < ovrEye_Count; ++eye) { ovrFovPort &fov = eyeRenderDesc[eye].Fov; + + // store data + m_EyeViewAdjustX[eye] = -eyeRenderDesc[eye].ViewAdjust.x; // setup viewport m_EyeViewport[eye].init( @@ -653,11 +656,11 @@ void CStereoOVR::getCurrentFrustum(uint cid, NL3D::UCamera *camera) const } void CStereoOVR::getCurrentMatrix(uint cid, NL3D::UCamera *camera) const -{/* +{ CMatrix translate; if (m_Stage == 2) { } - else if (m_Stage % 2) translate.translate(CVector((m_DevicePtr->HMDInfo.InterpupillaryDistance * m_Scale) * -0.5f, 0.f, 0.f)); - else translate.translate(CVector((m_DevicePtr->HMDInfo.InterpupillaryDistance * m_Scale) * 0.5f, 0.f, 0.f)); + else if (m_Stage % 2) translate.translate(CVector(m_EyeViewAdjustX[ovrEye_Left] * m_Scale, 0.f, 0.f)); + else translate.translate(CVector(m_EyeViewAdjustX[ovrEye_Right] * m_Scale, 0.f, 0.f)); CMatrix mat = m_CameraMatrix[cid] * translate; if (camera->getTransformMode() == NL3D::UTransformable::RotQuat) { @@ -668,7 +671,7 @@ void CStereoOVR::getCurrentMatrix(uint cid, NL3D::UCamera *camera) const { // camera->setTransformMode(NL3D::UTransformable::DirectMatrix); camera->setMatrix(mat); - }*/ + } } bool CStereoOVR::wantClear()