1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0026617: Visualization, Ray Tracing - adopt progressive rendering Path Tracing for rendering stereoscopic pair

- Use two different FBOs for accumulating frames for left/right eye projection.
- Added equality checks to camera modification methods to avoid camera updates when performing identity operations.
This commit is contained in:
apl
2015-10-20 12:59:56 +03:00
committed by bugmaster
parent 23963a92d2
commit bf02aa7d7d
10 changed files with 246 additions and 88 deletions

View File

@@ -103,20 +103,13 @@ Graphic3d_Camera::Graphic3d_Camera (const Handle(Graphic3d_Camera)& theOther)
// =======================================================================
void Graphic3d_Camera::CopyMappingData (const Handle(Graphic3d_Camera)& theOtherCamera)
{
myFOVy = theOtherCamera->myFOVy;
myZNear = theOtherCamera->myZNear;
myZFar = theOtherCamera->myZFar;
myAspect = theOtherCamera->myAspect;
myScale = theOtherCamera->myScale;
myZFocus = theOtherCamera->myZFocus;
myZFocusType = theOtherCamera->myZFocusType;
myIOD = theOtherCamera->myIOD;
myIODType = theOtherCamera->myIODType;
myProjType = theOtherCamera->myProjType;
myWorldViewProjState.ProjectionState() = theOtherCamera->ProjectionState();
InvalidateProjection();
SetFOVy (theOtherCamera->FOVy());
SetZRange (theOtherCamera->ZNear(), theOtherCamera->ZFar());
SetAspect (theOtherCamera->Aspect());
SetScale (theOtherCamera->Scale());
SetZFocus (theOtherCamera->ZFocusType(), theOtherCamera->ZFocus());
SetIOD (theOtherCamera->GetIODType(), theOtherCamera->IOD());
SetProjectionType (theOtherCamera->ProjectionType());
}
// =======================================================================
@@ -125,14 +118,10 @@ void Graphic3d_Camera::CopyMappingData (const Handle(Graphic3d_Camera)& theOther
// =======================================================================
void Graphic3d_Camera::CopyOrientationData (const Handle(Graphic3d_Camera)& theOtherCamera)
{
myUp = theOtherCamera->myUp;
myEye = theOtherCamera->myEye;
myCenter = theOtherCamera->myCenter;
myAxialScale = theOtherCamera->myAxialScale;
myWorldViewProjState.WorldViewState() = theOtherCamera->WorldViewState();
InvalidateOrientation();
SetUp (theOtherCamera->Up());
SetEye (theOtherCamera->Eye());
SetCenter (theOtherCamera->Center());
SetAxialScale (theOtherCamera->AxialScale());
}
// =======================================================================
@@ -151,6 +140,11 @@ void Graphic3d_Camera::Copy (const Handle(Graphic3d_Camera)& theOther)
// =======================================================================
void Graphic3d_Camera::SetEye (const gp_Pnt& theEye)
{
if (Eye().IsEqual (theEye, 0.0))
{
return;
}
myEye = theEye;
InvalidateOrientation();
}
@@ -161,6 +155,11 @@ void Graphic3d_Camera::SetEye (const gp_Pnt& theEye)
// =======================================================================
void Graphic3d_Camera::SetCenter (const gp_Pnt& theCenter)
{
if (Center().IsEqual (theCenter, 0.0))
{
return;
}
myCenter = theCenter;
InvalidateOrientation();
}
@@ -171,6 +170,11 @@ void Graphic3d_Camera::SetCenter (const gp_Pnt& theCenter)
// =======================================================================
void Graphic3d_Camera::SetUp (const gp_Dir& theUp)
{
if (Up().IsEqual (theUp, 0.0))
{
return;
}
myUp = theUp;
InvalidateOrientation();
}
@@ -181,6 +185,11 @@ void Graphic3d_Camera::SetUp (const gp_Dir& theUp)
// =======================================================================
void Graphic3d_Camera::SetAxialScale (const gp_XYZ& theAxialScale)
{
if (AxialScale().IsEqual (theAxialScale, 0.0))
{
return;
}
myAxialScale = theAxialScale;
InvalidateOrientation();
}
@@ -191,6 +200,11 @@ void Graphic3d_Camera::SetAxialScale (const gp_XYZ& theAxialScale)
// =======================================================================
void Graphic3d_Camera::SetDistance (const Standard_Real theDistance)
{
if (Distance() == theDistance)
{
return;
}
gp_Vec aCenter2Eye (Direction());
aCenter2Eye.Reverse();
@@ -214,6 +228,11 @@ Standard_Real Graphic3d_Camera::Distance() const
// =======================================================================
void Graphic3d_Camera::SetDirection (const gp_Dir& theDir)
{
if (Direction().IsEqual (theDir, 0.0))
{
return;
}
gp_Vec aScaledDir (theDir);
aScaledDir.Scale (Distance());
aScaledDir.Reverse();
@@ -392,8 +411,8 @@ void Graphic3d_Camera::SetZFocus(const FocusType theType, const Standard_Real th
// =======================================================================
void Graphic3d_Camera::SetIOD (const IODType theType, const Standard_Real theIOD)
{
if (IODType() == theType
&& IOD () == theIOD)
if (GetIODType() == theType
&& IOD () == theIOD)
{
return;
}
@@ -432,10 +451,14 @@ gp_Dir Graphic3d_Camera::OrthogonalizedUp() const
// =======================================================================
void Graphic3d_Camera::Transform (const gp_Trsf& theTrsf)
{
myUp.Transform (theTrsf);
myEye.Transform (theTrsf);
myCenter.Transform (theTrsf);
InvalidateOrientation();
if (theTrsf.Form() == gp_Identity)
{
return;
}
SetUp (myUp.Transformed (theTrsf));
SetEye (myEye.Transformed (theTrsf));
SetCenter (myCenter.Transformed (theTrsf));
}
// =======================================================================