From d790688908082d0e8047cab3b1a3a94b1834f614 Mon Sep 17 00:00:00 2001 From: Viktor UZLOV Date: Thu, 15 Jul 2021 20:38:17 +0300 Subject: [PATCH] #19463 fix edges flickering with group of volumes --- src/OBJECT/SMESH_Actor.cxx | 20 +++++++++++--------- src/OBJECT/SMESH_Actor.h | 3 +++ src/OBJECT/SMESH_ActorDef.h | 3 +++ src/SMESHGUI/SMESHGUI_VTKUtils.cxx | 1 + 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/OBJECT/SMESH_Actor.cxx b/src/OBJECT/SMESH_Actor.cxx index 8baeb3c8b..0b3dcee32 100644 --- a/src/OBJECT/SMESH_Actor.cxx +++ b/src/OBJECT/SMESH_Actor.cxx @@ -1270,15 +1270,7 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj, // coincident patch. See also #18940. // NOTE: use Resolve coincident topology for actors in the same // mapper. If several mappers, then use Relative coincident topology - double aFactor, aUnits; - my2DActor->GetPolygonOffsetParameters(aFactor,aUnits); - my2DActor->SetPolygonOffsetParameters(aFactor,aUnits); - my2DExtActor->SetPolygonOffsetParameters(aFactor,aUnits*0.5); - my3DActor->SetPolygonOffsetParameters(aFactor*2,aUnits*2); - myHighlitableActor->GetMapper()->SetRelativeCoincidentTopologyLineOffsetParameters(aFactor*(-1.0), - aUnits*(-50)); - my2DActor->GetMapper()->SetRelativeCoincidentTopologyPolygonOffsetParameters(-aFactor, -aUnits); - my3DActor->GetMapper()->SetRelativeCoincidentTopologyLineOffsetParameters(-aUnits-1, -aUnits-1); + SetRelativeTopologyOffsetParameters(2, 2); SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr(); if( !mgr ) @@ -2559,6 +2551,16 @@ void SMESH_ActorDef::SetMarkerTexture( int theMarkerId, VTK::MarkerTexture theMa myMarkerTexture = theMarkerTexture; // for deferred update of myHighlightActor } +void SMESH_ActorDef::SetRelativeTopologyOffsetParameters(double f, double u, + double f_delta, double u_delta) +{ + my2DActor->SetPolygonOffsetParameters(f,u + u_delta); + my2DExtActor->SetPolygonOffsetParameters(f,u*0.5 + u_delta); + my3DActor->SetPolygonOffsetParameters(f,u*2 + u_delta); + myHighlitableActor->GetMapper()->SetRelativeCoincidentTopologyLineOffsetParameters(-f + f_delta, + u*(-50) + 10*u_delta); +} + void SMESH_ActorDef::UpdateFilter() { unsigned int anObjectEntities = eAllEntity; // entities present in my object diff --git a/src/OBJECT/SMESH_Actor.h b/src/OBJECT/SMESH_Actor.h index 6de50af11..bcb684a76 100644 --- a/src/OBJECT/SMESH_Actor.h +++ b/src/OBJECT/SMESH_Actor.h @@ -176,6 +176,9 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor virtual void UpdateFilter() = 0; + virtual void SetRelativeTopologyOffsetParameters(double f, double u, + double f_delta = 0, double u_delta = 0) = 0; + #ifndef DISABLE_PLOT2DVIEWER virtual SPlot2d_Histogram* GetPlot2Histogram() = 0; virtual SPlot2d_Histogram* UpdatePlot2Histogram() = 0; diff --git a/src/OBJECT/SMESH_ActorDef.h b/src/OBJECT/SMESH_ActorDef.h index 0d3051c54..67efe4482 100644 --- a/src/OBJECT/SMESH_ActorDef.h +++ b/src/OBJECT/SMESH_ActorDef.h @@ -239,6 +239,9 @@ class SMESH_ActorDef : public SMESH_Actor virtual void SetMarkerStd( VTK::MarkerType, VTK::MarkerScale ); virtual void SetMarkerTexture( int, VTK::MarkerTexture ); + virtual void SetRelativeTopologyOffsetParameters(double f, double u, + double f_delta = 0, double u_delta = 0); + virtual void UpdateFilter(); protected: diff --git a/src/SMESHGUI/SMESHGUI_VTKUtils.cxx b/src/SMESHGUI/SMESHGUI_VTKUtils.cxx index e3d6adeab..77267b55f 100644 --- a/src/SMESHGUI/SMESHGUI_VTKUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_VTKUtils.cxx @@ -676,6 +676,7 @@ namespace SMESH anActor->SetVolumeColor( aColor.R, aColor.G, aColor.B, deltaV ); else anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B, deltaF ); + anActor->SetRelativeTopologyOffsetParameters(2, 2, 1, 3); } } } -- 2.39.2