Create a clipping frustum, ref #43

--HG--
branch : multipass-stereo
hg/feature/sound
kaetemi 12 years ago
parent e7842982a0
commit 1cc5848220

@ -91,6 +91,8 @@ public:
virtual void getScreenResolution(uint &width, uint &height);
/// Set latest camera position etcetera
virtual void updateCamera(uint cid, const NL3D::UCamera *camera);
/// Get the frustum to use for clipping
virtual void getClippingFrustum(uint cid, NL3D::UCamera *camera) const;
/// Is there a next pass
virtual bool nextPass();
@ -143,6 +145,7 @@ private:
int m_Stage;
CViewport m_LeftViewport;
CViewport m_RightViewport;
CFrustum m_ClippingFrustum[NL_STEREO_MAX_USER_CAMERAS];
CFrustum m_LeftFrustum[NL_STEREO_MAX_USER_CAMERAS];
CFrustum m_RightFrustum[NL_STEREO_MAX_USER_CAMERAS];
CMatrix m_CameraMatrix[NL_STEREO_MAX_USER_CAMERAS];

@ -219,6 +219,17 @@ void CStereoOVR::initCamera(uint cid, const NL3D::UCamera *camera)
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];
m_ClippingFrustum[cid].Left = min(m_LeftFrustum[cid].Left, m_RightFrustum[cid].Left);
m_ClippingFrustum[cid].Right = max(m_LeftFrustum[cid].Right, m_RightFrustum[cid].Right);
}
/// Get the frustum to use for clipping
void CStereoOVR::getClippingFrustum(uint cid, NL3D::UCamera *camera) const
{
camera->setFrustum(m_ClippingFrustum[cid]);
}
void CStereoOVR::updateCamera(uint cid, const NL3D::UCamera *camera)

Loading…
Cancel
Save