3d-viewer, add an option to subtract Mask from Silk

Remove holes on Silk layer by default so the behaviour is the same
on OpenGL and Raytracing.
Fixes #1836
Fix raytracing shadow offset issue.
Some codestyle fix.
This commit is contained in:
Mario Luzeiro 2020-01-29 16:00:05 +00:00
parent 418dba440d
commit 970a0a593a
11 changed files with 480 additions and 1342 deletions

View File

@ -103,6 +103,7 @@ CINFO3D_VISU::CINFO3D_VISU() :
SetFlag( FL_ZONE, true );
SetFlag( FL_SILKSCREEN, true );
SetFlag( FL_SOLDERMASK, true );
SetFlag( FL_SUBTRACT_MASK_FROM_SILK, false );
m_BgColorBot = SFVEC3D( 0.4, 0.4, 0.5 );
m_BgColorTop = SFVEC3D( 0.8, 0.8, 0.9 );

View File

@ -32,9 +32,14 @@
/// Flags used in rendering options
enum DISPLAY3D_FLG {
FL_AXIS=0, FL_ZONE,
FL_ADHESIVE, FL_SILKSCREEN, FL_SOLDERMASK, FL_SOLDERPASTE,
FL_COMMENTS, FL_ECO,
FL_AXIS = 0,
FL_ZONE,
FL_ADHESIVE,
FL_SILKSCREEN,
FL_SOLDERMASK,
FL_SOLDERPASTE,
FL_COMMENTS,
FL_ECO,
FL_MODULE_ATTRIBUTES_NORMAL,
FL_MODULE_ATTRIBUTES_NORMAL_INSERT,
@ -43,6 +48,7 @@ enum DISPLAY3D_FLG {
FL_SHOW_BOARD_BODY,
FL_MOUSEWHEEL_PANNING,
FL_USE_REALISTIC_MODE,
FL_SUBTRACT_MASK_FROM_SILK,
// OpenGL options
FL_RENDER_OPENGL_SHOW_MODEL_BBOX,

View File

@ -735,8 +735,40 @@ bool C3D_RENDER_OGL_LEGACY::Redraw( bool aIsMoving,
}
else
{
pLayerDispList->DrawAllCameraCulled( m_settings.CameraGet().GetPos().z,
(aIsMoving == false) );
if( m_settings.GetFlag( FL_SUBTRACT_MASK_FROM_SILK ) &&
( ( ( layer_id == B_SilkS ) &&
( m_ogl_disp_lists_layers.find( B_Mask ) != m_ogl_disp_lists_layers.end() ) ) ||
( ( layer_id == F_SilkS ) &&
( m_ogl_disp_lists_layers.find( F_Mask ) != m_ogl_disp_lists_layers.end() ) ) ) )
{
const PCB_LAYER_ID layerMask_id = (layer_id == B_SilkS)?B_Mask:F_Mask;
const CLAYERS_OGL_DISP_LISTS *pLayerDispListMask = m_ogl_disp_lists_layers.at( layerMask_id );
pLayerDispList->DrawAllCameraCulledSubtractLayer(
pLayerDispListMask,
m_ogl_disp_list_through_holes_vias_outer,
(aIsMoving == false) );
}
else
{
if( m_ogl_disp_list_through_holes_vias_outer &&
( ( layer_id == B_SilkS ) || ( layer_id == F_SilkS )
// Remove vias on SolderPaste can be added as an option in future
// ( layer_id == B_Paste ) || ( layer_id == F_Paste ) )
) )
{
pLayerDispList->DrawAllCameraCulledSubtractLayer(
NULL,
m_ogl_disp_list_through_holes_vias_outer,
(aIsMoving == false) );
}
else
{
pLayerDispList->DrawAllCameraCulled( m_settings.CameraGet().GetPos().z,
(aIsMoving == false) );
}
}
}
glPopMatrix();
@ -762,6 +794,11 @@ bool C3D_RENDER_OGL_LEGACY::Redraw( bool aIsMoving,
//setLight_Top( true );
//setLight_Bottom( true );
// add a depth buffer offset, it will help to hide some artifacts
// on silkscreen where the SolderMask is removed
glEnable( GL_POLYGON_OFFSET_FILL );
glPolygonOffset( 0.0f, -1.0f );
if( m_settings.CameraGet().GetPos().z > 0 )
{
render_solder_mask_layer( B_Mask, m_settings.GetLayerTopZpos3DU( B_Mask ),
@ -778,6 +815,9 @@ bool C3D_RENDER_OGL_LEGACY::Redraw( bool aIsMoving,
render_solder_mask_layer( B_Mask, m_settings.GetLayerTopZpos3DU( B_Mask ),
aIsMoving );
}
glDisable( GL_POLYGON_OFFSET_FILL );
glPolygonOffset( 0.0f, 0.0f );
}

View File

@ -526,9 +526,6 @@ void CLAYERS_OGL_DISP_LISTS::DrawAllCameraCulledSubtractLayer(
const CLAYERS_OGL_DISP_LISTS *aLayerToSubtractB,
bool aDrawMiddle ) const
{
if( aDrawMiddle )
DrawMiddle();
glClearStencil( 0x00 );
glClear( GL_STENCIL_BUFFER_BIT );
@ -584,6 +581,8 @@ void CLAYERS_OGL_DISP_LISTS::DrawAllCameraCulledSubtractLayer(
glStencilOp( GL_KEEP, GL_KEEP, GL_INCR );
DrawTop();
if( aDrawMiddle )
DrawMiddle();
glLightModeli( GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE );

View File

@ -539,10 +539,12 @@ void C3D_RENDER_RAYTRACING::reload( REPORTER *aStatusTextReporter )
std::vector<const COBJECT2D *> *object2d_B = CSGITEM_EMPTY;
if( true ) // previously, was a option, now holes are always drawn in zones
{
object2d_B = new std::vector<const COBJECT2D *>();
object2d_B = new std::vector<const COBJECT2D*>();
// Subtract holes but not in SolderPaste
// (can be added as an option in future)
if( !( ( layer_id == B_Paste ) || ( layer_id == F_Paste ) ) )
{
// Check if there are any layerhole that intersects this object
// Eg: a segment is cutted by a via hole or THT hole.
// /////////////////////////////////////////////////////////////
@ -555,7 +557,6 @@ void C3D_RENDER_RAYTRACING::reload( REPORTER *aStatusTextReporter )
const CBVHCONTAINER2D *containerLayerHoles2d =
static_cast<const CBVHCONTAINER2D *>(ii_hole->second);
CONST_LIST_OBJECT2D intersectionList;
containerLayerHoles2d->GetListObjectsIntersects( object2d_A->GetBBox(),
intersectionList );
@ -600,14 +601,46 @@ void C3D_RENDER_RAYTRACING::reload( REPORTER *aStatusTextReporter )
}
}
}
}
if( object2d_B->empty() )
const MAP_CONTAINER_2D& mapLayers = m_settings.GetMapLayers();
if( m_settings.GetFlag( FL_SUBTRACT_MASK_FROM_SILK ) &&
( ( ( layer_id == B_SilkS ) &&
( mapLayers.find( B_Mask ) != mapLayers.end() ) ) ||
( ( layer_id == F_SilkS ) &&
( mapLayers.find( F_Mask ) != mapLayers.end() ) ) ) )
{
const PCB_LAYER_ID layerMask_id = ( layer_id == B_SilkS ) ? B_Mask : F_Mask;
const CBVHCONTAINER2D *containerMaskLayer2d =
static_cast<const CBVHCONTAINER2D*>( mapLayers.at( layerMask_id ) );
CONST_LIST_OBJECT2D intersectionList;
containerMaskLayer2d->GetListObjectsIntersects( object2d_A->GetBBox(),
intersectionList );
if( !intersectionList.empty() )
{
delete object2d_B;
object2d_B = CSGITEM_EMPTY;
for( CONST_LIST_OBJECT2D::const_iterator objOnLayer =
intersectionList.begin();
objOnLayer != intersectionList.end();
++objOnLayer )
{
const COBJECT2D* obj2d = static_cast<const COBJECT2D*>( *objOnLayer );
object2d_B->push_back( obj2d );
}
}
}
if( object2d_B->empty() )
{
delete object2d_B;
object2d_B = CSGITEM_EMPTY;
}
if( (object2d_B == CSGITEM_EMPTY) &&
(object2d_C == CSGITEM_FULL) )
{

View File

@ -1727,7 +1727,7 @@ SFVEC3F C3D_RENDER_RAYTRACING::shadeHit( const SFVEC3F &aBgColor,
SFVEC3F hitPoint = aHitInfo.m_HitPoint;
if( !m_isPreview )
hitPoint += aHitInfo.m_HitNormal * m_settings.GetNonCopperLayerThickness3DU() * 1.0f;
hitPoint += aHitInfo.m_HitNormal * m_settings.GetNonCopperLayerThickness3DU() * 1.2f;
const CMATERIAL *objMaterial = aHitInfo.pHitObject->GetMaterial();
wxASSERT( objMaterial != NULL );

View File

@ -87,6 +87,7 @@ void DIALOG_3D_VIEW_OPTIONS::initDialog()
m_bitmapAdhesive->SetBitmap( KiBitmap( tools_xpm ) );
m_bitmapComments->SetBitmap( KiBitmap( editor_xpm ) );
m_bitmapECO->SetBitmap( KiBitmap( editor_xpm ) );
m_bitmapSubtractMaskFromSilk->SetBitmap( KiBitmap( use_3D_copper_thickness_xpm ) );
}
@ -109,6 +110,7 @@ bool DIALOG_3D_VIEW_OPTIONS::TransferDataToWindow()
m_checkBoxAdhesive->SetValue( m_3Dprms.GetFlag( FL_ADHESIVE ) );
m_checkBoxComments->SetValue( m_3Dprms.GetFlag( FL_COMMENTS ) );
m_checkBoxECO->SetValue( m_3Dprms.GetFlag( FL_ECO ) );
m_checkBoxSubtractMaskFromSilk->SetValue( m_3Dprms.GetFlag( FL_SUBTRACT_MASK_FROM_SILK ) );
return true;
}
@ -124,6 +126,7 @@ bool DIALOG_3D_VIEW_OPTIONS::TransferDataFromWindow()
m_3Dprms.SetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS, m_checkBoxCuThickness->GetValue() );
m_3Dprms.SetFlag( FL_ZONE, m_checkBoxAreas->GetValue() );
m_3Dprms.SetFlag( FL_RENDER_OPENGL_SHOW_MODEL_BBOX, m_checkBoxBoundingBoxes->GetValue() );
m_3Dprms.SetFlag( FL_SUBTRACT_MASK_FROM_SILK, m_checkBoxSubtractMaskFromSilk->GetValue() );
// Set 3D shapes visibility
m_3Dprms.SetFlag( FL_MODULE_ATTRIBUTES_NORMAL, m_checkBox3DshapesTH->GetValue() );

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jul 11 2018)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -12,251 +12,260 @@
DIALOG_3D_VIEW_OPTIONS_BASE::DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerUpper;
bSizerUpper = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizeLeft;
bSizeLeft = new wxBoxSizer( wxVERTICAL );
m_staticText3DRenderOpts = new wxStaticText( this, wxID_ANY, _("Render options:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText3DRenderOpts->Wrap( -1 );
m_staticText3DRenderOpts->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
bSizeLeft->Add( m_staticText3DRenderOpts, 0, wxALL, 5 );
wxFlexGridSizer* fgSizerRenderOptions;
fgSizerRenderOptions = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizerRenderOptions->SetFlexibleDirection( wxBOTH );
fgSizerRenderOptions->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
fgSizerRenderOptions->Add( 0, 0, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 10 );
m_bitmapRealisticMode = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerRenderOptions->Add( m_bitmapRealisticMode, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBoxRealisticMode = new wxCheckBox( this, wxID_ANY, _("Realistic mode"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizerRenderOptions->Add( m_checkBoxRealisticMode, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
fgSizerRenderOptions->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 );
m_bitmapBoardBody = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerRenderOptions->Add( m_bitmapBoardBody, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBoxBoardBody = new wxCheckBox( this, wxID_ANY, _("Show board body"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizerRenderOptions->Add( m_checkBoxBoardBody, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
fgSizerRenderOptions->Add( 0, 0, 1, wxEXPAND, 5 );
m_bitmapCuThickness = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerRenderOptions->Add( m_bitmapCuThickness, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBoxCuThickness = new wxCheckBox( this, wxID_ANY, _("Show copper thickness"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizerRenderOptions->Add( m_checkBoxCuThickness, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
fgSizerRenderOptions->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 );
m_bitmapBoundingBoxes = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerRenderOptions->Add( m_bitmapBoundingBoxes, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBoxBoundingBoxes = new wxCheckBox( this, wxID_ANY, _("Show model bounding boxes"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizerRenderOptions->Add( m_checkBoxBoundingBoxes, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
fgSizerRenderOptions->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 );
m_bitmapAreas = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerRenderOptions->Add( m_bitmapAreas, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBoxAreas = new wxCheckBox( this, wxID_ANY, _("Show filled areas in zones"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizerRenderOptions->Add( m_checkBoxAreas, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
fgSizerRenderOptions->Add( 0, 0, 0, wxALIGN_LEFT|wxALIGN_RIGHT, 10 );
m_bitmapSubtractMaskFromSilk = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerRenderOptions->Add( m_bitmapSubtractMaskFromSilk, 0, wxALL, 5 );
m_checkBoxSubtractMaskFromSilk = new wxCheckBox( this, wxID_ANY, _("Subtract soldermask from silkscreen"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizerRenderOptions->Add( m_checkBoxSubtractMaskFromSilk, 0, wxALL, 5 );
wxFlexGridSizer* fgSizer3;
fgSizer3 = new wxFlexGridSizer( 0, 2, 0, 0 );
fgSizer3->SetFlexibleDirection( wxBOTH );
fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
fgSizerRenderOptions->Add( fgSizer3, 1, wxEXPAND, 5 );
bSizeLeft->Add( fgSizerRenderOptions, 0, wxEXPAND|wxBOTTOM, 5 );
bSizeLeft->Add( 0, 10, 0, 0, 5 );
m_staticText3DmodelVisibility = new wxStaticText( this, wxID_ANY, _("3D model visibility:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText3DmodelVisibility->Wrap( -1 );
m_staticText3DmodelVisibility->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
bSizeLeft->Add( m_staticText3DmodelVisibility, 0, wxALL, 5 );
wxFlexGridSizer* fgSizer3DVisibility;
fgSizer3DVisibility = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizer3DVisibility->SetFlexibleDirection( wxBOTH );
fgSizer3DVisibility->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
fgSizer3DVisibility->Add( 0, 0, 1, wxRIGHT|wxLEFT, 10 );
m_bitmap3DshapesTH = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3DVisibility->Add( m_bitmap3DshapesTH, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBox3DshapesTH = new wxCheckBox( this, wxID_ANY, _("Show 3D through hole models"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3DVisibility->Add( m_checkBox3DshapesTH, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
fgSizer3DVisibility->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 );
m_bitmap3DshapesSMD = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3DVisibility->Add( m_bitmap3DshapesSMD, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBox3DshapesSMD = new wxCheckBox( this, wxID_ANY, _("Show 3D SMD models"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3DVisibility->Add( m_checkBox3DshapesSMD, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
fgSizer3DVisibility->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 );
m_bitmap3DshapesVirtual = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3DVisibility->Add( m_bitmap3DshapesVirtual, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBox3DshapesVirtual = new wxCheckBox( this, wxID_ANY, _("Show 3D virtual models"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3DVisibility->Add( m_checkBox3DshapesVirtual, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
bSizeLeft->Add( fgSizer3DVisibility, 0, wxEXPAND, 5 );
bSizerUpper->Add( bSizeLeft, 1, wxEXPAND, 5 );
m_staticlineVertical = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
bSizerUpper->Add( m_staticlineVertical, 0, wxEXPAND | wxALL, 5 );
wxBoxSizer* bSizerRight;
bSizerRight = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizeLayer;
bSizeLayer = new wxBoxSizer( wxVERTICAL );
m_staticTextBoardLayers = new wxStaticText( this, wxID_ANY, _("Board layers:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextBoardLayers->Wrap( -1 );
m_staticTextBoardLayers->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
bSizeLayer->Add( m_staticTextBoardLayers, 0, wxALL, 5 );
wxFlexGridSizer* fgSizerShowBrdLayersOpts;
fgSizerShowBrdLayersOpts = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizerShowBrdLayersOpts->SetFlexibleDirection( wxBOTH );
fgSizerShowBrdLayersOpts->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
fgSizerShowBrdLayersOpts->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 );
m_bitmapSilkscreen = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowBrdLayersOpts->Add( m_bitmapSilkscreen, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBoxSilkscreen = new wxCheckBox( this, wxID_ANY, _("Show silkscreen layers"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowBrdLayersOpts->Add( m_checkBoxSilkscreen, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
fgSizerShowBrdLayersOpts->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 );
m_bitmapSolderMask = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowBrdLayersOpts->Add( m_bitmapSolderMask, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBoxSolderMask = new wxCheckBox( this, wxID_ANY, _("Show solder mask layers"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowBrdLayersOpts->Add( m_checkBoxSolderMask, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
fgSizerShowBrdLayersOpts->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 );
m_bitmapSolderPaste = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowBrdLayersOpts->Add( m_bitmapSolderPaste, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBoxSolderpaste = new wxCheckBox( this, wxID_ANY, _("Show solder paste layers"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowBrdLayersOpts->Add( m_checkBoxSolderpaste, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
fgSizerShowBrdLayersOpts->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 );
m_bitmapAdhesive = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowBrdLayersOpts->Add( m_bitmapAdhesive, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBoxAdhesive = new wxCheckBox( this, wxID_ANY, _("Show adhesive layers"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowBrdLayersOpts->Add( m_checkBoxAdhesive, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
bSizeLayer->Add( fgSizerShowBrdLayersOpts, 0, wxEXPAND, 5 );
bSizeLayer->Add( 0, 10, 0, 0, 5 );
m_staticTextUserLayers = new wxStaticText( this, wxID_ANY, _("User layers (not shown in realistic mode):"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextUserLayers->Wrap( -1 );
m_staticTextUserLayers->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
bSizeLayer->Add( m_staticTextUserLayers, 0, wxALL, 5 );
wxFlexGridSizer* fgSizerShowUserLayersOpts;
fgSizerShowUserLayersOpts = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizerShowUserLayersOpts->SetFlexibleDirection( wxBOTH );
fgSizerShowUserLayersOpts->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
fgSizerShowUserLayersOpts->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 );
m_bitmapComments = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowUserLayersOpts->Add( m_bitmapComments, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBoxComments = new wxCheckBox( this, wxID_ANY, _("Show comments and drawings layers"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowUserLayersOpts->Add( m_checkBoxComments, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
fgSizerShowUserLayersOpts->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 );
m_bitmapECO = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowUserLayersOpts->Add( m_bitmapECO, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_checkBoxECO = new wxCheckBox( this, wxID_ANY, _("Show ECO layers"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShowUserLayersOpts->Add( m_checkBoxECO, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
bSizeLayer->Add( fgSizerShowUserLayersOpts, 0, wxEXPAND, 5 );
bSizerRight->Add( bSizeLayer, 1, wxEXPAND, 5 );
bSizerUpper->Add( bSizerRight, 1, wxEXPAND, 5 );
bSizerMain->Add( bSizerUpper, 1, wxEXPAND, 5 );
m_staticlineH = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerMain->Add( m_staticlineH, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK );
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize();
bSizerMain->Add( m_sdbSizer, 0, wxALL|wxALIGN_RIGHT, 5 );
this->SetSizer( bSizerMain );
this->Layout();
this->Centre( wxBOTH );
// Connect Events
m_checkBoxRealisticMode->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_3D_VIEW_OPTIONS_BASE::OnCheckRealisticMode ), NULL, this );
}
@ -265,5 +274,5 @@ DIALOG_3D_VIEW_OPTIONS_BASE::~DIALOG_3D_VIEW_OPTIONS_BASE()
{
// Disconnect Events
m_checkBoxRealisticMode->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_3D_VIEW_OPTIONS_BASE::OnCheckRealisticMode ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,11 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jul 11 2018)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_3D_VIEW_OPTION_BASE_H__
#define __DIALOG_3D_VIEW_OPTION_BASE_H__
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
@ -37,7 +36,7 @@
class DIALOG_3D_VIEW_OPTIONS_BASE : public DIALOG_SHIM
{
private:
protected:
wxStaticText* m_staticText3DRenderOpts;
wxStaticBitmap* m_bitmapRealisticMode;
@ -50,6 +49,8 @@ class DIALOG_3D_VIEW_OPTIONS_BASE : public DIALOG_SHIM
wxCheckBox* m_checkBoxBoundingBoxes;
wxStaticBitmap* m_bitmapAreas;
wxCheckBox* m_checkBoxAreas;
wxStaticBitmap* m_bitmapSubtractMaskFromSilk;
wxCheckBox* m_checkBoxSubtractMaskFromSilk;
wxStaticText* m_staticText3DmodelVisibility;
wxStaticBitmap* m_bitmap3DshapesTH;
wxCheckBox* m_checkBox3DshapesTH;
@ -76,16 +77,15 @@ class DIALOG_3D_VIEW_OPTIONS_BASE : public DIALOG_SHIM
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnCheckRealisticMode( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("3D Display Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 571,372 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("3D Display Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 571,372 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_3D_VIEW_OPTIONS_BASE();
};
#endif //__DIALOG_3D_VIEW_OPTION_BASE_H__

View File

@ -87,6 +87,7 @@ static const wxChar keyBoardBodyColor_Green[] = wxT( "BoardBodyColor_Green" );
static const wxChar keyBoardBodyColor_Blue[] = wxT( "BoardBodyColor_Blue" );
static const wxChar keyShowRealisticMode[] = wxT( "ShowRealisticMode" );
static const wxChar keySubtractMaskFromSilk[] = wxT( "SubtractMaskFromSilk" );
static const wxChar keyRenderEngine[] = wxT( "RenderEngine" );
static const wxChar keyRenderMaterial[] = wxT( "Render_Material" );
@ -756,6 +757,9 @@ void EDA_3D_VIEWER::LoadSettings( wxConfigBase *aCfg )
aCfg->Read( keyShowRealisticMode, &tmp, true );
m_settings.SetFlag( FL_USE_REALISTIC_MODE, tmp );
aCfg->Read( keySubtractMaskFromSilk, &tmp, false );
m_settings.SetFlag( FL_SUBTRACT_MASK_FROM_SILK, tmp );
// OpenGL options
aCfg->Read( keyRenderOGL_ShowCopperTck, &tmp, true );
m_settings.SetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS, tmp );
@ -879,13 +883,14 @@ void EDA_3D_VIEWER::SaveSettings( wxConfigBase *aCfg )
aCfg->Write( keyBoardBodyColor_Blue, m_settings.m_BoardBodyColor.b );
aCfg->Write( keyShowRealisticMode, m_settings.GetFlag( FL_USE_REALISTIC_MODE ) );
aCfg->Write( keySubtractMaskFromSilk, m_settings.GetFlag( FL_SUBTRACT_MASK_FROM_SILK ) );
aCfg->Write( keyRenderEngine, static_cast<int>( m_settings.RenderEngineGet() ) );
wxLogTrace( m_logTrace, "EDA_3D_VIEWER::SaveSettings render setting %s",
( m_settings.RenderEngineGet() == RENDER_ENGINE::RAYTRACING ) ? "Ray Trace" :
"OpenGL" );
aCfg->Write( keyRenderMaterial, (int)m_settings.MaterialModeGet() );
aCfg->Write( keyRenderMaterial, (int) m_settings.MaterialModeGet() );
// OpenGL options
aCfg->Write( keyRenderOGL_ShowCopperTck,