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-2018 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 
30 #include "eda_3d_viewer.h"
31 #include "../3d_viewer_id.h"
32 #include <project.h>
33 #include <gestfich.h>
35 #include <wx/colordlg.h>
36 #include <wx/colourdata.h>
37 #include <lru_cache.h>
38 #include "../common_ogl/cogl_att_list.h"
39 #include <hotkeys_basic.h>
40 #include <wx/toolbar.h>
41 #include <bitmaps.h>
42 #include <pgm_base.h>
43 
44 
52 const wxChar * EDA_3D_VIEWER::m_logTrace = wxT( "KI_TRACE_EDA_3D_VIEWER" );
53 
54 
55 // Key to store 3D Viewer config
56 
57 static const wxChar keyBgColor_Red[] = wxT( "BgColor_Red" );
58 static const wxChar keyBgColor_Green[] = wxT( "BgColor_Green" );
59 static const wxChar keyBgColor_Blue[] = wxT( "BgColor_Blue" );
60 
61 static const wxChar keyBgColor_Red_Top[] = wxT( "BgColor_Red_Top" );
62 static const wxChar keyBgColor_Green_Top[] = wxT( "BgColor_Green_Top" );
63 static const wxChar keyBgColor_Blue_Top[] = wxT( "BgColor_Blue_Top" );
64 
65 static const wxChar keySMaskColor_Red[] = wxT( "SMaskColor_Red" );
66 static const wxChar keySMaskColor_Green[] = wxT( "SMaskColor_Green" );
67 static const wxChar keySMaskColor_Blue[] = wxT( "SMaskColor_Blue" );
68 
69 static const wxChar keySPasteColor_Red[] = wxT( "SPasteColor_Red" );
70 static const wxChar keySPasteColor_Green[] = wxT( "SPasteColor_Green" );
71 static const wxChar keySPasteColor_Blue[] = wxT( "SPasteColor_Blue" );
72 
73 static const wxChar keySilkColor_Red[] = wxT( "SilkColor_Red" );
74 static const wxChar keySilkColor_Green[] = wxT( "SilkColor_Green" );
75 static const wxChar keySilkColor_Blue[] = wxT( "SilkColor_Blue" );
76 
77 static const wxChar keyCopperColor_Red[] = wxT( "CopperColor_Red" );
78 static const wxChar keyCopperColor_Green[] = wxT( "CopperColor_Green" );
79 static const wxChar keyCopperColor_Blue[] = wxT( "CopperColor_Blue" );
80 
81 static const wxChar keyBoardBodyColor_Red[] = wxT( "BoardBodyColor_Red" );
82 static const wxChar keyBoardBodyColor_Green[] = wxT( "BoardBodyColor_Green" );
83 static const wxChar keyBoardBodyColor_Blue[] = wxT( "BoardBodyColor_Blue" );
84 
85 static const wxChar keyMousewheelPanning[] = wxT( "MousewheelPAN3D" );
86 
87 static const wxChar keyShowRealisticMode[] = wxT( "ShowRealisticMode" );
88 static const wxChar keyRenderEngine[] = wxT( "RenderEngine" );
89 //static const wxChar keyRenderTextures[] = wxT( "Render_Textures" );
90 static const wxChar keyRenderMaterial[] = wxT( "Render_Material" );
91 
92 static const wxChar keyRenderOGL_ShowCopperTck[]= wxT( "Render_OGL_ShowCopperThickness" );
93 static const wxChar keyRenderOGL_ShowModelBBox[]= wxT( "Render_OGL_ShowModelBoudingBoxes" );
94 
95 static const wxChar keyRenderRAY_Shadows[] = wxT( "Render_RAY_Shadows" );
96 static const wxChar keyRenderRAY_Backfloor[] = wxT( "Render_RAY_Backfloor" );
97 static const wxChar keyRenderRAY_Refractions[] = wxT( "Render_RAY_Refractions" );
98 static const wxChar keyRenderRAY_Reflections[] = wxT( "Render_RAY_Reflections" );
99 static const wxChar keyRenderRAY_PostProcess[] = wxT( "Render_RAY_PostProcess" );
100 static const wxChar keyRenderRAY_AAliasing[] = wxT( "Render_RAY_AntiAliasing" );
101 static const wxChar keyRenderRAY_ProceduralT[] = wxT( "Render_RAY_ProceduralTextures" );
102 
103 static const wxChar keyShowAxis[] = wxT( "ShowAxis" );
104 static const wxChar keyShowGrid[] = wxT( "ShowGrid3D" );
105 static const wxChar keyShowZones[] = wxT( "ShowZones" );
106 static const wxChar keyShowFootprints_Normal[] = wxT( "ShowFootprints_Normal" );
107 static const wxChar keyShowFootprints_Insert[] = wxT( "ShowFootprints_Insert" );
108 static const wxChar keyShowFootprints_Virtual[] = wxT( "ShowFootprints_Virtual" );
109 static const wxChar keyShowAdhesiveLayers[] = wxT( "ShowAdhesiveLayers" );
110 static const wxChar keyShowSilkScreenLayers[] = wxT( "ShowSilkScreenLayers" );
111 static const wxChar keyShowSolderMaskLayers[] = wxT( "ShowSolderMasLayers" );
112 static const wxChar keyShowSolderPasteLayers[] = wxT( "ShowSolderPasteLayers" );
113 static const wxChar keyShowCommentsLayer[] = wxT( "ShowCommentsLayers" );
114 static const wxChar keyShowBoardBody[] = wxT( "ShowBoardBody" );
115 static const wxChar keyShowEcoLayers[] = wxT( "ShowEcoLayers" );
116 
117 
118 BEGIN_EVENT_TABLE( EDA_3D_VIEWER, EDA_BASE_FRAME )
119 
120  EVT_ACTIVATE( EDA_3D_VIEWER::OnActivate )
121  EVT_SET_FOCUS( EDA_3D_VIEWER::OnSetFocus )
122 
124  EDA_3D_VIEWER::ProcessZoom )
125 
127  EDA_3D_VIEWER::Process_Special_Functions )
128 
129  EVT_TOOL( ID_TOOL_SET_VISIBLE_ITEMS, EDA_3D_VIEWER::Install3DViewOptionDialog )
130 
131  EVT_MENU( wxID_EXIT,
132  EDA_3D_VIEWER::Exit3DFrame )
133 
135  EDA_3D_VIEWER::On3DGridSelection )
136 
138  EDA_3D_VIEWER::OnRenderEngineSelection )
139 
140  EVT_CLOSE( EDA_3D_VIEWER::OnCloseWindow )
141 
142  EVT_UPDATE_UI_RANGE( ID_START_COMMAND_3D, ID_MENU_COMMAND_END,
143  EDA_3D_VIEWER::OnUpdateMenus )
144 
145 END_EVENT_TABLE()
146 
147 
149  const wxString &aTitle, long style ) :
150 
151  KIWAY_PLAYER( aKiway, aParent,
152  FRAME_PCB_DISPLAY3D, aTitle,
153  wxDefaultPosition, wxDefaultSize,
154  style, VIEWER3D_FRAMENAME )
155 {
156  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::EDA_3D_VIEWER %s", aTitle );
157 
158  m_canvas = NULL;
159 
160  // Give it an icon
161  wxIcon icon;
162  icon.CopyFromBitmap( KiBitmap( icon_3d_xpm ) );
163  SetIcon( icon );
164 
165  bool option;
166  Pgm().CommonSettings()->Read( ENBL_MOUSEWHEEL_PAN_KEY, &option, false );
167  m_settings.SetFlag( FL_MOUSEWHEEL_PANNING, option );
168 
169  LoadSettings( config() );
170  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
171 
172  // Create the status line
173  static const int status_dims[4] = { -1, 130, 130, 170 };
174 
175  wxStatusBar *status_bar = CreateStatusBar( arrayDim( status_dims ) );
176  SetStatusWidths( arrayDim( status_dims ), status_dims );
177 
178  CreateMenuBar();
179  ReCreateMainToolbar();
180 
181  m_canvas = new EDA_3D_CANVAS( this,
183  aParent->GetBoard(),
184  m_settings,
185  Prj().Get3DCacheManager() );
186 
187  if( m_canvas )
188  m_canvas->SetStatusBar( status_bar );
189 
190  m_auimgr.SetManagedWindow( this );
191 
192  m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
193  m_auimgr.AddPane( m_canvas, EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
194 
195  m_auimgr.Update();
196 
197  m_mainToolBar->EnableTool( ID_RENDER_CURRENT_VIEW,
198  (m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY) );
199 
200  m_mainToolBar->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( EDA_3D_VIEWER::OnKeyEvent ),
201  NULL, this );
202 
203  // Fixes bug in Windows (XP and possibly others) where the canvas requires the focus
204  // in order to receive mouse events. Otherwise, the user has to click somewhere on
205  // the canvas before it will respond to mouse wheel events.
206  if( m_canvas )
207  m_canvas->SetFocus();
208 }
209 
210 
212 {
213  m_mainToolBar->Disconnect( wxEVT_KEY_DOWN, wxKeyEventHandler( EDA_3D_VIEWER::OnKeyEvent ), 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 = 0;
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 = 0;
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  {
283  break;
284 
285  case ID_RELOAD3D_BOARD:
286  NewDisplay( true );
287  break;
288 
289  case ID_ROTATE3D_X_POS:
290  m_settings.CameraGet().RotateX( glm::radians(ROT_ANGLE) );
292  break;
293 
294  case ID_ROTATE3D_X_NEG:
295  m_settings.CameraGet().RotateX( -glm::radians(ROT_ANGLE) );
297  break;
298 
299  case ID_ROTATE3D_Y_POS:
300  m_settings.CameraGet().RotateY( glm::radians(ROT_ANGLE) );
302  break;
303 
304  case ID_ROTATE3D_Y_NEG:
305  m_settings.CameraGet().RotateY( -glm::radians(ROT_ANGLE) );
307  break;
308 
309  case ID_ROTATE3D_Z_POS:
310  m_settings.CameraGet().RotateZ( glm::radians(ROT_ANGLE) );
312  break;
313 
314  case ID_ROTATE3D_Z_NEG:
315  m_settings.CameraGet().RotateZ( -glm::radians(ROT_ANGLE) );
317  break;
318 
319  case ID_MOVE3D_LEFT:
320  m_canvas->SetView3D( WXK_LEFT );
321  return;
322 
323  case ID_MOVE3D_RIGHT:
324  m_canvas->SetView3D( WXK_RIGHT );
325  return;
326 
327  case ID_MOVE3D_UP:
328  m_canvas->SetView3D( WXK_UP );
329  return;
330 
331  case ID_MOVE3D_DOWN:
332  m_canvas->SetView3D( WXK_DOWN );
333  return;
334 
335  case ID_ORTHO:
338  return;
339 
343  takeScreenshot( event );
344  return;
345 
347  if( Set3DColorFromUser( m_settings.m_BgColorBot, _( "Background Color, Bottom" ),
348  nullptr ) )
349  {
352  else
353  NewDisplay( true );
354  }
355  return;
356 
358  if( Set3DColorFromUser( m_settings.m_BgColorTop, _( "Background Color, Top" ), nullptr ) )
359  {
362  else
363  NewDisplay( true );
364  }
365  return;
366 
369  return;
370 
373  return;
374 
377  return;
378 
381  break;
382 
385  break;
386 
390  NewDisplay( true );
391  return;
392 
395  NewDisplay( true );
396  return;
397 
400  NewDisplay( true );
401  return;
402 
405  NewDisplay( true );
406  return;
407 
410  NewDisplay( true );
411  return;
412 
416  return;
417 
421  return;
422 
425  NewDisplay( true );
426  return;
427 
430  NewDisplay( true );
431  return;
432 
436  return;
437 
441  return;
442 
445  NewDisplay( true );
446  return;
447 
451  return;
452 
454  m_settings.SetFlag( FL_SHOW_BOARD_BODY, isChecked );
455  NewDisplay( true );
456  return;
457 
459  m_settings.SetFlag( FL_AXIS, isChecked );
461  return;
462 
465  NewDisplay( true );
466  return;
467 
470  NewDisplay( true );
471  return;
472 
475  NewDisplay( true );
476  return;
477 
479  m_settings.SetFlag( FL_ZONE, isChecked );
480  NewDisplay( true );
481  return;
482 
484  m_settings.SetFlag( FL_ADHESIVE, isChecked );
485  NewDisplay( true );
486  return;
487 
489  m_settings.SetFlag( FL_SILKSCREEN, isChecked );
490  NewDisplay( true );
491  return;
492 
494  m_settings.SetFlag( FL_SOLDERMASK, isChecked );
495  NewDisplay( true );
496  return;
497 
499  m_settings.SetFlag( FL_SOLDERPASTE, isChecked );
500  NewDisplay( true );
501  return;
502 
504  m_settings.SetFlag( FL_COMMENTS, isChecked );
505  NewDisplay( true );
506  return;
507 
508  case ID_MENU3D_ECO_ONOFF:
509  m_settings.SetFlag( FL_ECO, isChecked );
510  NewDisplay( true );
511  return;
512 
514  {
515  // Reload settings with a dummy config, so it will load the defaults
516  wxConfig *fooconfig = new wxConfig("FooBarApp");
517  LoadSettings( fooconfig );
518  delete fooconfig;
519 
520  // Refresh menu option state
522 
523  // Tell canvas that we (may have) changed the render engine
525 
526  NewDisplay( true );
527  }
528  return;
529 
531  {
532  DisplayHotKeys();
533  }
534  return;
535 
536  default:
537  wxLogMessage( "EDA_3D_VIEWER::Process_Special_Functions() error: unknown command %d", id );
538  return;
539  }
540 }
541 
542 
543 void EDA_3D_VIEWER::On3DGridSelection( wxCommandEvent &event )
544 {
545  int id = event.GetId();
546 
547  wxASSERT( id < ID_MENU3D_GRID_END );
548  wxASSERT( id > ID_MENU3D_GRID );
549 
550  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::On3DGridSelection id:%d", id );
551 
552  switch( id )
553  {
556  break;
557 
560  break;
561 
562  case ID_MENU3D_GRID_5_MM:
564  break;
565 
568  break;
569 
570  case ID_MENU3D_GRID_1_MM:
572  break;
573 
574  default:
575  wxLogMessage( "EDA_3D_VIEWER::On3DGridSelection() error: unknown command %d", id );
576  return;
577  }
578 
579  if( m_canvas )
581 }
582 
583 
584 void EDA_3D_VIEWER::OnRenderEngineSelection( wxCommandEvent &event )
585 {
586  int id = event.GetId();
587 
588  wxASSERT( id < ID_MENU3D_ENGINE_END );
589  wxASSERT( id > ID_MENU3D_ENGINE );
590 
591  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::OnRenderEngineSelection id:%d", id );
592 
593  const RENDER_ENGINE old_engine = m_settings.RenderEngineGet();
594 
595  switch( id )
596  {
598  if( old_engine != RENDER_ENGINE_OPENGL_LEGACY )
600  break;
601 
603  if( old_engine != RENDER_ENGINE_RAYTRACING )
605  break;
606 
607  default:
608  wxLogMessage( "EDA_3D_VIEWER::OnRenderEngineSelection() error: unknown command %d", id );
609  return;
610  }
611 
612  if( old_engine != m_settings.RenderEngineGet() )
613  {
615  }
616 }
617 
618 
619 void EDA_3D_VIEWER::OnUpdateMenus(wxUpdateUIEvent &event)
620 {
622  // to have it working this way
624 }
625 
626 
627 void EDA_3D_VIEWER::ProcessZoom( wxCommandEvent &event )
628 {
629  int id = event.GetId();
630 
631  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::ProcessZoom id:%d", id );
632 
633  if( m_canvas == NULL )
634  return;
635 
636  switch( id )
637  {
638  case ID_ZOOM_PAGE:
639  m_canvas->SetView3D( WXK_HOME );
640  break;
641 
642  case ID_ZOOM_IN:
643  m_canvas->SetView3D( WXK_F1 );
644  break;
645 
646  case ID_ZOOM_OUT:
647  m_canvas->SetView3D( WXK_F2 );
648  break;
649 
650  case ID_ZOOM_REDRAW:
652  break;
653 
654  default:
655  wxLogMessage( "EDA_3D_VIEWER::ProcessZoom() error: unknown command %d", id );
656  return;
657  }
658 
660 }
661 
662 
663 void EDA_3D_VIEWER::OnActivate( wxActivateEvent &event )
664 {
665  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::OnActivate" );
666 
667  if( m_canvas )
668  {
669  // Reload data if 3D frame shows a board,
670  // because it can be changed since last frame activation
673 
674  // Activates again the focus of the canvas so it will catch mouse and key events
675  m_canvas->SetFocus();
676  }
677 
678  event.Skip(); // required under wxMAC
679 }
680 
681 
682 void EDA_3D_VIEWER::OnSetFocus(wxFocusEvent &event)
683 {
684  // Activates again the focus of the canvas so it will catch mouse and key events
685  if( m_canvas )
686  m_canvas->SetFocus();
687 
688  event.Skip();
689 }
690 
691 
692 void EDA_3D_VIEWER::LoadSettings( wxConfigBase *aCfg )
693 {
695 
696  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::LoadSettings" );
697 
698  aCfg->Read( keyBgColor_Red, &m_settings.m_BgColorBot.r, 0.4 );
699  aCfg->Read( keyBgColor_Green, &m_settings.m_BgColorBot.g, 0.4 );
700  aCfg->Read( keyBgColor_Blue, &m_settings.m_BgColorBot.b, 0.5 );
701 
702  aCfg->Read( keyBgColor_Red_Top, &m_settings.m_BgColorTop.r, 0.8 );
703  aCfg->Read( keyBgColor_Green_Top, &m_settings.m_BgColorTop.g, 0.8 );
704  aCfg->Read( keyBgColor_Blue_Top, &m_settings.m_BgColorTop.b, 0.9 );
705 
706  // m_SolderMaskColor default value = dark grey-green
707  aCfg->Read( keySMaskColor_Red, &m_settings.m_SolderMaskColor.r, 100.0 * 0.2 / 255.0 );
708  aCfg->Read( keySMaskColor_Green, &m_settings.m_SolderMaskColor.g, 255.0 * 0.2 / 255.0 );
709  aCfg->Read( keySMaskColor_Blue, &m_settings.m_SolderMaskColor.b, 180.0 * 0.2 / 255.0 );
710 
711  // m_SolderPasteColor default value = light grey
712  aCfg->Read( keySPasteColor_Red, &m_settings.m_SolderPasteColor.r, 128.0 /255.0 );
713  aCfg->Read( keySPasteColor_Green, &m_settings.m_SolderPasteColor.g, 128.0 /255.0 );
714  aCfg->Read( keySPasteColor_Blue, &m_settings.m_SolderPasteColor.b, 128.0 /255.0 );
715 
716  // m_SilkScreenColor default value = white
717  aCfg->Read( keySilkColor_Red, &m_settings.m_SilkScreenColor.r, 0.9 );
718  aCfg->Read( keySilkColor_Green, &m_settings.m_SilkScreenColor.g, 0.9 );
719  aCfg->Read( keySilkColor_Blue, &m_settings.m_SilkScreenColor.b, 0.9 );
720 
721  // m_CopperColor default value = gold
722  aCfg->Read( keyCopperColor_Red, &m_settings.m_CopperColor.r, 255.0 * 0.7 / 255.0 );
723  aCfg->Read( keyCopperColor_Green, &m_settings.m_CopperColor.g, 223.0 * 0.7 / 255.0 );
724  aCfg->Read( keyCopperColor_Blue, &m_settings.m_CopperColor.b, 0.0 );
725 
726  // m_BoardBodyColor default value = FR4, in realistic mode
727  aCfg->Read( keyBoardBodyColor_Red, &m_settings.m_BoardBodyColor.r, 51.0 / 255.0 );
728  aCfg->Read( keyBoardBodyColor_Green, &m_settings.m_BoardBodyColor.g, 43.0 / 255.0 );
729  aCfg->Read( keyBoardBodyColor_Blue, &m_settings.m_BoardBodyColor.b, 22.0 /255.0 );
730 
731 
732  bool tmp;
733  aCfg->Read( keyShowRealisticMode, &tmp, true );
735 
736  // OpenGL options
737  aCfg->Read( keyRenderOGL_ShowCopperTck, &tmp, true );
739 
740  aCfg->Read( keyRenderOGL_ShowModelBBox, &tmp, false );
742 
743  // Raytracing options
744  aCfg->Read( keyRenderRAY_Shadows, &tmp, true );
746 
747  aCfg->Read( keyRenderRAY_Backfloor, &tmp, true );
749 
750  aCfg->Read( keyRenderRAY_Refractions, &tmp, true );
752 
753  aCfg->Read( keyRenderRAY_Reflections, &tmp, true );
755 
756  aCfg->Read( keyRenderRAY_PostProcess, &tmp, true );
758 
759  aCfg->Read( keyRenderRAY_AAliasing, &tmp, true );
761 
762  aCfg->Read( keyRenderRAY_ProceduralT, &tmp, true );
764 
765  aCfg->Read( keyShowAxis, &tmp, true );
766  m_settings.SetFlag( FL_AXIS, tmp );
767 
768  aCfg->Read( keyShowFootprints_Normal, &tmp, true );
770 
771  aCfg->Read( keyShowFootprints_Insert, &tmp, true );
773 
774  aCfg->Read( keyShowFootprints_Virtual, &tmp, true );
776 
777  aCfg->Read( keyShowZones, &tmp, true );
778  m_settings.SetFlag( FL_ZONE, tmp );
779 
780  aCfg->Read( keyShowAdhesiveLayers, &tmp, true );
782 
783  aCfg->Read( keyShowSilkScreenLayers, &tmp, true );
785 
786  aCfg->Read( keyShowSolderMaskLayers, &tmp, true );
788 
789  aCfg->Read( keyShowSolderPasteLayers, &tmp, true );
791 
792  aCfg->Read( keyShowCommentsLayer, &tmp, true );
794 
795  aCfg->Read( keyShowEcoLayers, &tmp, true );
796  m_settings.SetFlag( FL_ECO, tmp );
797 
798  aCfg->Read( keyShowBoardBody, &tmp, true );
800 
801  int tmpi;
802  aCfg->Read( keyShowGrid, &tmpi, (int)GRID3D_NONE );
803  m_settings.GridSet( (GRID3D_TYPE)tmpi );
804 
805  aCfg->Read( keyRenderEngine, &tmpi, (int)RENDER_ENGINE_OPENGL_LEGACY );
807 
808  aCfg->Read( keyRenderMaterial, &tmpi, (int)MATERIAL_MODE_NORMAL );
810 }
811 
812 
813 void EDA_3D_VIEWER::SaveSettings( wxConfigBase *aCfg )
814 {
816 
817  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::SaveSettings" );
818 
819  aCfg->Write( keyBgColor_Red, m_settings.m_BgColorBot.r );
820  aCfg->Write( keyBgColor_Green, m_settings.m_BgColorBot.g );
821  aCfg->Write( keyBgColor_Blue, m_settings.m_BgColorBot.b );
822 
823  aCfg->Write( keyBgColor_Red_Top, m_settings.m_BgColorTop.r );
824  aCfg->Write( keyBgColor_Green_Top, m_settings.m_BgColorTop.g );
825  aCfg->Write( keyBgColor_Blue_Top, m_settings.m_BgColorTop.b );
826 
830 
834 
838 
839  aCfg->Write( keyCopperColor_Red, m_settings.m_CopperColor.r );
841  aCfg->Write( keyCopperColor_Blue, m_settings.m_CopperColor.b );
842 
846 
848 
849  aCfg->Write( keyRenderEngine, (int)m_settings.RenderEngineGet() );
850 
851  aCfg->Write( keyRenderMaterial, (int)m_settings.MaterialModeGet() );
852 
853  // OpenGL options
856 
857  // Raytracing options
865 
866  aCfg->Write( keyShowAxis, m_settings.GetFlag( FL_AXIS ) );
867  aCfg->Write( keyShowGrid, (int)m_settings.GridGet() );
868 
872 
873  aCfg->Write( keyShowZones, m_settings.GetFlag( FL_ZONE ) );
879  aCfg->Write( keyShowEcoLayers, m_settings.GetFlag( FL_ECO ) );
881 }
882 
883 
884 void EDA_3D_VIEWER::OnLeftClick( wxDC *DC, const wxPoint &MousePos )
885 {
886  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::OnLeftClick" );
887  // Do nothing
888 }
889 
890 
891 void EDA_3D_VIEWER::OnRightClick( const wxPoint &MousePos, wxMenu *PopMenu )
892 {
893  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::OnRightClick" );
894  // Do nothing
895 }
896 
897 
898 void EDA_3D_VIEWER::OnKeyEvent( wxKeyEvent& event )
899 {
900  if( m_canvas )
901  return m_canvas->OnKeyEvent( event );
902 
903  event.Skip();
904 }
905 
906 
907 void EDA_3D_VIEWER::RedrawActiveWindow( wxDC *DC, bool EraseBg )
908 {
909  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::RedrawActiveWindow" );
910  // Do nothing
911 }
912 
913 
914 void EDA_3D_VIEWER::takeScreenshot( wxCommandEvent& event )
915 {
916  wxString fullFileName;
917  bool fmt_is_jpeg = false;
918 
919  if( event.GetId() == ID_MENU_SCREENCOPY_JPEG )
920  fmt_is_jpeg = true;
921 
922  if( event.GetId() != ID_TOOL_SCREENCOPY_TOCLIBBOARD )
923  {
924  // Remember path between saves during this session only.
925  const wxString wildcard = fmt_is_jpeg ? JpegFileWildcard() : PngFileWildcard();
926  const wxString ext = fmt_is_jpeg ? JpegFileExtension : PngFileExtension;
927 
928  // First time path is set to the project path.
929  if( !m_defaultSaveScreenshotFileName.IsOk() )
931 
932  m_defaultSaveScreenshotFileName.SetExt( ext );
933 
934  wxFileDialog dlg( this, _( "3D Image File Name" ),
936  m_defaultSaveScreenshotFileName.GetFullName(), wildcard,
937  wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
938 
939  if( dlg.ShowModal() == wxID_CANCEL )
940  return;
941 
942  m_defaultSaveScreenshotFileName = dlg.GetPath();
943 
944  if( m_defaultSaveScreenshotFileName.GetExt().IsEmpty() )
945  m_defaultSaveScreenshotFileName.SetExt( ext );
946 
947  fullFileName = m_defaultSaveScreenshotFileName.GetFullPath();
948 
949  // Be sure the screen area destroyed by the file dialog is redrawn
950  // before making a screen copy.
951  // Without this call, under Linux the screen refresh is made to late.
952  wxYield();
953  }
954 
955  // Be sure we have the latest 3D view (remember 3D view is buffered)
956  Refresh();
957  wxYield();
958 
959  // Build image from the 3D buffer
960  wxWindowUpdateLocker noUpdates( this );
961 
962  wxImage screenshotImage;
963 
964  if( m_canvas )
965  m_canvas->GetScreenshot( screenshotImage );
966 
967  if( event.GetId() == ID_TOOL_SCREENCOPY_TOCLIBBOARD )
968  {
969  wxBitmap bitmap( screenshotImage );
970 
971  if( wxTheClipboard->Open() )
972  {
973  wxBitmapDataObject* dobjBmp = new wxBitmapDataObject( bitmap );
974 
975  if( !wxTheClipboard->SetData( dobjBmp ) )
976  wxMessageBox( _( "Failed to copy image to clipboard" ) );
977 
978  wxTheClipboard->Flush(); /* the data in clipboard will stay
979  * available after the application exits */
980  wxTheClipboard->Close();
981  }
982  }
983  else
984  {
985  if( !screenshotImage.SaveFile( fullFileName,
986  fmt_is_jpeg ? wxBITMAP_TYPE_JPEG : wxBITMAP_TYPE_PNG ) )
987  wxMessageBox( _( "Can't save file" ) );
988 
989  screenshotImage.Destroy();
990  }
991 
992 }
993 
994 
996 {
997  if( m_canvas )
999 
1002 
1003  m_mainToolBar->Refresh();
1004 }
1005 
1006 
1007 bool EDA_3D_VIEWER::Set3DColorFromUser( SFVEC3D &aColor, const wxString& aTitle,
1008  CUSTOM_COLORS_LIST* aPredefinedColors )
1009 {
1010  KIGFX::COLOR4D newcolor;
1011  KIGFX::COLOR4D oldcolor( aColor.r,aColor.g, aColor.b, 1.0 );
1012 
1013  DIALOG_COLOR_PICKER picker( this, oldcolor, false, aPredefinedColors );
1014 
1015  if( picker.ShowModal() != wxID_OK )
1016  return false;
1017 
1018  newcolor = picker.GetColor();
1019 
1020  if( newcolor == oldcolor )
1021  return false;
1022 
1023  aColor.r = newcolor.r;
1024  aColor.g = newcolor.g;
1025  aColor.b = newcolor.b;
1026 
1027  return true;
1028 }
1029 
1030 
1032 {
1033  CUSTOM_COLORS_LIST definedColors;
1034  definedColors.push_back( CUSTOM_COLOR_ITEM( 241.0/255.0, 241.0/255.0, 241.0/255.0, "White" ) );
1035  definedColors.push_back( CUSTOM_COLOR_ITEM( 4.0/255.0, 18.0/255.0, 21.0/255.0, "Dark" ) );
1036 
1038  _( "Solder Mask Color" ), &definedColors );
1039 
1040  if( change )
1041  NewDisplay( true );
1042 
1043  return change;
1044 }
1045 
1046 
1048 {
1049  CUSTOM_COLORS_LIST definedColors;
1050 
1051  definedColors.push_back( CUSTOM_COLOR_ITEM( 20/255.0, 51/255.0, 36/255.0, "Green" ) );
1052  definedColors.push_back( CUSTOM_COLOR_ITEM( 91/255.0, 168/255.0, 12/255.0, "Light Green" ) );
1053  definedColors.push_back( CUSTOM_COLOR_ITEM( 13/255.0, 104/255.0, 11/255.0,
1054  "Saturated Green" ) );
1055  definedColors.push_back( CUSTOM_COLOR_ITEM( 181/255.0, 19/255.0, 21/255.0, "Red" ) );
1056  definedColors.push_back( CUSTOM_COLOR_ITEM( 239/255.0, 53/255.0, 41/255.0,
1057  "Red Light Orange" ) );
1058  definedColors.push_back( CUSTOM_COLOR_ITEM( 210/255.0, 40/255.0, 14/255.0, "Red 2" ) );
1059  definedColors.push_back( CUSTOM_COLOR_ITEM( 2/255.0, 59/255.0, 162/255.0, "Blue" ) );
1060  definedColors.push_back( CUSTOM_COLOR_ITEM( 54/255.0, 79/255.0, 116/255.0, "Light blue 1" ) );
1061  definedColors.push_back( CUSTOM_COLOR_ITEM( 61/255.0, 85/255.0, 130/255.0, "Light blue 2" ) );
1062  definedColors.push_back( CUSTOM_COLOR_ITEM( 21/255.0, 70/255.0, 80/255.0,
1063  "Green blue (dark)" ) );
1064  definedColors.push_back( CUSTOM_COLOR_ITEM( 11/255.0, 11/255.0, 11/255.0, "Black" ) );
1065  definedColors.push_back( CUSTOM_COLOR_ITEM( 245/255.0, 245/255.0, 245/255.0, "White" ) );
1066  definedColors.push_back( CUSTOM_COLOR_ITEM( 119/255.0, 31/255.0, 91/255.0, "Purple" ) );
1067  definedColors.push_back( CUSTOM_COLOR_ITEM( 32/255.0, 2/255.0, 53/255.0, "Purple Dark" ) );
1068 
1070  _( "Solder Mask Color" ),
1071  &definedColors );
1072 
1073  if( change )
1074  NewDisplay( true );
1075 
1076  return change;
1077 }
1078 
1079 
1081 {
1082  CUSTOM_COLORS_LIST definedColors;
1083 
1084  definedColors.push_back( CUSTOM_COLOR_ITEM( 184/255.0, 115/255.0, 50/255.0, "Copper" ) );
1085  definedColors.push_back( CUSTOM_COLOR_ITEM( 178/255.0, 156/255.0, 0.0, "Gold" ) );
1086  definedColors.push_back( CUSTOM_COLOR_ITEM( 213/255.0, 213/255.0, 213/255.0, "Silver" ) );
1087  definedColors.push_back( CUSTOM_COLOR_ITEM( 160/255.0, 160/255.0, 160/255.0, "Tin" ) );
1088 
1089  bool change = Set3DColorFromUser( m_settings.m_CopperColor, _( "Copper Color" ),
1090  &definedColors );
1091 
1092  if( change )
1093  NewDisplay( true );
1094 
1095  return change;
1096 }
1097 
1098 
1100 {
1101  CUSTOM_COLORS_LIST definedColors;
1102 
1103  definedColors.push_back( CUSTOM_COLOR_ITEM( 51/255.0, 43/255.0, 22/255.0,
1104  "FR4 natural, dark" ) );
1105  definedColors.push_back( CUSTOM_COLOR_ITEM( 109/255.0, 116/255.0, 75/255.0, "FR4 natural" ) );
1106  definedColors.push_back( CUSTOM_COLOR_ITEM( 78/255.0, 14/255.0, 5/255.0, "brown/red" ) );
1107  definedColors.push_back( CUSTOM_COLOR_ITEM( 146/255.0, 99/255.0, 47/255.0, "brown 1" ) );
1108  definedColors.push_back( CUSTOM_COLOR_ITEM( 160/255.0, 123/255.0, 54/255.0, "brown 2" ) );
1109  definedColors.push_back( CUSTOM_COLOR_ITEM( 146/255.0, 99/255.0, 47/255.0, "brown 3" ) );
1110  definedColors.push_back( CUSTOM_COLOR_ITEM( 63/255.0, 126/255.0, 71/255.0, "green 1" ) );
1111  definedColors.push_back( CUSTOM_COLOR_ITEM( 117/255.0, 122/255.0, 90/255.0, "green 2" ) );
1112 
1113  bool change = Set3DColorFromUser( m_settings.m_BoardBodyColor, _( "Board Body Color" ),
1114  &definedColors );
1115  if( change )
1116  NewDisplay( true );
1117 
1118  return change;
1119 }
1120 
1121 
1123 {
1124  CUSTOM_COLORS_LIST definedColors;
1125 
1126  definedColors.push_back( CUSTOM_COLOR_ITEM( 128/255.0, 128/255.0, 128/255.0, "grey" ) );
1127  definedColors.push_back( CUSTOM_COLOR_ITEM( 213/255.0, 213/255.0, 213/255.0, "Silver" ) );
1128  definedColors.push_back( CUSTOM_COLOR_ITEM( 90/255.0, 90/255.0, 90/255.0, "grey 2" ) );
1129 
1131  _( "Solder Paste Color" ), &definedColors );
1132 
1133  if( change )
1134  NewDisplay( true );
1135 
1136  return change;
1137 }
static const wxChar keyShowSolderMaskLayers[]
static const wxChar keyShowFootprints_Normal[]
PCB_BASE_FRAME * Parent() const
Definition: eda_3d_viewer.h:60
GRID3D_TYPE GridGet() const
GridGet - get the current grid.
Definition: cinfo3d_visu.h:216
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:120
static const wxChar keyShowBoardBody[]
Use only diffuse material properties.
Definition: 3d_enums.h:93
static const int * GetAttributesList(bool aUseAntiAliasing)
Get a list of attributes to pass to wxGLCanvas.
static const wxChar keyRenderRAY_Reflections[]
const std::string JpegFileExtension
CINFO3D_VISU m_settings
Store all the settings and options to be used by the renders.
static const wxChar keyBgColor_Red_Top[]
void On3DGridSelection(wxCommandEvent &event)
This file is part of the common library TODO brief description.
bool IsReloadRequestPending() const
IsReloadRequestPending - Query if there is a pending reload request.
Definition: eda_3d_canvas.h:82
MATERIAL_MODE MaterialModeGet() const
MaterialModeGet.
Definition: cinfo3d_visu.h:246
static const wxChar keySilkColor_Blue[]
static const wxChar keyMousewheelPanning[]
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:509
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
PROJECT & Prj()
Definition: kicad.cpp:292
void OnKeyEvent(wxKeyEvent &event)
void SetMenuBarOptionsState()
Set the state of toggle menus according to the current display options.
Definition: 3d_menubar.cpp:350
void RotateY(float aAngleInRadians)
Definition: ccamera.cpp:503
static const wxChar keyShowFootprints_Insert[]
virtual void SaveSettings(wxConfigBase *aCfg)
Function SaveSettings saves common frame parameters to a configuration data file. ...
void RedrawActiveWindow(wxDC *DC, bool EraseBg)
Definition: id.h:241
static const wxChar keyCopperColor_Green[]
static const wxChar keyShowFootprints_Virtual[]
void SetStatusBar(wxStatusBar *aStatusBar)
Definition: eda_3d_canvas.h:74
void SaveSettings(wxConfigBase *aCfg) override
Function SaveSettings saves common frame parameters to a configuration data file. ...
VTBL_ENTRY const wxString GetProjectFullName() const
Function GetProjectFullName returns the full path and name of the project.
Definition: project.cpp:96
Class EDA_3D_CANVAS Implement a canvas based on a wxGLCanvas.
Definition: eda_3d_canvas.h:53
double g
Green component.
Definition: color4d.h:288
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:66
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:503
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:504
void Exit3DFrame(wxCommandEvent &event)
Called when user press the File->Exit.
void MaterialModeSet(MATERIAL_MODE aMaterialMode)
MaterialModeSet.
Definition: cinfo3d_visu.h:240
static const wxChar keyShowRealisticMode[]
SFVEC3D m_BoardBodyColor
in realistic mode: FR4 board color
Definition: cinfo3d_visu.h:505
double b
Blue component.
Definition: color4d.h:289
EDA_3D_CANVAS * m_canvas
The canvas where the openGL context will be rendered.
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.
EDA_3D_VIEWER::Process_Special_Functions EVT_MENU(wxID_EXIT, EDA_3D_VIEWER::Exit3DFrame) EVT_MENU_RANGE(ID_MENU3D_GRID
static const wxChar keyBgColor_Green_Top[]
static const wxChar keyShowSolderPasteLayers[]
void RenderEngineSet(RENDER_ENGINE aRenderEngine)
RenderEngineSet.
Definition: cinfo3d_visu.h:228
static const wxChar keySPasteColor_Red[]
static const wxChar keyShowSilkScreenLayers[]
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
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)
void OnUpdateMenus(wxUpdateUIEvent &event)
EDA_3D_VIEWER::Process_Special_Functions ID_MENU3D_GRID_END
static const wxChar keyCopperColor_Red[]
void RotateZ(float aAngleInRadians)
Definition: ccamera.cpp:510
void RotateX(float aAngleInRadians)
Definition: ccamera.cpp:496
void RenderRaytracingRequest()
RenderRaytracingRequest - Request to render the current view in Raytracing mode.
void OnKeyEvent(wxKeyEvent &event)
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...
static const wxChar keyShowZones[]
static const wxChar keyRenderMaterial[]
static const wxChar keyRenderRAY_AAliasing[]
FOOTPRINT_EDIT_FRAME::OnVerticalToolbar FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard EVT_UPDATE_UI_RANGE(ID_MODEDIT_PAD_TOOL, ID_MODEDIT_MEASUREMENT_TOOL, FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar) EVT_UPDATE_UI(ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE
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)
Function LoadSettings loads common frame parameters from a configuration file.
void ToggleProjection()
Definition: ccamera.cpp:417
#define ENBL_MOUSEWHEEL_PAN_KEY
Definition: pgm_base.h:49
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 OnLeftClick(wxDC *DC, const wxPoint &MousePos)
void OnCloseWindow(wxCloseEvent &event)
Template define a least-recently-used cache algo based on wxHashMap and wxString http://docs.wxwidgets.org/3.0/classwx_hash_map.html.
EVT_TOOL_RANGE(ID_ZOOM_IN, ID_ZOOM_REDRAW, EDA_3D_VIEWER::ProcessZoom) EVT_TOOL_RANGE(ID_START_COMMAND_3D
static const wxChar keyBgColor_Green[]
static const wxChar keyBoardBodyColor_Blue[]
EVT_TOOL(ID_FOOTPRINT_WIZARD_SELECT_WIZARD, FOOTPRINT_WIZARD_FRAME::SelectCurrentWizard) EVT_TOOL(ID_FOOTPRINT_WIZARD_RESET_TO_DEFAULT
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:507
bool Set3DSolderPasteColorFromUser()
Set the solder mask color from a set of colors.
Specialization of the wxAuiPaneInfo class for KiCad panels.
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
RENDER_ENGINE RenderEngineGet() const
RenderEngineGet.
Definition: cinfo3d_visu.h:234
SFVEC3D m_SolderMaskColor
in realistic mode: solder mask color
Definition: cinfo3d_visu.h:506
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
of elements in an array. This implements type-safe compile time checking
Definition: macros.h:99
void RenderEngineChanged()
RenderEngineChanged - Update toolbar icon and call canvas RenderEngineChanged.
static const wxChar keySPasteColor_Green[]
Use all material properties from model file.
Definition: 3d_enums.h:92
static const wxChar keyBoardBodyColor_Red[]
bool GetFlag(DISPLAY3D_FLG aFlag) const
GetFlag - get a configuration status of a flag.
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:508
static const wxChar keySilkColor_Red[]
static const wxChar keyBgColor_Blue[]
static const wxChar keySMaskColor_Red[]
ID_MENU_COMMAND_END
static const wxChar keyRenderRAY_Refractions[]
see class PGM_BASE
Declaration of the eda_3d_viewer class.
EDA_3D_VIEWER::Process_Special_Functions EDA_3D_VIEWER::On3DGridSelection EVT_MENU_RANGE(ID_MENU3D_ENGINE, ID_MENU3D_ENGINE_END, EDA_3D_VIEWER::OnRenderEngineSelection) EVT_UPDATE_UI_RANGE(ID_START_COMMAND_3D
static const wxChar keyRenderOGL_ShowCopperTck[]
static const wxChar keyRenderRAY_Backfloor[]
wxFileName m_defaultSaveScreenshotFileName
Filename to propose for save a screenshot.
CCAMERA & CameraGet() const
CameraGet - get current camera in use.
Definition: cinfo3d_visu.h:210
bool SetView3D(int aKeycode)
SetView3D - Helper function to call view commands.
void ProcessZoom(wxCommandEvent &event)
#define ROT_ANGLE
static const wxChar keySMaskColor_Blue[]
Class EDA_BASE_FRAME is the base frame for deriving all KiCad main window classes.
void OnRenderEngineSelection(wxCommandEvent &event)
VTBL_ENTRY wxConfigBase * CommonSettings() const
Definition: pgm_base.h:189
KIGFX::COLOR4D GetColor()
const std::string PngFileExtension
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[]
void OnRightClick(const wxPoint &MousePos, wxMenu *PopMenu)
Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard. ...
Definition: eda_3d_viewer.h:49
Some functions to handle hotkeys in KiCad.
double r
Red component.
Definition: color4d.h:287
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 VIEWER3D_FRAMENAME
Definition: eda_3d_viewer.h:44
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...
BOARD * GetBoard()
Definition: eda_3d_viewer.h:62
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)
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.