mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-03 14:10:33 +03:00
0025687: Visualization, XCAF - eliminate visual artifacts at the edges of faces
AIS_ColoredShape::Compute() - improve logic to split input shape into Closed and Open volumes with back-face culling enabled when possible. Change last argument of method StdPrs_ShadedShape::Add() from boolean to enumeration StdPrs_Volume which controls parsing of Closed/Open volumes within input shape. Make method StdPrs_ShadedShape::ExploreSolids() public. Extend Draw Harness command vaspects with option -setvisibility to hide subshape (using AIS_ColoredShape). Add new test cases bugs/bis/bug25687_1 and bugs/bis/bug25687_2. the logic of bindSubShapes method clarified Conflicts: src/AIS/AIS_ColoredShape.cxx AIS_ColoredShape::dispatchColors considers the colors of displayed shapes in connection with specific priority the color of specific shape can be exported from several ways: the color of this shape, the color of a compound containing this shape. The highest priority has the color of shape than the one of the compound. The color with highest priority will be displayed. This patch accounts for the highest priority of the shape color. For example: w - wire has GREEN color; e - edge has RED color; "w" contains "e"; all edges of "w" will be displayed in GREEN color except "e" edge, it will be displayed in RED color Added sample generating model of Intel i7-4790 CPU on which the problem can be reproduced
This commit is contained in:
@@ -237,56 +237,6 @@ namespace
|
||||
return anArray;
|
||||
}
|
||||
|
||||
//! Searches closed and unclosed subshapes in shape structure
|
||||
//! and puts them into two compounds for separate processing of closed and unclosed sub-shapes.
|
||||
static void exploreSolids (const TopoDS_Shape& theShape,
|
||||
const BRep_Builder& theBuilder,
|
||||
TopoDS_Compound& theCompoundForClosed,
|
||||
TopoDS_Compound& theCompoundForOpened)
|
||||
{
|
||||
if (theShape.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (theShape.ShapeType())
|
||||
{
|
||||
case TopAbs_COMPOUND:
|
||||
case TopAbs_COMPSOLID:
|
||||
{
|
||||
for (TopoDS_Iterator anIter (theShape); anIter.More(); anIter.Next())
|
||||
{
|
||||
exploreSolids (anIter.Value(), theBuilder, theCompoundForClosed, theCompoundForOpened);
|
||||
}
|
||||
return;
|
||||
}
|
||||
case TopAbs_SOLID:
|
||||
{
|
||||
for (TopoDS_Iterator anIter (theShape); anIter.More(); anIter.Next())
|
||||
{
|
||||
const TopoDS_Shape& aSubShape = anIter.Value();
|
||||
const Standard_Boolean isClosed = aSubShape.ShapeType() == TopAbs_SHELL &&
|
||||
BRep_Tool::IsClosed (aSubShape) &&
|
||||
StdPrs_ToolShadedShape::IsTriangulated (aSubShape);
|
||||
theBuilder.Add (isClosed ? theCompoundForClosed : theCompoundForOpened, aSubShape);
|
||||
}
|
||||
return;
|
||||
}
|
||||
case TopAbs_SHELL:
|
||||
case TopAbs_FACE:
|
||||
{
|
||||
theBuilder.Add (theCompoundForOpened, theShape);
|
||||
return;
|
||||
}
|
||||
case TopAbs_WIRE:
|
||||
case TopAbs_EDGE:
|
||||
case TopAbs_VERTEX:
|
||||
case TopAbs_SHAPE:
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//! Prepare shaded presentation for specified shape
|
||||
static Standard_Boolean shadeFromShape (const TopoDS_Shape& theShape,
|
||||
const Handle(Prs3d_Presentation)& thePrs,
|
||||
@@ -435,6 +385,66 @@ namespace
|
||||
}
|
||||
};
|
||||
|
||||
// =======================================================================
|
||||
// function : ExploreSolids
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void StdPrs_ShadedShape::ExploreSolids (const TopoDS_Shape& theShape,
|
||||
const BRep_Builder& theBuilder,
|
||||
TopoDS_Compound& theClosed,
|
||||
TopoDS_Compound& theOpened,
|
||||
const Standard_Boolean theIgnore1DSubShape)
|
||||
{
|
||||
if (theShape.IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (theShape.ShapeType())
|
||||
{
|
||||
case TopAbs_COMPOUND:
|
||||
case TopAbs_COMPSOLID:
|
||||
{
|
||||
for (TopoDS_Iterator anIter (theShape); anIter.More(); anIter.Next())
|
||||
{
|
||||
ExploreSolids (anIter.Value(), theBuilder, theClosed, theOpened, theIgnore1DSubShape);
|
||||
}
|
||||
return;
|
||||
}
|
||||
case TopAbs_SOLID:
|
||||
{
|
||||
for (TopoDS_Iterator anIter (theShape); anIter.More(); anIter.Next())
|
||||
{
|
||||
const TopoDS_Shape& aSubShape = anIter.Value();
|
||||
const Standard_Boolean isClosed = aSubShape.ShapeType() == TopAbs_SHELL &&
|
||||
BRep_Tool::IsClosed (aSubShape) &&
|
||||
StdPrs_ToolShadedShape::IsTriangulated (aSubShape);
|
||||
theBuilder.Add (isClosed ? theClosed : theOpened, aSubShape);
|
||||
}
|
||||
return;
|
||||
}
|
||||
case TopAbs_SHELL:
|
||||
case TopAbs_FACE:
|
||||
{
|
||||
theBuilder.Add (theOpened, theShape);
|
||||
return;
|
||||
}
|
||||
case TopAbs_WIRE:
|
||||
case TopAbs_EDGE:
|
||||
case TopAbs_VERTEX:
|
||||
{
|
||||
if (!theIgnore1DSubShape)
|
||||
{
|
||||
theBuilder.Add (theOpened, theShape);
|
||||
}
|
||||
return;
|
||||
}
|
||||
case TopAbs_SHAPE:
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Add
|
||||
// purpose :
|
||||
@@ -442,11 +452,11 @@ namespace
|
||||
void StdPrs_ShadedShape::Add (const Handle(Prs3d_Presentation)& thePrs,
|
||||
const TopoDS_Shape& theShape,
|
||||
const Handle(Prs3d_Drawer)& theDrawer,
|
||||
const Standard_Boolean theToExploreSolids)
|
||||
const StdPrs_Volume theVolume)
|
||||
{
|
||||
gp_Pnt2d aDummy;
|
||||
StdPrs_ShadedShape::Add (thePrs, theShape, theDrawer,
|
||||
Standard_False, aDummy, aDummy, aDummy, theToExploreSolids);
|
||||
Standard_False, aDummy, aDummy, aDummy, theVolume);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -484,7 +494,7 @@ void StdPrs_ShadedShape::Add (const Handle (Prs3d_Presentation)& thePrs,
|
||||
const gp_Pnt2d& theUVOrigin,
|
||||
const gp_Pnt2d& theUVRepeat,
|
||||
const gp_Pnt2d& theUVScale,
|
||||
const Standard_Boolean theToExploreSolids)
|
||||
const StdPrs_Volume theVolume)
|
||||
{
|
||||
if (theShape.IsNull())
|
||||
{
|
||||
@@ -503,14 +513,14 @@ void StdPrs_ShadedShape::Add (const Handle (Prs3d_Presentation)& thePrs,
|
||||
if ((theShape.ShapeType() == TopAbs_COMPOUND
|
||||
|| theShape.ShapeType() == TopAbs_COMPSOLID
|
||||
|| theShape.ShapeType() == TopAbs_SOLID)
|
||||
&& theToExploreSolids)
|
||||
&& theVolume == StdPrs_Volume_Autodetection)
|
||||
{
|
||||
// collect two compounds: for opened and closed (solid) sub-shapes
|
||||
TopoDS_Compound anOpened, aClosed;
|
||||
BRep_Builder aBuilder;
|
||||
aBuilder.MakeCompound (aClosed);
|
||||
aBuilder.MakeCompound (anOpened);
|
||||
exploreSolids (theShape, aBuilder, aClosed, anOpened);
|
||||
ExploreSolids (theShape, aBuilder, aClosed, anOpened, Standard_True);
|
||||
|
||||
TopoDS_Iterator aShapeIter (aClosed);
|
||||
if (aShapeIter.More())
|
||||
@@ -528,9 +538,10 @@ void StdPrs_ShadedShape::Add (const Handle (Prs3d_Presentation)& thePrs,
|
||||
}
|
||||
else
|
||||
{
|
||||
// if the shape type is not compound, composolid or solid, use autodetection back-facing filled
|
||||
shadeFromShape (theShape, thePrs, theDrawer,
|
||||
theHasTexels, theUVOrigin, theUVRepeat, theUVScale,
|
||||
StdPrs_ToolShadedShape::IsClosed (theShape));
|
||||
(theVolume == StdPrs_Volume_Closed ? Standard_True : Standard_False));
|
||||
}
|
||||
|
||||
if (theDrawer->IsFaceBoundaryDraw())
|
||||
|
Reference in New Issue
Block a user