3D viewer: disable thickness rendering on tech layers when disabled for copper.

Building the vertical walls around shapes to show layer tickness is very
time consuming. It can be disabled for copper layers but was always enabled
for other layers.
Now layer thickness is enabled or disabled for all layers.
This commit is contained in:
jean-pierre charras 2022-03-01 11:29:35 +01:00
parent fab78af176
commit 9fec8aa269
5 changed files with 74 additions and 57 deletions

View File

@ -627,8 +627,6 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
aShape->TransformShapeWithClearanceToPolygon( polyList, UNDEFINED_LAYER, 0,
ARC_HIGH_DEF, ERROR_INSIDE );
polyList.Simplify( SHAPE_POLY_SET::PM_FAST );
if( polyList.IsEmpty() ) // Just for caution
break;

View File

@ -878,6 +878,12 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
aStatusReporter->Report( _( "Build Tech layers" ) );
// draw graphic items, on technical layers
// Vertical walls (layer thickness) around shapes is really time consumming
// They are built on request
bool buildVerticalWallsForTechLayers = m_Cfg->m_Render.opengl_copper_thickness
&& m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL;
static const PCB_LAYER_ID teckLayerList[] = {
B_Adhes,
F_Adhes,
@ -951,7 +957,9 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
}
}
// Add drawing contours
// Add drawing contours (vertical walls)
if( buildVerticalWallsForTechLayers )
{
for( BOARD_ITEM* item : m_board->Drawings() )
{
if( !item->IsOnLayer( curr_layer_id ) )
@ -986,6 +994,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
break;
}
}
}
// Add footprints tech layers - objects
for( FOOTPRINT* footprint : m_board->Footprints() )
@ -1011,7 +1020,9 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
}
// Add footprints tech layers - contours
// Add footprints tech layers - contours (vertical walls)
if( buildVerticalWallsForTechLayers )
{
for( FOOTPRINT* footprint : m_board->Footprints() )
{
if( ( curr_layer_id == F_SilkS ) || ( curr_layer_id == B_SilkS ) )
@ -1039,7 +1050,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
// Add the remaining things with dynamic seg count for circles
transformFPShapesToPolygon( footprint, curr_layer_id, *layerPoly );
}
}
// Draw non copper zones
if( m_Cfg->m_Render.show_zones )
@ -1050,12 +1061,16 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
addSolidAreasShapes( zone, layerContainer, curr_layer_id );
}
if( buildVerticalWallsForTechLayers )
{
for( ZONE* zone : m_board->Zones() )
{
if( zone->IsOnLayer( curr_layer_id ) )
zone->TransformSolidAreasShapesToPolygon( curr_layer_id, *layerPoly );
}
}
}
// This will make a union of all added contours
layerPoly->Simplify( SHAPE_POLY_SET::PM_FAST );

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -25,7 +25,7 @@ PANEL_3D_OPENGL_OPTIONS_BASE::PANEL_3D_OPENGL_OPTIONS_BASE( wxWindow* parent, wx
m_checkBoxBoundingBoxes = new wxCheckBox( sbSizerOpenGLRenderoptions->GetStaticBox(), wxID_ANY, _("Show model bounding boxes"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerOpenGLRenderoptions->Add( m_checkBoxBoundingBoxes, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_checkBoxCuThickness = new wxCheckBox( sbSizerOpenGLRenderoptions->GetStaticBox(), wxID_ANY, _("Show copper thickness"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkBoxCuThickness = new wxCheckBox( sbSizerOpenGLRenderoptions->GetStaticBox(), wxID_ANY, _("Show copper and tech layers thickness (very slow)"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizerOpenGLRenderoptions->Add( m_checkBoxCuThickness, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_checkBoxHighlightOnRollOver = new wxCheckBox( sbSizerOpenGLRenderoptions->GetStaticBox(), wxID_ANY, _("Highlight items on rollover"), wxDefaultPosition, wxDefaultSize, 0 );

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="15" />
<FileVersion major="1" minor="16" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
@ -14,6 +14,7 @@
<property name="file">panel_3D_opengl_options_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">panel_3D_opengl_optionS_base</property>
@ -25,6 +26,7 @@
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Panel" expanded="1">
@ -46,6 +48,7 @@
<property name="size">-1,-1</property>
<property name="subclass">RESETTABLE_PANEL; widgets/resettable_panel.h; forward_declare</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
@ -172,7 +175,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Show copper thickness</property>
<property name="label">Show copper and tech layers thickness (very slow)</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -51,6 +51,7 @@ class PANEL_3D_OPENGL_OPTIONS_BASE : public RESETTABLE_PANEL
public:
PANEL_3D_OPENGL_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
~PANEL_3D_OPENGL_OPTIONS_BASE();
};