- 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.
// =======================================================================
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());
}
// =======================================================================
// =======================================================================
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());
}
// =======================================================================
// =======================================================================
void Graphic3d_Camera::SetEye (const gp_Pnt& theEye)
{
+ if (Eye().IsEqual (theEye, 0.0))
+ {
+ return;
+ }
+
myEye = theEye;
InvalidateOrientation();
}
// =======================================================================
void Graphic3d_Camera::SetCenter (const gp_Pnt& theCenter)
{
+ if (Center().IsEqual (theCenter, 0.0))
+ {
+ return;
+ }
+
myCenter = theCenter;
InvalidateOrientation();
}
// =======================================================================
void Graphic3d_Camera::SetUp (const gp_Dir& theUp)
{
+ if (Up().IsEqual (theUp, 0.0))
+ {
+ return;
+ }
+
myUp = theUp;
InvalidateOrientation();
}
// =======================================================================
void Graphic3d_Camera::SetAxialScale (const gp_XYZ& theAxialScale)
{
+ if (AxialScale().IsEqual (theAxialScale, 0.0))
+ {
+ return;
+ }
+
myAxialScale = theAxialScale;
InvalidateOrientation();
}
// =======================================================================
void Graphic3d_Camera::SetDistance (const Standard_Real theDistance)
{
+ if (Distance() == theDistance)
+ {
+ return;
+ }
+
gp_Vec aCenter2Eye (Direction());
aCenter2Eye.Reverse();
// =======================================================================
void Graphic3d_Camera::SetDirection (const gp_Dir& theDir)
{
+ if (Direction().IsEqual (theDir, 0.0))
+ {
+ return;
+ }
+
gp_Vec aScaledDir (theDir);
aScaledDir.Scale (Distance());
aScaledDir.Reverse();
// =======================================================================
void Graphic3d_Camera::SetIOD (const IODType theType, const Standard_Real theIOD)
{
- if (IODType() == theType
- && IOD () == theIOD)
+ if (GetIODType() == theType
+ && IOD () == theIOD)
{
return;
}
// =======================================================================
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));
}
// =======================================================================
myColorTexture->Release (theGlCtx);
myDepthStencilTexture->Release (theGlCtx);
+
+ myVPSizeX = 0;
+ myVPSizeY = 0;
}
// =======================================================================
const Standard_Boolean theToDrawImmediate);
//! Renders the graphical scene.
+ //! @param theProjection [in] the projection that is used for rendering.
//! @param theReadDrawFbo [in] the framebuffer for rendering graphics.
//! @param theToDrawImmediate [in] the flag indicates whether the rendering performs in immediate mode.
- Standard_EXPORT virtual void renderScene (OpenGl_FrameBuffer* theReadDrawFbo,
+ Standard_EXPORT virtual void renderScene (Graphic3d_Camera::Projection theProjection,
+ OpenGl_FrameBuffer* theReadDrawFbo,
const Standard_Boolean theToDrawImmediate);
//! Draw background (gradient / image)
Standard_EXPORT virtual void drawBackground (const Handle(OpenGl_Workspace)& theWorkspace);
//! Render set of structures presented in the view.
+ //! @param theProjection [in] the projection that is used for rendering.
//! @param theReadDrawFbo [in] the framebuffer for rendering graphics.
//! @param theToDrawImmediate [in] the flag indicates whether the rendering performs in immediate mode.
- Standard_EXPORT virtual void renderStructs (OpenGl_FrameBuffer* theReadDrawFbo,
+ Standard_EXPORT virtual void renderStructs (Graphic3d_Camera::Projection theProjection,
+ OpenGl_FrameBuffer* theReadDrawFbo,
const Standard_Boolean theToDrawImmediate);
//! Renders trihedron.
//! Releases OpenGL/GLSL shader programs.
void releaseRaytraceResources (const Handle(OpenGl_Context)& theGlContext);
- //! Resizes OpenGL frame buffers.
- Standard_Boolean resizeRaytraceBuffers (const Standard_Integer theSizeX,
+ //! Updates auxiliary OpenGL frame buffers.
+ Standard_Boolean updateRaytraceBuffers (const Standard_Integer theSizeX,
const Standard_Integer theSizeY,
const Handle(OpenGl_Context)& theGlContext);
const OpenGl_Vec3* theOrigins,
const OpenGl_Vec3* theDirects,
const OpenGl_Mat4& theUnviewMat,
+ Graphic3d_Camera::Projection theProjection,
OpenGl_FrameBuffer* theReadDrawFbo,
const Handle(OpenGl_Context)& theGlContext);
//! Redraws the window using OpenGL/GLSL ray-tracing.
Standard_Boolean raytrace (const Standard_Integer theSizeX,
const Standard_Integer theSizeY,
+ Graphic3d_Camera::Projection theProjection,
OpenGl_FrameBuffer* theReadDrawFbo,
const Handle(OpenGl_Context)& theGlContext);
Handle(OpenGl_TextureBufferArb) myRaytraceLightSrcTexture;
//! 1st framebuffer (FBO) to perform adaptive FSAA.
- Handle(OpenGl_FrameBuffer) myRaytraceFBO1;
+ Handle(OpenGl_FrameBuffer) myRaytraceFBO1[2];
//! 2nd framebuffer (FBO) to perform adaptive FSAA.
- Handle(OpenGl_FrameBuffer) myRaytraceFBO2;
+ Handle(OpenGl_FrameBuffer) myRaytraceFBO2[2];
//! Framebuffer (FBO) for preliminary OpenGL output.
Handle(OpenGl_FrameBuffer) myOpenGlFBO;
return myRaytraceInitStatus == OpenGl_RT_INIT;
}
- if (myRaytraceFBO1.IsNull())
+ if (myRaytraceFBO1[0].IsNull())
{
- myRaytraceFBO1 = new OpenGl_FrameBuffer (GL_RGBA32F);
+ myRaytraceFBO1[0] = new OpenGl_FrameBuffer (GL_RGBA32F);
+ myRaytraceFBO1[1] = new OpenGl_FrameBuffer (GL_RGBA32F);
}
- if (myRaytraceFBO2.IsNull())
+ if (myRaytraceFBO2[0].IsNull())
{
- myRaytraceFBO2 = new OpenGl_FrameBuffer (GL_RGBA32F);
+ myRaytraceFBO2[0] = new OpenGl_FrameBuffer (GL_RGBA32F);
+ myRaytraceFBO2[1] = new OpenGl_FrameBuffer (GL_RGBA32F);
}
const GLfloat aVertices[] = { -1.f, -1.f, 0.f,
void OpenGl_View::releaseRaytraceResources (const Handle(OpenGl_Context)& theGlContext)
{
nullifyResource (theGlContext, myOpenGlFBO);
- nullifyResource (theGlContext, myRaytraceFBO1);
- nullifyResource (theGlContext, myRaytraceFBO2);
+ nullifyResource (theGlContext, myRaytraceFBO1[0]);
+ nullifyResource (theGlContext, myRaytraceFBO2[0]);
+ nullifyResource (theGlContext, myRaytraceFBO1[1]);
+ nullifyResource (theGlContext, myRaytraceFBO2[1]);
nullifyResource (theGlContext, myRaytraceShader);
nullifyResource (theGlContext, myPostFSAAShader);
}
// =======================================================================
-// function : resizeRaytraceBuffers
-// purpose : Resizes OpenGL frame buffers
+// function : updateRaytraceBuffers
+// purpose : Updates auxiliary OpenGL frame buffers.
// =======================================================================
-Standard_Boolean OpenGl_View::resizeRaytraceBuffers (const Standard_Integer theSizeX,
+Standard_Boolean OpenGl_View::updateRaytraceBuffers (const Standard_Integer theSizeX,
const Standard_Integer theSizeY,
const Handle(OpenGl_Context)& theGlContext)
{
- if (myRaytraceFBO1->GetVPSizeX() != theSizeX
- || myRaytraceFBO1->GetVPSizeY() != theSizeY)
+ // Auxiliary buffers are not used.
+ if (!myRaytraceParameters.GlobalIllumination && !myRenderParams.IsAntialiasingEnabled)
{
- myRaytraceFBO1->Init (theGlContext, theSizeX, theSizeY);
- myRaytraceFBO2->Init (theGlContext, theSizeX, theSizeY);
+ myRaytraceFBO1[0]->Release (theGlContext.operator->());
+ myRaytraceFBO2[0]->Release (theGlContext.operator->());
+ myRaytraceFBO1[1]->Release (theGlContext.operator->());
+ myRaytraceFBO2[1]->Release (theGlContext.operator->());
+ return Standard_True;
+ }
+
+ if ( myRaytraceFBO1[0]->GetVPSizeX() != theSizeX
+ || myRaytraceFBO1[0]->GetVPSizeY() != theSizeY)
+ {
+ myRaytraceFBO1[0]->Init (theGlContext, theSizeX, theSizeY);
+ myRaytraceFBO2[0]->Init (theGlContext, theSizeX, theSizeY);
+ }
+
+ // Init second set of buffers for stereographic rendering.
+ if (myCamera->ProjectionType() == Graphic3d_Camera::Projection_Stereo)
+ {
+ if (myRaytraceFBO1[1]->GetVPSizeX() != theSizeX
+ || myRaytraceFBO1[1]->GetVPSizeY() != theSizeY)
+ {
+ myRaytraceFBO1[1]->Init (theGlContext, theSizeX, theSizeY);
+ myRaytraceFBO2[1]->Init (theGlContext, theSizeX, theSizeY);
+ }
+ }
+ else
+ {
+ myRaytraceFBO1[1]->Release (theGlContext.operator->());
+ myRaytraceFBO2[1]->Release (theGlContext.operator->());
}
return Standard_True;
const OpenGl_Vec3* theOrigins,
const OpenGl_Vec3* theDirects,
const OpenGl_Mat4& theUnviewMat,
+ Graphic3d_Camera::Projection theProjection,
OpenGl_FrameBuffer* theReadDrawFbo,
const Handle(OpenGl_Context)& theGlContext)
{
Handle(OpenGl_FrameBuffer) aRenderFramebuffer;
Handle(OpenGl_FrameBuffer) anAccumFramebuffer;
+ // Choose proper set of framebuffers for stereo rendering
+ Standard_Boolean isStereo = myCamera->ProjectionType() == Graphic3d_Camera::Projection_Stereo;
+ Standard_Boolean isRightEye = theProjection == Graphic3d_Camera::Projection_MonoRightEye;
+ Standard_Integer aFBOIdx = (isStereo && isRightEye) ? 1 : 0;
+
if (myRaytraceParameters.GlobalIllumination) // if path-tracing is used
{
- for (int anIdx = 0; anIdx < 3; ++anIdx)
- {
- if (fabsf (theOrigins[anIdx].x() - myPreviousOrigins[anIdx].x()) > std::numeric_limits<Standard_ShortReal>::epsilon()
- || fabsf (theOrigins[anIdx].y() - myPreviousOrigins[anIdx].y()) > std::numeric_limits<Standard_ShortReal>::epsilon()
- || fabsf (theOrigins[anIdx].z() - myPreviousOrigins[anIdx].z()) > std::numeric_limits<Standard_ShortReal>::epsilon())
- {
- myAccumFrames = 0; // camera has been moved
- }
-
- myPreviousOrigins[anIdx] = theOrigins[anIdx];
- }
-
- aRenderFramebuffer = myAccumFrames % 2 ? myRaytraceFBO1 : myRaytraceFBO2;
- anAccumFramebuffer = myAccumFrames % 2 ? myRaytraceFBO2 : myRaytraceFBO1;
+ aRenderFramebuffer = myAccumFrames % 2 ? myRaytraceFBO1[aFBOIdx] : myRaytraceFBO2[aFBOIdx];
+ anAccumFramebuffer = myAccumFrames % 2 ? myRaytraceFBO2[aFBOIdx] : myRaytraceFBO1[aFBOIdx];
anAccumFramebuffer->ColorTexture()->Bind (
theGlContext, GL_TEXTURE0 + OpenGl_RT_PrevAccumTexture);
}
else if (myRenderParams.IsAntialiasingEnabled) // if 2-pass ray-tracing is used
{
- myRaytraceFBO1->BindBuffer (theGlContext);
+ myRaytraceFBO1[aFBOIdx]->BindBuffer (theGlContext);
glDisable (GL_BLEND);
}
theGlContext, GL_TEXTURE0 + OpenGl_RT_PrevAccumTexture);
theGlContext->core20fwd->glDrawArrays (GL_TRIANGLES, 0, 6);
-
- ++myAccumFrames;
}
else if (myRenderParams.IsAntialiasingEnabled)
{
- myRaytraceFBO1->ColorTexture()->Bind (theGlContext, GL_TEXTURE0 + OpenGl_RT_FsaaInputTexture);
+ myRaytraceFBO1[aFBOIdx]->ColorTexture()->Bind (theGlContext, GL_TEXTURE0 + OpenGl_RT_FsaaInputTexture);
aResult &= theGlContext->BindProgram (myPostFSAAProgram);
aResult &= myPostFSAAProgram->SetUniform (theGlContext,
myUniformLocations[1][OpenGl_RT_uOffsetY], aOffsetY);
- Handle(OpenGl_FrameBuffer)& aFramebuffer = anIt % 2 ? myRaytraceFBO2 : myRaytraceFBO1;
+ Handle(OpenGl_FrameBuffer)& aFramebuffer = anIt % 2 ? myRaytraceFBO2[aFBOIdx] : myRaytraceFBO1[aFBOIdx];
if (anIt == 3) // disable FBO on last iteration
{
// =======================================================================
Standard_Boolean OpenGl_View::raytrace (const Standard_Integer theSizeX,
const Standard_Integer theSizeY,
+ Graphic3d_Camera::Projection theProjection,
OpenGl_FrameBuffer* theReadDrawFbo,
const Handle(OpenGl_Context)& theGlContext)
{
return Standard_False;
}
- if (!resizeRaytraceBuffers (theSizeX, theSizeY, theGlContext))
+ if (!updateRaytraceBuffers (theSizeX, theSizeY, theGlContext))
{
return Standard_False;
}
aOrigins,
aDirects,
anUnviewMat,
+ theProjection,
theReadDrawFbo,
theGlContext);
}
#endif
+ if (myRenderParams.Method == Graphic3d_RM_RAYTRACING
+ && myRenderParams.IsGlobalIlluminationEnabled)
+ {
+ myAccumFrames++;
+ }
+
// bind default FBO
bindDefaultFbo();
{
aContext->ProjectionState.SetCurrent (myCamera->ProjectionMatrixF());
aContext->WorldViewState .SetCurrent (myCamera->OrientationMatrixF());
+ myAccumFrames = 0;
}
// Apply new matrix state if camera has changed or this view differs from the one
aContext->ProjectionState.SetCurrent (myCamera->ProjectionStereoRightF());
aContext->ApplyProjectionMatrix();
}
- renderScene (theOutputFBO, theToDrawImmediate);
+ renderScene (theProjection, theOutputFBO, theToDrawImmediate);
// ===============================
// Step 4: Trihedron
//function : renderStructs
//purpose :
//=======================================================================
-void OpenGl_View::renderStructs (OpenGl_FrameBuffer* theReadDrawFbo,
- const Standard_Boolean theToDrawImmediate)
+void OpenGl_View::renderStructs (Graphic3d_Camera::Projection theProjection,
+ OpenGl_FrameBuffer* theReadDrawFbo,
+ const Standard_Boolean theToDrawImmediate)
{
if ( myZLayers.NbStructures() <= 0 )
return;
}
// Ray-tracing polygonal primitive arrays
- raytrace (aSizeX, aSizeY, theReadDrawFbo, aCtx);
+ raytrace (aSizeX, aSizeY, theProjection, theReadDrawFbo, aCtx);
// Render upper (top and topmost) OpenGL layers
myZLayers.Render (myWorkspace, theToDrawImmediate, OpenGl_LF_Upper);
//function : renderScene
//purpose :
//=======================================================================
-void OpenGl_View::renderScene (OpenGl_FrameBuffer* theReadDrawFbo,
- const Standard_Boolean theToDrawImmediate)
+void OpenGl_View::renderScene (Graphic3d_Camera::Projection theProjection,
+ OpenGl_FrameBuffer* theReadDrawFbo,
+ const Standard_Boolean theToDrawImmediate)
{
const Handle(OpenGl_Context)& aContext = myWorkspace->GetGlContext();
myWorkspace->NamedStatus |= OPENGL_NS_FORBIDSETTEX;
myWorkspace->DisableTexture();
// Render the view
- renderStructs (theReadDrawFbo, theToDrawImmediate);
+ renderStructs (theProjection, theReadDrawFbo, theToDrawImmediate);
break;
case Graphic3d_TOD_ENVIRONMENT:
myWorkspace->EnableTexture (myTextureEnv);
}
// Render the view
- renderStructs (theReadDrawFbo, theToDrawImmediate);
+ renderStructs (theProjection, theReadDrawFbo, theToDrawImmediate);
myWorkspace->DisableTexture();
break;
// First pass
myWorkspace->NamedStatus &= ~OPENGL_NS_FORBIDSETTEX;
// Render the view
- renderStructs (theReadDrawFbo, theToDrawImmediate);
+ renderStructs (theProjection, theReadDrawFbo, theToDrawImmediate);
myWorkspace->DisableTexture();
// Second pass
myWorkspace->NamedStatus |= OPENGL_NS_FORBIDSETTEX;
// Render the view
- renderStructs (theReadDrawFbo, theToDrawImmediate);
+ renderStructs (theProjection, theReadDrawFbo, theToDrawImmediate);
myWorkspace->DisableTexture();
// Restore properties back
// 4) Determine new zooming in view space.
// 1. Determine normalized projection asymmetry (if any).
- Standard_Real anAssymX = Tan ( aCamSide.Angle (aFrustumPlane (1).Axis().Direction()))
- - Tan (-aCamSide.Angle (aFrustumPlane (2).Axis().Direction()));
- Standard_Real anAssymY = Tan ( aCamUp.Angle (aFrustumPlane (3).Axis().Direction()))
- - Tan (-aCamUp.Angle (aFrustumPlane (4).Axis().Direction()));
+ Standard_Real anAssymX = Tan (( aCamSide).Angle (aFrustumPlane (1).Axis().Direction()))
+ - Tan ((-aCamSide).Angle (aFrustumPlane (2).Axis().Direction()));
+ Standard_Real anAssymY = Tan (( aCamUp) .Angle (aFrustumPlane (3).Axis().Direction()))
+ - Tan ((-aCamUp) .Angle (aFrustumPlane (4).Axis().Direction()));
// 2. Determine how far should be the frustum planes placed from center
// of bounding box, in order to match the bounding box closely.
// \//
// //
// (frustum plane)
- aFitDistance.ChangeValue (1) *= Sqrt(1 + Pow (Tan ( aCamSide.Angle (aFrustumPlane (1).Axis().Direction())), 2.0));
- aFitDistance.ChangeValue (2) *= Sqrt(1 + Pow (Tan (-aCamSide.Angle (aFrustumPlane (2).Axis().Direction())), 2.0));
- aFitDistance.ChangeValue (3) *= Sqrt(1 + Pow (Tan ( aCamUp.Angle (aFrustumPlane (3).Axis().Direction())), 2.0));
- aFitDistance.ChangeValue (4) *= Sqrt(1 + Pow (Tan (-aCamUp.Angle (aFrustumPlane (4).Axis().Direction())), 2.0));
- aFitDistance.ChangeValue (5) *= Sqrt(1 + Pow (Tan ( aCamDir.Angle (aFrustumPlane (5).Axis().Direction())), 2.0));
- aFitDistance.ChangeValue (6) *= Sqrt(1 + Pow (Tan (-aCamDir.Angle (aFrustumPlane (6).Axis().Direction())), 2.0));
+ aFitDistance.ChangeValue (1) *= Sqrt(1 + Pow (Tan ( aCamSide .Angle (aFrustumPlane (1).Axis().Direction())), 2.0));
+ aFitDistance.ChangeValue (2) *= Sqrt(1 + Pow (Tan ((-aCamSide).Angle (aFrustumPlane (2).Axis().Direction())), 2.0));
+ aFitDistance.ChangeValue (3) *= Sqrt(1 + Pow (Tan ( aCamUp .Angle (aFrustumPlane (3).Axis().Direction())), 2.0));
+ aFitDistance.ChangeValue (4) *= Sqrt(1 + Pow (Tan ((-aCamUp) .Angle (aFrustumPlane (4).Axis().Direction())), 2.0));
+ aFitDistance.ChangeValue (5) *= Sqrt(1 + Pow (Tan ( aCamDir .Angle (aFrustumPlane (5).Axis().Direction())), 2.0));
+ aFitDistance.ChangeValue (6) *= Sqrt(1 + Pow (Tan ((-aCamDir) .Angle (aFrustumPlane (6).Axis().Direction())), 2.0));
Standard_Real aViewSizeXv = aFitDistance (1) + aFitDistance (2);
Standard_Real aViewSizeYv = aFitDistance (3) + aFitDistance (4);
Standard_Boolean isActive = ViewerTest_myDefaultCaps.contextStereo;
theDI << "Stereo " << (isActive ? "ON" : "OFF") << "\n";
+ if (isActive)
+ {
+ TCollection_AsciiString aMode;
+ switch (aView->RenderingParams().StereoMode)
+ {
+ case Graphic3d_StereoMode_QuadBuffer : aMode = "quadBuffer"; break;
+ case Graphic3d_StereoMode_RowInterlaced : aMode = "rowInterlaced"; break;
+ case Graphic3d_StereoMode_ColumnInterlaced : aMode = "columnInterlaced"; break;
+ case Graphic3d_StereoMode_ChessBoard : aMode = "chessBoard"; break;
+ case Graphic3d_StereoMode_SideBySide : aMode = "sideBySide"; break;
+ case Graphic3d_StereoMode_OverUnder : aMode = "overUnder"; break;
+ case Graphic3d_StereoMode_SoftPageFlip : aMode = "softpageflip"; break;
+ case Graphic3d_StereoMode_Anaglyph :
+ aMode = "anaglyph";
+ switch (aView->RenderingParams().AnaglyphFilter)
+ {
+ case Graphic3d_RenderingParams::Anaglyph_RedCyan_Simple : aMode.AssignCat (" (redCyanSimple)"); break;
+ case Graphic3d_RenderingParams::Anaglyph_RedCyan_Optimized : aMode.AssignCat (" (redCyan)"); break;
+ case Graphic3d_RenderingParams::Anaglyph_YellowBlue_Simple : aMode.AssignCat (" (yellowBlueSimple)"); break;
+ case Graphic3d_RenderingParams::Anaglyph_YellowBlue_Optimized: aMode.AssignCat (" (yellowBlue)"); break;
+ case Graphic3d_RenderingParams::Anaglyph_GreenMagenta_Simple : aMode.AssignCat (" (greenMagentaSimple)"); break;
+ default: break;
+ }
+ default: break;
+ }
+ theDI << "Mode " << aMode << "\n";
+ }
return 0;
}
catch { vfit }
-if { ![info exists subgroup] || $subgroup != "mesh" } {
+if { [info exists subgroup] && $subgroup == "raytrace" } {
+
+ # dump final image for raytraced visualization tests
+ if { ![info exists to_dump_screen] || $to_dump_screen == 1 } {
+ catch { set render_parameters [vrenderparams] }
+ catch { set stereo_parameters [vstereo] }
+
+ # for global illumination mode accumulate frames before dumping
+ regexp {renderMode *: *([A-Za-z]+)} $render_parameters full renderMode
+ regexp {GI *: *([A-Za-z]+)} $render_parameters full gi_enabled
+ if { [string equal -nocase "raytrace" $renderMode] && [string equal -nocase "on" $gi_enabled] } {
+ vfps 200
+ }
+
+ set dump_options {}
+ regexp {Stereo *([A-Za-z]+)} $stereo_parameters full stereo_enabled
+ regexp {Mode *([A-Za-z]+)} $stereo_parameters full stereo_mode
+ if { [string equal -nocase "on" $stereo_enabled] } {
+ set dump_options {-stereo blend}
+ }
+
+ if { [ catch { vdump $imagedir/${test_image}.png {*}$dump_options } catch_result ] } {
+ puts $catch_result
+ }
+ }
+} elseif { ![info exists subgroup] || $subgroup != "mesh" } {
+
+ # dump final image for common visualization tests
if { ![info exists to_dump_screen] && [ catch { vdump $imagedir/${test_image}.png } catch_result ] } {
puts $catch_result
}
+set subgroup "raytrace"
vinit View1
\ No newline at end of file
--- /dev/null
+puts "============"
+puts "CR26617"
+puts "============"
+puts ""
+
+##########################################################################################
+# Visualization, Ray Tracing - adopt progressive rendering Path Tracing for rendering stereoscopic pair
+##########################################################################################
+
+# custom shapes
+set aShape1 [locate_data_file occ/Top.brep]
+set aShape2 [locate_data_file occ/Bottom.brep]
+
+# setup 3D viewer content
+vinit name=View1 w=512 h=512
+vglinfo
+
+vvbo 0
+vsetdispmode 1
+vsetgradientbg 180 200 255 180 180 180 2
+restore $aShape1 s1
+restore $aShape2 s2
+vdisplay s1 s2
+vsetmaterial s1 Silver
+vsetmaterial s2 Pewter
+vsetlocation s1 0.0 0.1 0.0
+vlight change 0 pos -1 1 1
+
+# activate ray-tracing
+vrenderparams -raytrace
+vtextureenv on 5
+vrenderparams -reflections -gi
+
+# activate stereo
+vstereo on
+vstereo -mode anaglyph
+vcamera -iod 0.1
+vfit