3D-Viewer: disable layer subtraction operations on non realistic mode

This commit is contained in:
Mario Luzeiro 2020-11-07 16:19:42 +00:00 committed by Wayne Stambaugh
parent a9be08e1ce
commit 753383d6ec
4 changed files with 53 additions and 27 deletions

View File

@ -208,7 +208,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
}
}
if( GetFlag( FL_RENDER_PLATED_PADS_AS_PLATED ) )
if( GetFlag( FL_RENDER_PLATED_PADS_AS_PLATED ) &&
GetFlag( FL_USE_REALISTIC_MODE ) )
{
m_F_Cu_PlatedPads_poly = new SHAPE_POLY_SET;
m_B_Cu_PlatedPads_poly = new SHAPE_POLY_SET;
@ -316,7 +317,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
hole_inner_radius + thickness,
*track ) );
if( GetFlag( FL_CLIP_SILK_ON_VIA_ANNULUS ) )
if( GetFlag( FL_CLIP_SILK_ON_VIA_ANNULUS ) &&
GetFlag( FL_USE_REALISTIC_MODE ) )
{
m_through_holes_outer_ring.Add( new CFILLEDCIRCLE2D( via_center,
ring_radius,
@ -413,7 +415,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
TransformCircleToPolygon( m_through_outer_holes_vias_poly, via->GetStart(),
hole_outer_radius, ARC_HIGH_DEF, ERROR_INSIDE );
if( GetFlag( FL_CLIP_SILK_ON_VIA_ANNULUS ) )
if( GetFlag( FL_CLIP_SILK_ON_VIA_ANNULUS ) &&
GetFlag( FL_USE_REALISTIC_MODE ) )
{
TransformCircleToPolygon( m_through_outer_ring_holes_poly,
via->GetStart(), hole_outer_ring_radius,
@ -479,7 +482,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
m_through_holes_outer.Add( createNewPadDrill( pad, inflate ) );
if( GetFlag( FL_CLIP_SILK_ON_VIA_ANNULUS ) )
if( GetFlag( FL_CLIP_SILK_ON_VIA_ANNULUS ) &&
GetFlag( FL_USE_REALISTIC_MODE ) )
{
m_through_holes_outer_ring.Add( createNewPadDrill( pad, inflate ) );
}
@ -507,7 +511,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
if( pad->GetAttribute () != PAD_ATTRIB_NPTH )
{
if( GetFlag( FL_CLIP_SILK_ON_VIA_ANNULUS ) )
if( GetFlag( FL_CLIP_SILK_ON_VIA_ANNULUS ) &&
GetFlag( FL_USE_REALISTIC_MODE ) )
{
pad->TransformHoleWithClearanceToPolygon( m_through_outer_ring_holes_poly,
inflate,
@ -520,7 +525,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
else
{
// If not plated, no copper.
if( GetFlag( FL_CLIP_SILK_ON_VIA_ANNULUS ) )
if( GetFlag( FL_CLIP_SILK_ON_VIA_ANNULUS ) &&
GetFlag( FL_USE_REALISTIC_MODE ) )
{
pad->TransformHoleWithClearanceToPolygon( m_through_outer_ring_holes_poly, 0,
ARC_HIGH_DEF, ERROR_INSIDE );
@ -532,7 +538,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
}
}
const bool renderPlatedPadsAsPlated = GetFlag( FL_RENDER_PLATED_PADS_AS_PLATED );
const bool renderPlatedPadsAsPlated = GetFlag( FL_RENDER_PLATED_PADS_AS_PLATED ) &&
GetFlag( FL_USE_REALISTIC_MODE );
// Add footprints PADs objects to containers
for( PCB_LAYER_ID curr_layer_id : layer_id )
@ -777,7 +784,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
if( GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS )
&& ( m_render_engine == RENDER_ENGINE::OPENGL_LEGACY ) )
{
if( GetFlag( FL_RENDER_PLATED_PADS_AS_PLATED ) )
if( GetFlag( FL_RENDER_PLATED_PADS_AS_PLATED ) &&
GetFlag( FL_USE_REALISTIC_MODE ) )
{
if( m_F_Cu_PlatedPads_poly && ( m_layers_poly.find( F_Cu ) != m_layers_poly.end() ) )
{
@ -799,7 +807,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
std::vector< PCB_LAYER_ID > &selected_layer_id = layer_id;
std::vector< PCB_LAYER_ID > layer_id_without_F_and_B;
if( GetFlag( FL_RENDER_PLATED_PADS_AS_PLATED ) )
if( GetFlag( FL_RENDER_PLATED_PADS_AS_PLATED ) &&
GetFlag( FL_USE_REALISTIC_MODE ) )
{
layer_id_without_F_and_B.clear();
layer_id_without_F_and_B.reserve( layer_id.size() );

View File

@ -504,6 +504,8 @@ void C3D_RENDER_OGL_LEGACY::reload( REPORTER* aStatusReporter, REPORTER* aWarnin
m_ogl_disp_list_board = createBoard( m_boardAdapter.GetBoardPoly(), &m_boardAdapter.GetThroughHole_Inner() );
if( m_boardAdapter.GetFlag( FL_USE_REALISTIC_MODE ) )
{
m_anti_board_poly.RemoveAllContours();
m_anti_board_poly.NewOutline();
m_anti_board_poly.Append( VECTOR2I( -INT_MAX/2, -INT_MAX/2 ) );
@ -514,11 +516,13 @@ void C3D_RENDER_OGL_LEGACY::reload( REPORTER* aStatusReporter, REPORTER* aWarnin
m_anti_board_poly.BooleanSubtract( m_boardAdapter.GetBoardPoly(), SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
m_ogl_disp_list_anti_board = createBoard( m_anti_board_poly );
}
SHAPE_POLY_SET board_poly_with_holes = m_boardAdapter.GetBoardPoly();
board_poly_with_holes.BooleanSubtract( m_boardAdapter.GetThroughHole_Outer_poly(), SHAPE_POLY_SET::PM_FAST );
board_poly_with_holes.BooleanSubtract( m_boardAdapter.GetThroughHole_Outer_poly_NPTH(), SHAPE_POLY_SET::PM_FAST );
m_ogl_disp_list_board_with_holes = createBoard( board_poly_with_holes );
if( m_ogl_disp_list_anti_board )
@ -531,6 +535,8 @@ void C3D_RENDER_OGL_LEGACY::reload( REPORTER* aStatusReporter, REPORTER* aWarnin
aStatusReporter->Report( _( "Load OpenGL: holes and vias" ) );
SHAPE_POLY_SET outerPolyTHT = m_boardAdapter.GetThroughHole_Outer_poly();
if( m_boardAdapter.GetFlag( FL_USE_REALISTIC_MODE ) )
outerPolyTHT.BooleanIntersection( m_boardAdapter.GetBoardPoly(), SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
m_ogl_disp_list_through_holes_outer = generate_holes_display_list(
@ -548,7 +554,8 @@ void C3D_RENDER_OGL_LEGACY::reload( REPORTER* aStatusReporter, REPORTER* aWarnin
0.0f,
false );
if( m_boardAdapter.GetFlag( FL_CLIP_SILK_ON_VIA_ANNULUS ) )
if( m_boardAdapter.GetFlag( FL_CLIP_SILK_ON_VIA_ANNULUS ) &&
m_boardAdapter.GetFlag( FL_USE_REALISTIC_MODE ) )
{
m_ogl_disp_list_through_holes_outer_ring = generate_holes_display_list(
m_boardAdapter.GetThroughHole_Outer_Ring().GetList(),
@ -637,7 +644,8 @@ void C3D_RENDER_OGL_LEGACY::reload( REPORTER* aStatusReporter, REPORTER* aWarnin
SHAPE_POLY_SET polyListSubtracted;
polyListSubtracted = *aPolyList;
if( ( layer_id != B_Paste ) && ( layer_id != F_Paste ) )
if( ( layer_id != B_Paste ) && ( layer_id != F_Paste ) &&
m_boardAdapter.GetFlag( FL_USE_REALISTIC_MODE ) )
{
polyListSubtracted.BooleanIntersection( m_boardAdapter.GetBoardPoly(), SHAPE_POLY_SET::PM_FAST );
@ -668,7 +676,8 @@ void C3D_RENDER_OGL_LEGACY::reload( REPORTER* aStatusReporter, REPORTER* aWarnin
}// for each layer on
if( m_boardAdapter.GetFlag( FL_RENDER_PLATED_PADS_AS_PLATED ) )
if( m_boardAdapter.GetFlag( FL_RENDER_PLATED_PADS_AS_PLATED ) &&
m_boardAdapter.GetFlag( FL_USE_REALISTIC_MODE ) )
{
if( m_boardAdapter.GetPolyPlatedPads_Front() )
{
@ -878,6 +887,8 @@ void C3D_RENDER_OGL_LEGACY::generate_3D_Vias_and_Pads()
// Subtract the holes
tht_outer_holes_poly.BooleanSubtract( tht_inner_holes_poly, SHAPE_POLY_SET::PM_FAST );
if( m_boardAdapter.GetFlag( FL_USE_REALISTIC_MODE ) )
tht_outer_holes_poly.BooleanSubtract( m_anti_board_poly, SHAPE_POLY_SET::PM_FAST );
CCONTAINER2D holesContainer;

View File

@ -729,7 +729,8 @@ bool C3D_RENDER_OGL_LEGACY::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
if( (layer_id >= F_Cu) && (layer_id <= B_Cu) )
{
if( !m_boardAdapter.GetFlag( FL_USE_REALISTIC_MODE ) ||
!m_boardAdapter.GetFlag( FL_RENDER_PLATED_PADS_AS_PLATED ) )
!( m_boardAdapter.GetFlag( FL_RENDER_PLATED_PADS_AS_PLATED ) &&
m_boardAdapter.GetFlag( FL_USE_REALISTIC_MODE ) ) )
set_layer_material( layer_id );
else
setCopperMaterial();
@ -848,7 +849,8 @@ bool C3D_RENDER_OGL_LEGACY::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
set_layer_material( layer_id );
CLAYERS_OGL_DISP_LISTS* dispListThroughHolesOuter =
( m_boardAdapter.GetFlag( FL_CLIP_SILK_ON_VIA_ANNULUS )
( m_boardAdapter.GetFlag( FL_CLIP_SILK_ON_VIA_ANNULUS ) &&
m_boardAdapter.GetFlag( FL_USE_REALISTIC_MODE )
&& ( ( layer_id == B_SilkS ) || ( layer_id == F_SilkS ) ) ) ?
m_ogl_disp_list_through_holes_outer_ring :
m_ogl_disp_list_through_holes_outer;
@ -872,6 +874,7 @@ bool C3D_RENDER_OGL_LEGACY::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
if( (!skipRenderHoles) &&
m_boardAdapter.GetFlag( FL_SUBTRACT_MASK_FROM_SILK ) &&
m_boardAdapter.GetFlag( FL_USE_REALISTIC_MODE ) &&
( ( ( layer_id == B_SilkS ) &&
( m_ogl_disp_lists_layers.find( B_Mask ) != m_ogl_disp_lists_layers.end() ) ) ||
( ( layer_id == F_SilkS ) &&

View File

@ -342,7 +342,8 @@ void C3D_RENDER_RAYTRACING::createItemsFromContainer( const CBVHCONTAINER2D *aCo
// clip the silk screening at the outer edge of the annular ring, rather
// than the at the outer edge of the copper plating.
const CBVHCONTAINER2D& throughHoleOuter =
( m_boardAdapter.GetFlag( FL_CLIP_SILK_ON_VIA_ANNULUS )
( m_boardAdapter.GetFlag( FL_CLIP_SILK_ON_VIA_ANNULUS ) &&
m_boardAdapter.GetFlag( FL_USE_REALISTIC_MODE )
&& ( ( aLayer_id == B_SilkS ) || ( aLayer_id == F_SilkS ) ) ) ?
m_boardAdapter.GetThroughHole_Outer_Ring() :
m_boardAdapter.GetThroughHole_Outer();
@ -389,6 +390,7 @@ void C3D_RENDER_RAYTRACING::createItemsFromContainer( const CBVHCONTAINER2D *aCo
const MAP_CONTAINER_2D& mapLayers = m_boardAdapter.GetMapLayers();
if( m_boardAdapter.GetFlag( FL_SUBTRACT_MASK_FROM_SILK ) &&
m_boardAdapter.GetFlag( FL_USE_REALISTIC_MODE ) &&
( ( ( aLayer_id == B_SilkS ) &&
( mapLayers.find( B_Mask ) != mapLayers.end() ) ) ||
( ( aLayer_id == F_SilkS ) &&
@ -779,7 +781,8 @@ void C3D_RENDER_RAYTRACING::Reload( REPORTER* aStatusReporter,
}// for each layer on map
// Create plated copper
if( m_boardAdapter.GetFlag( FL_RENDER_PLATED_PADS_AS_PLATED ) )
if( m_boardAdapter.GetFlag( FL_RENDER_PLATED_PADS_AS_PLATED ) &&
m_boardAdapter.GetFlag( FL_USE_REALISTIC_MODE ) )
{
SFVEC3F layerColor_F_Cu = m_boardAdapter.GetLayerColor( F_Cu );
SFVEC3F layerColor_B_Cu = m_boardAdapter.GetLayerColor( B_Cu );