Browse Source

3d_viewer: hatched polygons shown as solid

pull/18/head
Damjan 6 months ago
committed by jean-pierre charras
parent
commit
447b7426fd
  1. 44
      3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp

44
3d-viewer/3d_canvas/create_3Dgraphic_brd_items.cpp

@ -685,27 +685,43 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
case SHAPE_T::BEZIER:
case SHAPE_T::POLY:
{
SHAPE_POLY_SET polyList;
if( isSolidFill )
{
SHAPE_POLY_SET polyList;
aShape->TransformShapeToPolygon( polyList, UNDEFINED_LAYER, 0, ARC_HIGH_DEF, ERROR_INSIDE );
aShape->TransformShapeToPolygon( polyList, UNDEFINED_LAYER, 0, ARC_HIGH_DEF, ERROR_INSIDE );
// Some polygons can be a bit complex (especially when coming from a
// picture of a text converted to a polygon
// So call Simplify before calling ConvertPolygonToTriangles, just in case.
polyList.Simplify();
// Some polygons can be a bit complex (especially when coming from a
// picture of a text converted to a polygon
// So call Simplify before calling ConvertPolygonToTriangles, just in case.
polyList.Simplify();
if( polyList.IsEmpty() ) // Just for caution
break;
if( polyList.IsEmpty() ) // Just for caution
break;
if( margin != 0 )
{
CORNER_STRATEGY cornerStr = margin >= 0 ? CORNER_STRATEGY::ROUND_ALL_CORNERS
: CORNER_STRATEGY::ALLOW_ACUTE_CORNERS;
if( margin != 0 )
{
CORNER_STRATEGY cornerStr =
margin >= 0 ? CORNER_STRATEGY::ROUND_ALL_CORNERS : CORNER_STRATEGY::ALLOW_ACUTE_CORNERS;
polyList.Inflate( margin, cornerStr, GetBoard()->GetDesignSettings().m_MaxError );
polyList.Inflate( margin, cornerStr, GetBoard()->GetDesignSettings().m_MaxError );
}
ConvertPolygonToTriangles( polyList, *aContainer, m_biuTo3Dunits, *aOwner );
}
else
{
std::vector<VECTOR2I> pts = aShape->GetCorners();
ConvertPolygonToTriangles( polyList, *aContainer, m_biuTo3Dunits, *aOwner );
for( int i = 0; i < pts.size() - 1; i++ )
{
addROUND_SEGMENT_2D( aContainer, TO_SFVEC2F( pts[i] ), TO_SFVEC2F( pts[i + 1] ), linewidth3DU,
*aOwner );
}
addROUND_SEGMENT_2D( aContainer, TO_SFVEC2F( pts[pts.size() - 1] ), TO_SFVEC2F( pts[0] ), linewidth3DU,
*aOwner );
}
break;
}

Loading…
Cancel
Save