KiCad PCB EDA Suite
eda_3d_viewer.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
5  * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #include <wx/colordlg.h>
26 #include <wx/colour.h>
27 #include <wx/filename.h>
28 #include <wx/string.h>
29 #include <wx/wupdlock.h>
30 #include <wx/clipbrd.h>
31 #include "eda_3d_viewer.h"
32 #include <3d_viewer_settings.h>
33 #include <3d_viewer_id.h>
34 #include "../common_ogl/cogl_att_list.h"
38 #include <bitmaps.h>
41 #include <class_board.h>
43 #include <gal/dpi_scaling.h>
44 #include <pgm_base.h>
45 #include <project.h>
48 #include <tool/action_manager.h>
49 #include <tool/common_control.h>
50 #include <tool/tool_manager.h>
51 #include <tool/tool_dispatcher.h>
52 #include <tool/action_toolbar.h>
53 #include <widgets/infobar.h>
55 
63 const wxChar * EDA_3D_VIEWER::m_logTrace = wxT( "KI_TRACE_EDA_3D_VIEWER" );
64 
65 
66 BEGIN_EVENT_TABLE( EDA_3D_VIEWER, EDA_BASE_FRAME )
67 
68  EVT_ACTIVATE( EDA_3D_VIEWER::OnActivate )
69  EVT_SET_FOCUS( EDA_3D_VIEWER::OnSetFocus )
70 
72  EDA_3D_VIEWER::Process_Special_Functions )
73 
74  EVT_TOOL( ID_TOOL_SET_VISIBLE_ITEMS, EDA_3D_VIEWER::Install3DViewOptionDialog )
75 
76  EVT_MENU( wxID_CLOSE, EDA_3D_VIEWER::Exit3DFrame )
77  EVT_MENU( ID_RENDER_CURRENT_VIEW, EDA_3D_VIEWER::OnRenderEngineSelection )
78  EVT_MENU( ID_DISABLE_RAY_TRACING, EDA_3D_VIEWER::OnDisableRayTracing )
79 
80  EVT_CLOSE( EDA_3D_VIEWER::OnCloseWindow )
81 END_EVENT_TABLE()
82 
83 
84 EDA_3D_VIEWER::EDA_3D_VIEWER( KIWAY *aKiway, PCB_BASE_FRAME *aParent, const wxString &aTitle,
85  long style ) :
86  KIWAY_PLAYER( aKiway, aParent, FRAME_PCB_DISPLAY3D, aTitle, wxDefaultPosition,
87  wxDefaultSize, style, QUALIFIED_VIEWER3D_FRAMENAME( aParent ) ),
88  m_mainToolBar( nullptr ),
89  m_canvas( nullptr ),
90  m_currentCamera( m_trackBallCamera ),
91  m_trackBallCamera( RANGE_SCALE_3D )
92 {
93  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::EDA_3D_VIEWER %s", aTitle );
94 
95  m_disable_ray_tracing = false;
96  m_AboutTitle = "3D Viewer";
97 
98  // Give it an icon
99  wxIcon icon;
100  icon.CopyFromBitmap( KiBitmap( icon_3d_xpm ) );
101  SetIcon( icon );
102 
103  // Create the status line
104  static const int status_dims[4] = { -1, 130, 130, 170 };
105 
106  wxStatusBar *status_bar = CreateStatusBar( arrayDim( status_dims ) );
107  SetStatusWidths( arrayDim( status_dims ), status_dims );
108 
109  m_canvas = new EDA_3D_CANVAS( this, COGL_ATT_LIST::GetAttributesList( m_boardAdapter.AntiAliasingGet() ),
110  aParent->GetBoard(), m_boardAdapter, m_currentCamera,
111  Prj().Get3DCacheManager() );
112 
113  auto config = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
114  LoadSettings( config );
115 
116  // Some settings need the canvas
117  loadCommonSettings();
118 
119  // Create the manager
120  m_toolManager = new TOOL_MANAGER;
121  m_toolManager->SetEnvironment( GetBoard(), nullptr, nullptr, config, this );
122 
123  m_actions = new EDA_3D_ACTIONS();
124  m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
125  m_canvas->SetEventDispatcher( m_toolDispatcher );
126 
127  // Register tools
128  m_toolManager->RegisterTool( new COMMON_CONTROL );
129  m_toolManager->RegisterTool( new EDA_3D_CONTROLLER );
130  m_toolManager->InitTools();
131 
132  setupUIConditions();
133 
134  if( EDA_3D_CONTROLLER* ctrlTool = GetToolManager()->GetTool<EDA_3D_CONTROLLER>() )
135  ctrlTool->SetRotationIncrement( config->m_Camera.rotation_increment );
136 
137  // Run the viewer control tool, it is supposed to be always active
138  m_toolManager->InvokeTool( "3DViewer.Control" );
139 
140  CreateMenuBar();
141  ReCreateMainToolbar();
142 
143  // Create the infobar
144  m_infoBar = new WX_INFOBAR( this, &m_auimgr );
145 
146  m_auimgr.SetManagedWindow( this );
147 
148  m_auimgr.AddPane( m_mainToolBar,
149  EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer( 6 ) );
150  m_auimgr.AddPane( m_infoBar,
151  EDA_PANE().InfoBar().Name( "InfoBar" ).Top().Layer(1) );
152  m_auimgr.AddPane( m_canvas,
153  EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
154 
155  // Call Update() to fix all pane default sizes, especially the "InfoBar" pane before
156  // hidding it.
157  m_auimgr.Update();
158 
159  // We don't want the infobar displayed right away
160  m_auimgr.GetPane( "InfoBar" ).Hide();
161  m_auimgr.Update();
162 
163  if( m_canvas )
164  {
165  m_canvas->SetInfoBar( m_infoBar );
166  m_canvas->SetStatusBar( status_bar );
167  }
168 
169  // Fixes bug in Windows (XP and possibly others) where the canvas requires the focus
170  // in order to receive mouse events. Otherwise, the user has to click somewhere on
171  // the canvas before it will respond to mouse wheel events.
172  if( m_canvas )
173  m_canvas->SetFocus();
174 }
175 
176 
178 {
179  m_canvas->SetEventDispatcher( nullptr );
180 
181  m_auimgr.UnInit();
182 
183  // m_canvas delete will be called by wxWidget manager
184  //delete m_canvas;
185  //m_canvas = nullptr;
186 }
187 
188 
190 {
192 
195 
196 // Helper to define check conditions
197 #define MaterialCheck( x ) ACTION_CONDITIONS().Check( cond.MaterialMode( x ) )
198 #define FlagCheck( x ) ACTION_CONDITIONS().Check( cond.Flag( x ) )
199 #define GridSizeCheck( x ) ACTION_CONDITIONS().Check( cond.GridSize( x ) )
200 
201  auto raytracingCondition = [this]( const SELECTION& aSel )
202  {
204  };
205 
207  ACTION_CONDITIONS().Check( raytracingCondition ) );
208 
215 
233  FlagCheck( FL_AXIS ) );
234 
240 
241 
242  auto orthoCondition =
243  [this] ( const SELECTION& )
244  {
246  };
247 
248  mgr->SetConditions( EDA_3D_ACTIONS::toggleOrtho, ACTION_CONDITIONS().Check( orthoCondition ) );
249 
250 #undef MaterialCheck
251 #undef FlagCheck
252 #undef GridSizeCheck
253 }
254 
255 
257 {
258  // This will schedule a request to load later
259  if( m_canvas )
260  m_canvas->ReloadRequest( GetBoard(), Prj().Get3DCacheManager() );
261 }
262 
263 
264 void EDA_3D_VIEWER::NewDisplay( bool aForceImmediateRedraw )
265 {
266  ReloadRequest();
267 
268  // After the ReloadRequest call, the refresh often takes a bit of time,
269  // and it is made here only on request.
270  if( aForceImmediateRedraw )
271  m_canvas->Refresh();
272 }
273 
274 
275 void EDA_3D_VIEWER::Exit3DFrame( wxCommandEvent &event )
276 {
277  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::Exit3DFrame" );
278 
279  Close( true );
280 }
281 
282 
283 void EDA_3D_VIEWER::OnCloseWindow( wxCloseEvent &event )
284 {
285  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::OnCloseWindow" );
286 
287  if( m_canvas )
288  m_canvas->Close();
289 
290  // m_canvas delete will be called by wxWidget manager
291  //delete m_canvas;
292  //m_canvas = nullptr;
293 
294  Destroy();
295  event.Skip( true );
296 }
297 
298 
299 void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
300 {
301  int id = event.GetId();
302  bool isChecked = event.IsChecked();
303 
304  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::Process_Special_Functions id %d isChecked %d",
305  id, isChecked );
306 
307  if( m_canvas == NULL )
308  return;
309 
310  switch( id )
311  {
312  case ID_RELOAD3D_BOARD:
313  NewDisplay( true );
314  break;
315 
319  takeScreenshot( event );
320  return;
321 
323  if( Set3DColorFromUser( m_boardAdapter.m_BgColorBot, _( "Background Color, Bottom" ),
324  nullptr ) )
325  {
328  else
329  NewDisplay( true );
330  }
331  return;
332 
334  if( Set3DColorFromUser( m_boardAdapter.m_BgColorTop, _( "Background Color, Top" ), nullptr ) )
335  {
338  else
339  NewDisplay( true );
340  }
341  return;
342 
345  return;
346 
349  return;
350 
353  return;
354 
357  break;
358 
361  break;
362 
365  NewDisplay( true );
366  break;
367 
369  {
370  auto cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
371  cfg->ResetToDefaults();
372  LoadSettings( cfg );
373 
374  // Tell canvas that we (may have) changed the render engine
376 
377  NewDisplay( true );
378  }
379  return;
380 
381  default:
382  wxFAIL_MSG( "Invalid event in EDA_3D_VIEWER::Process_Special_Functions()" );
383  return;
384  }
385 }
386 
387 
388 void EDA_3D_VIEWER::OnRenderEngineSelection( wxCommandEvent &event )
389 {
390  const RENDER_ENGINE old_engine = m_boardAdapter.RenderEngineGet();
391 
392  if( old_engine == RENDER_ENGINE::OPENGL_LEGACY )
394  else
396 
397  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::OnRenderEngineSelection type %s ",
399  "OpenGL Legacy" );
400 
401  if( old_engine != m_boardAdapter.RenderEngineGet() )
403 }
404 
405 
406 void EDA_3D_VIEWER::OnDisableRayTracing( wxCommandEvent& aEvent )
407 {
408  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::%s disabling ray tracing.", __WXFUNCTION__ );
409 
410  m_disable_ray_tracing = true;
412 }
413 
414 
415 void EDA_3D_VIEWER::OnActivate( wxActivateEvent &event )
416 {
417  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::OnActivate" );
418 
419  if( m_canvas )
420  {
421  // Reload data if 3D frame shows a board,
422  // because it can be changed since last frame activation
425 
426  // Activates again the focus of the canvas so it will catch mouse and key events
427  m_canvas->SetFocus();
428  }
429 
430  event.Skip(); // required under wxMAC
431 }
432 
433 
434 void EDA_3D_VIEWER::OnSetFocus(wxFocusEvent &event)
435 {
436  // Activates again the focus of the canvas so it will catch mouse and key events
437  if( m_canvas )
438  m_canvas->SetFocus();
439 
440  event.Skip();
441 }
442 
443 
445 {
447 
448  EDA_3D_VIEWER_SETTINGS* cfg = dynamic_cast<EDA_3D_VIEWER_SETTINGS*>( aCfg );
449  wxASSERT( cfg );
450 
451  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::LoadSettings" );
452 
453  COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings();
454 
455  auto set_color =
456  [] ( const COLOR4D& aColor, SFVEC4F& aTarget )
457  {
458  aTarget.r = aColor.r;
459  aTarget.g = aColor.g;
460  aTarget.b = aColor.b;
461  aTarget.a = aColor.a;
462  };
463 
465  set_color( colors->GetColor( LAYER_3D_BACKGROUND_TOP ), m_boardAdapter.m_BgColorTop );
466  set_color( colors->GetColor( LAYER_3D_BOARD ), m_boardAdapter.m_BoardBodyColor );
467  set_color( colors->GetColor( LAYER_3D_COPPER ), m_boardAdapter.m_CopperColor );
473 
474  if( cfg )
475  {
479 
482 
483  for( size_t i = 0; i < cfg->m_Render.raytrace_lightColor.size(); ++i )
484  {
486 
487  SFVEC2F sphericalCoord = SFVEC2F( ( cfg->m_Render.raytrace_lightElevation[i] + 90.0f ) / 180.0f,
488  cfg->m_Render.raytrace_lightAzimuth[i] / 180.0f );
489 
490  sphericalCoord.x = glm::clamp( sphericalCoord.x, 0.0f, 1.0f );
491  sphericalCoord.y = glm::clamp( sphericalCoord.y, 0.0f, 2.0f );
492 
494  }
495 
496 #define TRANSFER_SETTING( flag, field ) m_boardAdapter.SetFlag( flag, cfg->m_Render.field )
497 
499  TRANSFER_SETTING( FL_SUBTRACT_MASK_FROM_SILK, subtract_mask_from_silk );
500 
501  // OpenGL options
502  TRANSFER_SETTING( FL_RENDER_OPENGL_COPPER_THICKNESS, opengl_copper_thickness );
503  TRANSFER_SETTING( FL_RENDER_OPENGL_SHOW_MODEL_BBOX, opengl_show_model_bbox );
504  TRANSFER_SETTING( FL_RENDER_OPENGL_AA_DISABLE_ON_MOVE, opengl_AA_disableOnMove );
505  TRANSFER_SETTING( FL_RENDER_OPENGL_THICKNESS_DISABLE_ON_MOVE, opengl_thickness_disableOnMove );
506  TRANSFER_SETTING( FL_RENDER_OPENGL_VIAS_DISABLE_ON_MOVE, opengl_vias_disableOnMove );
507  TRANSFER_SETTING( FL_RENDER_OPENGL_HOLES_DISABLE_ON_MOVE, opengl_holes_disableOnMove );
508 
509  // Raytracing options
510  TRANSFER_SETTING( FL_RENDER_RAYTRACING_SHADOWS, raytrace_shadows );
511  TRANSFER_SETTING( FL_RENDER_RAYTRACING_BACKFLOOR, raytrace_backfloor );
512  TRANSFER_SETTING( FL_RENDER_RAYTRACING_REFRACTIONS, raytrace_refractions );
513  TRANSFER_SETTING( FL_RENDER_RAYTRACING_REFLECTIONS, raytrace_reflections );
514  TRANSFER_SETTING( FL_RENDER_RAYTRACING_POST_PROCESSING, raytrace_post_processing );
515  TRANSFER_SETTING( FL_RENDER_RAYTRACING_ANTI_ALIASING, raytrace_anti_aliasing );
516  TRANSFER_SETTING( FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES, raytrace_procedural_textures );
517 
518  TRANSFER_SETTING( FL_AXIS, show_axis );
519  TRANSFER_SETTING( FL_MODULE_ATTRIBUTES_NORMAL, show_footprints_normal );
520  TRANSFER_SETTING( FL_MODULE_ATTRIBUTES_NORMAL_INSERT, show_footprints_insert );
521  TRANSFER_SETTING( FL_MODULE_ATTRIBUTES_VIRTUAL, show_footprints_virtual );
522  TRANSFER_SETTING( FL_ZONE, show_zones );
523  TRANSFER_SETTING( FL_ADHESIVE, show_adhesive );
524  TRANSFER_SETTING( FL_SILKSCREEN, show_silkscreen );
525  TRANSFER_SETTING( FL_SOLDERMASK, show_soldermask );
526  TRANSFER_SETTING( FL_SOLDERPASTE, show_solderpaste );
527  TRANSFER_SETTING( FL_COMMENTS, show_comments );
528  TRANSFER_SETTING( FL_ECO, show_eco );
529  TRANSFER_SETTING( FL_SHOW_BOARD_BODY, show_board_body );
530  TRANSFER_SETTING( FL_CLIP_SILK_ON_VIA_ANNULUS, clip_silk_on_via_annulus );
531 
532  m_boardAdapter.GridSet( static_cast<GRID3D_TYPE>( cfg->m_Render.grid_type ) );
533  m_boardAdapter.AntiAliasingSet( static_cast<ANTIALIASING_MODE>( cfg->m_Render.opengl_AA_mode ) );
534 
538 
542 
545 
546  // When opening the 3D viewer, we use the opengl mode, not the ray tracing engine
547  // because the ray tracing is very time consumming, and can be seen as not working
548  // (freeze window) with large boards.
549 #if 0
550  RENDER_ENGINE engine = static_cast<RENDER_ENGINE>( cfg->m_Render.engine );
551  wxLogTrace( m_logTrace, engine == RENDER_ENGINE::RAYTRACING ?
552  "EDA_3D_VIEWER::LoadSettings render setting Ray Trace" :
553  "EDA_3D_VIEWER::LoadSettings render setting OpenGL" );
554 #else
556 #endif
557 
558  m_boardAdapter.MaterialModeSet( static_cast<MATERIAL_MODE>( cfg->m_Render.material_mode ) );
559 
562 
563 #undef TRANSFER_SETTING
564  }
565 }
566 
567 
569 {
570  auto cfg = Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>();
571 
573 
574  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::SaveSettings" );
575 
576  COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings();
577 
578  auto save_color =
579  [colors] ( SFVEC4F& aSource, LAYER_3D_ID aTarget )
580  {
581  // You could think just copy the new color in config is enough.
582  // unfortunately, SFVEC4F uses floats, and COLOR4D uses doubles,
583  // and the conversion SFVEC4F from/to COLOR4D creates small diffs.
584  //
585  // This has no matter to draw colors, but creates slight differences
586  // in config file, that appears always modified.
587  // So we must compare the SFVEC4F old and new values and update only
588  // actual changes.
589  SFVEC4F newSFVEC4Fcolor( float(colors->GetColor( aTarget ).r),
590  float(colors->GetColor( aTarget ).g),
591  float(colors->GetColor( aTarget ).b),
592  float(colors->GetColor( aTarget ).a) );
593 
594  if( aSource != newSFVEC4Fcolor )
595  colors->SetColor( aTarget, COLOR4D( aSource.r, aSource.g, aSource.b, aSource.a ) );
596  };
597 
606 
607  Pgm().GetSettingsManager().SaveColorSettings( colors, "3d_viewer" );
608 
610  "EDA_3D_VIEWER::SaveSettings render setting Ray Trace" :
611  "EDA_3D_VIEWER::SaveSettings render setting OpenGL" );
612 
613  if( cfg )
614  {
615 
616  auto save_color =
617  [] ( const SFVEC3F& aSource, COLOR4D& aTarget )
618  {
619  aTarget = COLOR4D( aSource.r, aSource.g, aSource.b, 1.0 );
620  };
621 
622  save_color( m_boardAdapter.m_raytrace_lightColorCamera, cfg->m_Render.raytrace_lightColorCamera );
623 
624  save_color( m_boardAdapter.m_raytrace_lightColorTop, cfg->m_Render.raytrace_lightColorTop );
625  save_color( m_boardAdapter.m_raytrace_lightColorBottom, cfg->m_Render.raytrace_lightColorBottom );
626 
627  for( size_t i = 0; i < cfg->m_Render.raytrace_lightColor.size(); ++i )
628  {
629  save_color( m_boardAdapter.m_raytrace_lightColor[i], cfg->m_Render.raytrace_lightColor[i] );
630 
631  cfg->m_Render.raytrace_lightElevation[i] = (int)( m_boardAdapter.m_raytrace_lightSphericalCoords[i].x * 180.0f - 90.0f );
632  cfg->m_Render.raytrace_lightAzimuth[i] = (int)( m_boardAdapter.m_raytrace_lightSphericalCoords[i].y * 180.0f );
633  }
634 
635  cfg->m_Render.raytrace_nrsamples_shadows = m_boardAdapter.m_raytrace_nrsamples_shadows;
636  cfg->m_Render.raytrace_nrsamples_reflections = m_boardAdapter.m_raytrace_nrsamples_reflections;
637  cfg->m_Render.raytrace_nrsamples_refractions = m_boardAdapter.m_raytrace_nrsamples_refractions;
638 
639  cfg->m_Render.raytrace_spread_shadows = m_boardAdapter.m_raytrace_spread_shadows;
640  cfg->m_Render.raytrace_spread_reflections = m_boardAdapter.m_raytrace_spread_reflections;
641  cfg->m_Render.raytrace_spread_refractions = m_boardAdapter.m_raytrace_spread_refractions;
642 
643  cfg->m_Render.raytrace_recursivelevel_refractions = m_boardAdapter.m_raytrace_recursivelevel_refractions;
644  cfg->m_Render.raytrace_recursivelevel_reflections = m_boardAdapter.m_raytrace_recursivelevel_reflections;
645 
646 #define TRANSFER_SETTING( field, flag ) cfg->m_Render.field = m_boardAdapter.GetFlag( flag )
647 
648  cfg->m_Render.engine = static_cast<int>( m_boardAdapter.RenderEngineGet() );
649  cfg->m_Render.grid_type = static_cast<int>( m_boardAdapter.GridGet() );
650  cfg->m_Render.material_mode = static_cast<int>( m_boardAdapter.MaterialModeGet() );
651  cfg->m_Render.opengl_AA_mode = static_cast<int>( m_boardAdapter.AntiAliasingGet() );
652 
653  cfg->m_Camera.animation_enabled = m_canvas->AnimationEnabledGet();
654  cfg->m_Camera.moving_speed_multiplier = m_canvas->MovingSpeedMultiplierGet();
655 
656  if( EDA_3D_CONTROLLER* ctrlTool = GetToolManager()->GetTool<EDA_3D_CONTROLLER>() )
657  cfg->m_Camera.rotation_increment = ctrlTool->GetRotationIncrement();
658 
659  TRANSFER_SETTING( opengl_AA_disableOnMove, FL_RENDER_OPENGL_AA_DISABLE_ON_MOVE );
660  TRANSFER_SETTING( opengl_copper_thickness, FL_RENDER_OPENGL_COPPER_THICKNESS );
661  TRANSFER_SETTING( opengl_show_model_bbox, FL_RENDER_OPENGL_SHOW_MODEL_BBOX );
662  TRANSFER_SETTING( opengl_thickness_disableOnMove, FL_RENDER_OPENGL_THICKNESS_DISABLE_ON_MOVE );
663  TRANSFER_SETTING( opengl_vias_disableOnMove, FL_RENDER_OPENGL_VIAS_DISABLE_ON_MOVE );
664  TRANSFER_SETTING( opengl_holes_disableOnMove, FL_RENDER_OPENGL_HOLES_DISABLE_ON_MOVE );
665 
666  TRANSFER_SETTING( raytrace_anti_aliasing, FL_RENDER_RAYTRACING_ANTI_ALIASING );
667  TRANSFER_SETTING( raytrace_backfloor, FL_RENDER_RAYTRACING_BACKFLOOR );
668  TRANSFER_SETTING( raytrace_post_processing, FL_RENDER_RAYTRACING_POST_PROCESSING );
669  TRANSFER_SETTING( raytrace_procedural_textures, FL_RENDER_RAYTRACING_PROCEDURAL_TEXTURES );
670  TRANSFER_SETTING( raytrace_reflections, FL_RENDER_RAYTRACING_REFLECTIONS );
671  TRANSFER_SETTING( raytrace_refractions, FL_RENDER_RAYTRACING_REFRACTIONS );
672  TRANSFER_SETTING( raytrace_shadows, FL_RENDER_RAYTRACING_SHADOWS );
673 
675  TRANSFER_SETTING( show_adhesive, FL_ADHESIVE );
676  TRANSFER_SETTING( show_axis, FL_AXIS );
677  TRANSFER_SETTING( show_board_body, FL_SHOW_BOARD_BODY );
678  TRANSFER_SETTING( clip_silk_on_via_annulus, FL_CLIP_SILK_ON_VIA_ANNULUS );
679  TRANSFER_SETTING( show_comments, FL_COMMENTS );
680  TRANSFER_SETTING( show_eco, FL_ECO );
681  TRANSFER_SETTING( show_footprints_insert, FL_MODULE_ATTRIBUTES_NORMAL_INSERT );
682  TRANSFER_SETTING( show_footprints_normal, FL_MODULE_ATTRIBUTES_NORMAL );
683  TRANSFER_SETTING( show_footprints_virtual, FL_MODULE_ATTRIBUTES_VIRTUAL );
684  TRANSFER_SETTING( show_silkscreen, FL_SILKSCREEN );
685  TRANSFER_SETTING( show_soldermask, FL_SOLDERMASK );
686  TRANSFER_SETTING( show_solderpaste, FL_SOLDERPASTE );
687  TRANSFER_SETTING( show_zones, FL_ZONE );
688  TRANSFER_SETTING( subtract_mask_from_silk, FL_SUBTRACT_MASK_FROM_SILK );
689 
690 #undef TRANSFER_SETTING
691  }
692 }
693 
694 
696 {
697  BOARD* brd = GetBoard();
698  const FAB_LAYER_COLOR* stdColors = GetColorStandardList();
699  wxColour color;
700  if( brd )
701  {
703 
704  for( BOARD_STACKUP_ITEM* stckpItem : stckp.GetList() )
705  {
706  wxString colorName = stckpItem->GetColor();
707 
708  if( colorName.StartsWith( "#" ) ) // This is a user defined color.
709  {
710  color.Set( colorName );
711  }
712  else
713  {
714  for( int i = 0; i < GetColorStandardListCount(); i++ )
715  {
716  if( stdColors[i].m_ColorName == colorName )
717  {
718  color = stdColors[i].m_Color;
719  break;
720  }
721  }
722  }
723 
724  if( color.IsOk() )
725  {
726  switch( stckpItem->GetBrdLayerId() )
727  {
728  case F_SilkS:
729  m_boardAdapter.m_SilkScreenColorTop.r = color.Red() / 255.0;
730  m_boardAdapter.m_SilkScreenColorTop.g = color.Green() / 255.0;
731  m_boardAdapter.m_SilkScreenColorTop.b = color.Blue() / 255.0;
732  break;
733  case B_SilkS:
734  m_boardAdapter.m_SilkScreenColorBot.r = color.Red() / 255.0;
735  m_boardAdapter.m_SilkScreenColorBot.g = color.Green() / 255.0;
736  m_boardAdapter.m_SilkScreenColorBot.b = color.Blue() / 255.0;
737  break;
738  case F_Mask:
739  m_boardAdapter.m_SolderMaskColorTop.r = color.Red() / 255.0;
740  m_boardAdapter.m_SolderMaskColorTop.g = color.Green() / 255.0;
741  m_boardAdapter.m_SolderMaskColorTop.b = color.Blue() / 255.0;
742  m_boardAdapter.m_SolderMaskColorTop.a = color.Alpha() / 255.0;
743  break;
744  case B_Mask:
745  m_boardAdapter.m_SolderMaskColorBot.r = color.Red() / 255.0;
746  m_boardAdapter.m_SolderMaskColorBot.g = color.Green() / 255.0;
747  m_boardAdapter.m_SolderMaskColorBot.b = color.Blue() / 255.0;
748  m_boardAdapter.m_SolderMaskColorBot.a = color.Alpha() / 255.0;
749  break;
750  default:
751  break;
752  }
753  }
754  }
755  }
756 }
757 
758 
759 void EDA_3D_VIEWER::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
760 {
761  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::CommonSettingsChanged" );
762 
763  // Regen menu bars, etc
764  EDA_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
765 
766  // There is no base class that handles toolbars for this frame
768 
770 
771  NewDisplay( true );
772 }
773 
774 
775 void EDA_3D_VIEWER::takeScreenshot( wxCommandEvent& event )
776 {
777  wxString fullFileName;
778  bool fmt_is_jpeg = false;
779 
780  if( event.GetId() == ID_MENU_SCREENCOPY_JPEG )
781  fmt_is_jpeg = true;
782 
783  if( event.GetId() != ID_TOOL_SCREENCOPY_TOCLIBBOARD )
784  {
785  // Remember path between saves during this session only.
786  const wxString wildcard = fmt_is_jpeg ? JpegFileWildcard() : PngFileWildcard();
787  const wxString ext = fmt_is_jpeg ? JpegFileExtension : PngFileExtension;
788 
789  // First time path is set to the project path.
790  if( !m_defaultSaveScreenshotFileName.IsOk() )
792 
793  m_defaultSaveScreenshotFileName.SetExt( ext );
794 
795  wxFileDialog dlg( this, _( "3D Image File Name" ),
797  m_defaultSaveScreenshotFileName.GetFullName(), wildcard,
798  wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
799 
800  if( dlg.ShowModal() == wxID_CANCEL )
801  return;
802 
803  m_defaultSaveScreenshotFileName = dlg.GetPath();
804 
805  if( m_defaultSaveScreenshotFileName.GetExt().IsEmpty() )
806  m_defaultSaveScreenshotFileName.SetExt( ext );
807 
808  fullFileName = m_defaultSaveScreenshotFileName.GetFullPath();
809 
810  wxFileName fn = fullFileName;
811 
812  if( !fn.IsDirWritable() )
813  {
814  wxString msg;
815 
816  msg.Printf( _( "Insufficient permissions required to save file\n%s" ), fullFileName );
817  wxMessageBox( msg, _( "Error" ), wxOK | wxICON_ERROR, this );
818  return;
819  }
820 
821  // Be sure the screen area destroyed by the file dialog is redrawn
822  // before making a screen copy.
823  // Without this call, under Linux the screen refresh is made to late.
824  wxYield();
825  }
826 
827  // Be sure we have the latest 3D view (remember 3D view is buffered)
828  m_canvas->Request_refresh( true );
829  wxYield();
830 
831  // Build image from the 3D buffer
832  wxWindowUpdateLocker noUpdates( this );
833 
834  wxImage screenshotImage;
835 
836  if( m_canvas )
837  m_canvas->GetScreenshot( screenshotImage );
838 
839  if( event.GetId() == ID_TOOL_SCREENCOPY_TOCLIBBOARD )
840  {
841  wxBitmap bitmap( screenshotImage );
842 
843  if( wxTheClipboard->Open() )
844  {
845  wxBitmapDataObject* dobjBmp = new wxBitmapDataObject( bitmap );
846 
847  if( !wxTheClipboard->SetData( dobjBmp ) )
848  wxMessageBox( _( "Failed to copy image to clipboard" ) );
849 
850  wxTheClipboard->Flush(); /* the data in clipboard will stay
851  * available after the application exits */
852  wxTheClipboard->Close();
853  }
854  }
855  else
856  {
857  if( !screenshotImage.SaveFile( fullFileName,
858  fmt_is_jpeg ? wxBITMAP_TYPE_JPEG : wxBITMAP_TYPE_PNG ) )
859  wxMessageBox( _( "Can't save file" ) );
860 
861  screenshotImage.Destroy();
862  }
863 
864 }
865 
866 
868 {
869  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::RenderEngineChanged()" );
870 
871  if( m_canvas )
873 }
874 
875 
876 bool EDA_3D_VIEWER::Set3DColorFromUser( SFVEC4F &aColor, const wxString& aTitle,
877  CUSTOM_COLORS_LIST* aPredefinedColors,
878  bool aAllowOpacityControl,
879  KIGFX::COLOR4D aDefaultColor )
880 {
881  KIGFX::COLOR4D newcolor;
882  KIGFX::COLOR4D oldcolor( aColor.r,aColor.g, aColor.b, aColor.a );
883 
884  DIALOG_COLOR_PICKER picker( this, oldcolor, aAllowOpacityControl, aPredefinedColors, aDefaultColor );
885 
886  if( picker.ShowModal() != wxID_OK )
887  return false;
888 
889  newcolor = picker.GetColor();
890 
891  if( newcolor == oldcolor )
892  return false;
893 
894  aColor.r = newcolor.r;
895  aColor.g = newcolor.g;
896  aColor.b = newcolor.b;
897  aColor.a = newcolor.a;
898 
899  return true;
900 }
901 
902 
904 {
906 
907  colors.push_back( CUSTOM_COLOR_ITEM( 241.0/255.0, 241.0/255.0, 241.0/255.0, "White" ) );
908  colors.push_back( CUSTOM_COLOR_ITEM( 4.0/255.0, 18.0/255.0, 21.0/255.0, "Dark" ) );
909 
910  if( Set3DColorFromUser( m_boardAdapter.m_SilkScreenColorTop, _( "Silkscreen Color" ), &colors, false, colors[0].m_Color ) )
911  {
913  NewDisplay( true );
914  return true;
915  }
916 
917  return false;
918 }
919 
920 
922 {
924 
925  colors.push_back( CUSTOM_COLOR_ITEM( 20/255.0, 51/255.0, 36/255.0, 0.83, "Green" ) );
926  colors.push_back( CUSTOM_COLOR_ITEM( 91/255.0, 168/255.0, 12/255.0, 0.83, "Light Green" ) );
927  colors.push_back( CUSTOM_COLOR_ITEM( 13/255.0, 104/255.0, 11/255.0, 0.83, "Saturated Green" ) );
928  colors.push_back( CUSTOM_COLOR_ITEM( 181/255.0, 19/255.0, 21/255.0, 0.83, "Red" ) );
929  colors.push_back( CUSTOM_COLOR_ITEM( 239/255.0, 53/255.0, 41/255.0, 0.83, "Red Light Orange" ) );
930  colors.push_back( CUSTOM_COLOR_ITEM( 210/255.0, 40/255.0, 14/255.0, 0.83, "Red 2" ) );
931  colors.push_back( CUSTOM_COLOR_ITEM( 2/255.0, 59/255.0, 162/255.0, 0.83, "Blue" ) );
932  colors.push_back( CUSTOM_COLOR_ITEM( 54/255.0, 79/255.0, 116/255.0, 0.83, "Light blue 1" ) );
933  colors.push_back( CUSTOM_COLOR_ITEM( 61/255.0, 85/255.0, 130/255.0, 0.83, "Light blue 2" ) );
934  colors.push_back( CUSTOM_COLOR_ITEM( 21/255.0, 70/255.0, 80/255.0, 0.83, "Green blue (dark)" ) );
935  colors.push_back( CUSTOM_COLOR_ITEM( 11/255.0, 11/255.0, 11/255.0, 0.83, "Black" ) );
936  colors.push_back( CUSTOM_COLOR_ITEM( 245/255.0, 245/255.0, 245/255.0, 0.83, "White" ) );
937  colors.push_back( CUSTOM_COLOR_ITEM( 119/255.0, 31/255.0, 91/255.0, 0.83, "Purple" ) );
938  colors.push_back( CUSTOM_COLOR_ITEM( 32/255.0, 2/255.0, 53/255.0, 0.83, "Purple Dark" ) );
939 
940  if( Set3DColorFromUser( m_boardAdapter.m_SolderMaskColorTop, _( "Solder Mask Color" ), &colors, true, colors[0].m_Color ) )
941  {
943 
946  else
947  NewDisplay( true );
948 
949  return true;
950  }
951 
952  return false;
953 }
954 
955 
957 {
959 
960  colors.push_back( CUSTOM_COLOR_ITEM( 184/255.0, 115/255.0, 50/255.0, "Copper" ) );
961  colors.push_back( CUSTOM_COLOR_ITEM( 178/255.0, 156/255.0, 0.0, "Gold" ) );
962  colors.push_back( CUSTOM_COLOR_ITEM( 213/255.0, 213/255.0, 213/255.0, "Silver" ) );
963  colors.push_back( CUSTOM_COLOR_ITEM( 160/255.0, 160/255.0, 160/255.0, "Tin" ) );
964 
965  if( Set3DColorFromUser( m_boardAdapter.m_CopperColor, _( "Copper Color" ), &colors, false, colors[0].m_Color ) )
966  {
967  NewDisplay( true );
968  return true;
969  }
970 
971  return false;
972 }
973 
974 
976 {
978 
979  colors.push_back( CUSTOM_COLOR_ITEM( 51/255.0, 43/255.0, 22/255.0, 0.9, "FR4 natural, dark" ) );
980  colors.push_back( CUSTOM_COLOR_ITEM( 109/255.0, 116/255.0, 75/255.0, 0.9, "FR4 natural" ) );
981  colors.push_back( CUSTOM_COLOR_ITEM( 78/255.0, 14/255.0, 5/255.0, 0.9, "brown/red" ) );
982  colors.push_back( CUSTOM_COLOR_ITEM( 146/255.0, 99/255.0, 47/255.0, 0.9, "brown 1" ) );
983  colors.push_back( CUSTOM_COLOR_ITEM( 160/255.0, 123/255.0, 54/255.0, 0.9, "brown 2" ) );
984  colors.push_back( CUSTOM_COLOR_ITEM( 146/255.0, 99/255.0, 47/255.0, 0.9, "brown 3" ) );
985  colors.push_back( CUSTOM_COLOR_ITEM( 63/255.0, 126/255.0, 71/255.0, 0.9, "green 1" ) );
986  colors.push_back( CUSTOM_COLOR_ITEM( 117/255.0, 122/255.0, 90/255.0, 0.9, "green 2" ) );
987 
988  if( Set3DColorFromUser( m_boardAdapter.m_BoardBodyColor, _( "Board Body Color" ), &colors, true, colors[0].m_Color ) )
989  {
992  else
993  NewDisplay( true );
994 
995  return true;
996  }
997 
998  return false;
999 }
1000 
1001 
1003 {
1005 
1006  colors.push_back( CUSTOM_COLOR_ITEM( 128/255.0, 128/255.0, 128/255.0, "grey" ) );
1007  colors.push_back( CUSTOM_COLOR_ITEM( 213/255.0, 213/255.0, 213/255.0, "Silver" ) );
1008  colors.push_back( CUSTOM_COLOR_ITEM( 90/255.0, 90/255.0, 90/255.0, "grey 2" ) );
1009 
1010  if( Set3DColorFromUser( m_boardAdapter.m_SolderPasteColor, _( "Solder Paste Color" ), &colors, false, colors[0].m_Color ) )
1011  {
1012  NewDisplay( true );
1013  return true;
1014  }
1015 
1016  return false;
1017 }
1018 
1019 
1021 {
1022  wxCHECK_RET( m_canvas, "Cannot load settings to null canvas" );
1023 
1024  COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
1025 
1026  const DPI_SCALING dpi{ settings, this };
1027  m_canvas->SetScaleFactor( dpi.GetScaleFactor() );
1028  // TODO(JE) use all control options
1030 }
Use a gray shading based on diffuse material.
void AnimationEnabledSet(bool aAnimationEnabled)
AnimationEnabledSet - Enable or disable camera animation when switching to a pre-defined view.
void ResetToDefaults()
Resets all parameters to default values.
std::vector< SFVEC3F > m_raytrace_lightColor
void GridSet(GRID3D_TYPE aGridType) noexcept
GridSet - set the current grid.
SFVEC3F m_raytrace_lightColorBottom
SFVEC4F GetColor(COLOR4D aColor) const
GetColor.
bool Set3DCopperColorFromUser()
Set the copper color from a set of colors.
KIWAY_PLAYER is a wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of ...
Definition: kiway_player.h:59
SFVEC3F m_raytrace_lightColorCamera
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:104
SFVEC4F m_SilkScreenColorBot
in realistic mode: SilkScreen color ( bot )
std::vector< BOARD_STACKUP_ITEM * > & GetList()
const std::string JpegFileExtension
int m_raytrace_nrsamples_refractions
static TOOL_ACTION show10mmGrid
Definition: 3d_actions.h:70
static TOOL_ACTION materialCAD
Definition: 3d_actions.h:77
this class manage the layers needed to make a physical board they are solder mask,...
virtual void SaveSettings(APP_SETTINGS_BASE *aCfg)
Saves common frame parameters to a configuration data file.
std::vector< SFVEC2F > m_raytrace_lightSphericalCoords
static TOOL_ACTION showBoundingBoxes
Definition: 3d_actions.h:83
bool Set3DSolderMaskColorFromUser()
Set the solder mask color from a set of colors.
float m_raytrace_spread_reflections
PROJECT & Prj()
Definition: kicad.cpp:318
glm::vec4 SFVEC4F
Definition: xv3d_types.h:49
void SetFlag(DISPLAY3D_FLG aFlag, bool aState)
SetFlag - set the status of a flag.
SFVEC4F m_SolderMaskColorTop
in realistic mode: solder mask color ( top )
int color
Definition: DXF_plotter.cpp:61
EDA_3D_ACTIONS.
Definition: 3d_actions.h:41
LAYER_3D_ID
3D Viewer virtual layers for color settings
SFVEC3F m_raytrace_lightColorTop
virtual void setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Saves common frame parameters to a configuration data file.
Implement a canvas based on a wxGLCanvas.
Definition: eda_3d_canvas.h:47
bool IsReloadRequestPending() const
IsReloadRequestPending - Query if there is a pending reload request.
Definition: eda_3d_canvas.h:87
SFVEC4F m_BoardBodyColor
in realistic mode: FR4 board color
SFVEC4F m_SolderPasteColor
in realistic mode: solder paste color
static TOOL_ACTION showRefractions
Definition: 3d_actions.h:87
virtual void RegisterUIUpdateHandler(const TOOL_ACTION &aAction, const ACTION_CONDITIONS &aConditions) override
Register an action's update conditions with the UI layer to allow the UI to appropriately display the...
int GetColorStandardListCount()
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:531
double g
Green component.
Definition: color4d.h:367
void SynchroniseColoursWithBoard()
a class to handle a custom color (predefined color) for the color picker dialog
SFVEC4F m_SolderMaskColorBot
in realistic mode: solder mask color ( bot )
wxString JpegFileWildcard()
wxAuiManager m_auimgr
ACTION_MANAGER.
std::vector< CUSTOM_COLOR_ITEM > CUSTOM_COLORS_LIST
void Request_refresh(bool aRedrawImmediately=true)
Request_refresh - Schedule a refresh update of the canvas.
CCAMERA & m_currentCamera
void ReloadRequest(BOARD *aBoard=NULL, S3D_CACHE *aCachePointer=NULL)
void RenderEngineSet(RENDER_ENGINE aRenderEngine) noexcept
RenderEngineSet.
void Exit3DFrame(wxCommandEvent &event)
Called when user press the File->Exit.
void loadCommonSettings()
Load configuration from common settings.
Class to handle configuration and automatic determination of the DPI scale to use for canvases.
Definition: dpi_scaling.h:36
double b
Blue component.
Definition: color4d.h:368
EDA_3D_CANVAS * m_canvas
void MovingSpeedMultiplierSet(int aMovingSpeedMultiplier)
MovingSpeedMultiplierSet - Set the camera animation moving speed multiplier option.
Use only diffuse material properties.
TOOL_MANAGER.
Definition: tool_manager.h:51
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:80
void OnActivate(wxActivateEvent &event)
static TOOL_ACTION antiAliasing
Definition: 3d_actions.h:89
BOARD_ADAPTER m_boardAdapter
BOARD_STACKUP & GetStackupDescriptor()
double a
Alpha component.
Definition: color4d.h:369
float m_raytrace_spread_shadows
void OnDisableRayTracing(wxCommandEvent &aEvent)
SFVEC4F m_BgColorTop
background top color
void SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Function SetEventDispatcher() Sets a dispatcher that processes events and forwards them to tools.
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:99
static TOOL_ACTION show5mmGrid
Definition: 3d_actions.h:71
PROJECTION_TYPE GetProjection()
Definition: ccamera.h:164
glm::vec2 SFVEC2F
Definition: xv3d_types.h:45
#define NULL
int m_raytrace_nrsamples_shadows
#define TRANSFER_SETTING(flag, field)
const BITMAP_OPAQUE icon_3d_xpm[1]
Definition: icon_3d.cpp:143
Use all material properties from model file.
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
void RenderEngineChanged()
RenderEngineChanged - Notify that the render engine was changed.
bool Set3DSilkScreenColorFromUser()
Set the silkscreen color from a set of colors.
void AntiAliasingSet(ANTIALIASING_MODE aAAmode)
AntiAliasingSet - set the current antialiasing mode value.
EDA_3D_CONTROLLER.
Definition: 3d_controller.h:39
bool AnimationEnabledGet() const
AnimationEnabledGet - Returns whether camera animation is enabled when switching to a pre-defined vie...
Definition of file extensions used in Kicad.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
float m_raytrace_spread_refractions
RENDER_ENGINE RenderEngineGet() const noexcept
RenderEngineGet.
KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the s...
Definition: kiway.h:273
void OnCloseWindow(wxCloseEvent &event)
SFVEC4F m_BgColorBot
background bottom color
bool Set3DColorFromUser(SFVEC4F &aColor, const wxString &aTitle, CUSTOM_COLORS_LIST *aPredefinedColors, bool aAllowOpacityControl=false, KIGFX::COLOR4D aDefaultColor=KIGFX::COLOR4D(1.0, 1.0, 1.0, 1.0))
Get a SFVEC3D from a wx colour dialog.
static TOOL_ACTION materialNormal
Definition: 3d_actions.h:75
void ReCreateMainToolbar()
Definition: 3d_toolbar.cpp:39
VTBL_ENTRY const wxString GetProjectFullName() const
Function GetProjectFullName returns the full path and name of the project.
Definition: project.cpp:118
static TOOL_ACTION addFloor
Definition: 3d_actions.h:86
static TOOL_ACTION showAxis
Definition: 3d_actions.h:93
COMMON_CONTROL.
bool Set3DSolderPasteColorFromUser()
Set the solder mask color from a set of colors.
this class manage one layer needed to make a physical board it can be a solder mask,...
Specialization of the wxAuiPaneInfo class for KiCad panels.
int m_raytrace_recursivelevel_reflections
void SetConditions(const TOOL_ACTION &aAction, const ACTION_CONDITIONS &aConditions)
Set the conditions the UI elements for activating a specific tool action should use for determining t...
wxString PngFileWildcard()
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:160
void RenderEngineChanged()
RenderEngineChanged - Update toolbar icon and call canvas RenderEngineChanged.
BOARD * GetBoard()
static TOOL_ACTION materialDiffuse
Definition: 3d_actions.h:76
static const int * GetAttributesList(ANTIALIASING_MODE aAntiAliasingMode)
Get a list of attributes to pass to wxGLCanvas.
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
A modified version of the wxInfoBar class that allows us to:
Definition: infobar.h:68
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
void GetScreenshot(wxImage &aDstImage)
Request a screenshot and output it to the aDstImage.
int MovingSpeedMultiplierGet() const
MovingSpeedMultiplierGet - Return the current camera animation moving speed multiplier option.
static TOOL_ACTION proceduralTextures
Definition: 3d_actions.h:85
static TOOL_ACTION show2_5mmGrid
Definition: 3d_actions.h:72
static TOOL_ACTION show1mmGrid
Definition: 3d_actions.h:73
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:50
see class PGM_BASE
Declaration of the eda_3d_viewer class.
Board layer functions and definitions.
wxFileName m_defaultSaveScreenshotFileName
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:178
ACTION_MANAGER * GetActionManager()
Definition: tool_manager.h:199
void SetEnvironment(EDA_ITEM *aModel, KIGFX::VIEW *aView, KIGFX::VIEW_CONTROLS *aViewControls, APP_SETTINGS_BASE *aSettings, TOOLS_HOLDER *aFrame)
Sets the work environment (model, view, view controls and the parent window).
#define _(s)
Definition: 3d_actions.cpp:33
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47
Functors that can be used to figure out how the action controls should be displayed in the UI and if ...
SFVEC4F m_CopperColor
in realistic mode: copper color
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
The base frame for deriving all KiCad main window classes.
void OnRenderEngineSelection(wxCommandEvent &event)
#define MaterialCheck(x)
#define GridSizeCheck(x)
static TOOL_ACTION postProcessing
Definition: 3d_actions.h:90
PCB_BASE_FRAME * Parent() const
Definition: eda_3d_viewer.h:76
KIGFX::COLOR4D GetColor()
const FAB_LAYER_COLOR * GetColorStandardList()
const std::string PngFileExtension
void SetScaleFactor(double aFactor)
Set the canvas scale factor, probably for a hi-DPI display.
std::vector< KIGFX::COLOR4D > raytrace_lightColor
RENDER_ENGINE
Render engine mode.
Definition: 3d_enums.h:106
static TOOL_ACTION noGrid
Definition: 3d_actions.h:69
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
void OnSetFocus(wxFocusEvent &event)
Color settings are a bit different than most of the settings objects in that there can be more than o...
ANTIALIASING_MODE AntiAliasingGet() const
GridGet - get the current antialiasing mode value.
static TOOL_ACTION showReflections
Definition: 3d_actions.h:88
SFVEC4F m_SilkScreenColorTop
in realistic mode: SilkScreen color ( top )
Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard.
Definition: eda_3d_viewer.h:65
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:78
double r
Red component.
Definition: color4d.h:366
int m_raytrace_recursivelevel_refractions
static TOOL_ACTION toggleOrtho
Definition: 3d_actions.h:60
#define FlagCheck(x)
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification that common settings are updated.
GRID3D_TYPE GridGet() const noexcept
GridGet - get the current grid.
void NewDisplay(bool aForceImmediateRedraw=false)
Reload and refresh (rebuild) the 3D scene.
MATERIAL_MODE MaterialModeGet() const noexcept
MaterialModeGet.
static TOOL_ACTION renderShadows
Definition: 3d_actions.h:84
EVT_TOOL_RANGE(ID_START_COMMAND_3D, ID_MENU_COMMAND_END, EDA_3D_VIEWER::Process_Special_Functions) EDA_3D_VIEWER
#define RANGE_SCALE_3D
This defines the range that all coord will have to be rendered.
Definition: board_adapter.h:61
#define QUALIFIED_VIEWER3D_FRAMENAME(parent)
Definition: eda_3d_viewer.h:51
static VRML_COLOR colors[VRML_COLOR_LAST]
PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
BOARD * GetBoard()
Definition: eda_3d_viewer.h:78
bool m_disable_ray_tracing
bool Set3DBoardBodyColorFromUser()
Set the copper color from a set of colors.
void ReloadRequest()
Request reloading the 3D view.
void MaterialModeSet(MATERIAL_MODE aMaterialMode) noexcept
MaterialModeSet.
virtual void LoadSettings(APP_SETTINGS_BASE *aCfg)
Load common frame parameters from a configuration file.
void Process_Special_Functions(wxCommandEvent &event)
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:99
int m_raytrace_nrsamples_reflections
void takeScreenshot(wxCommandEvent &event)
Create a Screenshot of the current 3D view.