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-2017 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>
34 #include <wx/colordlg.h>
35 #include <wx/colourdata.h>
36 #include <lru_cache.h>
37 #include "../common_ogl/cogl_att_list.h"
38 #include <hotkeys_basic.h>
39 #include <wx/toolbar.h>
40 #include <bitmaps.h>
41 #include <pgm_base.h>
42 
49 const wxChar * EDA_3D_VIEWER::m_logTrace = wxT( "KI_TRACE_EDA_3D_VIEWER" );
50 
51 
52 // Key to store 3D Viewer config
53 
54 static const wxChar keyBgColor_Red[] = wxT( "BgColor_Red" );
55 static const wxChar keyBgColor_Green[] = wxT( "BgColor_Green" );
56 static const wxChar keyBgColor_Blue[] = wxT( "BgColor_Blue" );
57 
58 static const wxChar keyBgColor_Red_Top[] = wxT( "BgColor_Red_Top" );
59 static const wxChar keyBgColor_Green_Top[] = wxT( "BgColor_Green_Top" );
60 static const wxChar keyBgColor_Blue_Top[] = wxT( "BgColor_Blue_Top" );
61 
62 static const wxChar keySMaskColor_Red[] = wxT( "SMaskColor_Red" );
63 static const wxChar keySMaskColor_Green[] = wxT( "SMaskColor_Green" );
64 static const wxChar keySMaskColor_Blue[] = wxT( "SMaskColor_Blue" );
65 
66 static const wxChar keySPasteColor_Red[] = wxT( "SPasteColor_Red" );
67 static const wxChar keySPasteColor_Green[] = wxT( "SPasteColor_Green" );
68 static const wxChar keySPasteColor_Blue[] = wxT( "SPasteColor_Blue" );
69 
70 static const wxChar keySilkColor_Red[] = wxT( "SilkColor_Red" );
71 static const wxChar keySilkColor_Green[] = wxT( "SilkColor_Green" );
72 static const wxChar keySilkColor_Blue[] = wxT( "SilkColor_Blue" );
73 
74 static const wxChar keyCopperColor_Red[] = wxT( "CopperColor_Red" );
75 static const wxChar keyCopperColor_Green[] = wxT( "CopperColor_Green" );
76 static const wxChar keyCopperColor_Blue[] = wxT( "CopperColor_Blue" );
77 
78 static const wxChar keyBoardBodyColor_Red[] = wxT( "BoardBodyColor_Red" );
79 static const wxChar keyBoardBodyColor_Green[] = wxT( "BoardBodyColor_Green" );
80 static const wxChar keyBoardBodyColor_Blue[] = wxT( "BoardBodyColor_Blue" );
81 
82 static const wxChar keyMousewheelPanning[] = wxT( "MousewheelPAN3D" );
83 
84 static const wxChar keyShowRealisticMode[] = wxT( "ShowRealisticMode" );
85 static const wxChar keyRenderEngine[] = wxT( "RenderEngine" );
86 //static const wxChar keyRenderTextures[] = wxT( "Render_Textures" );
87 static const wxChar keyRenderMaterial[] = wxT( "Render_Material" );
88 
89 static const wxChar keyRenderOGL_ShowCopperTck[]= wxT( "Render_OGL_ShowCopperThickness" );
90 static const wxChar keyRenderOGL_ShowModelBBox[]= wxT( "Render_OGL_ShowModelBoudingBoxes" );
91 
92 static const wxChar keyRenderRAY_Shadows[] = wxT( "Render_RAY_Shadows" );
93 static const wxChar keyRenderRAY_Backfloor[] = wxT( "Render_RAY_Backfloor" );
94 static const wxChar keyRenderRAY_Refractions[] = wxT( "Render_RAY_Refractions" );
95 static const wxChar keyRenderRAY_Reflections[] = wxT( "Render_RAY_Reflections" );
96 static const wxChar keyRenderRAY_PostProcess[] = wxT( "Render_RAY_PostProcess" );
97 static const wxChar keyRenderRAY_AAliasing[] = wxT( "Render_RAY_AntiAliasing" );
98 static const wxChar keyRenderRAY_ProceduralT[] = wxT( "Render_RAY_ProceduralTextures" );
99 
100 static const wxChar keyShowAxis[] = wxT( "ShowAxis" );
101 static const wxChar keyShowGrid[] = wxT( "ShowGrid3D" );
102 static const wxChar keyShowZones[] = wxT( "ShowZones" );
103 static const wxChar keyShowFootprints_Normal[] = wxT( "ShowFootprints_Normal" );
104 static const wxChar keyShowFootprints_Insert[] = wxT( "ShowFootprints_Insert" );
105 static const wxChar keyShowFootprints_Virtual[] = wxT( "ShowFootprints_Virtual" );
106 static const wxChar keyShowAdhesiveLayers[] = wxT( "ShowAdhesiveLayers" );
107 static const wxChar keyShowSilkScreenLayers[] = wxT( "ShowSilkScreenLayers" );
108 static const wxChar keyShowSolderMaskLayers[] = wxT( "ShowSolderMasLayers" );
109 static const wxChar keyShowSolderPasteLayers[] = wxT( "ShowSolderPasteLayers" );
110 static const wxChar keyShowCommentsLayer[] = wxT( "ShowCommentsLayers" );
111 static const wxChar keyShowBoardBody[] = wxT( "ShowBoardBody" );
112 static const wxChar keyShowEcoLayers[] = wxT( "ShowEcoLayers" );
113 
114 
115 BEGIN_EVENT_TABLE( EDA_3D_VIEWER, EDA_BASE_FRAME )
116 
117  EVT_ACTIVATE( EDA_3D_VIEWER::OnActivate )
118  EVT_SET_FOCUS( EDA_3D_VIEWER::OnSetFocus )
119 
121  EDA_3D_VIEWER::ProcessZoom )
122 
124  EDA_3D_VIEWER::Process_Special_Functions )
125 
126  EVT_TOOL( ID_TOOL_SET_VISIBLE_ITEMS, EDA_3D_VIEWER::Install3DViewOptionDialog )
127 
128  EVT_MENU( wxID_EXIT,
129  EDA_3D_VIEWER::Exit3DFrame )
130 
132  EDA_3D_VIEWER::On3DGridSelection )
133 
135  EDA_3D_VIEWER::OnRenderEngineSelection )
136 
137  EVT_CLOSE( EDA_3D_VIEWER::OnCloseWindow )
138 
139  EVT_UPDATE_UI_RANGE( ID_START_COMMAND_3D, ID_MENU_COMMAND_END,
140  EDA_3D_VIEWER::OnUpdateMenus )
141 
142 END_EVENT_TABLE()
143 
144 
146  const wxString &aTitle, long style ) :
147 
148  KIWAY_PLAYER( aKiway, aParent,
149  FRAME_PCB_DISPLAY3D, aTitle,
150  wxDefaultPosition, wxDefaultSize,
151  style, VIEWER3D_FRAMENAME )
152 {
153  wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::EDA_3D_VIEWER %s" ), aTitle );
154 
155  m_canvas = NULL;
156 
157  // Give it an icon
158  wxIcon icon;
159  icon.CopyFromBitmap( KiBitmap( icon_3d_xpm ) );
160  SetIcon( icon );
161 
162  bool option;
163  Pgm().CommonSettings()->Read( ENBL_MOUSEWHEEL_PAN_KEY, &option, false );
164  m_settings.SetFlag( FL_MOUSEWHEEL_PANNING, option );
165 
166  LoadSettings( config() );
167  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
168 
169  // Create the status line
170  static const int status_dims[4] = { -1, 130, 130, 170 };
171 
172  wxStatusBar *status_bar = CreateStatusBar( DIM( status_dims ) );
173  SetStatusWidths( DIM( status_dims ), status_dims );
174 
175  CreateMenuBar();
176  ReCreateMainToolbar();
177 
178  m_canvas = new EDA_3D_CANVAS( this,
180  aParent->GetBoard(),
181  m_settings,
182  Prj().Get3DCacheManager() );
183 
184  if( m_canvas )
185  m_canvas->SetStatusBar( status_bar );
186 
187  m_auimgr.SetManagedWindow( this );
188 
189  m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
190  m_auimgr.AddPane( m_canvas, EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
191 
192  m_auimgr.Update();
193 
194  m_mainToolBar->EnableTool( ID_RENDER_CURRENT_VIEW,
195  (m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY) );
196 
197  m_mainToolBar->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( EDA_3D_VIEWER::OnKeyEvent ), NULL, this );
198 
199  // Fixes bug in Windows (XP and possibly others) where the canvas requires the focus
200  // in order to receive mouse events. Otherwise, the user has to click somewhere on
201  // the canvas before it will respond to mouse wheel events.
202  if( m_canvas )
203  m_canvas->SetFocus();
204 }
205 
206 
208 {
209  m_mainToolBar->Disconnect( wxEVT_KEY_DOWN, wxKeyEventHandler( EDA_3D_VIEWER::OnKeyEvent ), NULL, this );
210 
211  m_auimgr.UnInit();
212 
213  // m_canvas delete will be called by wxWidget manager
214  //delete m_canvas;
215  //m_canvas = 0;
216 }
217 
218 
220 {
221  // This will schedule a request to load later
222  if( m_canvas )
223  m_canvas->ReloadRequest( GetBoard(), Prj().Get3DCacheManager() );
224 }
225 
226 
227 void EDA_3D_VIEWER::NewDisplay( bool aForceImmediateRedraw )
228 {
229  ReloadRequest();
230 
231  // After the ReloadRequest call, the refresh often takes a bit of time,
232  // and it is made here only on request.
233  if( aForceImmediateRedraw )
234  m_canvas->Refresh();
235 }
236 
237 
238 void EDA_3D_VIEWER::Exit3DFrame( wxCommandEvent &event )
239 {
240  wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::Exit3DFrame" ) );
241 
242  Close( true );
243 }
244 
245 
246 void EDA_3D_VIEWER::OnCloseWindow( wxCloseEvent &event )
247 {
248  wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::OnCloseWindow" ) );
249 
250  if( m_canvas )
251  m_canvas->Close();
252 
253  // m_canvas delete will be called by wxWidget manager
254  //delete m_canvas;
255  //m_canvas = 0;
256 
257  Destroy();
258  event.Skip( true );
259 }
260 
261 #define ROT_ANGLE 10.0
262 
263 void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
264 {
265  int id = event.GetId();
266  bool isChecked = event.IsChecked();
267 
268  wxLogTrace( m_logTrace,
269  wxT( "EDA_3D_VIEWER::Process_Special_Functions id:%d isChecked:%d" ),
270  id, isChecked );
271 
272  if( m_canvas == NULL )
273  return;
274 
275  switch( id )
276  {
279  break;
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) );
288  break;
289 
290  case ID_ROTATE3D_X_NEG:
291  m_settings.CameraGet().RotateX( -glm::radians(ROT_ANGLE) );
293  break;
294 
295  case ID_ROTATE3D_Y_POS:
296  m_settings.CameraGet().RotateY( glm::radians(ROT_ANGLE) );
298  break;
299 
300  case ID_ROTATE3D_Y_NEG:
301  m_settings.CameraGet().RotateY( -glm::radians(ROT_ANGLE) );
303  break;
304 
305  case ID_ROTATE3D_Z_POS:
306  m_settings.CameraGet().RotateZ( glm::radians(ROT_ANGLE) );
308  break;
309 
310  case ID_ROTATE3D_Z_NEG:
311  m_settings.CameraGet().RotateZ( -glm::radians(ROT_ANGLE) );
313  break;
314 
315  case ID_MOVE3D_LEFT:
316  m_canvas->SetView3D( WXK_LEFT );
317  return;
318 
319  case ID_MOVE3D_RIGHT:
320  m_canvas->SetView3D( WXK_RIGHT );
321  return;
322 
323  case ID_MOVE3D_UP:
324  m_canvas->SetView3D( WXK_UP );
325  return;
326 
327  case ID_MOVE3D_DOWN:
328  m_canvas->SetView3D( WXK_DOWN );
329  return;
330 
331  case ID_ORTHO:
334  return;
335 
339  takeScreenshot( event );
340  return;
341 
343  if( Set3DColorFromUser( m_settings.m_BgColorBot, _( "Background Color, Bottom" ), nullptr ) )
344  {
347  else
348  NewDisplay( true );
349  }
350  return;
351 
353  if( Set3DColorFromUser( m_settings.m_BgColorTop, _( "Background Color, Top" ), nullptr ) )
354  {
357  else
358  NewDisplay( true );
359  }
360  return;
361 
364  return;
365 
368  return;
369 
372  return;
373 
376  break;
377 
380  break;
381 
385  NewDisplay( true );
386  return;
387 
390  NewDisplay( true );
391  return;
392 
395  NewDisplay( true );
396  return;
397 
400  NewDisplay( true );
401  return;
402 
405  NewDisplay( true );
406  return;
407 
411  return;
412 
416  return;
417 
420  NewDisplay( true );
421  return;
422 
425  NewDisplay( true );
426  return;
427 
431  return;
432 
436  return;
437 
440  NewDisplay( true );
441  return;
442 
446  return;
447 
449  m_settings.SetFlag( FL_SHOW_BOARD_BODY, isChecked );
450  NewDisplay( true );
451  return;
452 
454  m_settings.SetFlag( FL_AXIS, isChecked );
456  return;
457 
460  NewDisplay( true );
461  return;
462 
465  NewDisplay( true );
466  return;
467 
470  NewDisplay( true );
471  return;
472 
474  m_settings.SetFlag( FL_ZONE, isChecked );
475  NewDisplay( true );
476  return;
477 
479  m_settings.SetFlag( FL_ADHESIVE, isChecked );
480  NewDisplay( true );
481  return;
482 
484  m_settings.SetFlag( FL_SILKSCREEN, isChecked );
485  NewDisplay( true );
486  return;
487 
489  m_settings.SetFlag( FL_SOLDERMASK, isChecked );
490  NewDisplay( true );
491  return;
492 
494  m_settings.SetFlag( FL_SOLDERPASTE, isChecked );
495  NewDisplay( true );
496  return;
497 
499  m_settings.SetFlag( FL_COMMENTS, isChecked );
500  NewDisplay( true );
501  return;
502 
503  case ID_MENU3D_ECO_ONOFF:
504  m_settings.SetFlag( FL_ECO, isChecked );
505  NewDisplay( true );
506  return;
507 
509  {
510  // Reload settings with a dummy config, so it will load the defaults
511  wxConfig *fooconfig = new wxConfig("FooBarApp");
512  LoadSettings( fooconfig );
513  delete fooconfig;
514 
515  // Refresh menu option state
517 
518  // Tell canvas that we (may have) changed the render engine
520 
521  NewDisplay( true );
522  }
523  return;
524 
526  {
527  DisplayHotKeys();
528  }
529  return;
530 
531  default:
532  wxLogMessage( wxT( "EDA_3D_VIEWER::Process_Special_Functions() error: unknown command %d" ), id );
533  return;
534  }
535 }
536 
537 
538 void EDA_3D_VIEWER::On3DGridSelection( wxCommandEvent &event )
539 {
540  int id = event.GetId();
541 
542  wxASSERT( id < ID_MENU3D_GRID_END );
543  wxASSERT( id > ID_MENU3D_GRID );
544 
545  wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::On3DGridSelection id:%d" ), id );
546 
547  switch( id )
548  {
551  break;
552 
555  break;
556 
557  case ID_MENU3D_GRID_5_MM:
559  break;
560 
563  break;
564 
565  case ID_MENU3D_GRID_1_MM:
567  break;
568 
569  default:
570  wxLogMessage( wxT( "EDA_3D_VIEWER::On3DGridSelection() error: unknown command %d" ), id );
571  return;
572  }
573 
574  if( m_canvas )
576 }
577 
578 
579 void EDA_3D_VIEWER::OnRenderEngineSelection( wxCommandEvent &event )
580 {
581  int id = event.GetId();
582 
583  wxASSERT( id < ID_MENU3D_ENGINE_END );
584  wxASSERT( id > ID_MENU3D_ENGINE );
585 
586  wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::OnRenderEngineSelection id:%d" ), id );
587 
588  const RENDER_ENGINE old_engine = m_settings.RenderEngineGet();
589 
590  switch( id )
591  {
593  if( old_engine != RENDER_ENGINE_OPENGL_LEGACY )
595  break;
596 
598  if( old_engine != RENDER_ENGINE_RAYTRACING )
600  break;
601 
602  default:
603  wxLogMessage( wxT( "EDA_3D_VIEWER::OnRenderEngineSelection() error: unknown command %d" ), id );
604  return;
605  }
606 
607  if( old_engine != m_settings.RenderEngineGet() )
608  {
610  }
611 }
612 
613 
614 void EDA_3D_VIEWER::OnUpdateMenus(wxUpdateUIEvent &event)
615 {
617  // to have it working this way
619 }
620 
621 
622 void EDA_3D_VIEWER::ProcessZoom( wxCommandEvent &event )
623 {
624  int id = event.GetId();
625 
626  wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::ProcessZoom id:%d" ), id );
627 
628  if( m_canvas == NULL )
629  return;
630 
631  switch( id )
632  {
633  case ID_ZOOM_PAGE:
634  m_canvas->SetView3D( WXK_HOME );
635  break;
636 
637  case ID_ZOOM_IN:
638  m_canvas->SetView3D( WXK_F1 );
639  break;
640 
641  case ID_ZOOM_OUT:
642  m_canvas->SetView3D( WXK_F2 );
643  break;
644 
645  case ID_ZOOM_REDRAW:
647  break;
648 
649  default:
650  wxLogMessage( wxT( "EDA_3D_VIEWER::ProcessZoom() error: unknown command %d" ), id );
651  return;
652  }
653 
655 }
656 
657 
658 void EDA_3D_VIEWER::OnActivate( wxActivateEvent &event )
659 {
660  wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::OnActivate" ) );
661 
662  if( m_canvas )
663  {
664  // Reload data if 3D frame shows a board,
665  // because it can be changed since last frame activation
668 
669  // Activates again the focus of the canvas so it will catch mouse and key events
670  m_canvas->SetFocus();
671  }
672 
673  event.Skip(); // required under wxMAC
674 }
675 
676 
677 void EDA_3D_VIEWER::OnSetFocus(wxFocusEvent &event)
678 {
679  // Activates again the focus of the canvas so it will catch mouse and key events
680  if( m_canvas )
681  m_canvas->SetFocus();
682 
683  event.Skip();
684 }
685 
686 
687 void EDA_3D_VIEWER::LoadSettings( wxConfigBase *aCfg )
688 {
690 
691  wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::LoadSettings" ) );
692 
693  aCfg->Read( keyBgColor_Red, &m_settings.m_BgColorBot.r, 0.4 );
694  aCfg->Read( keyBgColor_Green, &m_settings.m_BgColorBot.g, 0.4 );
695  aCfg->Read( keyBgColor_Blue, &m_settings.m_BgColorBot.b, 0.5 );
696 
697  aCfg->Read( keyBgColor_Red_Top, &m_settings.m_BgColorTop.r, 0.8 );
698  aCfg->Read( keyBgColor_Green_Top, &m_settings.m_BgColorTop.g, 0.8 );
699  aCfg->Read( keyBgColor_Blue_Top, &m_settings.m_BgColorTop.b, 0.9 );
700 
701  // m_SolderMaskColor default value = dark grey-green
702  aCfg->Read( keySMaskColor_Red, &m_settings.m_SolderMaskColor.r, 100.0 * 0.2 / 255.0 );
703  aCfg->Read( keySMaskColor_Green, &m_settings.m_SolderMaskColor.g, 255.0 * 0.2 / 255.0 );
704  aCfg->Read( keySMaskColor_Blue, &m_settings.m_SolderMaskColor.b, 180.0 * 0.2 / 255.0 );
705 
706  // m_SolderPasteColor default value = light grey
707  aCfg->Read( keySPasteColor_Red, &m_settings.m_SolderPasteColor.r, 128.0 /255.0 );
708  aCfg->Read( keySPasteColor_Green, &m_settings.m_SolderPasteColor.g, 128.0 /255.0 );
709  aCfg->Read( keySPasteColor_Blue, &m_settings.m_SolderPasteColor.b, 128.0 /255.0 );
710 
711  // m_SilkScreenColor default value = white
712  aCfg->Read( keySilkColor_Red, &m_settings.m_SilkScreenColor.r, 0.9 );
713  aCfg->Read( keySilkColor_Green, &m_settings.m_SilkScreenColor.g, 0.9 );
714  aCfg->Read( keySilkColor_Blue, &m_settings.m_SilkScreenColor.b, 0.9 );
715 
716  // m_CopperColor default value = gold
717  aCfg->Read( keyCopperColor_Red, &m_settings.m_CopperColor.r, 255.0 * 0.7 / 255.0 );
718  aCfg->Read( keyCopperColor_Green, &m_settings.m_CopperColor.g, 223.0 * 0.7 / 255.0 );
719  aCfg->Read( keyCopperColor_Blue, &m_settings.m_CopperColor.b, 0.0 );
720 
721  // m_BoardBodyColor default value = FR4, in realistic mode
722  aCfg->Read( keyBoardBodyColor_Red, &m_settings.m_BoardBodyColor.r, 51.0 / 255.0 );
723  aCfg->Read( keyBoardBodyColor_Green, &m_settings.m_BoardBodyColor.g, 43.0 / 255.0 );
724  aCfg->Read( keyBoardBodyColor_Blue, &m_settings.m_BoardBodyColor.b, 22.0 /255.0 );
725 
726 
727  bool tmp;
728  aCfg->Read( keyShowRealisticMode, &tmp, true );
730 
731  // OpenGL options
732  aCfg->Read( keyRenderOGL_ShowCopperTck, &tmp, true );
734 
735  aCfg->Read( keyRenderOGL_ShowModelBBox, &tmp, false );
737 
738  // Raytracing options
739  aCfg->Read( keyRenderRAY_Shadows, &tmp, true );
741 
742  aCfg->Read( keyRenderRAY_Backfloor, &tmp, true );
744 
745  aCfg->Read( keyRenderRAY_Refractions, &tmp, true );
747 
748  aCfg->Read( keyRenderRAY_Reflections, &tmp, true );
750 
751  aCfg->Read( keyRenderRAY_PostProcess, &tmp, true );
753 
754  aCfg->Read( keyRenderRAY_AAliasing, &tmp, true );
756 
757  aCfg->Read( keyRenderRAY_ProceduralT, &tmp, true );
759 
760  aCfg->Read( keyShowAxis, &tmp, true );
761  m_settings.SetFlag( FL_AXIS, tmp );
762 
763  aCfg->Read( keyShowFootprints_Normal, &tmp, true );
765 
766  aCfg->Read( keyShowFootprints_Insert, &tmp, true );
768 
769  aCfg->Read( keyShowFootprints_Virtual, &tmp, true );
771 
772  aCfg->Read( keyShowZones, &tmp, true );
773  m_settings.SetFlag( FL_ZONE, tmp );
774 
775  aCfg->Read( keyShowAdhesiveLayers, &tmp, true );
777 
778  aCfg->Read( keyShowSilkScreenLayers, &tmp, true );
780 
781  aCfg->Read( keyShowSolderMaskLayers, &tmp, true );
783 
784  aCfg->Read( keyShowSolderPasteLayers, &tmp, true );
786 
787  aCfg->Read( keyShowCommentsLayer, &tmp, true );
789 
790  aCfg->Read( keyShowEcoLayers, &tmp, true );
791  m_settings.SetFlag( FL_ECO, tmp );
792 
793  aCfg->Read( keyShowBoardBody, &tmp, true );
795 
796  int tmpi;
797  aCfg->Read( keyShowGrid, &tmpi, (int)GRID3D_NONE );
798  m_settings.GridSet( (GRID3D_TYPE)tmpi );
799 
800  aCfg->Read( keyRenderEngine, &tmpi, (int)RENDER_ENGINE_OPENGL_LEGACY );
802 
803  aCfg->Read( keyRenderMaterial, &tmpi, (int)MATERIAL_MODE_NORMAL );
805 }
806 
807 
808 void EDA_3D_VIEWER::SaveSettings( wxConfigBase *aCfg )
809 {
811 
812  wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::SaveSettings" ) );
813 
814  aCfg->Write( keyBgColor_Red, m_settings.m_BgColorBot.r );
815  aCfg->Write( keyBgColor_Green, m_settings.m_BgColorBot.g );
816  aCfg->Write( keyBgColor_Blue, m_settings.m_BgColorBot.b );
817 
818  aCfg->Write( keyBgColor_Red_Top, m_settings.m_BgColorTop.r );
819  aCfg->Write( keyBgColor_Green_Top, m_settings.m_BgColorTop.g );
820  aCfg->Write( keyBgColor_Blue_Top, m_settings.m_BgColorTop.b );
821 
825 
829 
833 
834  aCfg->Write( keyCopperColor_Red, m_settings.m_CopperColor.r );
836  aCfg->Write( keyCopperColor_Blue, m_settings.m_CopperColor.b );
837 
841 
843 
844  aCfg->Write( keyRenderEngine, (int)m_settings.RenderEngineGet() );
845 
846  aCfg->Write( keyRenderMaterial, (int)m_settings.MaterialModeGet() );
847 
848  // OpenGL options
851 
852  // Raytracing options
860 
861  aCfg->Write( keyShowAxis, m_settings.GetFlag( FL_AXIS ) );
862  aCfg->Write( keyShowGrid, (int)m_settings.GridGet() );
863 
867 
868  aCfg->Write( keyShowZones, m_settings.GetFlag( FL_ZONE ) );
874  aCfg->Write( keyShowEcoLayers, m_settings.GetFlag( FL_ECO ) );
876 }
877 
878 
879 void EDA_3D_VIEWER::OnLeftClick( wxDC *DC, const wxPoint &MousePos )
880 {
881  wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::OnLeftClick" ) );
882  // Do nothing
883 }
884 
885 
886 void EDA_3D_VIEWER::OnRightClick( const wxPoint &MousePos, wxMenu *PopMenu )
887 {
888  wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::OnRightClick" ) );
889  // Do nothing
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::RedrawActiveWindow( wxDC *DC, bool EraseBg )
903 {
904  wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::RedrawActiveWindow" ) );
905  // Do nothing
906 }
907 
908 
909 void EDA_3D_VIEWER::takeScreenshot( wxCommandEvent& event )
910 {
911  wxString fullFileName;
912  bool fmt_is_jpeg = false;
913 
914  if( event.GetId() == ID_MENU_SCREENCOPY_JPEG )
915  fmt_is_jpeg = true;
916 
917  if( event.GetId() != ID_TOOL_SCREENCOPY_TOCLIBBOARD )
918  {
919  // Remember path between saves during this session only.
920  static wxFileName fn;
921  const wxString file_ext = fmt_is_jpeg ? wxT( "jpg" ) : wxT( "png" );
922  const wxString mask = wxT( "*." ) + file_ext;
923 
924  // First time path is set to the project path.
925  if( !fn.IsOk() )
926  fn = Parent()->Prj().GetProjectFullName();
927 
928  fn.SetExt( file_ext );
929 
930  fullFileName = EDA_FILE_SELECTOR( _( "3D Image File Name:" ), fn.GetPath(),
931  m_defaultSaveScreenshotFileName, file_ext, mask, this,
932  wxFD_SAVE | wxFD_OVERWRITE_PROMPT, true );
933 
934  if( fullFileName.IsEmpty() )
935  return;
936 
937  fn = fullFileName;
938 
939  // Be sure the screen area destroyed by the file dialog is redrawn
940  // before making a screen copy.
941  // Without this call, under Linux the screen refresh is made to late.
942  wxYield();
943  }
944 
945  // Be sure we have the latest 3D view (remember 3D view is buffered)
946  Refresh();
947  wxYield();
948 
949  // Build image from the 3D buffer
950  wxWindowUpdateLocker noUpdates( this );
951 
952  wxImage screenshotImage;
953 
954  if( m_canvas )
955  m_canvas->GetScreenshot( screenshotImage );
956 
957  if( event.GetId() == ID_TOOL_SCREENCOPY_TOCLIBBOARD )
958  {
959  wxBitmap bitmap( screenshotImage );
960 
961  if( wxTheClipboard->Open() )
962  {
963  wxBitmapDataObject* dobjBmp = new wxBitmapDataObject( bitmap );
964 
965  if( !wxTheClipboard->SetData( dobjBmp ) )
966  wxMessageBox( _( "Failed to copy image to clipboard" ) );
967 
968  wxTheClipboard->Flush(); /* the data in clipboard will stay
969  * available after the application exits */
970  wxTheClipboard->Close();
971  }
972  }
973  else
974  {
975  if( !screenshotImage.SaveFile( fullFileName,
976  fmt_is_jpeg ? wxBITMAP_TYPE_JPEG : wxBITMAP_TYPE_PNG ) )
977  wxMessageBox( _( "Can't save file" ) );
978 
979  screenshotImage.Destroy();
980  }
981 
982 }
983 
984 
986 {
987  if( m_canvas )
989 
992 
993  m_mainToolBar->Refresh();
994 }
995 
996 
997 bool EDA_3D_VIEWER::Set3DColorFromUser( SFVEC3D &aColor, const wxString& aTitle,
998  CUSTOM_COLORS_LIST* aPredefinedColors )
999 {
1000  KIGFX::COLOR4D newcolor;
1001  KIGFX::COLOR4D oldcolor( aColor.r,aColor.g, aColor.b, 1.0 );
1002 
1003  DIALOG_COLOR_PICKER picker( this, oldcolor, false, aPredefinedColors );
1004 
1005  if( picker.ShowModal() != wxID_OK )
1006  return false;
1007 
1008  newcolor = picker.GetColor();
1009 
1010  if( newcolor == oldcolor )
1011  return false;
1012 
1013  aColor.r = newcolor.r;
1014  aColor.g = newcolor.g;
1015  aColor.b = newcolor.b;
1016 
1017  return true;
1018 }
1019 
1020 
1022 {
1023  CUSTOM_COLORS_LIST definedColors;
1024  definedColors.push_back( CUSTOM_COLOR_ITEM( 241.0/255.0, 241.0/255.0, 241.0/255.0, "White" ) );
1025  definedColors.push_back( CUSTOM_COLOR_ITEM( 4.0/255.0, 18.0/255.0, 21.0/255.0, "Dark" ) );
1026 
1028  _( "Solder Mask Color" ), &definedColors );
1029 
1030  if( change )
1031  NewDisplay( true );
1032 
1033  return change;
1034 }
1035 
1036 
1038 {
1039  CUSTOM_COLORS_LIST definedColors;
1040 
1041  definedColors.push_back( CUSTOM_COLOR_ITEM( 20/255.0, 51/255.0, 36/255.0, "Green" ) );
1042  definedColors.push_back( CUSTOM_COLOR_ITEM( 91/255.0, 168/255.0, 12/255.0, "Light Green" ) );
1043  definedColors.push_back( CUSTOM_COLOR_ITEM( 13/255.0, 104/255.0, 11/255.0, "Saturated Green" ) );
1044  definedColors.push_back( CUSTOM_COLOR_ITEM( 181/255.0, 19/255.0, 21/255.0, "Red" ) );
1045  definedColors.push_back( CUSTOM_COLOR_ITEM( 239/255.0, 53/255.0, 41/255.0, "Red Light Orange" ) );
1046  definedColors.push_back( CUSTOM_COLOR_ITEM( 210/255.0, 40/255.0, 14/255.0, "Red 2" ) );
1047  definedColors.push_back( CUSTOM_COLOR_ITEM( 2/255.0, 59/255.0, 162/255.0, "Blue" ) );
1048  definedColors.push_back( CUSTOM_COLOR_ITEM( 54/255.0, 79/255.0, 116/255.0, "Light blue 1" ) );
1049  definedColors.push_back( CUSTOM_COLOR_ITEM( 61/255.0, 85/255.0, 130/255.0, "Light blue 2" ) );
1050  definedColors.push_back( CUSTOM_COLOR_ITEM( 21/255.0, 70/255.0, 80/255.0, "Green blue (dark)" ) );
1051  definedColors.push_back( CUSTOM_COLOR_ITEM( 11/255.0, 11/255.0, 11/255.0, "Black" ) );
1052  definedColors.push_back( CUSTOM_COLOR_ITEM( 245/255.0, 245/255.0, 245/255.0, "White" ) );
1053  definedColors.push_back( CUSTOM_COLOR_ITEM( 119/255.0, 31/255.0, 91/255.0, "Purple" ) );
1054  definedColors.push_back( CUSTOM_COLOR_ITEM( 32/255.0, 2/255.0, 53/255.0, "Purple Dark" ) );
1055 
1057  _( "Solder Mask Color" ),
1058  &definedColors );
1059 
1060  if( change )
1061  NewDisplay( true );
1062 
1063  return change;
1064 }
1065 
1066 
1068 {
1069  CUSTOM_COLORS_LIST definedColors;
1070 
1071  definedColors.push_back( CUSTOM_COLOR_ITEM( 184/255.0, 115/255.0, 50/255.0, "Copper" ) );
1072  definedColors.push_back( CUSTOM_COLOR_ITEM( 178/255.0, 156/255.0, 0.0, "Gold" ) );
1073  definedColors.push_back( CUSTOM_COLOR_ITEM( 213/255.0, 213/255.0, 213/255.0, "Silver" ) );
1074  definedColors.push_back( CUSTOM_COLOR_ITEM( 160/255.0, 160/255.0, 160/255.0, "Tin" ) );
1075 
1076  bool change = Set3DColorFromUser( m_settings.m_CopperColor, _( "Copper Color" ),
1077  &definedColors );
1078 
1079  if( change )
1080  NewDisplay( true );
1081 
1082  return change;
1083 }
1084 
1085 
1087 {
1088  CUSTOM_COLORS_LIST definedColors;
1089 
1090  definedColors.push_back( CUSTOM_COLOR_ITEM( 51/255.0, 43/255.0, 22/255.0, "FR4 natural, dark" ) );
1091  definedColors.push_back( CUSTOM_COLOR_ITEM( 109/255.0, 116/255.0, 75/255.0, "FR4 natural" ) );
1092  definedColors.push_back( CUSTOM_COLOR_ITEM( 78/255.0, 14/255.0, 5/255.0, "brown/red" ) );
1093  definedColors.push_back( CUSTOM_COLOR_ITEM( 146/255.0, 99/255.0, 47/255.0, "brown 1" ) );
1094  definedColors.push_back( CUSTOM_COLOR_ITEM( 160/255.0, 123/255.0, 54/255.0, "brown 2" ) );
1095  definedColors.push_back( CUSTOM_COLOR_ITEM( 146/255.0, 99/255.0, 47/255.0, "brown 3" ) );
1096  definedColors.push_back( CUSTOM_COLOR_ITEM( 63/255.0, 126/255.0, 71/255.0, "green 1" ) );
1097  definedColors.push_back( CUSTOM_COLOR_ITEM( 117/255.0, 122/255.0, 90/255.0, "green 2" ) );
1098 
1099  bool change = Set3DColorFromUser( m_settings.m_BoardBodyColor, _( "Board Body Color" ),
1100  &definedColors );
1101  if( change )
1102  NewDisplay( true );
1103 
1104  return change;
1105 }
1106 
1107 
1109 {
1110  CUSTOM_COLORS_LIST definedColors;
1111 
1112  definedColors.push_back( CUSTOM_COLOR_ITEM( 128/255.0, 128/255.0, 128/255.0, "grey" ) );
1113  definedColors.push_back( CUSTOM_COLOR_ITEM( 213/255.0, 213/255.0, 213/255.0, "Silver" ) );
1114  definedColors.push_back( CUSTOM_COLOR_ITEM( 90/255.0, 90/255.0, 90/255.0, "grey 2" ) );
1115 
1117  _( "Solder Paste Color" ), &definedColors );
1118 
1119  if( change )
1120  NewDisplay( true );
1121 
1122  return change;
1123 }
static const wxChar keyShowSolderMaskLayers[]
static const wxChar keyShowFootprints_Normal[]
PCB_BASE_FRAME * Parent() const
Definition: eda_3d_viewer.h:61
#define DIM(x)
of elements in an array
Definition: macros.h:98
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()
Function 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[]
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()
Function 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
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.
wxString m_defaultSaveScreenshotFileName
Filename to propose for save a screenshot.
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)
Function Set3DColorFromUser 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()
Function 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
wxString EDA_FILE_SELECTOR(const wxString &aTitle, const wxString &aPath, const wxString &aFileName, const wxString &aExtension, const wxString &aWildcard, wxWindow *aParent, int aStyle, const bool aKeepWorkingDirectory, const wxPoint &aPosition, wxString *aMruPath)
Function EDA_FILE_SELECTOR.
Definition: gestfich.cpp:82
#define ENBL_MOUSEWHEEL_PAN_KEY
Definition: pgm_base.h:48
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()
Function 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[]
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.
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[]
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)
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
#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:187
KIGFX::COLOR4D GetColor()
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)
Class EDA_3D_VIEWER Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard...
Definition: eda_3d_viewer.h:50
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:63
bool Set3DBoardBodyColorFromUser()
Function Set3DBoardBodyBodyColorFromUser 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)
Function TakeScreenshot Create a Screenshot of the current 3D view.