This commit is contained in:
kaetemi 2013-07-01 20:15:55 +02:00
parent ebba0c1917
commit 9960b9dfdb
2 changed files with 14 additions and 6 deletions

View file

@ -686,6 +686,13 @@ SOURCE_GROUP(Shadows FILES
../../include/nel/3d/shadow_map_manager.h
shadow_poly_receiver.cpp
../../include/nel/3d/shadow_poly_receiver.h)
SOURCE_GROUP(Stereo FILES
stereo_display.cpp
../../include/nel/3d/stereo_display.h
stereo_hmd.cpp
../../include/nel/3d/stereo_hmd.h
stereo_ovr.cpp
../../include/nel/3d/stereo_ovr.h)
NL_TARGET_LIB(nel3d ${HEADERS} ${SRC})

View file

@ -218,15 +218,16 @@ void CStereoOVR::initCamera(uint cid, const NL3D::UCamera *camera)
float fov = 2.0f * atanf((m_DevicePtr->HMDInfo.VScreenSize / 2.0f) / m_DevicePtr->HMDInfo.EyeToScreenDistance); //(float)NLMISC::Pi/2.f; // 2.0f * atanf(m_DevicePtr->HMDInfo.VScreenSize / 2.0f * m_DevicePtr->HMDInfo.EyeToScreenDistance);
m_LeftFrustum[cid].initPerspective(fov, ar, camera->getFrustum().Near, camera->getFrustum().Far);
m_RightFrustum[cid] = m_LeftFrustum[cid];
float viewCenter = m_DevicePtr->HMDInfo.HScreenSize * 0.25f;
float eyeProjectionShift = viewCenter - m_DevicePtr->HMDInfo.LensSeparationDistance * 0.5f;
float projectionCenterOffset = 4.0f * eyeProjectionShift / m_DevicePtr->HMDInfo.HScreenSize;
float projectionCenterOffset = (eyeProjectionShift / (m_DevicePtr->HMDInfo.HScreenSize * 0.5f)) * (m_LeftFrustum[cid].Right - m_LeftFrustum[cid].Left); // used logic for this one, but it ends up being the same as the one i made up
nldebug("OVR: projectionCenterOffset = %f", projectionCenterOffset);
projectionCenterOffset *= (m_LeftFrustum[cid].Left - m_LeftFrustum[cid].Right) * 0.5f; // made this up ...
m_LeftFrustum[cid].Left += projectionCenterOffset;
m_LeftFrustum[cid].Right += projectionCenterOffset;
m_RightFrustum[cid].Left -= projectionCenterOffset;
m_RightFrustum[cid].Right -= projectionCenterOffset;
m_LeftFrustum[cid].Left -= projectionCenterOffset;
m_LeftFrustum[cid].Right -= projectionCenterOffset;
m_RightFrustum[cid].Left += projectionCenterOffset;
m_RightFrustum[cid].Right += projectionCenterOffset;
// TODO: Clipping frustum should also take into account the IPD
m_ClippingFrustum[cid] = m_LeftFrustum[cid];