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-2019 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 "eda_3d_viewer.h"
26 
27 #include "../3d_viewer_id.h"
28 #include "../common_ogl/cogl_att_list.h"
29 #include <3d_actions.h>
30 #include <bitmaps.h>
31 #include <dpi_scaling.h>
32 #include <gestfich.h>
33 #include <pgm_base.h>
34 #include <project.h>
36 #include <tool/tool_manager.h>
37 #include <tool/common_control.h>
38 #include <hotkeys_basic.h>
39 #include <wx/colordlg.h>
40 #include <wx/toolbar.h>
41 
42 
50 const wxChar * EDA_3D_VIEWER::m_logTrace = wxT( "KI_TRACE_EDA_3D_VIEWER" );
51 
52 
53 // Key to store 3D Viewer config
54 
55 static const wxChar keyBgColor_Red[] = wxT( "BgColor_Red" );
56 static const wxChar keyBgColor_Green[] = wxT( "BgColor_Green" );
57 static const wxChar keyBgColor_Blue[] = wxT( "BgColor_Blue" );
58 
59 static const wxChar keyBgColor_Red_Top[] = wxT( "BgColor_Red_Top" );
60 static const wxChar keyBgColor_Green_Top[] = wxT( "BgColor_Green_Top" );
61 static const wxChar keyBgColor_Blue_Top[] = wxT( "BgColor_Blue_Top" );
62 
63 static const wxChar keySMaskColor_Red[] = wxT( "SMaskColor_Red" );
64 static const wxChar keySMaskColor_Green[] = wxT( "SMaskColor_Green" );
65 static const wxChar keySMaskColor_Blue[] = wxT( "SMaskColor_Blue" );
66 
67 static const wxChar keySPasteColor_Red[] = wxT( "SPasteColor_Red" );
68 static const wxChar keySPasteColor_Green[] = wxT( "SPasteColor_Green" );
69 static const wxChar keySPasteColor_Blue[] = wxT( "SPasteColor_Blue" );
70 
71 static const wxChar keySilkColor_Red[] = wxT( "SilkColor_Red" );
72 static const wxChar keySilkColor_Green[] = wxT( "SilkColor_Green" );
73 static const wxChar keySilkColor_Blue[] = wxT( "SilkColor_Blue" );
74 
75 static const wxChar keyCopperColor_Red[] = wxT( "CopperColor_Red" );
76 static const wxChar keyCopperColor_Green[] = wxT( "CopperColor_Green" );
77 static const wxChar keyCopperColor_Blue[] = wxT( "CopperColor_Blue" );
78 
79 static const wxChar keyBoardBodyColor_Red[] = wxT( "BoardBodyColor_Red" );
80 static const wxChar keyBoardBodyColor_Green[] = wxT( "BoardBodyColor_Green" );
81 static const wxChar keyBoardBodyColor_Blue[] = wxT( "BoardBodyColor_Blue" );
82 
83 static const wxChar keyShowRealisticMode[] = wxT( "ShowRealisticMode" );
84 static const wxChar keyRenderEngine[] = wxT( "RenderEngine" );
85 static const wxChar keyRenderMaterial[] = wxT( "Render_Material" );
86 
87 static const wxChar keyRenderOGL_ShowCopperTck[]= wxT( "Render_OGL_ShowCopperThickness" );
88 static const wxChar keyRenderOGL_ShowModelBBox[]= wxT( "Render_OGL_ShowModelBoudingBoxes" );
89 
90 static const wxChar keyRenderRAY_Shadows[] = wxT( "Render_RAY_Shadows" );
91 static const wxChar keyRenderRAY_Backfloor[] = wxT( "Render_RAY_Backfloor" );
92 static const wxChar keyRenderRAY_Refractions[] = wxT( "Render_RAY_Refractions" );
93 static const wxChar keyRenderRAY_Reflections[] = wxT( "Render_RAY_Reflections" );
94 static const wxChar keyRenderRAY_PostProcess[] = wxT( "Render_RAY_PostProcess" );
95 static const wxChar keyRenderRAY_AAliasing[] = wxT( "Render_RAY_AntiAliasing" );
96 static const wxChar keyRenderRAY_ProceduralT[] = wxT( "Render_RAY_ProceduralTextures" );
97 
98 static const wxChar keyShowAxis[] = wxT( "ShowAxis" );
99 static const wxChar keyShowGrid[] = wxT( "ShowGrid3D" );
100 static const wxChar keyShowZones[] = wxT( "ShowZones" );
101 static const wxChar keyShowFootprints_Normal[] = wxT( "ShowFootprints_Normal" );
102 static const wxChar keyShowFootprints_Insert[] = wxT( "ShowFootprints_Insert" );
103 static const wxChar keyShowFootprints_Virtual[] = wxT( "ShowFootprints_Virtual" );
104 static const wxChar keyShowAdhesiveLayers[] = wxT( "ShowAdhesiveLayers" );
105 static const wxChar keyShowSilkScreenLayers[] = wxT( "ShowSilkScreenLayers" );
106 static const wxChar keyShowSolderMaskLayers[] = wxT( "ShowSolderMasLayers" );
107 static const wxChar keyShowSolderPasteLayers[] = wxT( "ShowSolderPasteLayers" );
108 static const wxChar keyShowCommentsLayer[] = wxT( "ShowCommentsLayers" );
109 static const wxChar keyShowBoardBody[] = wxT( "ShowBoardBody" );
110 static const wxChar keyShowEcoLayers[] = wxT( "ShowEcoLayers" );
111 
112 
113 BEGIN_EVENT_TABLE( EDA_3D_VIEWER, EDA_BASE_FRAME )
114 
115  EVT_ACTIVATE( EDA_3D_VIEWER::OnActivate )
116  EVT_SET_FOCUS( EDA_3D_VIEWER::OnSetFocus )
117 
119 
122 
124 
125  EVT_MENU( wxID_CLOSE, EDA_3D_VIEWER::Exit3DFrame )
128 
130 
135 
136  EVT_CLOSE( EDA_3D_VIEWER::OnCloseWindow )
137 END_EVENT_TABLE()
138 
139 
141  const wxString &aTitle, long style ) :
142  KIWAY_PLAYER( aKiway, aParent,
143  FRAME_PCB_DISPLAY3D, aTitle,
144  wxDefaultPosition, wxDefaultSize,
145  style, QUALIFIED_VIEWER3D_FRAMENAME( aParent ) )
146 {
147  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::EDA_3D_VIEWER %s", aTitle );
148 
149  m_canvas = NULL;
150  m_disable_ray_tracing = false;
151  m_mainToolBar = nullptr;
152  m_AboutTitle = "3D Viewer";
153 
154  // Give it an icon
155  wxIcon icon;
156  icon.CopyFromBitmap( KiBitmap( icon_3d_xpm ) );
157  SetIcon( icon );
158 
159  LoadSettings( config() );
160  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
161 
162  // Create the status line
163  static const int status_dims[4] = { -1, 130, 130, 170 };
164 
165  wxStatusBar *status_bar = CreateStatusBar( arrayDim( status_dims ) );
166  SetStatusWidths( arrayDim( status_dims ), status_dims );
167 
168  m_canvas = new EDA_3D_CANVAS( this,
170  aParent->GetBoard(),
171  m_settings,
172  Prj().Get3DCacheManager() );
173 
174  if( m_canvas )
175  m_canvas->SetStatusBar( status_bar );
176 
177  // Some settings need the canvas
178  loadCommonSettings();
179 
180  // Create the manager
181  m_toolManager = new TOOL_MANAGER;
182  m_toolManager->SetEnvironment( nullptr, nullptr, nullptr, this );
183 
184  // Register tools
185  m_toolManager->RegisterTool( new COMMON_CONTROL );
186  m_actions = new EDA_3D_ACTIONS();
187  m_toolManager->InitTools();
188 
189  CreateMenuBar();
190  ReCreateMainToolbar();
191 
192  m_auimgr.SetManagedWindow( this );
193 
194  m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer( 6 ) );
195  m_auimgr.AddPane( m_canvas, EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
196 
197  m_auimgr.Update();
198 
199  m_mainToolBar->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( EDA_3D_VIEWER::OnKeyEvent ),
200  NULL, this );
201 
202  // Fixes bug in Windows (XP and possibly others) where the canvas requires the focus
203  // in order to receive mouse events. Otherwise, the user has to click somewhere on
204  // the canvas before it will respond to mouse wheel events.
205  if( m_canvas )
206  m_canvas->SetFocus();
207 }
208 
209 
211 {
212  m_mainToolBar->Disconnect( wxEVT_KEY_DOWN, wxKeyEventHandler( EDA_3D_VIEWER::OnKeyEvent ),
213  NULL, this );
214 
215  m_auimgr.UnInit();
216 
217  // m_canvas delete will be called by wxWidget manager
218  //delete m_canvas;
219  //m_canvas = nullptr;
220 }
221 
222 
224 {
225  // This will schedule a request to load later
226  if( m_canvas )
227  m_canvas->ReloadRequest( GetBoard(), Prj().Get3DCacheManager() );
228 }
229 
230 
231 void EDA_3D_VIEWER::NewDisplay( bool aForceImmediateRedraw )
232 {
233  ReloadRequest();
234 
235  // After the ReloadRequest call, the refresh often takes a bit of time,
236  // and it is made here only on request.
237  if( aForceImmediateRedraw )
238  m_canvas->Refresh();
239 }
240 
241 
242 void EDA_3D_VIEWER::Exit3DFrame( wxCommandEvent &event )
243 {
244  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::Exit3DFrame" );
245 
246  Close( true );
247 }
248 
249 
250 void EDA_3D_VIEWER::OnCloseWindow( wxCloseEvent &event )
251 {
252  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::OnCloseWindow" );
253 
254  if( m_canvas )
255  m_canvas->Close();
256 
257  // m_canvas delete will be called by wxWidget manager
258  //delete m_canvas;
259  //m_canvas = nullptr;
260 
261  Destroy();
262  event.Skip( true );
263 }
264 
265 #define ROT_ANGLE 10.0
266 
267 void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
268 {
269  int id = event.GetId();
270  bool isChecked = event.IsChecked();
271 
272  wxLogTrace( m_logTrace,
273  "EDA_3D_VIEWER::Process_Special_Functions id %d isChecked %d",
274  id, isChecked );
275 
276  if( m_canvas == NULL )
277  return;
278 
279  switch( id )
280  {
281  case ID_RELOAD3D_BOARD:
282  NewDisplay( true );
283  break;
284 
285  case ID_ROTATE3D_X_POS:
286  m_settings.CameraGet().RotateX( glm::radians(ROT_ANGLE) );
287 
290  else
292 
293  break;
294 
295  case ID_ROTATE3D_X_NEG:
296  m_settings.CameraGet().RotateX( -glm::radians(ROT_ANGLE) );
297 
300  else
302 
303  break;
304 
305  case ID_ROTATE3D_Y_POS:
306  m_settings.CameraGet().RotateY( glm::radians(ROT_ANGLE) );
307 
310  else
312 
313  break;
314 
315  case ID_ROTATE3D_Y_NEG:
316  m_settings.CameraGet().RotateY( -glm::radians(ROT_ANGLE) );
317 
320  else
322 
323  break;
324 
325  case ID_ROTATE3D_Z_POS:
326  m_settings.CameraGet().RotateZ( glm::radians(ROT_ANGLE) );
327 
330  else
332 
333  break;
334 
335  case ID_ROTATE3D_Z_NEG:
336  m_settings.CameraGet().RotateZ( -glm::radians(ROT_ANGLE) );
337 
340  else
342 
343  break;
344 
345  case ID_MOVE3D_LEFT:
346  m_canvas->SetView3D( WXK_LEFT );
347  return;
348 
349  case ID_MOVE3D_RIGHT:
350  m_canvas->SetView3D( WXK_RIGHT );
351  return;
352 
353  case ID_MOVE3D_UP:
354  m_canvas->SetView3D( WXK_UP );
355  return;
356 
357  case ID_MOVE3D_DOWN:
358  m_canvas->SetView3D( WXK_DOWN );
359  return;
360 
361  case ID_ORTHO:
364  return;
365 
369  takeScreenshot( event );
370  return;
371 
373  if( Set3DColorFromUser( m_settings.m_BgColorBot, _( "Background Color, Bottom" ),
374  nullptr ) )
375  {
378  else
379  NewDisplay( true );
380  }
381  return;
382 
384  if( Set3DColorFromUser( m_settings.m_BgColorTop, _( "Background Color, Top" ), nullptr ) )
385  {
388  else
389  NewDisplay( true );
390  }
391  return;
392 
395  return;
396 
399  return;
400 
403  return;
404 
407  break;
408 
411  break;
412 
415  NewDisplay( true );
416  return;
417 
420  NewDisplay( true );
421  return;
422 
425  NewDisplay( true );
426  return;
427 
430  NewDisplay( true );
431  return;
432 
435  NewDisplay( true );
436  return;
437 
441  return;
442 
446  return;
447 
450  NewDisplay( true );
451  return;
452 
455  NewDisplay( true );
456  return;
457 
461  return;
462 
466  return;
467 
470  NewDisplay( true );
471  return;
472 
476  return;
477 
479  m_settings.SetFlag( FL_SHOW_BOARD_BODY, isChecked );
480  NewDisplay( true );
481  return;
482 
484  m_settings.SetFlag( FL_AXIS, isChecked );
486  return;
487 
490  NewDisplay( true );
491  return;
492 
495  NewDisplay( true );
496  return;
497 
500  NewDisplay( true );
501  return;
502 
504  m_settings.SetFlag( FL_ZONE, isChecked );
505  NewDisplay( true );
506  return;
507 
509  m_settings.SetFlag( FL_ADHESIVE, isChecked );
510  NewDisplay( true );
511  return;
512 
514  m_settings.SetFlag( FL_SILKSCREEN, isChecked );
515  NewDisplay( true );
516  return;
517 
519  m_settings.SetFlag( FL_SOLDERMASK, isChecked );
520  NewDisplay( true );
521  return;
522 
524  m_settings.SetFlag( FL_SOLDERPASTE, isChecked );
525  NewDisplay( true );
526  return;
527 
529  m_settings.SetFlag( FL_COMMENTS, isChecked );
530  NewDisplay( true );
531  return;
532 
533  case ID_MENU3D_ECO_ONOFF:
534  m_settings.SetFlag( FL_ECO, isChecked );
535  NewDisplay( true );
536  return;
537 
539  {
540  // Reload settings with a dummy config, so it will load the defaults
541  wxConfig *fooconfig = new wxConfig( "FooBarApp" );
542  LoadSettings( fooconfig );
543  delete fooconfig;
544 
545  // Tell canvas that we (may have) changed the render engine
547 
548  NewDisplay( true );
549  }
550  return;
551 
552  default:
553  wxFAIL_MSG( "Invalid event in EDA_3D_VIEWER::Process_Special_Functions()" );
554  return;
555  }
556 }
557 
558 
559 void EDA_3D_VIEWER::On3DGridSelection( wxCommandEvent &event )
560 {
561  int id = event.GetId();
562 
563  wxASSERT( id < ID_MENU3D_GRID_END );
564  wxASSERT( id > ID_MENU3D_GRID );
565 
566  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::On3DGridSelection id %d", id );
567 
568  switch( id )
569  {
575 
576  default: wxFAIL_MSG( "Invalid event in EDA_3D_VIEWER::On3DGridSelection()" );
577  }
578 
579  int menu_ids[]
580  {
583  };
584 
585  // Refresh checkmarks
586  wxMenuBar* menuBar = GetMenuBar();
587 
588  for( int ii = 0; ii < 5; ii++ )
589  {
590  wxMenuItem* item = menuBar->FindItem( menu_ids[ii] );
591  item->Check( menu_ids[ii] == id );
592  }
593 
594  if( m_canvas )
596 }
597 
598 
599 void EDA_3D_VIEWER::OnRenderEngineSelection( wxCommandEvent &event )
600 {
601  const RENDER_ENGINE old_engine = m_settings.RenderEngineGet();
602 
603  if( old_engine == RENDER_ENGINE_OPENGL_LEGACY )
605  else
607 
608  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::OnRenderEngineSelection type %s ",
610  "Ray Trace" : "OpenGL Legacy" );
611 
612  if( old_engine != m_settings.RenderEngineGet() )
613  {
615  }
616 }
617 
618 
619 void EDA_3D_VIEWER::ProcessZoom( wxCommandEvent &event )
620 {
621  int id = event.GetId();
622 
623  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::ProcessZoom id:%d", id );
624 
625  if( m_canvas == NULL )
626  return;
627 
628  switch( id )
629  {
630  case ID_ZOOM_PAGE: m_canvas->SetView3D( WXK_HOME ); break;
631  case ID_ZOOM_IN: m_canvas->SetView3D( WXK_F1 ); break;
632  case ID_ZOOM_OUT: m_canvas->SetView3D( WXK_F2 ); break;
633  case ID_ZOOM_REDRAW: m_canvas->Request_refresh(); break;
634  default: wxFAIL_MSG( "Invalid event in EDA_3D_VIEWER::ProcessZoom()" );
635  }
636 
638 }
639 
640 
641 void EDA_3D_VIEWER::OnDisableRayTracing( wxCommandEvent& aEvent )
642 {
643  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::%s disabling ray tracing.", __WXFUNCTION__ );
644 
645  m_disable_ray_tracing = true;
647 }
648 
649 
650 void EDA_3D_VIEWER::OnActivate( wxActivateEvent &event )
651 {
652  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::OnActivate" );
653 
654  if( m_canvas )
655  {
656  // Reload data if 3D frame shows a board,
657  // because it can be changed since last frame activation
660 
661  // Activates again the focus of the canvas so it will catch mouse and key events
662  m_canvas->SetFocus();
663  }
664 
665  event.Skip(); // required under wxMAC
666 }
667 
668 
669 void EDA_3D_VIEWER::OnSetFocus(wxFocusEvent &event)
670 {
671  // Activates again the focus of the canvas so it will catch mouse and key events
672  if( m_canvas )
673  m_canvas->SetFocus();
674 
675  event.Skip();
676 }
677 
678 
679 void EDA_3D_VIEWER::LoadSettings( wxConfigBase *aCfg )
680 {
682 
683  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::LoadSettings" );
684 
685  aCfg->Read( keyBgColor_Red, &m_settings.m_BgColorBot.r, 0.4 );
686  aCfg->Read( keyBgColor_Green, &m_settings.m_BgColorBot.g, 0.4 );
687  aCfg->Read( keyBgColor_Blue, &m_settings.m_BgColorBot.b, 0.5 );
688 
689  aCfg->Read( keyBgColor_Red_Top, &m_settings.m_BgColorTop.r, 0.8 );
690  aCfg->Read( keyBgColor_Green_Top, &m_settings.m_BgColorTop.g, 0.8 );
691  aCfg->Read( keyBgColor_Blue_Top, &m_settings.m_BgColorTop.b, 0.9 );
692 
693  // m_SolderMaskColor default value = dark grey-green
694  aCfg->Read( keySMaskColor_Red, &m_settings.m_SolderMaskColor.r, 100.0 * 0.2 / 255.0 );
695  aCfg->Read( keySMaskColor_Green, &m_settings.m_SolderMaskColor.g, 255.0 * 0.2 / 255.0 );
696  aCfg->Read( keySMaskColor_Blue, &m_settings.m_SolderMaskColor.b, 180.0 * 0.2 / 255.0 );
697 
698  // m_SolderPasteColor default value = light grey
699  aCfg->Read( keySPasteColor_Red, &m_settings.m_SolderPasteColor.r, 128.0 /255.0 );
700  aCfg->Read( keySPasteColor_Green, &m_settings.m_SolderPasteColor.g, 128.0 /255.0 );
701  aCfg->Read( keySPasteColor_Blue, &m_settings.m_SolderPasteColor.b, 128.0 /255.0 );
702 
703  // m_SilkScreenColor default value = white
704  aCfg->Read( keySilkColor_Red, &m_settings.m_SilkScreenColor.r, 0.9 );
705  aCfg->Read( keySilkColor_Green, &m_settings.m_SilkScreenColor.g, 0.9 );
706  aCfg->Read( keySilkColor_Blue, &m_settings.m_SilkScreenColor.b, 0.9 );
707 
708  // m_CopperColor default value = gold
709  aCfg->Read( keyCopperColor_Red, &m_settings.m_CopperColor.r, 255.0 * 0.7 / 255.0 );
710  aCfg->Read( keyCopperColor_Green, &m_settings.m_CopperColor.g, 223.0 * 0.7 / 255.0 );
711  aCfg->Read( keyCopperColor_Blue, &m_settings.m_CopperColor.b, 0.0 );
712 
713  // m_BoardBodyColor default value = FR4, in realistic mode
714  aCfg->Read( keyBoardBodyColor_Red, &m_settings.m_BoardBodyColor.r, 51.0 / 255.0 );
715  aCfg->Read( keyBoardBodyColor_Green, &m_settings.m_BoardBodyColor.g, 43.0 / 255.0 );
716  aCfg->Read( keyBoardBodyColor_Blue, &m_settings.m_BoardBodyColor.b, 22.0 /255.0 );
717 
718 
719  bool tmp;
720  aCfg->Read( keyShowRealisticMode, &tmp, true );
722 
723  // OpenGL options
724  aCfg->Read( keyRenderOGL_ShowCopperTck, &tmp, true );
726 
727  aCfg->Read( keyRenderOGL_ShowModelBBox, &tmp, false );
729 
730  // Raytracing options
731  aCfg->Read( keyRenderRAY_Shadows, &tmp, true );
733 
734  aCfg->Read( keyRenderRAY_Backfloor, &tmp, true );
736 
737  aCfg->Read( keyRenderRAY_Refractions, &tmp, true );
739 
740  aCfg->Read( keyRenderRAY_Reflections, &tmp, true );
742 
743  aCfg->Read( keyRenderRAY_PostProcess, &tmp, true );
745 
746  aCfg->Read( keyRenderRAY_AAliasing, &tmp, true );
748 
749  aCfg->Read( keyRenderRAY_ProceduralT, &tmp, true );
751 
752  aCfg->Read( keyShowAxis, &tmp, true );
753  m_settings.SetFlag( FL_AXIS, tmp );
754 
755  aCfg->Read( keyShowFootprints_Normal, &tmp, true );
757 
758  aCfg->Read( keyShowFootprints_Insert, &tmp, true );
760 
761  aCfg->Read( keyShowFootprints_Virtual, &tmp, true );
763 
764  aCfg->Read( keyShowZones, &tmp, true );
765  m_settings.SetFlag( FL_ZONE, tmp );
766 
767  aCfg->Read( keyShowAdhesiveLayers, &tmp, true );
769 
770  aCfg->Read( keyShowSilkScreenLayers, &tmp, true );
772 
773  aCfg->Read( keyShowSolderMaskLayers, &tmp, true );
775 
776  aCfg->Read( keyShowSolderPasteLayers, &tmp, true );
778 
779  aCfg->Read( keyShowCommentsLayer, &tmp, true );
781 
782  aCfg->Read( keyShowEcoLayers, &tmp, true );
783  m_settings.SetFlag( FL_ECO, tmp );
784 
785  aCfg->Read( keyShowBoardBody, &tmp, true );
787 
788  int tmpi;
789  aCfg->Read( keyShowGrid, &tmpi, (int)GRID3D_NONE );
790  m_settings.GridSet( (GRID3D_TYPE)tmpi );
791 
792  aCfg->Read( keyRenderEngine, &tmpi, (int)RENDER_ENGINE_OPENGL_LEGACY );
793  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::LoadSettings render setting %s",
794  ( (RENDER_ENGINE)tmpi == RENDER_ENGINE_RAYTRACING ) ? "Ray Trace" : "OpenGL" );
796 
797  aCfg->Read( keyRenderMaterial, &tmpi, (int)MATERIAL_MODE_NORMAL );
799 }
800 
801 
802 void EDA_3D_VIEWER::SaveSettings( wxConfigBase *aCfg )
803 {
805 
806  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::SaveSettings" );
807 
808  aCfg->Write( keyBgColor_Red, m_settings.m_BgColorBot.r );
809  aCfg->Write( keyBgColor_Green, m_settings.m_BgColorBot.g );
810  aCfg->Write( keyBgColor_Blue, m_settings.m_BgColorBot.b );
811 
812  aCfg->Write( keyBgColor_Red_Top, m_settings.m_BgColorTop.r );
813  aCfg->Write( keyBgColor_Green_Top, m_settings.m_BgColorTop.g );
814  aCfg->Write( keyBgColor_Blue_Top, m_settings.m_BgColorTop.b );
815 
819 
823 
827 
828  aCfg->Write( keyCopperColor_Red, m_settings.m_CopperColor.r );
830  aCfg->Write( keyCopperColor_Blue, m_settings.m_CopperColor.b );
831 
835 
837 
838  aCfg->Write( keyRenderEngine, (int)m_settings.RenderEngineGet() );
839  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::SaveSettings render setting %s",
840  ( m_settings.RenderEngineGet() == RENDER_ENGINE_RAYTRACING ) ? "Ray Trace" : "OpenGL" );
841 
842  aCfg->Write( keyRenderMaterial, (int)m_settings.MaterialModeGet() );
843 
844  // OpenGL options
845  aCfg->Write( keyRenderOGL_ShowCopperTck,
847  aCfg->Write( keyRenderOGL_ShowModelBBox,
849 
850  // Raytracing options
858 
859  aCfg->Write( keyShowAxis, m_settings.GetFlag( FL_AXIS ) );
860  aCfg->Write( keyShowGrid, (int)m_settings.GridGet() );
861 
865 
866  aCfg->Write( keyShowZones, m_settings.GetFlag( FL_ZONE ) );
872  aCfg->Write( keyShowEcoLayers, m_settings.GetFlag( FL_ECO ) );
874 }
875 
876 
877 void EDA_3D_VIEWER::CommonSettingsChanged( bool aEnvVarsChanged )
878 {
879  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::CommonSettingsChanged" );
880 
881  // Regen menu bars, etc
882  EDA_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged );
883 
884  // There is no base class that handles toolbars for this frame
886 
888 
889  NewDisplay( true );
890 }
891 
892 
893 void EDA_3D_VIEWER::OnKeyEvent( wxKeyEvent& event )
894 {
895  if( m_canvas )
896  return m_canvas->OnKeyEvent( event );
897 
898  event.Skip();
899 }
900 
901 
902 void EDA_3D_VIEWER::takeScreenshot( wxCommandEvent& event )
903 {
904  wxString fullFileName;
905  bool fmt_is_jpeg = false;
906 
907  if( event.GetId() == ID_MENU_SCREENCOPY_JPEG )
908  fmt_is_jpeg = true;
909 
910  if( event.GetId() != ID_TOOL_SCREENCOPY_TOCLIBBOARD )
911  {
912  // Remember path between saves during this session only.
913  const wxString wildcard = fmt_is_jpeg ? JpegFileWildcard() : PngFileWildcard();
914  const wxString ext = fmt_is_jpeg ? JpegFileExtension : PngFileExtension;
915 
916  // First time path is set to the project path.
917  if( !m_defaultSaveScreenshotFileName.IsOk() )
919 
920  m_defaultSaveScreenshotFileName.SetExt( ext );
921 
922  wxFileDialog dlg( this, _( "3D Image File Name" ),
924  m_defaultSaveScreenshotFileName.GetFullName(), wildcard,
925  wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
926 
927  if( dlg.ShowModal() == wxID_CANCEL )
928  return;
929 
930  m_defaultSaveScreenshotFileName = dlg.GetPath();
931 
932  if( m_defaultSaveScreenshotFileName.GetExt().IsEmpty() )
933  m_defaultSaveScreenshotFileName.SetExt( ext );
934 
935  fullFileName = m_defaultSaveScreenshotFileName.GetFullPath();
936 
937  // Be sure the screen area destroyed by the file dialog is redrawn
938  // before making a screen copy.
939  // Without this call, under Linux the screen refresh is made to late.
940  wxYield();
941  }
942 
943  // Be sure we have the latest 3D view (remember 3D view is buffered)
944  m_canvas->Request_refresh( true );
945  wxYield();
946 
947  // Build image from the 3D buffer
948  wxWindowUpdateLocker noUpdates( this );
949 
950  wxImage screenshotImage;
951 
952  if( m_canvas )
953  m_canvas->GetScreenshot( screenshotImage );
954 
955  if( event.GetId() == ID_TOOL_SCREENCOPY_TOCLIBBOARD )
956  {
957  wxBitmap bitmap( screenshotImage );
958 
959  if( wxTheClipboard->Open() )
960  {
961  wxBitmapDataObject* dobjBmp = new wxBitmapDataObject( bitmap );
962 
963  if( !wxTheClipboard->SetData( dobjBmp ) )
964  wxMessageBox( _( "Failed to copy image to clipboard" ) );
965 
966  wxTheClipboard->Flush(); /* the data in clipboard will stay
967  * available after the application exits */
968  wxTheClipboard->Close();
969  }
970  }
971  else
972  {
973  if( !screenshotImage.SaveFile( fullFileName,
974  fmt_is_jpeg ? wxBITMAP_TYPE_JPEG : wxBITMAP_TYPE_PNG ) )
975  wxMessageBox( _( "Can't save file" ) );
976 
977  screenshotImage.Destroy();
978  }
979 
980 }
981 
982 
984 {
985  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::RenderEngineChanged()" );
986 
987  if( m_canvas )
989 }
990 
991 
992 bool EDA_3D_VIEWER::Set3DColorFromUser( SFVEC3D &aColor, const wxString& aTitle,
993  CUSTOM_COLORS_LIST* aPredefinedColors )
994 {
995  KIGFX::COLOR4D newcolor;
996  KIGFX::COLOR4D oldcolor( aColor.r,aColor.g, aColor.b, 1.0 );
997 
998  DIALOG_COLOR_PICKER picker( this, oldcolor, false, aPredefinedColors );
999 
1000  if( picker.ShowModal() != wxID_OK )
1001  return false;
1002 
1003  newcolor = picker.GetColor();
1004 
1005  if( newcolor == oldcolor )
1006  return false;
1007 
1008  aColor.r = newcolor.r;
1009  aColor.g = newcolor.g;
1010  aColor.b = newcolor.b;
1011 
1012  return true;
1013 }
1014 
1015 
1017 {
1019 
1020  colors.push_back( CUSTOM_COLOR_ITEM( 241.0/255.0, 241.0/255.0, 241.0/255.0, "White" ) );
1021  colors.push_back( CUSTOM_COLOR_ITEM( 4.0/255.0, 18.0/255.0, 21.0/255.0, "Dark" ) );
1022 
1023  if( Set3DColorFromUser( m_settings.m_SilkScreenColor, _( "Silkscreen Color" ), &colors ) )
1024  {
1025  NewDisplay( true );
1026  return true;
1027  }
1028 
1029  return false;
1030 }
1031 
1032 
1034 {
1036 
1037  colors.push_back( CUSTOM_COLOR_ITEM( 20/255.0, 51/255.0, 36/255.0, "Green" ) );
1038  colors.push_back( CUSTOM_COLOR_ITEM( 91/255.0, 168/255.0, 12/255.0, "Light Green" ) );
1039  colors.push_back( CUSTOM_COLOR_ITEM( 13/255.0, 104/255.0, 11/255.0, "Saturated Green" ) );
1040  colors.push_back( CUSTOM_COLOR_ITEM( 181/255.0, 19/255.0, 21/255.0, "Red" ) );
1041  colors.push_back( CUSTOM_COLOR_ITEM( 239/255.0, 53/255.0, 41/255.0, "Red Light Orange" ) );
1042  colors.push_back( CUSTOM_COLOR_ITEM( 210/255.0, 40/255.0, 14/255.0, "Red 2" ) );
1043  colors.push_back( CUSTOM_COLOR_ITEM( 2/255.0, 59/255.0, 162/255.0, "Blue" ) );
1044  colors.push_back( CUSTOM_COLOR_ITEM( 54/255.0, 79/255.0, 116/255.0, "Light blue 1" ) );
1045  colors.push_back( CUSTOM_COLOR_ITEM( 61/255.0, 85/255.0, 130/255.0, "Light blue 2" ) );
1046  colors.push_back( CUSTOM_COLOR_ITEM( 21/255.0, 70/255.0, 80/255.0, "Green blue (dark)" ) );
1047  colors.push_back( CUSTOM_COLOR_ITEM( 11/255.0, 11/255.0, 11/255.0, "Black" ) );
1048  colors.push_back( CUSTOM_COLOR_ITEM( 245/255.0, 245/255.0, 245/255.0, "White" ) );
1049  colors.push_back( CUSTOM_COLOR_ITEM( 119/255.0, 31/255.0, 91/255.0, "Purple" ) );
1050  colors.push_back( CUSTOM_COLOR_ITEM( 32/255.0, 2/255.0, 53/255.0, "Purple Dark" ) );
1051 
1052  if( Set3DColorFromUser( m_settings.m_SolderMaskColor, _( "Solder Mask Color" ), &colors ) )
1053  {
1054  NewDisplay( true );
1055  return true;
1056  }
1057 
1058  return false;
1059 }
1060 
1061 
1063 {
1065 
1066  colors.push_back( CUSTOM_COLOR_ITEM( 184/255.0, 115/255.0, 50/255.0, "Copper" ) );
1067  colors.push_back( CUSTOM_COLOR_ITEM( 178/255.0, 156/255.0, 0.0, "Gold" ) );
1068  colors.push_back( CUSTOM_COLOR_ITEM( 213/255.0, 213/255.0, 213/255.0, "Silver" ) );
1069  colors.push_back( CUSTOM_COLOR_ITEM( 160/255.0, 160/255.0, 160/255.0, "Tin" ) );
1070 
1071  if( Set3DColorFromUser( m_settings.m_CopperColor, _( "Copper Color" ), &colors ) )
1072  {
1073  NewDisplay( true );
1074  return true;
1075  }
1076 
1077  return false;
1078 }
1079 
1080 
1082 {
1084 
1085  colors.push_back( CUSTOM_COLOR_ITEM( 51/255.0, 43/255.0, 22/255.0, "FR4 natural, dark" ) );
1086  colors.push_back( CUSTOM_COLOR_ITEM( 109/255.0, 116/255.0, 75/255.0, "FR4 natural" ) );
1087  colors.push_back( CUSTOM_COLOR_ITEM( 78/255.0, 14/255.0, 5/255.0, "brown/red" ) );
1088  colors.push_back( CUSTOM_COLOR_ITEM( 146/255.0, 99/255.0, 47/255.0, "brown 1" ) );
1089  colors.push_back( CUSTOM_COLOR_ITEM( 160/255.0, 123/255.0, 54/255.0, "brown 2" ) );
1090  colors.push_back( CUSTOM_COLOR_ITEM( 146/255.0, 99/255.0, 47/255.0, "brown 3" ) );
1091  colors.push_back( CUSTOM_COLOR_ITEM( 63/255.0, 126/255.0, 71/255.0, "green 1" ) );
1092  colors.push_back( CUSTOM_COLOR_ITEM( 117/255.0, 122/255.0, 90/255.0, "green 2" ) );
1093 
1094  if( Set3DColorFromUser( m_settings.m_BoardBodyColor, _( "Board Body Color" ), &colors ) )
1095  {
1096  NewDisplay( true );
1097  return true;
1098  }
1099 
1100  return false;
1101 }
1102 
1103 
1105 {
1107 
1108  colors.push_back( CUSTOM_COLOR_ITEM( 128/255.0, 128/255.0, 128/255.0, "grey" ) );
1109  colors.push_back( CUSTOM_COLOR_ITEM( 213/255.0, 213/255.0, 213/255.0, "Silver" ) );
1110  colors.push_back( CUSTOM_COLOR_ITEM( 90/255.0, 90/255.0, 90/255.0, "grey 2" ) );
1111 
1112  if( Set3DColorFromUser( m_settings.m_SolderPasteColor, _( "Solder Paste Color" ), &colors ) )
1113  {
1114  NewDisplay( true );
1115  return true;
1116  }
1117 
1118  return false;
1119 }
1120 
1121 
1122 void EDA_3D_VIEWER::OnUpdateUIEngine( wxUpdateUIEvent& aEvent )
1123 {
1125 }
1126 
1127 
1128 void EDA_3D_VIEWER::OnUpdateUIMaterial( wxUpdateUIEvent& aEvent )
1129 {
1130  // Set the state of toggle menus according to the current display options
1131  switch( aEvent.GetId() )
1132  {
1134  aEvent.Check( m_settings.MaterialModeGet() == MATERIAL_MODE_NORMAL );
1135  break;
1136 
1139  break;
1140 
1142  aEvent.Check( m_settings.MaterialModeGet() == MATERIAL_MODE_CAD_MODE );
1143  break;
1144 
1145  default:
1146  wxFAIL_MSG( "Invalid event in EDA_3D_VIEWER::OnUpdateUIMaterial()" );
1147  }
1148 }
1149 
1150 
1152 {
1153  wxCHECK_RET( m_canvas, "Cannot load settings to null canvas" );
1154 
1155  wxConfigBase& cmnCfg = *Pgm().CommonSettings();
1156 
1157  {
1158  const DPI_SCALING dpi{ &cmnCfg, this };
1159  m_canvas->SetScaleFactor( dpi.GetScaleFactor() );
1160  }
1161 
1162  {
1163  bool option;
1164  cmnCfg.Read( ENBL_MOUSEWHEEL_PAN_KEY, &option, false );
1166  }
1167 }
static const wxChar keyShowSolderMaskLayers[]
static const wxChar keyShowFootprints_Normal[]
static const wxChar keyRenderRAY_ProceduralT[]
static const wxChar keyShowGrid[]
bool Set3DCopperColorFromUser()
Set the copper color from a set of colors.
Class KIWAY_PLAYER is a wxFrame capable of the OpenProjectFiles function, meaning it can load a porti...
Definition: kiway_player.h:59
static const wxChar keyShowBoardBody[]
Use only diffuse material properties.
Definition: 3d_enums.h:93
EVT_UPDATE_UI(ID_MODEDIT_LOAD_MODULE_FROM_BOARD, FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard) EVT_UPDATE_UI(ID_ADD_FOOTPRINT_TO_BOARD
static const int * GetAttributesList(bool aUseAntiAliasing)
Get a list of attributes to pass to wxGLCanvas.
static const wxChar keyRenderRAY_Reflections[]
void CommonSettingsChanged(bool aEnvVarsChanged) override
Notification that common settings are updated.
const std::string JpegFileExtension
CINFO3D_VISU m_settings
static const wxChar keyBgColor_Red_Top[]
void On3DGridSelection(wxCommandEvent &event)
This file is part of the common library TODO brief description.
void Install3DViewOptionDialog(wxCommandEvent &event)
static const wxChar keySilkColor_Blue[]
static const wxChar keyBgColor_Blue_Top[]
bool Set3DSolderMaskColorFromUser()
Set the solder mask color from a set of colors.
void GridSet(GRID3D_TYPE aGridType)
GridSet - set the current grid.
Definition: cinfo3d_visu.h:222
static const wxChar keyRenderEngine[]
static const wxChar keyBgColor_Red[]
SFVEC3D m_CopperColor
in realistic mode: copper color
Definition: cinfo3d_visu.h:503
void LoadSettings(wxConfigBase *aCfg) override
Load common frame parameters from a configuration file.
PROJECT & Prj()
Definition: kicad.cpp:297
void OnKeyEvent(wxKeyEvent &event)
void RotateY(float aAngleInRadians)
Definition: ccamera.cpp:503
static const wxChar keyShowFootprints_Insert[]
virtual void SaveSettings(wxConfigBase *aCfg)
Saves common frame parameters to a configuration data file.
Class EDA_3D_ACTIONS.
Definition: 3d_actions.h:41
Definition: id.h:215
static const wxChar keyCopperColor_Green[]
static const wxChar keyShowFootprints_Virtual[]
void SetStatusBar(wxStatusBar *aStatusBar)
Definition: eda_3d_canvas.h:73
void SaveSettings(wxConfigBase *aCfg) override
Saves common frame parameters to a configuration data file.
GRID3D_TYPE GridGet() const
GridGet - get the current grid.
Definition: cinfo3d_visu.h:216
Implement a canvas based on a wxGLCanvas.
Definition: eda_3d_canvas.h:52
bool IsReloadRequestPending() const
IsReloadRequestPending - Query if there is a pending reload request.
Definition: eda_3d_canvas.h:81
double g
Green component.
Definition: color4d.h:302
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:65
static const wxChar keyShowAdhesiveLayers[]
a class to handle a custom color (predefined color) for the color picker dialog
wxString JpegFileWildcard()
static const wxChar keySilkColor_Green[]
wxAuiManager m_auimgr
SFVEC3D m_BgColorBot
background bottom color
Definition: cinfo3d_visu.h:497
std::vector< CUSTOM_COLOR_ITEM > CUSTOM_COLORS_LIST
void DisplayStatus()
DisplayStatus - Update the status bar with the position information.
void Request_refresh(bool aRedrawImmediately=true)
Request_refresh - Schedule a refresh update of the canvas.
void ReloadRequest(BOARD *aBoard=NULL, S3D_CACHE *aCachePointer=NULL)
SFVEC3D m_BgColorTop
background top color
Definition: cinfo3d_visu.h:498
void Exit3DFrame(wxCommandEvent &event)
Called when user press the File->Exit.
void MaterialModeSet(MATERIAL_MODE aMaterialMode)
MaterialModeSet.
Definition: cinfo3d_visu.h:240
bool GetFlag(DISPLAY3D_FLG aFlag) const
GetFlag - get a configuration status of a flag.
void loadCommonSettings()
Load configuration from common settings.
static const wxChar keyShowRealisticMode[]
Class to handle configuration and automatic determination of the DPI scale to use for canvases.
Definition: dpi_scaling.h:35
SFVEC3D m_BoardBodyColor
in realistic mode: FR4 board color
Definition: cinfo3d_visu.h:499
double b
Blue component.
Definition: color4d.h:303
EDA_3D_CANVAS * m_canvas
static const wxChar keyCopperColor_Blue[]
static const wxChar keySMaskColor_Green[]
bool Set3DColorFromUser(SFVEC3D &aColor, const wxString &aTitle, CUSTOM_COLORS_LIST *aPredefinedColors)
Get a SFVEC3D from a wx colour dialog.
static const wxChar keyBgColor_Green_Top[]
static const wxChar keyShowSolderPasteLayers[]
ID_MENU3D_FL_RENDER_MATERIAL_MODE_CAD_MODE
MATERIAL_MODE MaterialModeGet() const
MaterialModeGet.
Definition: cinfo3d_visu.h:246
void RenderEngineSet(RENDER_ENGINE aRenderEngine)
RenderEngineSet.
Definition: cinfo3d_visu.h:228
static const wxChar keySPasteColor_Red[]
static const wxChar keyShowSilkScreenLayers[]
Class TOOL_MANAGER.
Definition: tool_manager.h:50
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
void OnActivate(wxActivateEvent &event)
static const wxChar keyCopperColor_Red[]
void RotateZ(float aAngleInRadians)
Definition: ccamera.cpp:510
void OnUpdateUIMaterial(wxUpdateUIEvent &aEvent)
void RotateX(float aAngleInRadians)
Definition: ccamera.cpp:496
void OnDisableRayTracing(wxCommandEvent &aEvent)
CCAMERA & CameraGet() const
CameraGet - get current camera in use.
Definition: cinfo3d_visu.h:210
void RenderRaytracingRequest()
RenderRaytracingRequest - Request to render the current view in Raytracing mode.
wxAuiToolBar * m_mainToolBar
void OnKeyEvent(wxKeyEvent &event)
static const wxChar keyShowZones[]
static const wxChar keyRenderMaterial[]
static const wxChar keyRenderRAY_AAliasing[]
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.
virtual void LoadSettings(wxConfigBase *aCfg)
Load common frame parameters from a configuration file.
void OnUpdateUIEngine(wxUpdateUIEvent &aEvent)
void ToggleProjection()
Definition: ccamera.cpp:417
#define ENBL_MOUSEWHEEL_PAN_KEY
Definition: pgm_base.h:51
Definition of file extensions used in Kicad.
Use a gray shading based on diffuse material.
Definition: 3d_enums.h:94
Class KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within...
Definition: kiway.h:258
glm::dvec3 SFVEC3D
Definition: xv3d_types.h:48
void OnCloseWindow(wxCloseEvent &event)
static const wxChar keyBgColor_Green[]
static const wxChar keyBoardBodyColor_Blue[]
void ReCreateMainToolbar()
Equivalent of EDA_DRAW_FRAME::ReCreateHToolbar.
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:96
Class COMMON_CONTROL.
MATERIAL_MODE
Render 3d model shape materials mode.
Definition: 3d_enums.h:90
SFVEC3D m_SolderPasteColor
in realistic mode: solder paste color
Definition: cinfo3d_visu.h:501
bool Set3DSolderPasteColorFromUser()
Set the solder mask color from a set of colors.
#define _(s)
VTBL_ENTRY wxConfigBase * CommonSettings() const
Definition: pgm_base.h:204
Specialization of the wxAuiPaneInfo class for KiCad panels.
SFVEC3D m_SolderMaskColor
in realistic mode: solder mask color
Definition: cinfo3d_visu.h:500
EVT_MENU_RANGE(ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, KICAD_MANAGER_FRAME::language_change) KICAD_MANAGER_FRAME
GRID3D_TYPE
Grid types.
Definition: 3d_enums.h:71
static const wxChar keyRenderOGL_ShowModelBBox[]
wxString PngFileWildcard()
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:108
void RenderEngineChanged()
RenderEngineChanged - Update toolbar icon and call canvas RenderEngineChanged.
RENDER_ENGINE RenderEngineGet() const
RenderEngineGet.
Definition: cinfo3d_visu.h:234
static const wxChar keySPasteColor_Green[]
virtual void CommonSettingsChanged(bool aEnvVarsChanged)
Notification event that some of the common (suite-wide) settings have changed.
Use all material properties from model file.
Definition: 3d_enums.h:92
static const wxChar keyBoardBodyColor_Red[]
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.
SFVEC3D m_SilkScreenColor
in realistic mode: SilkScreen color
Definition: cinfo3d_visu.h:502
static const wxChar keySilkColor_Red[]
static const wxChar keyBgColor_Blue[]
static const wxChar keySMaskColor_Red[]
static const wxChar keyRenderRAY_Refractions[]
see class PGM_BASE
Declaration of the eda_3d_viewer class.
static const wxChar keyRenderOGL_ShowCopperTck[]
static const wxChar keyRenderRAY_Backfloor[]
PCB_EDIT_FRAME::OnUpdateSelectTrackWidth EVT_UPDATE_UI_RANGE(ID_POPUP_PCB_SELECT_VIASIZE1, ID_POPUP_PCB_SELECT_VIASIZE8, PCB_EDIT_FRAME::OnUpdateSelectViaSize) PCB_EDIT_FRAME
wxFileName m_defaultSaveScreenshotFileName
bool SetView3D(int aKeycode)
SetView3D - Helper function to call view commands.
void ProcessZoom(wxCommandEvent &event)
#define ROT_ANGLE
static const wxChar keySMaskColor_Blue[]
The base frame for deriving all KiCad main window classes.
void OnRenderEngineSelection(wxCommandEvent &event)
PCB_BASE_FRAME * Parent() const
Definition: eda_3d_viewer.h:67
KIGFX::COLOR4D GetColor()
const std::string PngFileExtension
void SetEnvironment(EDA_ITEM *aModel, KIGFX::VIEW *aView, KIGFX::VIEW_CONTROLS *aViewControls, EDA_BASE_FRAME *aFrame)
Sets the work environment (model, view, view controls and the parent window).
void SetScaleFactor(double aFactor)
Set the canvas scale factor, probably for a hi-DPI display.
RENDER_ENGINE
Render engine mode.
Definition: 3d_enums.h:82
static const wxChar keyBoardBodyColor_Green[]
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
void OnSetFocus(wxFocusEvent &event)
static const wxChar keyShowAxis[]
static const wxChar keySPasteColor_Blue[]
Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard.
Definition: eda_3d_viewer.h:56
double r
Red component.
Definition: color4d.h:301
void SetFlag(DISPLAY3D_FLG aFlag, bool aState)
SetFlag - set the status of a flag.
static const wxChar keyShowEcoLayers[]
static const wxChar keyShowCommentsLayer[]
void NewDisplay(bool aForceImmediateRedraw=false)
Reload and refresh (rebuild) the 3D scene.
static const wxChar keyRenderRAY_Shadows[]
#define QUALIFIED_VIEWER3D_FRAMENAME(parent)
Definition: eda_3d_viewer.h:50
static VRML_COLOR colors[VRML_COLOR_LAST]
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
BOARD * GetBoard()
Definition: eda_3d_viewer.h:69
bool m_disable_ray_tracing
bool Set3DBoardBodyColorFromUser()
Set the copper color from a set of colors.
static const wxChar keyRenderRAY_PostProcess[]
void ReloadRequest()
Request reloading the 3D view.
void Process_Special_Functions(wxCommandEvent &event)
EVT_TOOL_RANGE(ID_START_COMMAND_3D, ID_MENU_COMMAND_END, EDA_3D_VIEWER::Process_Special_Functions) EVT_UPDATE_UI_RANGE(ID_MENU3D_FL_RENDER_MATERIAL_MODE_NORMAL
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
void takeScreenshot(wxCommandEvent &event)
Create a Screenshot of the current 3D view.