1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +03:00

0026072: Visualization - more realistic display of face edges

Code tweaks.
This commit is contained in:
drochalo 2024-04-09 18:15:46 +01:00
parent b63fe6e31f
commit 11fb8e63f6
3 changed files with 17 additions and 16 deletions

View File

@ -636,7 +636,7 @@ void AIS_ColoredShape::addShapesWithCustomProps (const Handle(Prs3d_Presentation
{
if (Handle(Graphic3d_ArrayOfSegments) aBndSegments = StdPrs_ShadedShape::FillFaceBoundaries (aShapeDraw, aDrawer->FaceBoundaryUpperContinuity()))
{
Handle(Graphic3d_AspectLine3d) aLineAspect = aDrawer->FaceBoundaryAspect()->Aspect();
Handle(Graphic3d_AspectLine3d) aLineAspect = Handle(Graphic3d_AspectLine3d)(aDrawer->FaceBoundaryAspect()->Aspect());
if (aDrawer->FaceBoundaryShadingOverride())
{
Quantity_Color aColor = aDrawer->Color();

View File

@ -369,9 +369,8 @@ namespace
// create indexed segments array to pack polylines from different edges into single array
const Standard_Integer aSegmentEdgeNb = (aNodeNumber - aNbPolylines) * 2;
const Standard_Boolean aToAddNormals = Standard_True;
Handle(Graphic3d_ArrayOfSegments) aSegments = new Graphic3d_ArrayOfSegments (aNodeNumber + aNbExtra, aSegmentEdgeNb + aNbExtra,
Standard_False, aToAddNormals);
Standard_False, Standard_True);
for (TopTools_IndexedDataMapOfShapeListOfShape::Iterator anEdgeIter (anEdgesMap); anEdgeIter.More(); anEdgeIter.Next())
{
if (anEdgeIter.Value().Extent() == 0)
@ -379,6 +378,14 @@ namespace
continue;
}
const TopoDS_Edge& anEdge = TopoDS::Edge (anEdgeIter.Key());
if (theUpperContinuity < GeomAbs_CN
&& anEdgeIter.Value().Extent() >= 2
&& BRep_Tool::MaxContinuity (anEdge) > theUpperContinuity)
{
continue;
}
Standard_Integer aFaceIndex = 0;
const Standard_Integer aFirstNodeInFace = aSegments->VertexNumber() + 1;
for (TopTools_ListOfShape::Iterator aFaceIter (anEdgeIter.Value()); aFaceIter.More(); aFaceIter.Next())
@ -390,14 +397,7 @@ namespace
continue;
}
const TopoDS_Edge& anEdge = TopoDS::Edge (anEdgeIter.Key());
if (theUpperContinuity < GeomAbs_CN
&& anEdgeIter.Value().Extent() >= 2
&& BRep_Tool::MaxContinuity (anEdge) > theUpperContinuity)
{
continue;
}
Standard_Boolean aHasNormals = aTriangulation->HasNormals();
Handle(Poly_PolygonOnTriangulation) anEdgePoly = BRep_Tool::PolygonOnTriangulation (anEdge, aTriangulation, aLoc);
if (anEdgePoly.IsNull()
|| anEdgePoly->Nodes().Length () < 2)
@ -406,7 +406,6 @@ namespace
}
// get edge nodes indexes from face triangulation
++aFaceIndex;
const TColStd_Array1OfInteger& anEdgeNodes = anEdgePoly->Nodes();
const gp_Trsf& aTrsf = aLoc.Transformation();
@ -419,7 +418,7 @@ namespace
const Standard_Integer aTriIndex = anEdgeNodes.Value (aNodeIdx);
gp_Pnt aTriNode = aTriangulation->Node (aTriIndex);
gp_Dir aNorm = aTriangulation->Normal (aTriIndex);
gp_Dir aNorm = aHasNormals ? aTriangulation->Normal (aTriIndex) : gp_Dir();
if (aFace.Orientation() == TopAbs_REVERSED)
{
aNorm.Reverse();
@ -430,7 +429,7 @@ namespace
aNorm.Transform (aTrsf);
}
if (aFaceIndex == 1)
if (aFaceIndex == 0)
{
aSegments->AddVertex (aTriNode, aNorm);
if (aNodeIdx != anEdgeNodes.Lower())
@ -449,6 +448,7 @@ namespace
++aSegmentEdge;
}
}
++aFaceIndex;
}
}
@ -614,7 +614,7 @@ void StdPrs_ShadedShape::Add (const Handle (Prs3d_Presentation)& thePrs,
if (Handle(Graphic3d_ArrayOfSegments) aBndSegments = fillFaceBoundaries (theShape, theDrawer->FaceBoundaryUpperContinuity()))
{
Handle(Graphic3d_Group) aPrsGrp = !theGroup.IsNull() ? theGroup : thePrs->NewGroup();
Handle(Graphic3d_AspectLine3d) aLineAspect = theDrawer->FaceBoundaryAspect()->Aspect();
Handle(Graphic3d_AspectLine3d) aLineAspect = Handle(Graphic3d_AspectLine3d)(theDrawer->FaceBoundaryAspect()->Aspect());
if (theDrawer->FaceBoundaryShadingOverride())
{
Quantity_Color aColor = theDrawer->ShadingAspect()->Color();

View File

@ -1200,7 +1200,7 @@ static Standard_Integer XShowFaceBoundary (Draw_Interpretor& di,
if (( argc != 4 && argc < 7 ) || argc > 11)
{
di << "Usage :\n " << argv[0]
<< " Doc Label IsOn [R G B [LineWidth [LineStyle]]]\n"
<< " Doc Label IsOn [R G B [LineWidth [LineStyle]]] Model Shading\n"
<< " Doc - is the document name. \n"
<< " Label - is the shape label. \n"
<< " IsOn - flag indicating whether the boundaries\n"
@ -1217,6 +1217,7 @@ static Standard_Integer XShowFaceBoundary (Draw_Interpretor& di,
<< " 2 - dot \n"
<< " 3 - dashdot\n"
<< " (default is solid)\n"
<< " Model - shading model [unlit|phong|pbr|gouraud]\n"
<< " Shading - flag indicating if the boundaries\n"
<< " should be shaded:"
<< " 0 - no override edge color"