Minor readability improvements.

This commit is contained in:
Jeff Young 2023-09-22 14:03:15 +01:00
parent 4bfebb4744
commit 78f70b45e6
9 changed files with 91 additions and 93 deletions

View File

@ -106,7 +106,7 @@ BOARD_ADAPTER::BOARD_ADAPTER() :
m_TH_IDs.Clear();
m_TH_ODs.Clear();
m_THAnnularRings.Clear();
m_viaAnnuli.Clear();
m_copperLayersCount = 2;

View File

@ -262,14 +262,14 @@ public:
return m_TH_ODPolys;
}
const BVH_CONTAINER_2D& GetTHAnnularRings() const noexcept
const BVH_CONTAINER_2D& GetViaAnnuli() const noexcept
{
return m_THAnnularRings;
return m_viaAnnuli;
}
const SHAPE_POLY_SET& GetTHAnnularRingPolys() const noexcept
const SHAPE_POLY_SET& GetViaAnnuliPolys() const noexcept
{
return m_THAnnularRingPolys;
return m_viaAnnuliPolys;
}
const SHAPE_POLY_SET& GetNPTH_ODPolys() const noexcept
@ -441,7 +441,7 @@ private:
SHAPE_POLY_SET m_NPTH_ODPolys; ///< NPTH outer diameters
SHAPE_POLY_SET m_TH_ODPolys; ///< PTH outer diameters
SHAPE_POLY_SET m_viaTH_ODPolys; ///< Via hole outer diameters
SHAPE_POLY_SET m_THAnnularRingPolys; ///< Via annular ring outer diameters
SHAPE_POLY_SET m_viaAnnuliPolys; ///< Via annular ring outer diameters
SHAPE_POLY_SET m_board_poly; ///< Board outline polygon.
@ -453,7 +453,7 @@ private:
BVH_CONTAINER_2D m_TH_ODs; ///< List of PTH outer diameters
BVH_CONTAINER_2D m_TH_IDs; ///< List of PTH inner diameters
BVH_CONTAINER_2D m_THAnnularRings; ///< List of via annular rings
BVH_CONTAINER_2D m_viaAnnuli; ///< List of via annular rings
BVH_CONTAINER_2D m_viaTH_ODs; ///< List of via hole outer diameters
unsigned int m_copperLayersCount;

View File

@ -125,7 +125,7 @@ void BOARD_ADAPTER::destroyLayers()
m_NPTH_ODPolys.RemoveAllContours();
m_TH_ODPolys.RemoveAllContours();
m_viaTH_ODPolys.RemoveAllContours();
m_THAnnularRingPolys.RemoveAllContours();
m_viaAnnuliPolys.RemoveAllContours();
DELETE_AND_FREE_MAP( m_layerMap )
DELETE_AND_FREE_MAP( m_layerHoleMap )
@ -135,7 +135,7 @@ void BOARD_ADAPTER::destroyLayers()
m_TH_ODs.Clear();
m_TH_IDs.Clear();
m_THAnnularRings.Clear();
m_viaAnnuli.Clear();
m_viaTH_ODs.Clear();
}
@ -157,6 +157,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
PCB_LAYER_ID cu_seq[MAX_CU_LAYERS];
LSET cu_set = LSET::AllCuMask( m_copperLayersCount );
EDA_3D_VIEWER_SETTINGS::RENDER_SETTINGS& cfg = m_Cfg->m_Render;
std::bitset<LAYER_3D_END> visibilityFlags = GetVisibleLayers();
m_trackCount = 0;
@ -225,22 +227,20 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
BVH_CONTAINER_2D *layerContainer = new BVH_CONTAINER_2D;
m_layerMap[layer] = layerContainer;
if( m_Cfg->m_Render.opengl_copper_thickness
&& m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL )
if( cfg.opengl_copper_thickness && cfg.engine == RENDER_ENGINE::OPENGL )
{
SHAPE_POLY_SET* layerPoly = new SHAPE_POLY_SET;
m_layers_poly[layer] = layerPoly;
}
}
if( m_Cfg->m_Render.renderPlatedPadsAsPlated )
if( cfg.renderPlatedPadsAsPlated )
{
m_frontPlatedPadPolys = new SHAPE_POLY_SET;
m_backPlatedPadPolys = new SHAPE_POLY_SET;
m_platedPadsFront = new BVH_CONTAINER_2D;
m_platedPadsBack = new BVH_CONTAINER_2D;
}
if( aStatusReporter )
@ -332,20 +332,15 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
m_viaTH_ODs.Add( new FILLED_CIRCLE_2D( via_center, hole_inner_radius + thickness,
*track ) );
if( m_Cfg->m_Render.clip_silk_on_via_annulus && ring_radius > 0.0 )
{
m_THAnnularRings.Add( new FILLED_CIRCLE_2D( via_center, ring_radius,
*track ) );
}
if( cfg.clip_silk_on_via_annuli && ring_radius > 0.0 )
m_viaAnnuli.Add( new FILLED_CIRCLE_2D( via_center, ring_radius, *track ) );
if( hole_inner_radius > 0.0 )
{
m_TH_IDs.Add( new FILLED_CIRCLE_2D( via_center, hole_inner_radius, *track ) );
}
}
}
}
}
// Create VIAS and THTs objects and add it to holes containers
for( PCB_LAYER_ID layer : layer_ids )
@ -419,9 +414,9 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
TransformCircleToPolygon( m_viaTH_ODPolys, via->GetStart(), hole_outer_radius,
maxError, ERROR_INSIDE );
if( m_Cfg->m_Render.clip_silk_on_via_annulus )
if( cfg.clip_silk_on_via_annuli )
{
TransformCircleToPolygon( m_THAnnularRingPolys, via->GetStart(),
TransformCircleToPolygon( m_viaAnnuliPolys, via->GetStart(),
hole_outer_ring_radius, maxError, ERROR_INSIDE );
}
}
@ -430,7 +425,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
}
// Creates vertical outline contours of the tracks and add it to the poly of the layer
if( m_Cfg->m_Render.opengl_copper_thickness && m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL )
if( cfg.opengl_copper_thickness && cfg.engine == RENDER_ENGINE::OPENGL )
{
for( PCB_LAYER_ID layer : layer_ids )
{
@ -483,8 +478,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
createPadWithHole( pad, &m_TH_ODs, inflate );
if( m_Cfg->m_Render.clip_silk_on_via_annulus )
createPadWithHole( pad, &m_THAnnularRings, inflate );
if( cfg.clip_silk_on_via_annuli )
createPadWithHole( pad, &m_viaAnnuli, inflate );
createPadWithHole( pad, &m_TH_IDs, 0 );
}
@ -508,16 +503,16 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
if( pad->GetAttribute () != PAD_ATTRIB::NPTH )
{
if( m_Cfg->m_Render.clip_silk_on_via_annulus )
pad->TransformHoleToPolygon( m_THAnnularRingPolys, inflate, maxError, ERROR_INSIDE );
if( cfg.clip_silk_on_via_annuli )
pad->TransformHoleToPolygon( m_viaAnnuliPolys, inflate, maxError, ERROR_INSIDE );
pad->TransformHoleToPolygon( m_TH_ODPolys, inflate, maxError, ERROR_INSIDE );
}
else
{
// If not plated, no copper.
if( m_Cfg->m_Render.clip_silk_on_via_annulus )
pad->TransformHoleToPolygon( m_THAnnularRingPolys, 0, maxError, ERROR_INSIDE );
if( cfg.clip_silk_on_via_annuli )
pad->TransformHoleToPolygon( m_viaAnnuliPolys, 0, maxError, ERROR_INSIDE );
pad->TransformHoleToPolygon( m_NPTH_ODPolys, 0, maxError, ERROR_INSIDE );
}
@ -534,15 +529,14 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
// ADD PADS
for( FOOTPRINT* footprint : m_board->Footprints() )
{
addPads( footprint, layerContainer, layer, m_Cfg->m_Render.renderPlatedPadsAsPlated,
false );
addPads( footprint, layerContainer, layer, cfg.renderPlatedPadsAsPlated, false );
// Micro-wave footprints may have items on copper layers
addFootprintShapes( footprint, layerContainer, layer, visibilityFlags );
}
}
if( m_Cfg->m_Render.renderPlatedPadsAsPlated )
if( cfg.renderPlatedPadsAsPlated )
{
// ADD PLATED PADS
for( FOOTPRINT* footprint : m_board->Footprints() )
@ -556,7 +550,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
}
// Add footprints PADs poly contours (vertical outlines)
if( m_Cfg->m_Render.opengl_copper_thickness && m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL )
if( cfg.opengl_copper_thickness && cfg.engine == RENDER_ENGINE::OPENGL )
{
for( PCB_LAYER_ID layer : layer_ids )
{
@ -570,14 +564,13 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
// Note: NPTH pads are not drawn on copper layers when the pad has same shape as
// its hole
footprint->TransformPadsToPolySet( *layerPoly, layer, 0, maxError, ERROR_INSIDE,
true, m_Cfg->m_Render.renderPlatedPadsAsPlated,
false );
true, cfg.renderPlatedPadsAsPlated, false );
transformFPShapesToPolySet( footprint, layer, *layerPoly, maxError, ERROR_INSIDE );
}
}
if( m_Cfg->m_Render.renderPlatedPadsAsPlated )
if( cfg.renderPlatedPadsAsPlated )
{
// ADD PLATED PADS contours
for( FOOTPRINT* footprint : m_board->Footprints() )
@ -636,7 +629,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
}
// Add graphic item on copper layers to poly contours (vertical outlines)
if( m_Cfg->m_Render.opengl_copper_thickness && m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL )
if( cfg.opengl_copper_thickness && cfg.engine == RENDER_ENGINE::OPENGL )
{
for( PCB_LAYER_ID layer : layer_ids )
{
@ -681,7 +674,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
}
}
if( m_Cfg->m_Render.show_zones )
if( cfg.show_zones )
{
if( aStatusReporter )
aStatusReporter->Report( _( "Create zones" ) );
@ -726,8 +719,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
if( layerContainer != m_layerMap.end() )
addSolidAreasShapes( zone, layerContainer->second, layer );
if( m_Cfg->m_Render.opengl_copper_thickness
&& m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL
if( cfg.opengl_copper_thickness && cfg.engine == RENDER_ENGINE::OPENGL
&& layerPolyContainer != m_layers_poly.end() )
{
auto mut_it = layer_lock.find( layer );
@ -753,9 +745,9 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
if( aStatusReporter )
aStatusReporter->Report( _( "Simplifying copper layers polygons" ) );
if( m_Cfg->m_Render.opengl_copper_thickness && m_Cfg->m_Render.engine == RENDER_ENGINE::OPENGL )
if( cfg.opengl_copper_thickness && cfg.engine == RENDER_ENGINE::OPENGL )
{
if( m_Cfg->m_Render.renderPlatedPadsAsPlated )
if( cfg.renderPlatedPadsAsPlated )
{
if( m_frontPlatedPadPolys && ( m_layers_poly.find( F_Cu ) != m_layers_poly.end() ) )
{
@ -783,7 +775,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
std::vector<PCB_LAYER_ID> &selected_layer_id = layer_ids;
std::vector<PCB_LAYER_ID> layer_id_without_F_and_B;
if( m_Cfg->m_Render.renderPlatedPadsAsPlated )
if( cfg.renderPlatedPadsAsPlated )
{
layer_id_without_F_and_B.clear();
layer_id_without_F_and_B.reserve( layer_ids.size() );
@ -864,7 +856,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
m_TH_ODPolys.Simplify( SHAPE_POLY_SET::PM_FAST );
m_NPTH_ODPolys.Simplify( SHAPE_POLY_SET::PM_FAST );
m_viaTH_ODPolys.Simplify( SHAPE_POLY_SET::PM_FAST );
m_THAnnularRingPolys.Simplify( SHAPE_POLY_SET::PM_FAST );
m_viaAnnuliPolys.Simplify( SHAPE_POLY_SET::PM_FAST );
// Build Tech layers
// Based on:
@ -876,8 +868,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
// 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;
bool buildVerticalWallsForTechLayers = cfg.opengl_copper_thickness
&& cfg.engine == RENDER_ENGINE::OPENGL;
static const PCB_LAYER_ID techLayerList[] = {
B_Adhes,
@ -1070,7 +1062,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
}
// Draw non copper zones
if( m_Cfg->m_Render.show_zones )
if( cfg.show_zones )
{
for( ZONE* zone : m_board->Zones() )
{
@ -1097,7 +1089,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
// A somewhat experimental feature: if we're rendering off-board silk, turn any pads of
// footprints which are entirely outside the board outline into silk. This makes off-board
// footprints more visually recognizable.
if( m_Cfg->m_Render.show_off_board_silk )
if( cfg.show_off_board_silk )
{
BOX2I boardBBox = m_board_poly.BBox();
@ -1127,7 +1119,7 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
m_TH_IDs.BuildBVH();
m_TH_ODs.BuildBVH();
m_THAnnularRings.BuildBVH();
m_viaAnnuli.BuildBVH();
if( !m_layerHoleMap.empty() )
{

View File

@ -502,10 +502,10 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
m_outerViaThroughHoles = generateHoles( m_boardAdapter.GetViaTH_ODs().GetList(),
m_boardAdapter.GetViaTH_ODPolys(), 1.0f, 0.0f, false );
if( m_boardAdapter.m_Cfg->m_Render.clip_silk_on_via_annulus )
if( m_boardAdapter.m_Cfg->m_Render.clip_silk_on_via_annuli )
{
m_outerThroughHoleRings = generateHoles( m_boardAdapter.GetTHAnnularRings().GetList(),
m_boardAdapter.GetTHAnnularRingPolys(),
m_outerThroughHoleRings = generateHoles( m_boardAdapter.GetViaAnnuli().GetList(),
m_boardAdapter.GetViaAnnuliPolys(),
1.0f, 0.0f, false );
}
@ -567,7 +567,7 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
if( map_poly.find( layer ) != map_poly.end() )
{
polyListSubtracted = *map_poly.at( layer );;
polyListSubtracted = *map_poly.at( layer );
if( LSET::PhysicalLayersMask().test( layer ) )
{
@ -605,7 +605,6 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
if( oglList != nullptr )
m_layers[layer] = oglList;
}
if( m_boardAdapter.m_Cfg->m_Render.renderPlatedPadsAsPlated )

View File

@ -452,6 +452,8 @@ bool RENDER_3D_OPENGL::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
return false;
}
EDA_3D_VIEWER_SETTINGS::RENDER_SETTINGS& cfg = m_boardAdapter.m_Cfg->m_Render;
if( m_reloadRequested )
{
std::unique_ptr<BUSY_INDICATOR> busy = CreateBusyIndicator();
@ -462,16 +464,16 @@ bool RENDER_3D_OPENGL::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
reload( aStatusReporter, aWarningReporter );
// generate a new 3D grid as the size of the board may had changed
m_lastGridType = static_cast<GRID3D_TYPE>( m_boardAdapter.m_Cfg->m_Render.grid_type );
m_lastGridType = static_cast<GRID3D_TYPE>( cfg.grid_type );
generate3dGrid( m_lastGridType );
}
else
{
// Check if grid was changed
if( m_boardAdapter.m_Cfg->m_Render.grid_type != m_lastGridType )
if( cfg.grid_type != m_lastGridType )
{
// and generate a new one
m_lastGridType = static_cast<GRID3D_TYPE>( m_boardAdapter.m_Cfg->m_Render.grid_type );
m_lastGridType = static_cast<GRID3D_TYPE>( cfg.grid_type );
generate3dGrid( m_lastGridType );
}
}
@ -485,7 +487,7 @@ bool RENDER_3D_OPENGL::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
glEnable( GL_NORMALIZE ); // This allow OpenGL to normalize the normals after transformations
glViewport( 0, 0, m_windowSize.x, m_windowSize.y );
if( aIsMoving && m_boardAdapter.m_Cfg->m_Render.opengl_AA_disableOnMove )
if( aIsMoving && cfg.opengl_AA_disableOnMove )
glDisable( GL_MULTISAMPLE );
else
glEnable( GL_MULTISAMPLE );
@ -536,9 +538,9 @@ bool RENDER_3D_OPENGL::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
glLightfv( GL_LIGHT0, GL_POSITION, headlight_pos );
}
bool skipThickness = aIsMoving && m_boardAdapter.m_Cfg->m_Render.opengl_thickness_disableOnMove;
bool skipRenderHoles = aIsMoving && m_boardAdapter.m_Cfg->m_Render.opengl_holes_disableOnMove;
bool skipRenderVias = aIsMoving && m_boardAdapter.m_Cfg->m_Render.opengl_vias_disableOnMove;
bool skipThickness = aIsMoving && cfg.opengl_thickness_disableOnMove;
bool skipRenderHoles = aIsMoving && cfg.opengl_holes_disableOnMove;
bool skipRenderVias = aIsMoving && cfg.opengl_vias_disableOnMove;
bool drawMiddleSegments = !skipThickness;
@ -582,7 +584,7 @@ bool RENDER_3D_OPENGL::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
if( isCopperLayer )
{
if( m_boardAdapter.m_Cfg->m_Render.renderPlatedPadsAsPlated )
if( cfg.renderPlatedPadsAsPlated )
setCopperMaterial();
else
setLayerMaterial( layer_id );
@ -647,21 +649,18 @@ bool RENDER_3D_OPENGL::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
OPENGL_RENDER_LIST* anti_board = nullptr;
OPENGL_RENDER_LIST* solder_mask = nullptr;
if( isSilkLayer && m_boardAdapter.m_Cfg->m_Render.clip_silk_on_via_annulus )
if( isSilkLayer && cfg.clip_silk_on_via_annuli )
throughHolesOuter = m_outerThroughHoleRings;
else
throughHolesOuter = m_outerThroughHoles;
if( isSilkLayer && m_boardAdapter.m_Cfg->m_Render.show_off_board_silk )
if( isSilkLayer && cfg.show_off_board_silk )
anti_board = nullptr;
else if( LSET::PhysicalLayersMask().test( layer_id ) )
anti_board = m_antiBoard;
if( isSilkLayer && m_boardAdapter.m_Cfg->m_Render.subtract_mask_from_silk
&& !m_boardAdapter.m_Cfg->m_Render.show_off_board_silk )
{
if( isSilkLayer && cfg.subtract_mask_from_silk && !cfg.show_off_board_silk )
solder_mask = m_layers[ (layer_id == B_SilkS) ? B_Mask : F_Mask ];
}
if( throughHolesOuter )
throughHolesOuter->ApplyScalePosition( pLayerDispList );
@ -766,7 +765,7 @@ bool RENDER_3D_OPENGL::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
glDepthMask( GL_TRUE );
// Render Grid
if( m_boardAdapter.m_Cfg->m_Render.grid_type != GRID3D_TYPE::NONE )
if( cfg.grid_type != GRID3D_TYPE::NONE )
{
glDisable( GL_LIGHTING );
@ -777,7 +776,7 @@ bool RENDER_3D_OPENGL::Redraw( bool aIsMoving, REPORTER* aStatusReporter,
}
// Render 3D arrows
if( m_boardAdapter.m_Cfg->m_Render.show_axis )
if( cfg.show_axis )
render3dArrows();
// Return back to the original viewport (this is important if we want
@ -947,6 +946,8 @@ void RENDER_3D_OPENGL::get3dModelsSelected( std::list<MODELTORENDER> &aDstRender
if( !m_boardAdapter.GetBoard() )
return;
EDA_3D_VIEWER_SETTINGS::RENDER_SETTINGS& cfg = m_boardAdapter.m_Cfg->m_Render;
// Go for all footprints
for( FOOTPRINT* fp : m_boardAdapter.GetBoard()->Footprints() )
{
@ -957,7 +958,7 @@ void RENDER_3D_OPENGL::get3dModelsSelected( std::list<MODELTORENDER> &aDstRender
if( fp->IsSelected() )
highlight = true;
if( m_boardAdapter.m_Cfg->m_Render.highlight_on_rollover && fp == m_currentRollOverItem )
if( cfg.highlight_on_rollover && fp == m_currentRollOverItem )
highlight = true;
if( aRenderSelectedOnly != highlight )
@ -1071,7 +1072,9 @@ void RENDER_3D_OPENGL::get3dModelsFromFootprint( std::list<MODELTORENDER> &aDstR
void RENDER_3D_OPENGL::renderOpaqueModels( const glm::mat4 &aCameraViewMatrix )
{
const SFVEC3F selColor = m_boardAdapter.GetColor( m_boardAdapter.m_Cfg->m_Render.opengl_selection_color );
EDA_3D_VIEWER_SETTINGS::RENDER_SETTINGS& cfg = m_boardAdapter.m_Cfg->m_Render;
const SFVEC3F selColor = m_boardAdapter.GetColor( cfg.opengl_selection_color );
glPushMatrix();
@ -1113,7 +1116,9 @@ void RENDER_3D_OPENGL::renderOpaqueModels( const glm::mat4 &aCameraViewMatrix )
void RENDER_3D_OPENGL::renderTransparentModels( const glm::mat4 &aCameraViewMatrix )
{
const SFVEC3F selColor = m_boardAdapter.GetColor( m_boardAdapter.m_Cfg->m_Render.opengl_selection_color );
EDA_3D_VIEWER_SETTINGS::RENDER_SETTINGS& cfg = m_boardAdapter.m_Cfg->m_Render;
const SFVEC3F selColor = m_boardAdapter.GetColor( cfg.opengl_selection_color );
std::list<MODELTORENDER> renderListModels; // do not clear it until this function returns
@ -1201,6 +1206,8 @@ void RENDER_3D_OPENGL::renderModel( const glm::mat4 &aCameraViewMatrix,
const MODELTORENDER &aModelToRender,
const SFVEC3F &aSelColor, const SFVEC3F *aCameraWorldPos )
{
EDA_3D_VIEWER_SETTINGS::RENDER_SETTINGS& cfg = m_boardAdapter.m_Cfg->m_Render;
const glm::mat4 modelviewMatrix = aCameraViewMatrix * aModelToRender.m_modelWorldMat;
glLoadMatrixf( glm::value_ptr( modelviewMatrix ) );
@ -1209,7 +1216,7 @@ void RENDER_3D_OPENGL::renderModel( const glm::mat4 &aCameraViewMatrix,
aModelToRender.m_isSelected, aSelColor,
&aModelToRender.m_modelWorldMat, aCameraWorldPos );
if( m_boardAdapter.m_Cfg->m_Render.show_model_bbox )
if( cfg.show_model_bbox )
{
const bool wasBlendEnabled = glIsEnabled( GL_BLEND );

View File

@ -235,6 +235,8 @@ void RENDER_3D_RAYTRACE::createItemsFromContainer( const BVH_CONTAINER_2D* aCont
if( aContainer2d == nullptr )
return;
EDA_3D_VIEWER_SETTINGS::RENDER_SETTINGS& cfg = m_boardAdapter.m_Cfg->m_Render;
bool isSilk = aLayer_id == B_SilkS || aLayer_id == F_SilkS;
const LIST_OBJECT2D& listObject2d = aContainer2d->GetList();
if( listObject2d.size() == 0 )
@ -274,10 +276,8 @@ void RENDER_3D_RAYTRACE::createItemsFromContainer( const BVH_CONTAINER_2D* aCont
// layer and the flag is set, then clip the silk at the outer edge of the annular ring,
// rather than the at the outer edge of the copper plating.
const BVH_CONTAINER_2D& throughHoleOuter =
m_boardAdapter.m_Cfg->m_Render.clip_silk_on_via_annulus
&& ( aLayer_id == B_SilkS || aLayer_id == F_SilkS ) ?
m_boardAdapter.GetTHAnnularRings() :
m_boardAdapter.GetTH_ODs();
cfg.clip_silk_on_via_annuli && isSilk ? m_boardAdapter.GetViaAnnuli()
: m_boardAdapter.GetTH_ODs();
if( !throughHoleOuter.GetList().empty() )
{
@ -303,13 +303,13 @@ void RENDER_3D_RAYTRACE::createItemsFromContainer( const BVH_CONTAINER_2D* aCont
const MAP_CONTAINER_2D_BASE& mapLayers = m_boardAdapter.GetLayerMap();
if( m_boardAdapter.m_Cfg->m_Render.subtract_mask_from_silk
if( cfg.subtract_mask_from_silk
&& ( ( aLayer_id == B_SilkS && mapLayers.find( B_Mask ) != mapLayers.end() )
|| ( aLayer_id == F_SilkS && mapLayers.find( F_Mask ) != mapLayers.end() ) ) )
{
const PCB_LAYER_ID layerMask_id = ( aLayer_id == B_SilkS ) ? B_Mask : F_Mask;
const PCB_LAYER_ID maskLayer = ( aLayer_id == B_SilkS ) ? B_Mask : F_Mask;
const BVH_CONTAINER_2D* containerMaskLayer2d = mapLayers.at( layerMask_id );
const BVH_CONTAINER_2D* containerMaskLayer2d = mapLayers.at( maskLayer );
CONST_LIST_OBJECT2D intersecting;

View File

@ -365,7 +365,7 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
m_params.emplace_back( new PARAM<bool>( "render.subtract_mask_from_silk",
&m_Render.subtract_mask_from_silk, false ) );
m_params.emplace_back( new PARAM<bool>( "render.clip_silk_on_via_annulus",
&m_Render.clip_silk_on_via_annulus, false ) );
&m_Render.clip_silk_on_via_annuli, false ) );
m_params.emplace_back( new PARAM<bool>( "render.plated_and_bare_copper",
&m_Render.renderPlatedPadsAsPlated, false ) );
m_params.emplace_back( new PARAM<bool>( "camera.animation_enabled",

View File

@ -145,7 +145,7 @@ public:
bool show_fp_values;
bool show_fp_text;
bool subtract_mask_from_silk;
bool clip_silk_on_via_annulus;
bool clip_silk_on_via_annuli;
bool renderPlatedPadsAsPlated;
};

View File

@ -48,7 +48,7 @@ void PANEL_3D_DISPLAY_OPTIONS::loadViewSettings( EDA_3D_VIEWER_SETTINGS* aCfg )
m_checkBoxAreas->SetValue( aCfg->m_Render.show_zones );
m_checkBoxSubtractMaskFromSilk->SetValue( aCfg->m_Render.subtract_mask_from_silk );
m_checkBoxClipSilkOnViaAnnulus->SetValue( aCfg->m_Render.clip_silk_on_via_annulus );
m_checkBoxClipSilkOnViaAnnulus->SetValue( aCfg->m_Render.clip_silk_on_via_annuli );
m_checkBoxRenderPlatedPadsAsPlated->SetValue( aCfg->m_Render.renderPlatedPadsAsPlated );
m_materialProperties->SetSelection( static_cast<int>( aCfg->m_Render.material_mode ) );
@ -79,7 +79,7 @@ bool PANEL_3D_DISPLAY_OPTIONS::TransferDataFromWindow()
// Set visibility of items
cfg->m_Render.show_zones = m_checkBoxAreas->GetValue();
cfg->m_Render.subtract_mask_from_silk = m_checkBoxSubtractMaskFromSilk->GetValue();
cfg->m_Render.clip_silk_on_via_annulus = m_checkBoxClipSilkOnViaAnnulus->GetValue();
cfg->m_Render.clip_silk_on_via_annuli = m_checkBoxClipSilkOnViaAnnulus->GetValue();
cfg->m_Render.renderPlatedPadsAsPlated = m_checkBoxRenderPlatedPadsAsPlated->GetValue();
cfg->m_Render.material_mode = static_cast<MATERIAL_MODE>( m_materialProperties->GetSelection() );