mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-25 08:36:14 +00:00
Create a clipping frustum, ref #43
This commit is contained in:
parent
922b0e67ad
commit
a68f54b4e8
2 changed files with 14 additions and 0 deletions
|
@ -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…
Reference in a new issue