From 4c5133866b71812e8c02e1a7fb63ae4be9ddef08 Mon Sep 17 00:00:00 2001 From: osa Date: Thu, 5 Mar 2015 14:48:42 +0300 Subject: [PATCH] 0023200: Visualization - prevent multiple triangulating of a shape that already has been triangulated Add new flag IsAutoTriangulated to Prs3d_Drawer. It is True by default. If this flag is True automatic re-triangulation with deflection-check logic will be applied. Else this feature will be disable and triangulation is expected to be computed by application itself. Change the syntax of vdefalts command. Add new parameter -autoTriang for check of AutoTriangulated functionality. Adjust camera position in test case bugs/xde/bug23969 --- src/AIS/AIS_ColoredShape.cxx | 19 +++-- src/AIS/AIS_ConnectedInteractive.cxx | 3 +- src/AIS/AIS_Shape.cxx | 40 ++++----- src/AIS/AIS_TexturedShape.cxx | 24 +++--- src/Prs3d/Prs3d_Drawer.cxx | 14 ++++ src/Prs3d/Prs3d_Drawer.hxx | 19 +++++ src/StdPrs/StdPrs_HLRPolyShape.cxx | 9 ++- src/StdPrs/StdPrs_ShadedShape.cxx | 49 ++++++++++- src/ViewerTest/ViewerTest_ViewerCommands.cxx | 85 ++++++++++++++------ tests/bugs/vis/bug21753 | 2 +- tests/bugs/vis/bug23200 | 54 +++++++++++++ tests/bugs/vis/bug23200_1 | 23 ++++++ tests/bugs/vis/bug23886_1 | 2 +- tests/bugs/vis/bug23886_2 | 2 +- tests/bugs/vis/bug23886_3 | 2 +- tests/bugs/xde/bug23969 | 5 ++ tests/v3d/glsl/phong_couple | 2 +- tests/v3d/glsl/phong_fuse | 2 +- tests/v3d/glsl/phong_fuse2 | 2 +- 19 files changed, 281 insertions(+), 77 deletions(-) create mode 100644 tests/bugs/vis/bug23200 create mode 100644 tests/bugs/vis/bug23200_1 diff --git a/src/AIS/AIS_ColoredShape.cxx b/src/AIS/AIS_ColoredShape.cxx index 7e31948068..5d0f8d99dd 100644 --- a/src/AIS/AIS_ColoredShape.cxx +++ b/src/AIS/AIS_ColoredShape.cxx @@ -308,16 +308,19 @@ void AIS_ColoredShape::Compute (const Handle(PrsMgr_PresentationManager3d)& , if (theMode == AIS_Shaded) { - // compute mesh for entire shape beforehand to ensure consistency and optimizations (parallelization) - Standard_Real anAnglePrev, anAngleNew, aCoeffPrev, aCoeffNew; - Standard_Boolean isOwnDeviationAngle = OwnDeviationAngle (anAngleNew, anAnglePrev); - Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient(aCoeffNew, aCoeffPrev); - if ((isOwnDeviationAngle && Abs (anAngleNew - anAnglePrev) > Precision::Angular()) - || (isOwnDeviationCoefficient && Abs (aCoeffNew - aCoeffPrev) > Precision::Confusion())) + if (myDrawer->IsAutoTriangulation()) { - BRepTools::Clean (myshape); + // compute mesh for entire shape beforehand to ensure consistency and optimizations (parallelization) + Standard_Real anAnglePrev, anAngleNew, aCoeffPrev, aCoeffNew; + Standard_Boolean isOwnDeviationAngle = OwnDeviationAngle (anAngleNew, anAnglePrev); + Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient(aCoeffNew, aCoeffPrev); + if ((isOwnDeviationAngle && Abs (anAngleNew - anAnglePrev) > Precision::Angular()) + || (isOwnDeviationCoefficient && Abs (aCoeffNew - aCoeffPrev) > Precision::Confusion())) + { + BRepTools::Clean (myshape); + } + StdPrs_ShadedShape::Tessellate (myshape, myDrawer); } - StdPrs_ShadedShape::Tessellate (myshape, myDrawer); } TopoDS_Compound anOpened, aClosed; diff --git a/src/AIS/AIS_ConnectedInteractive.cxx b/src/AIS/AIS_ConnectedInteractive.cxx index 10a7368765..9a4fef784f 100644 --- a/src/AIS/AIS_ConnectedInteractive.cxx +++ b/src/AIS/AIS_ConnectedInteractive.cxx @@ -225,7 +225,8 @@ void AIS_ConnectedInteractive::Compute (const Handle(Prs3d_Projector)& theProjec // process HLRAngle and HLRDeviationCoefficient() Standard_Real aPrevAngle = myDrawer->HLRAngle(); Standard_Real aNewAngle = aDefaultDrawer->HLRAngle(); - if (Abs (aNewAngle - aPrevAngle) > Precision::Angular()) + if (myDrawer->IsAutoTriangulation() && + Abs (aNewAngle - aPrevAngle) > Precision::Angular()) { BRepTools::Clean (theShape); } diff --git a/src/AIS/AIS_Shape.cxx b/src/AIS/AIS_Shape.cxx index 668dfe3af4..b05772dca1 100644 --- a/src/AIS/AIS_Shape.cxx +++ b/src/AIS/AIS_Shape.cxx @@ -165,13 +165,16 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat } case 1: { - Standard_Real anAnglePrev, anAngleNew, aCoeffPrev, aCoeffNew; - Standard_Boolean isOwnDeviationAngle = OwnDeviationAngle (anAngleNew, anAnglePrev); - Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient(aCoeffNew, aCoeffPrev); - if ((isOwnDeviationAngle && Abs (anAngleNew - anAnglePrev) > Precision::Angular()) - || (isOwnDeviationCoefficient && Abs (aCoeffNew - aCoeffPrev) > Precision::Confusion())) + if (myDrawer->IsAutoTriangulation()) { - BRepTools::Clean (myshape); + Standard_Real anAnglePrev, anAngleNew, aCoeffPrev, aCoeffNew; + Standard_Boolean isOwnDeviationAngle = OwnDeviationAngle (anAngleNew, anAnglePrev); + Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient(aCoeffNew, aCoeffPrev); + if ((isOwnDeviationAngle && Abs (anAngleNew - anAnglePrev) > Precision::Angular()) + || (isOwnDeviationCoefficient && Abs (aCoeffNew - aCoeffPrev) > Precision::Confusion())) + { + BRepTools::Clean (myshape); + } } //shading only on face... @@ -259,20 +262,18 @@ void AIS_Shape::Compute(const Handle(Prs3d_Projector)& aProjector, Aspect_TypeOfDeflection prevdef = defdrawer->TypeOfDeflection(); defdrawer->SetTypeOfDeflection(Aspect_TOD_RELATIVE); -// coefficients for calculation - - Standard_Real prevangle, newangle ,prevcoeff,newcoeff ; - Standard_Boolean isOwnHLRDeviationAngle = OwnHLRDeviationAngle(newangle,prevangle); - Standard_Boolean isOwnHLRDeviationCoefficient = OwnHLRDeviationCoefficient(newcoeff,prevcoeff); - if (((Abs (newangle - prevangle) > Precision::Angular()) && isOwnHLRDeviationAngle) || - ((Abs (newcoeff - prevcoeff) > Precision::Confusion()) && isOwnHLRDeviationCoefficient)) { -#ifdef OCCT_DEBUG - cout << "AIS_Shape : compute"<IsAutoTriangulation()) + { + // coefficients for calculation + Standard_Real aPrevAngle, aNewAngle, aPrevCoeff, aNewCoeff; + Standard_Boolean isOwnHLRDeviationAngle = OwnHLRDeviationAngle (aNewAngle, aPrevAngle); + Standard_Boolean isOwnHLRDeviationCoefficient = OwnHLRDeviationCoefficient (aNewCoeff, aPrevCoeff); + if (((Abs (aNewAngle - aPrevAngle) > Precision::Angular()) && isOwnHLRDeviationAngle) || + ((Abs (aNewCoeff - aPrevCoeff) > Precision::Confusion()) && isOwnHLRDeviationCoefficient)) + { BRepTools::Clean(SH); } + } { try { @@ -381,7 +382,6 @@ void AIS_Shape::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, // POP protection against crash in low layers Standard_Real aDeflection = Prs3d::GetDeflection(shape, myDrawer); - Standard_Boolean autoTriangulation = Standard_True; try { OCC_CATCH_SIGNALS StdSelect_BRepSelectionTool::Load(aSelection, @@ -390,7 +390,7 @@ void AIS_Shape::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, TypOfSel, aDeflection, myDrawer->HLRAngle(), - autoTriangulation); + myDrawer->IsAutoTriangulation()); } catch ( Standard_Failure ) { // cout << "a Shape should be incorrect : A Selection on the Bnd is activated "< Precision::Angular()) && isOwnDeviationAngle) || - ((Abs (newcoeff - prevcoeff) > Precision::Confusion()) && isOwnDeviationCoefficient)) { - BRepTools::Clean (myshape); + if (myDrawer->IsAutoTriangulation()) + { + Standard_Real aPrevAngle; + Standard_Real aNewAngle; + Standard_Real aPrevCoeff; + Standard_Real aNewCoeff; + + Standard_Boolean isOwnDeviationAngle = OwnDeviationAngle (aNewAngle, aPrevAngle); + Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient (aNewCoeff,aPrevCoeff); + if (((Abs (aNewAngle - aPrevAngle) > Precision::Angular()) && isOwnDeviationAngle) || + ((Abs (aNewCoeff - aPrevCoeff) > Precision::Confusion()) && isOwnDeviationCoefficient)) + { + BRepTools::Clean (myshape); + } } if (myshape.ShapeType() > TopAbs_FACE) diff --git a/src/Prs3d/Prs3d_Drawer.cxx b/src/Prs3d/Prs3d_Drawer.cxx index 71b2a6e055..9fd5643620 100644 --- a/src/Prs3d/Prs3d_Drawer.cxx +++ b/src/Prs3d/Prs3d_Drawer.cxx @@ -50,6 +50,8 @@ Prs3d_Drawer::Prs3d_Drawer() myHasOwnHLRDeviationAngle (Standard_False), myIsoOnPlane (Standard_False), myHasOwnIsoOnPlane (Standard_False), + myIsAutoTriangulated (Standard_True), + myHasOwnIsAutoTriangulated (Standard_False), myHasOwnUIsoAspect (Standard_False), myHasOwnVIsoAspect (Standard_False), @@ -229,6 +231,17 @@ void Prs3d_Drawer::SetHLRAngle (const Standard_Real theAngle) myHasOwnHLRDeviationAngle = Standard_True; } +// ======================================================================= +// function : SetAutoTriangulation +// purpose : +// ======================================================================= + +void Prs3d_Drawer::SetAutoTriangulation (const Standard_Boolean theIsEnabled) +{ + myHasOwnIsAutoTriangulated = Standard_True; + myIsAutoTriangulated = theIsEnabled; +} + // ======================================================================= // function : FreeBoundaryAspect // purpose : @@ -1027,6 +1040,7 @@ void Prs3d_Drawer::ClearLocalAttributes() myHasOwnDeviationAngle = Standard_False; myHasOwnHLRDeviationAngle = Standard_False; myHasOwnIsoOnPlane = Standard_False; + myHasOwnIsAutoTriangulated = Standard_False; myHasOwnWireDraw = Standard_False; myHasOwnShadingAspectGlobal = Standard_False; myHasOwnLineArrowDraw = Standard_False; diff --git a/src/Prs3d/Prs3d_Drawer.hxx b/src/Prs3d/Prs3d_Drawer.hxx index 58232df8d7..6ac8d5454d 100644 --- a/src/Prs3d/Prs3d_Drawer.hxx +++ b/src/Prs3d/Prs3d_Drawer.hxx @@ -309,6 +309,23 @@ public: : 0.0; } + //! Sets IsAutoTriangulated on or off by setting the parameter theIsEnabled to true or false. + //! If this flag is True automatic re-triangulation with deflection-check logic will be applied. + //! Else this feature will be disable and triangulation is expected to be computed by application itself + //! and no shading presentation at all if unavailable. + Standard_EXPORT void SetAutoTriangulation (const Standard_Boolean theIsEnabled); + + //! Returns True if automatic triangulation is enabled. + Standard_Boolean IsAutoTriangulation() const + { + return HasOwnIsAutoTriangulation() || myLink.IsNull() + ? myIsAutoTriangulated + : myLink->IsAutoTriangulation(); + } + + //! Returns true if the drawer has IsoOnPlane setting active. + Standard_Boolean HasOwnIsAutoTriangulation() const { return myHasOwnIsAutoTriangulated; } + //! Defines the attributes which are used when drawing an //! U isoparametric curve of a face. Defines the number //! of U isoparametric curves to be drawn for a single face. @@ -840,6 +857,8 @@ protected: Standard_Real myPreviousHLRDeviationAngle; Standard_Boolean myIsoOnPlane; Standard_Boolean myHasOwnIsoOnPlane; + Standard_Boolean myIsAutoTriangulated; + Standard_Boolean myHasOwnIsAutoTriangulated; Handle(Prs3d_IsoAspect) myUIsoAspect; Standard_Boolean myHasOwnUIsoAspect; diff --git a/src/StdPrs/StdPrs_HLRPolyShape.cxx b/src/StdPrs/StdPrs_HLRPolyShape.cxx index cddcff878a..ef05b629b2 100644 --- a/src/StdPrs/StdPrs_HLRPolyShape.cxx +++ b/src/StdPrs/StdPrs_HLRPolyShape.cxx @@ -64,9 +64,12 @@ void StdPrs_HLRPolyShape::Add(const Handle (Prs3d_Presentation)& aPresentation, TColgp_SequenceOfPnt HiddenPnts; TColgp_SequenceOfPnt SeenPnts; - const Standard_Boolean rel = aDrawer->TypeOfDeflection() == Aspect_TOD_RELATIVE; - Standard_Real def = rel? aDrawer->HLRDeviationCoefficient() : aDrawer->MaximalChordialDeviation(); - BRepMesh_IncrementalMesh mesh(aShape, def, rel, aDrawer->HLRAngle()); + if (aDrawer->IsAutoTriangulation()) + { + const Standard_Boolean aRel = aDrawer->TypeOfDeflection() == Aspect_TOD_RELATIVE; + Standard_Real aDef = aRel ? aDrawer->HLRDeviationCoefficient() : aDrawer->MaximalChordialDeviation(); + BRepMesh_IncrementalMesh mesh(aShape, aDef, aRel, aDrawer->HLRAngle()); + } Handle(HLRBRep_PolyAlgo) hider = new HLRBRep_PolyAlgo(aShape); diff --git a/src/StdPrs/StdPrs_ShadedShape.cxx b/src/StdPrs/StdPrs_ShadedShape.cxx index 444d4d411a..3ddef99171 100644 --- a/src/StdPrs/StdPrs_ShadedShape.cxx +++ b/src/StdPrs/StdPrs_ShadedShape.cxx @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -40,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -105,6 +107,42 @@ namespace } } + //! Computes special wireframe presentation for faces without triangulation. + void wireframeNoTriangFacesFromShape (const Handle(Prs3d_Presentation)& thePrs, + const TopoDS_Shape& theShape, + const Handle(Prs3d_Drawer)& theDrawer) + { + TopoDS_Compound aCompoundWF; + BRep_Builder aBuilder; + aBuilder.MakeCompound (aCompoundWF); + TopLoc_Location aLoc; + Standard_Boolean hasElement = Standard_False; + + for (TopExp_Explorer aShapeIter(theShape, TopAbs_FACE); aShapeIter.More(); aShapeIter.Next()) + { + const TopoDS_Face& aFace = TopoDS::Face (aShapeIter.Current()); + const Handle(Poly_Triangulation) aTriang = BRep_Tool::Triangulation (aFace, aLoc); + if (aTriang.IsNull()) + { + hasElement = Standard_True; + aBuilder.Add (aCompoundWF, aFace); + } + } + + if (hasElement) + { + Standard_Integer aPrevUIsoNb = theDrawer->UIsoAspect()->Number(); + Standard_Integer aPrevVIsoNb = theDrawer->VIsoAspect()->Number(); + theDrawer->UIsoAspect()->SetNumber (5); + theDrawer->VIsoAspect()->SetNumber (5); + + StdPrs_WFDeflectionShape::Add (thePrs, aCompoundWF, theDrawer); + + theDrawer->UIsoAspect()->SetNumber (aPrevUIsoNb); + theDrawer->VIsoAspect()->SetNumber (aPrevVIsoNb); + } + } + //! Gets triangulation of every face of shape and fills output array of triangles static Handle(Graphic3d_ArrayOfTriangles) fillTriangles (const TopoDS_Shape& theShape, const Standard_Boolean theHasTexels, @@ -504,8 +542,15 @@ void StdPrs_ShadedShape::Add (const Handle (Prs3d_Presentation)& thePrs, // add wireframe presentation for isolated edges and vertices wireframeFromShape (thePrs, theShape, theDrawer); - // Triangulation completeness is important for "open-closed" analysis - perform tessellation beforehand - Tessellate (theShape, theDrawer); + // Use automatic re-triangulation with deflection-check logic only if this feature is enable + if (theDrawer->IsAutoTriangulation()) + { + // Triangulation completeness is important for "open-closed" analysis - perform tessellation beforehand + Tessellate (theShape, theDrawer); + } + + // add special wireframe presentation for faces without triangulation + wireframeNoTriangFacesFromShape (thePrs, theShape, theDrawer); // The shape types listed below need advanced analysis as potentially containing // both closed and open parts. Solids are also included, because they might diff --git a/src/ViewerTest/ViewerTest_ViewerCommands.cxx b/src/ViewerTest/ViewerTest_ViewerCommands.cxx index cd0a073498..009b8efe56 100644 --- a/src/ViewerTest/ViewerTest_ViewerCommands.cxx +++ b/src/ViewerTest/ViewerTest_ViewerCommands.cxx @@ -6620,44 +6620,74 @@ static int VDefaults (Draw_Interpretor& theDi, << "AbsoluteDeflection: " << aDefParams->MaximalChordialDeviation() << "\n"; } theDi << "AngularDeflection: " << (180.0 * aDefParams->HLRAngle() / M_PI) << "\n"; + theDi << "AutoTriangulation: " << (aDefParams->IsAutoTriangulation() ? "on" : "off") << "\n"; return 0; } for (Standard_Integer anArgIter = 1; anArgIter < theArgsNb; ++anArgIter) { TCollection_AsciiString anArg (theArgVec[anArgIter]); - TCollection_AsciiString aKey, aValue; - if (!ViewerTest::SplitParameter (anArg, aKey, aValue) - || aValue.IsEmpty()) - { - std::cerr << "Error, wrong syntax at: '" << anArg.ToCString() << "'!\n"; - return 1; - } - - aKey.UpperCase(); - if (aKey == "ABSDEFL" - || aKey == "ABSOLUTEDEFLECTION" - || aKey == "DEFL" - || aKey == "DEFLECTION") + anArg.UpperCase(); + if (anArg == "-ABSDEFL" + || anArg == "-ABSOLUTEDEFLECTION" + || anArg == "-DEFL" + || anArg == "-DEFLECTION") { + if (++anArgIter >= theArgsNb) + { + std::cout << "Error: wrong syntax at " << anArg << "\n"; + return 1; + } aDefParams->SetTypeOfDeflection (Aspect_TOD_ABSOLUTE); - aDefParams->SetMaximalChordialDeviation (aValue.RealValue()); + aDefParams->SetMaximalChordialDeviation (Draw::Atof (theArgVec[anArgIter])); } - else if (aKey == "RELDEFL" - || aKey == "RELATIVEDEFLECTION" - || aKey == "DEVCOEFF" - || aKey == "DEVIATIONCOEFF" - || aKey == "DEVIATIONCOEFFICIENT") + else if (anArg == "-RELDEFL" + || anArg == "-RELATIVEDEFLECTION" + || anArg == "-DEVCOEFF" + || anArg == "-DEVIATIONCOEFF" + || anArg == "-DEVIATIONCOEFFICIENT") { + if (++anArgIter >= theArgsNb) + { + std::cout << "Error: wrong syntax at " << anArg << "\n"; + return 1; + } aDefParams->SetTypeOfDeflection (Aspect_TOD_RELATIVE); - aDefParams->SetDeviationCoefficient (aValue.RealValue()); + aDefParams->SetDeviationCoefficient (Draw::Atof (theArgVec[anArgIter])); } - else if (aKey == "ANGDEFL" - || aKey == "ANGULARDEFL" - || aKey == "ANGULARDEFLECTION") + else if (anArg == "-ANGDEFL" + || anArg == "-ANGULARDEFL" + || anArg == "-ANGULARDEFLECTION") { + if (++anArgIter >= theArgsNb) + { + std::cout << "Error: wrong syntax at " << anArg << "\n"; + return 1; + } // currently HLRDeviationAngle is used instead of DeviationAngle in most places - aDefParams->SetHLRAngle (M_PI * aValue.RealValue() / 180.0); + aDefParams->SetHLRAngle (M_PI * Draw::Atof (theArgVec[anArgIter]) / 180.0); + } + if (anArg == "-AUTOTR" + || anArg == "-AUTOTRIANG" + || anArg == "-AUTOTRIANGULATION") + { + if (++anArgIter >= theArgsNb) + { + std::cout << "Error: wrong syntax at " << anArg << "\n"; + return 1; + } + TCollection_AsciiString aValue (theArgVec[anArgIter]); + aValue.LowerCase(); + if (aValue == "on" + || aValue == "1") + { + aDefParams->SetAutoTriangulation (Standard_True); + } + else if (aValue == "off" + || aValue == "0") + { + aDefParams->SetAutoTriangulation (Standard_False); + } } else { @@ -7969,8 +7999,11 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands) " this command sets texture details mode for the specified view.\n" , __FILE__, VSetTextureMode, group); theCommands.Add("vdefaults", - "vdefaults [absDefl=value] [devCoeff=value] [angDefl=value]", - __FILE__, VDefaults, group); + "vdefaults [-absDefl value]" + "\n\t\t: [-devCoeff value]" + "\n\t\t: [-angDefl value]" + "\n\t\t: [-autoTriang {off/on | 0/1}]" + , __FILE__, VDefaults, group); theCommands.Add("vlight", "tool to manage light sources, without arguments shows list of lights." "\n Main commands: " diff --git a/tests/bugs/vis/bug21753 b/tests/bugs/vis/bug21753 index 19b790bded..5bd92c3f4e 100644 --- a/tests/bugs/vis/bug21753 +++ b/tests/bugs/vis/bug21753 @@ -7,7 +7,7 @@ puts "==================================" # set rough meshing parameters vinit -vdefaults absDefl=10 devCoeff=0.1 +vdefaults -absDefl 10 -devCoeff 0.1 puts "Displaying two equal cones, one with Phong shader" pcone p_gouraud 10 100 100 diff --git a/tests/bugs/vis/bug23200 b/tests/bugs/vis/bug23200 new file mode 100644 index 0000000000..a1378a86c7 --- /dev/null +++ b/tests/bugs/vis/bug23200 @@ -0,0 +1,54 @@ +puts "============" +puts "CR23200" +puts "Check that the shape is automatic re-triangulated with deflection-check logic" +puts "in case of enabled auto triangulation feature (its own triangulation can be lost)." +puts "And it keeps its already computed triangulation" +puts "in case of disabled auto triangulation feature." +puts "============" +puts "" + +set aDefaultShape $imagedir/${casename}_shape.png +set aShapeAutoTr $imagedir/${casename}_shape_auto_triangulation.png +set aShapeNotAutoTr $imagedir/${casename}_shape_not_auto_triangulation.png + +vinit View1 +vclear +vaxo +vsetdispmode 1 +vdefaults -autoTriang on +psphere s 0.5 +vdisplay s +vfit +vdump $aDefaultShape + +vclear +tclean s +incmesh s 0.1 -a 45 +set tri_info [trinfo s] +regexp { +([-0-9.+eE]+) +triangles} $tri_info full triIncmesh1 + +vdisplay s +set tri_info [trinfo s] +regexp { +([-0-9.+eE]+) +triangles} $tri_info full triAutoTrShape +vfit +vdump $aShapeAutoTr + +vclear +vdefaults -autoTriang off +tclean s +incmesh s 0.1 -a 45 +set tri_info [trinfo s] +regexp { +([-0-9.+eE]+) +triangles} $tri_info full triIncmesh2 + +vdisplay s +set tri_info [trinfo s] +regexp { +([-0-9.+eE]+) +triangles} $tri_info full triNotAutoTrShape +vfit +vdump $aShapeNotAutoTr + +if {${triIncmesh1} == ${triAutoTrShape}} { + puts "ERROR : Test failed. Incorrect triangulation in case of enabled auto triangulation feature." +} +if {${triIncmesh2} != ${triNotAutoTrShape}} { + puts "ERROR : Test failed. Incorrect triangulation in case of disabled auto triangulation feature." +} diff --git a/tests/bugs/vis/bug23200_1 b/tests/bugs/vis/bug23200_1 new file mode 100644 index 0000000000..1f2fc8398b --- /dev/null +++ b/tests/bugs/vis/bug23200_1 @@ -0,0 +1,23 @@ +puts "============" +puts "CR23200" +puts "Check that the shape doesn't have a shading presentation" +puts "due to its triangulation isn't computed in case of disabled auto triangulation feature." +puts "But in this case the shape should have special wireframe presentation." +puts "============" +puts "" + +vinit View1 +vclear +vaxo +vsetdispmode 1 +vdefaults -autoTriang off +pcone c 0 5 10 +vdisplay c +vfit + +set aColor [vreadpixel 200 77 rgb name] +vdump $imagedir/${casename}_shape_pres.png + +if {"$aColor" != "GRAY75"} { + puts "Error: shading presentation of shape is incorrect" +} diff --git a/tests/bugs/vis/bug23886_1 b/tests/bugs/vis/bug23886_1 index 32b650a155..5815f0c7cf 100755 --- a/tests/bugs/vis/bug23886_1 +++ b/tests/bugs/vis/bug23886_1 @@ -12,7 +12,7 @@ vinit vdisplay s vfit -vdefaults angDefl=1 +vdefaults -angDefl 1 vsetdispmode s 1 vdump ${imagedir}/${casename}_1.png diff --git a/tests/bugs/vis/bug23886_2 b/tests/bugs/vis/bug23886_2 index 15ee4e1e16..8bc69e9a86 100755 --- a/tests/bugs/vis/bug23886_2 +++ b/tests/bugs/vis/bug23886_2 @@ -12,7 +12,7 @@ vinit vdisplay s vfit -vdefaults angDefl=1 +vdefaults -angDefl 1 vsetdispmode s 1 vdump ${imagedir}/${casename}_1.png diff --git a/tests/bugs/vis/bug23886_3 b/tests/bugs/vis/bug23886_3 index 054500061d..8917585e22 100755 --- a/tests/bugs/vis/bug23886_3 +++ b/tests/bugs/vis/bug23886_3 @@ -12,7 +12,7 @@ vinit vdisplay s vfit -vdefaults angDefl=1 +vdefaults -angDefl 1 vsetdispmode s 1 vdump ${imagedir}/${casename}_1.png diff --git a/tests/bugs/xde/bug23969 b/tests/bugs/xde/bug23969 index f6df352eac..86422c1956 100644 --- a/tests/bugs/xde/bug23969 +++ b/tests/bugs/xde/bug23969 @@ -12,7 +12,11 @@ XGetOneShape res_1 D_First vinit vsetdispmode 1 vdisplay res_1 + vfit +vdump $::imagedir/${::casename}_fit.png + +vviewparams -eye 106.849 -177.049 169.775 -at -70.2 -5.456e-015 -7.274 -up -0.408 0.408 0.816 -scale 3.048 set ver_color [vreadpixel 157 104] if {$ver_color == "0 0 0 0"} { @@ -34,5 +38,6 @@ set ver_color [vreadpixel 243 323] if {$ver_color == "0 0 0 0"} { puts "ERROR: OCC23969 is reproduced" } +vdump $::imagedir/${::casename}_center.png set 3dviewer 1 diff --git a/tests/v3d/glsl/phong_couple b/tests/v3d/glsl/phong_couple index edcba9c633..2922b1a814 100644 --- a/tests/v3d/glsl/phong_couple +++ b/tests/v3d/glsl/phong_couple @@ -10,7 +10,7 @@ box b 2 0 0 1 0.5 0.25 # draw box vinit View1 vclear -vdefaults absDefl=0.5 +vdefaults -absDefl 0.5 vsetdispmode 1 vaxo vdisplay f diff --git a/tests/v3d/glsl/phong_fuse b/tests/v3d/glsl/phong_fuse index 11fe8a931b..6d183adb36 100644 --- a/tests/v3d/glsl/phong_fuse +++ b/tests/v3d/glsl/phong_fuse @@ -9,7 +9,7 @@ tclean f # draw box vinit View1 vclear -vdefaults absDefl=0.5 +vdefaults -absDefl 0.5 vsetdispmode 1 vaxo vdisplay f diff --git a/tests/v3d/glsl/phong_fuse2 b/tests/v3d/glsl/phong_fuse2 index f65abf9dd7..0f465ef0d4 100644 --- a/tests/v3d/glsl/phong_fuse2 +++ b/tests/v3d/glsl/phong_fuse2 @@ -9,7 +9,7 @@ tclean f # draw box vinit View1 vclear -vdefaults absDefl=0.5 +vdefaults -absDefl 0.5 vsetdispmode 1 vaxo vdisplay f -- 2.20.1