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 
48 const wxChar * EDA_3D_VIEWER::m_logTrace = wxT( "KI_TRACE_EDA_3D_VIEWER" );
49 
50 
51 // Key to store 3D Viewer config
52 
53 static const wxChar keyBgColor_Red[] = wxT( "BgColor_Red" );
54 static const wxChar keyBgColor_Green[] = wxT( "BgColor_Green" );
55 static const wxChar keyBgColor_Blue[] = wxT( "BgColor_Blue" );
56 
57 static const wxChar keyBgColor_Red_Top[] = wxT( "BgColor_Red_Top" );
58 static const wxChar keyBgColor_Green_Top[] = wxT( "BgColor_Green_Top" );
59 static const wxChar keyBgColor_Blue_Top[] = wxT( "BgColor_Blue_Top" );
60 
61 static const wxChar keySMaskColor_Red[] = wxT( "SMaskColor_Red" );
62 static const wxChar keySMaskColor_Green[] = wxT( "SMaskColor_Green" );
63 static const wxChar keySMaskColor_Blue[] = wxT( "SMaskColor_Blue" );
64 
65 static const wxChar keySPasteColor_Red[] = wxT( "SPasteColor_Red" );
66 static const wxChar keySPasteColor_Green[] = wxT( "SPasteColor_Green" );
67 static const wxChar keySPasteColor_Blue[] = wxT( "SPasteColor_Blue" );
68 
69 static const wxChar keySilkColor_Red[] = wxT( "SilkColor_Red" );
70 static const wxChar keySilkColor_Green[] = wxT( "SilkColor_Green" );
71 static const wxChar keySilkColor_Blue[] = wxT( "SilkColor_Blue" );
72 
73 static const wxChar keyCopperColor_Red[] = wxT( "CopperColor_Red" );
74 static const wxChar keyCopperColor_Green[] = wxT( "CopperColor_Green" );
75 static const wxChar keyCopperColor_Blue[] = wxT( "CopperColor_Blue" );
76 
77 static const wxChar keyBoardBodyColor_Red[] = wxT( "BoardBodyColor_Red" );
78 static const wxChar keyBoardBodyColor_Green[] = wxT( "BoardBodyColor_Green" );
79 static const wxChar keyBoardBodyColor_Blue[] = wxT( "BoardBodyColor_Blue" );
80 
81 static const wxChar keyMousewheelPanning[] = wxT( "MousewheelPAN3D" );
82 
83 static const wxChar keyShowRealisticMode[] = wxT( "ShowRealisticMode" );
84 static const wxChar keyRenderEngine[] = wxT( "RenderEngine" );
85 //static const wxChar keyRenderTextures[] = wxT( "Render_Textures" );
86 static const wxChar keyRenderMaterial[] = wxT( "Render_Material" );
87 
88 static const wxChar keyRenderOGL_ShowCopperTck[]= wxT( "Render_OGL_ShowCopperThickness" );
89 static const wxChar keyRenderOGL_ShowModelBBox[]= wxT( "Render_OGL_ShowModelBoudingBoxes" );
90 
91 static const wxChar keyRenderRAY_Shadows[] = wxT( "Render_RAY_Shadows" );
92 static const wxChar keyRenderRAY_Backfloor[] = wxT( "Render_RAY_Backfloor" );
93 static const wxChar keyRenderRAY_Refractions[] = wxT( "Render_RAY_Refractions" );
94 static const wxChar keyRenderRAY_Reflections[] = wxT( "Render_RAY_Reflections" );
95 static const wxChar keyRenderRAY_PostProcess[] = wxT( "Render_RAY_PostProcess" );
96 static const wxChar keyRenderRAY_AAliasing[] = wxT( "Render_RAY_AntiAliasing" );
97 static const wxChar keyRenderRAY_ProceduralT[] = wxT( "Render_RAY_ProceduralTextures" );
98 
99 static const wxChar keyShowAxis[] = wxT( "ShowAxis" );
100 static const wxChar keyShowGrid[] = wxT( "ShowGrid3D" );
101 static const wxChar keyShowZones[] = wxT( "ShowZones" );
102 static const wxChar keyShowFootprints_Normal[] = wxT( "ShowFootprints_Normal" );
103 static const wxChar keyShowFootprints_Insert[] = wxT( "ShowFootprints_Insert" );
104 static const wxChar keyShowFootprints_Virtual[] = wxT( "ShowFootprints_Virtual" );
105 static const wxChar keyShowAdhesiveLayers[] = wxT( "ShowAdhesiveLayers" );
106 static const wxChar keyShowSilkScreenLayers[] = wxT( "ShowSilkScreenLayers" );
107 static const wxChar keyShowSolderMaskLayers[] = wxT( "ShowSolderMasLayers" );
108 static const wxChar keyShowSolderPasteLayers[] = wxT( "ShowSolderPasteLayers" );
109 static const wxChar keyShowCommentsLayer[] = wxT( "ShowCommentsLayers" );
110 static const wxChar keyShowBoardBody[] = wxT( "ShowBoardBody" );
111 static const wxChar keyShowEcoLayers[] = wxT( "ShowEcoLayers" );
112 
113 
114 BEGIN_EVENT_TABLE( EDA_3D_VIEWER, EDA_BASE_FRAME )
115 
116  EVT_ACTIVATE( EDA_3D_VIEWER::OnActivate )
117  EVT_SET_FOCUS( EDA_3D_VIEWER::OnSetFocus )
118 
120  EDA_3D_VIEWER::ProcessZoom )
121 
123  EDA_3D_VIEWER::Process_Special_Functions )
124 
125  EVT_TOOL( ID_TOOL_SET_VISIBLE_ITEMS, EDA_3D_VIEWER::Install3DViewOptionDialog )
126 
127  EVT_MENU( wxID_EXIT,
128  EDA_3D_VIEWER::Exit3DFrame )
129 
131  EDA_3D_VIEWER::On3DGridSelection )
132 
134  EDA_3D_VIEWER::OnRenderEngineSelection )
135 
136  EVT_CLOSE( EDA_3D_VIEWER::OnCloseWindow )
137 
138  EVT_UPDATE_UI_RANGE( ID_START_COMMAND_3D, ID_MENU_COMMAND_END,
139  EDA_3D_VIEWER::OnUpdateMenus )
140 
141 END_EVENT_TABLE()
142 
143 
145  const wxString &aTitle, long style ) :
146 
147  KIWAY_PLAYER( aKiway, aParent,
148  FRAME_PCB_DISPLAY3D, aTitle,
149  wxDefaultPosition, wxDefaultSize,
150  style, VIEWER3D_FRAMENAME )
151 {
152  wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::EDA_3D_VIEWER %s" ), aTitle );
153 
154  m_canvas = NULL;
155 
156  // Give it an icon
157  wxIcon icon;
158  icon.CopyFromBitmap( KiBitmap( icon_3d_xpm ) );
159  SetIcon( icon );
160 
161  LoadSettings( config() );
162  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
163 
164  // Create the status line
165  static const int status_dims[4] = { -1, 130, 130, 170 };
166 
167  wxStatusBar *status_bar = CreateStatusBar( DIM( status_dims ) );
168  SetStatusWidths( DIM( status_dims ), status_dims );
169 
170  CreateMenuBar();
171  ReCreateMainToolbar();
172 
173  m_canvas = new EDA_3D_CANVAS( this,
175  aParent->GetBoard(),
176  m_settings,
177  Prj().Get3DCacheManager() );
178 
179  if( m_canvas )
180  m_canvas->SetStatusBar( status_bar );
181 
182  m_auimgr.SetManagedWindow( this );
183 
184  EDA_PANEINFO horiztb;
185  horiztb.HorizontalToolbarPane();
186 
187  m_auimgr.AddPane( m_mainToolBar,
188  wxAuiPaneInfo( horiztb ).Name( wxT( "m_mainToolBar" ) ).Top() );
189 
190  if( m_canvas )
191  m_auimgr.AddPane( m_canvas,
192  wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
193 
194  m_auimgr.Update();
195 
196  m_mainToolBar->EnableTool( ID_RENDER_CURRENT_VIEW,
197  (m_settings.RenderEngineGet() == RENDER_ENGINE_OPENGL_LEGACY) );
198 
199  m_mainToolBar->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( EDA_3D_VIEWER::OnKeyEvent ), NULL, this );
200 
201  // Fixes bug in Windows (XP and possibly others) where the canvas requires the focus
202  // in order to receive mouse events. Otherwise, the user has to click somewhere on
203  // the canvas before it will respond to mouse wheel events.
204  if( m_canvas )
205  m_canvas->SetFocus();
206 }
207 
208 
210 {
211  m_mainToolBar->Disconnect( wxEVT_KEY_DOWN, wxKeyEventHandler( EDA_3D_VIEWER::OnKeyEvent ), NULL, this );
212 
213  m_auimgr.UnInit();
214 
215  // m_canvas delete will be called by wxWidget manager
216  //delete m_canvas;
217  //m_canvas = 0;
218 }
219 
220 
222 {
223  // This will schedule a request to load later
224  if( m_canvas )
225  m_canvas->ReloadRequest( GetBoard(), Prj().Get3DCacheManager() );
226 }
227 
228 
229 void EDA_3D_VIEWER::NewDisplay( bool aForceImmediateRedraw )
230 {
231  ReloadRequest();
232 
233  // After the ReloadRequest call, the refresh often takes a bit of time,
234  // and it is made here only on request.
235  if( aForceImmediateRedraw )
236  m_canvas->Refresh();
237 }
238 
239 
240 void EDA_3D_VIEWER::Exit3DFrame( wxCommandEvent &event )
241 {
242  wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::Exit3DFrame" ) );
243 
244  Close( true );
245 }
246 
247 
248 void EDA_3D_VIEWER::OnCloseWindow( wxCloseEvent &event )
249 {
250  wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::OnCloseWindow" ) );
251 
252  if( m_canvas )
253  m_canvas->Close();
254 
255  // m_canvas delete will be called by wxWidget manager
256  //delete m_canvas;
257  //m_canvas = 0;
258 
259  Destroy();
260  event.Skip( true );
261 }
262 
263 #define ROT_ANGLE 10.0
264 
265 void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
266 {
267  int id = event.GetId();
268  bool isChecked = event.IsChecked();
269 
270  wxLogTrace( m_logTrace,
271  wxT( "EDA_3D_VIEWER::Process_Special_Functions id:%d isChecked:%d" ),
272  id, isChecked );
273 
274  if( m_canvas == NULL )
275  return;
276 
277  switch( id )
278  {
281  break;
282 
283  case ID_RELOAD3D_BOARD:
284  NewDisplay( true );
285  break;
286 
287  case ID_ROTATE3D_X_POS:
288  m_settings.CameraGet().RotateX( glm::radians(ROT_ANGLE) );
290  break;
291 
292  case ID_ROTATE3D_X_NEG:
293  m_settings.CameraGet().RotateX( -glm::radians(ROT_ANGLE) );
295  break;
296 
297  case ID_ROTATE3D_Y_POS:
298  m_settings.CameraGet().RotateY( glm::radians(ROT_ANGLE) );
300  break;
301 
302  case ID_ROTATE3D_Y_NEG:
303  m_settings.CameraGet().RotateY( -glm::radians(ROT_ANGLE) );
305  break;
306 
307  case ID_ROTATE3D_Z_POS:
308  m_settings.CameraGet().RotateZ( glm::radians(ROT_ANGLE) );
310  break;
311 
312  case ID_ROTATE3D_Z_NEG:
313  m_settings.CameraGet().RotateZ( -glm::radians(ROT_ANGLE) );
315  break;
316 
317  case ID_MOVE3D_LEFT:
318  m_canvas->SetView3D( WXK_LEFT );
319  return;
320 
321  case ID_MOVE3D_RIGHT:
322  m_canvas->SetView3D( WXK_RIGHT );
323  return;
324 
325  case ID_MOVE3D_UP:
326  m_canvas->SetView3D( WXK_UP );
327  return;
328 
329  case ID_MOVE3D_DOWN:
330  m_canvas->SetView3D( WXK_DOWN );
331  return;
332 
333  case ID_ORTHO:
336  return;
337 
341  takeScreenshot( event );
342  return;
343 
345  if( Set3DColorFromUser( m_settings.m_BgColorBot, _( "Background Color, Bottom" ) ) )
346  {
349  else
350  NewDisplay( true );
351  }
352  return;
353 
355  if( Set3DColorFromUser( m_settings.m_BgColorTop, _( "Background Color, Top" ) ) )
356  {
359  else
360  NewDisplay( true );
361  }
362  return;
363 
366  return;
367 
370  return;
371 
374  return;
375 
378  break;
379 
382  break;
383 
386  break;
387 
391  NewDisplay( true );
392  return;
393 
396  NewDisplay( true );
397  return;
398 
401  NewDisplay( true );
402  return;
403 
406  NewDisplay( true );
407  return;
408 
411  NewDisplay( true );
412  return;
413 
417  return;
418 
422  return;
423 
426  NewDisplay( true );
427  return;
428 
431  NewDisplay( true );
432  return;
433 
437  return;
438 
442  return;
443 
446  NewDisplay( true );
447  return;
448 
452  return;
453 
455  m_settings.SetFlag( FL_SHOW_BOARD_BODY, isChecked );
456  NewDisplay( true );
457  return;
458 
460  m_settings.SetFlag( FL_AXIS, isChecked );
462  return;
463 
466  NewDisplay( true );
467  return;
468 
471  NewDisplay( true );
472  return;
473 
476  NewDisplay( true );
477  return;
478 
480  m_settings.SetFlag( FL_ZONE, isChecked );
481  NewDisplay( true );
482  return;
483 
485  m_settings.SetFlag( FL_ADHESIVE, isChecked );
486  NewDisplay( true );
487  return;
488 
490  m_settings.SetFlag( FL_SILKSCREEN, isChecked );
491  NewDisplay( true );
492  return;
493 
495  m_settings.SetFlag( FL_SOLDERMASK, isChecked );
496  NewDisplay( true );
497  return;
498 
500  m_settings.SetFlag( FL_SOLDERPASTE, isChecked );
501  NewDisplay( true );
502  return;
503 
505  m_settings.SetFlag( FL_COMMENTS, isChecked );
506  NewDisplay( true );
507  return;
508 
509  case ID_MENU3D_ECO_ONOFF:
510  m_settings.SetFlag( FL_ECO, isChecked );
511  NewDisplay( true );
512  return;
513 
515  {
516  // Reload settings with a dummy config, so it will load the defaults
517  wxConfig *fooconfig = new wxConfig("FooBarApp");
518  LoadSettings( fooconfig );
519  delete fooconfig;
520 
521  // Refresh menu option state
523 
524  // Tell canvas that we (may have) changed the render engine
526 
527  NewDisplay( true );
528  }
529  return;
530 
532  {
533  DisplayHotKeys();
534  }
535  return;
536 
537  default:
538  wxLogMessage( wxT( "EDA_3D_VIEWER::Process_Special_Functions() error: unknown command %d" ), id );
539  return;
540  }
541 }
542 
543 
544 void EDA_3D_VIEWER::On3DGridSelection( wxCommandEvent &event )
545 {
546  int id = event.GetId();
547 
548  wxASSERT( id < ID_MENU3D_GRID_END );
549  wxASSERT( id > ID_MENU3D_GRID );
550 
551  wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::On3DGridSelection id:%d" ), id );
552 
553  switch( id )
554  {
557  break;
558 
561  break;
562 
563  case ID_MENU3D_GRID_5_MM:
565  break;
566 
569  break;
570 
571  case ID_MENU3D_GRID_1_MM:
573  break;
574 
575  default:
576  wxLogMessage( wxT( "EDA_3D_VIEWER::On3DGridSelection() error: unknown command %d" ), id );
577  return;
578  }
579 
580  if( m_canvas )
582 }
583 
584 
585 void EDA_3D_VIEWER::OnRenderEngineSelection( wxCommandEvent &event )
586 {
587  int id = event.GetId();
588 
589  wxASSERT( id < ID_MENU3D_ENGINE_END );
590  wxASSERT( id > ID_MENU3D_ENGINE );
591 
592  wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::OnRenderEngineSelection id:%d" ), id );
593 
594  const RENDER_ENGINE old_engine = m_settings.RenderEngineGet();
595 
596  switch( id )
597  {
599  if( old_engine != RENDER_ENGINE_OPENGL_LEGACY )
601  break;
602 
604  if( old_engine != RENDER_ENGINE_RAYTRACING )
606  break;
607 
608  default:
609  wxLogMessage( wxT( "EDA_3D_VIEWER::OnRenderEngineSelection() error: unknown command %d" ), id );
610  return;
611  }
612 
613  if( old_engine != m_settings.RenderEngineGet() )
614  {
616  }
617 }
618 
619 
620 void EDA_3D_VIEWER::OnUpdateMenus(wxUpdateUIEvent &event)
621 {
623  // to have it working this way
625 }
626 
627 
628 void EDA_3D_VIEWER::ProcessZoom( wxCommandEvent &event )
629 {
630  int id = event.GetId();
631 
632  wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::ProcessZoom id:%d" ), id );
633 
634  if( m_canvas == NULL )
635  return;
636 
637  switch( id )
638  {
639  case ID_ZOOM_PAGE:
640  m_canvas->SetView3D( WXK_HOME );
641  break;
642 
643  case ID_ZOOM_IN:
644  m_canvas->SetView3D( WXK_F1 );
645  break;
646 
647  case ID_ZOOM_OUT:
648  m_canvas->SetView3D( WXK_F2 );
649  break;
650 
651  case ID_ZOOM_REDRAW:
653  break;
654 
655  default:
656  wxLogMessage( wxT( "EDA_3D_VIEWER::ProcessZoom() error: unknown command %d" ), id );
657  return;
658  }
659 
661 }
662 
663 
664 void EDA_3D_VIEWER::OnActivate( wxActivateEvent &event )
665 {
666  wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::OnActivate" ) );
667 
668  if( m_canvas )
669  {
670  // Reload data if 3D frame shows a board,
671  // because it can be changed since last frame activation
674 
675  // Activates again the focus of the canvas so it will catch mouse and key events
676  m_canvas->SetFocus();
677  }
678 
679  event.Skip(); // required under wxMAC
680 }
681 
682 
683 void EDA_3D_VIEWER::OnSetFocus(wxFocusEvent &event)
684 {
685  // Activates again the focus of the canvas so it will catch mouse and key events
686  if( m_canvas )
687  m_canvas->SetFocus();
688 
689  event.Skip();
690 }
691 
692 
693 void EDA_3D_VIEWER::LoadSettings( wxConfigBase *aCfg )
694 {
696 
697  wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::LoadSettings" ) );
698 
699  aCfg->Read( keyBgColor_Red, &m_settings.m_BgColorBot.r, 0.4 );
700  aCfg->Read( keyBgColor_Green, &m_settings.m_BgColorBot.g, 0.4 );
701  aCfg->Read( keyBgColor_Blue, &m_settings.m_BgColorBot.b, 0.5 );
702 
703  aCfg->Read( keyBgColor_Red_Top, &m_settings.m_BgColorTop.r, 0.8 );
704  aCfg->Read( keyBgColor_Green_Top, &m_settings.m_BgColorTop.g, 0.8 );
705  aCfg->Read( keyBgColor_Blue_Top, &m_settings.m_BgColorTop.b, 0.9 );
706 
707  // m_SolderMaskColor default value = dark grey-green
708  aCfg->Read( keySMaskColor_Red, &m_settings.m_SolderMaskColor.r, 100.0 * 0.2 / 255.0 );
709  aCfg->Read( keySMaskColor_Green, &m_settings.m_SolderMaskColor.g, 255.0 * 0.2 / 255.0 );
710  aCfg->Read( keySMaskColor_Blue, &m_settings.m_SolderMaskColor.b, 180.0 * 0.2 / 255.0 );
711 
712  // m_SolderPasteColor default value = light grey
713  aCfg->Read( keySPasteColor_Red, &m_settings.m_SolderPasteColor.r, 128.0 /255.0 );
714  aCfg->Read( keySPasteColor_Green, &m_settings.m_SolderPasteColor.g, 128.0 /255.0 );
715  aCfg->Read( keySPasteColor_Blue, &m_settings.m_SolderPasteColor.b, 128.0 /255.0 );
716 
717  // m_SilkScreenColor default value = white
718  aCfg->Read( keySilkColor_Red, &m_settings.m_SilkScreenColor.r, 0.9 );
719  aCfg->Read( keySilkColor_Green, &m_settings.m_SilkScreenColor.g, 0.9 );
720  aCfg->Read( keySilkColor_Blue, &m_settings.m_SilkScreenColor.b, 0.9 );
721 
722  // m_CopperColor default value = gold
723  aCfg->Read( keyCopperColor_Red, &m_settings.m_CopperColor.r, 255.0 * 0.7 / 255.0 );
724  aCfg->Read( keyCopperColor_Green, &m_settings.m_CopperColor.g, 223.0 * 0.7 / 255.0 );
725  aCfg->Read( keyCopperColor_Blue, &m_settings.m_CopperColor.b, 0.0 /255.0 );
726 
727  // m_BoardBodyColor default value = FR4, in realistic mode
728  aCfg->Read( keyBoardBodyColor_Red, &m_settings.m_BoardBodyColor.r, 51.0 / 255.0 );
729  aCfg->Read( keyBoardBodyColor_Green, &m_settings.m_BoardBodyColor.g, 43.0 / 255.0 );
730  aCfg->Read( keyBoardBodyColor_Blue, &m_settings.m_BoardBodyColor.b, 22.0 /255.0 );
731 
732 
733  bool tmp;
734  aCfg->Read( keyMousewheelPanning, &tmp, false );
736 
737  aCfg->Read( keyShowRealisticMode, &tmp, true );
739 
740  // OpenGL options
741  aCfg->Read( keyRenderOGL_ShowCopperTck, &tmp, true );
743 
744  aCfg->Read( keyRenderOGL_ShowModelBBox, &tmp, false );
746 
747  // Raytracing options
748  aCfg->Read( keyRenderRAY_Shadows, &tmp, true );
750 
751  aCfg->Read( keyRenderRAY_Backfloor, &tmp, true );
753 
754  aCfg->Read( keyRenderRAY_Refractions, &tmp, true );
756 
757  aCfg->Read( keyRenderRAY_Reflections, &tmp, true );
759 
760  aCfg->Read( keyRenderRAY_PostProcess, &tmp, true );
762 
763  aCfg->Read( keyRenderRAY_AAliasing, &tmp, true );
765 
766  aCfg->Read( keyRenderRAY_ProceduralT, &tmp, true );
768 
769  aCfg->Read( keyShowAxis, &tmp, true );
770  m_settings.SetFlag( FL_AXIS, tmp );
771 
772  aCfg->Read( keyShowFootprints_Normal, &tmp, true );
774 
775  aCfg->Read( keyShowFootprints_Insert, &tmp, true );
777 
778  aCfg->Read( keyShowFootprints_Virtual, &tmp, true );
780 
781  aCfg->Read( keyShowZones, &tmp, true );
782  m_settings.SetFlag( FL_ZONE, tmp );
783 
784  aCfg->Read( keyShowAdhesiveLayers, &tmp, true );
786 
787  aCfg->Read( keyShowSilkScreenLayers, &tmp, true );
789 
790  aCfg->Read( keyShowSolderMaskLayers, &tmp, true );
792 
793  aCfg->Read( keyShowSolderPasteLayers, &tmp, true );
795 
796  aCfg->Read( keyShowCommentsLayer, &tmp, true );
798 
799  aCfg->Read( keyShowEcoLayers, &tmp, true );
800  m_settings.SetFlag( FL_ECO, tmp );
801 
802  aCfg->Read( keyShowBoardBody, &tmp, true );
804 
805  int tmpi;
806  aCfg->Read( keyShowGrid, &tmpi, (int)GRID3D_NONE );
807  m_settings.GridSet( (GRID3D_TYPE)tmpi );
808 
809  aCfg->Read( keyRenderEngine, &tmpi, (int)RENDER_ENGINE_OPENGL_LEGACY );
811 
812  aCfg->Read( keyRenderMaterial, &tmpi, (int)MATERIAL_MODE_NORMAL );
814 }
815 
816 
817 void EDA_3D_VIEWER::SaveSettings( wxConfigBase *aCfg )
818 {
820 
821  wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::SaveSettings" ) );
822 
823  aCfg->Write( keyBgColor_Red, m_settings.m_BgColorBot.r );
824  aCfg->Write( keyBgColor_Green, m_settings.m_BgColorBot.g );
825  aCfg->Write( keyBgColor_Blue, m_settings.m_BgColorBot.b );
826 
827  aCfg->Write( keyBgColor_Red_Top, m_settings.m_BgColorTop.r );
828  aCfg->Write( keyBgColor_Green_Top, m_settings.m_BgColorTop.g );
829  aCfg->Write( keyBgColor_Blue_Top, m_settings.m_BgColorTop.b );
830 
834 
838 
842 
843  aCfg->Write( keyCopperColor_Red, m_settings.m_CopperColor.r );
845  aCfg->Write( keyCopperColor_Blue, m_settings.m_CopperColor.b );
846 
850 
852 
854 
855  aCfg->Write( keyRenderEngine, (int)m_settings.RenderEngineGet() );
856 
857  aCfg->Write( keyRenderMaterial, (int)m_settings.MaterialModeGet() );
858 
859  // OpenGL options
862 
863  // Raytracing options
871 
872  aCfg->Write( keyShowAxis, m_settings.GetFlag( FL_AXIS ) );
873  aCfg->Write( keyShowGrid, (int)m_settings.GridGet() );
874 
878 
879  aCfg->Write( keyShowZones, m_settings.GetFlag( FL_ZONE ) );
885  aCfg->Write( keyShowEcoLayers, m_settings.GetFlag( FL_ECO ) );
887 }
888 
889 
890 void EDA_3D_VIEWER::OnLeftClick( wxDC *DC, const wxPoint &MousePos )
891 {
892  wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::OnLeftClick" ) );
893  // Do nothing
894 }
895 
896 
897 void EDA_3D_VIEWER::OnRightClick( const wxPoint &MousePos, wxMenu *PopMenu )
898 {
899  wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::OnRightClick" ) );
900  // Do nothing
901 }
902 
903 
904 void EDA_3D_VIEWER::OnKeyEvent( wxKeyEvent& event )
905 {
906  if( m_canvas )
907  return m_canvas->OnKeyEvent( event );
908 
909  event.Skip();
910 }
911 
912 
913 void EDA_3D_VIEWER::RedrawActiveWindow( wxDC *DC, bool EraseBg )
914 {
915  wxLogTrace( m_logTrace, wxT( "EDA_3D_VIEWER::RedrawActiveWindow" ) );
916  // Do nothing
917 }
918 
919 
920 void EDA_3D_VIEWER::takeScreenshot( wxCommandEvent& event )
921 {
922  wxString fullFileName;
923  bool fmt_is_jpeg = false;
924 
925  if( event.GetId() == ID_MENU_SCREENCOPY_JPEG )
926  fmt_is_jpeg = true;
927 
928  if( event.GetId() != ID_TOOL_SCREENCOPY_TOCLIBBOARD )
929  {
930  // Remember path between saves during this session only.
931  static wxFileName fn;
932  const wxString file_ext = fmt_is_jpeg ? wxT( "jpg" ) : wxT( "png" );
933  const wxString mask = wxT( "*." ) + file_ext;
934 
935  // First time path is set to the project path.
936  if( !fn.IsOk() )
937  fn = Parent()->Prj().GetProjectFullName();
938 
939  fn.SetExt( file_ext );
940 
941  fullFileName = EDA_FILE_SELECTOR( _( "3D Image File Name:" ), fn.GetPath(),
942  m_defaultSaveScreenshotFileName, file_ext, mask, this,
943  wxFD_SAVE | wxFD_OVERWRITE_PROMPT, true );
944 
945  if( fullFileName.IsEmpty() )
946  return;
947 
948  fn = fullFileName;
949 
950  // Be sure the screen area destroyed by the file dialog is redrawn
951  // before making a screen copy.
952  // Without this call, under Linux the screen refresh is made to late.
953  wxYield();
954  }
955 
956  // Be sure we have the latest 3D view (remember 3D view is buffered)
957  Refresh();
958  wxYield();
959 
960  // Build image from the 3D buffer
961  wxWindowUpdateLocker noUpdates( this );
962 
963  wxImage screenshotImage;
964 
965  if( m_canvas )
966  m_canvas->GetScreenshot( screenshotImage );
967 
968  if( event.GetId() == ID_TOOL_SCREENCOPY_TOCLIBBOARD )
969  {
970  wxBitmap bitmap( screenshotImage );
971 
972  if( wxTheClipboard->Open() )
973  {
974  wxBitmapDataObject* dobjBmp = new wxBitmapDataObject( bitmap );
975 
976  if( !wxTheClipboard->SetData( dobjBmp ) )
977  wxMessageBox( _( "Failed to copy image to clipboard" ) );
978 
979  wxTheClipboard->Flush(); /* the data in clipboard will stay
980  * available after the application exits */
981  wxTheClipboard->Close();
982  }
983  }
984  else
985  {
986  if( !screenshotImage.SaveFile( fullFileName,
987  fmt_is_jpeg ? wxBITMAP_TYPE_JPEG : wxBITMAP_TYPE_PNG ) )
988  wxMessageBox( _( "Can't save file" ) );
989 
990  screenshotImage.Destroy();
991  }
992 
993 }
994 
995 
997 {
998  if( m_canvas )
1000 
1003 
1004  m_mainToolBar->Refresh();
1005 }
1006 
1007 
1008 bool EDA_3D_VIEWER::Set3DColorFromUser( SFVEC3D &aColor, const wxString& aTitle,
1009  wxColourData* aPredefinedColors )
1010 {
1011  wxColour newcolor, oldcolor;
1012 
1013  oldcolor.Set( KiROUND( aColor.r * 255 ),
1014  KiROUND( aColor.g * 255 ),
1015  KiROUND( aColor.b * 255 ) );
1016 
1017  wxColourData emptyColorSet; // Provides a empty predefined set of colors
1018  // if no color set available to avoid use of an
1019  // old color set
1020 
1021  if( aPredefinedColors == NULL )
1022  aPredefinedColors = &emptyColorSet;
1023 
1024  newcolor = wxGetColourFromUser( this, oldcolor, aTitle, aPredefinedColors );
1025 
1026  if( !newcolor.IsOk() ) // Cancel command
1027  return false;
1028 
1029  if( newcolor != oldcolor )
1030  {
1031  aColor.r = (double) newcolor.Red() / 255.0;
1032  aColor.g = (double) newcolor.Green() / 255.0;
1033  aColor.b = (double) newcolor.Blue() / 255.0;
1034  }
1035 
1036  return true;
1037 }
1038 
1039 
1041 {
1042  wxColourData definedColors;
1043  unsigned int i = 0;
1044 
1045  definedColors.SetCustomColour( i++, wxColour( 241, 241, 241 ) ); // White
1046  definedColors.SetCustomColour( i++, wxColour( 4, 18, 21 ) ); // Dark
1047 
1048  for(; i < wxColourData::NUM_CUSTOM;)
1049  {
1050  definedColors.SetCustomColour( i++, wxColour( 0, 0, 0 ) );
1051  }
1052 
1054  _( "Silk Screen Color" ),
1055  &definedColors );
1056 
1057  if( change )
1058  NewDisplay( true );
1059 
1060  return change;
1061 }
1062 
1063 
1065 {
1066  wxColourData definedColors;
1067  unsigned int i = 0;
1068 
1069  definedColors.SetCustomColour( i++, wxColour( 20, 51, 36 ) ); // Green
1070  definedColors.SetCustomColour( i++, wxColour( 91, 168, 12 ) ); // Light Green
1071  definedColors.SetCustomColour( i++, wxColour( 13, 104, 11 ) ); // Saturated Green
1072  definedColors.SetCustomColour( i++, wxColour(181, 19, 21 ) ); // Red
1073  definedColors.SetCustomColour( i++, wxColour(239, 53, 41 ) ); // Red Light Orange
1074  definedColors.SetCustomColour( i++, wxColour(210, 40, 14 ) ); // Red 2
1075  definedColors.SetCustomColour( i++, wxColour( 2, 59, 162 ) ); // Blue
1076  definedColors.SetCustomColour( i++, wxColour( 54, 79, 116 ) ); // Light blue 1
1077  definedColors.SetCustomColour( i++, wxColour( 61, 85, 130 ) ); // Light blue 2
1078  definedColors.SetCustomColour( i++, wxColour( 21, 70, 80 ) ); // Green blue (dark)
1079  definedColors.SetCustomColour( i++, wxColour( 11, 11, 11 ) ); // Black
1080  definedColors.SetCustomColour( i++, wxColour( 245, 245,245 ) ); // White
1081  definedColors.SetCustomColour( i++, wxColour(119, 31, 91 ) ); // Purple
1082  definedColors.SetCustomColour( i++, wxColour( 32, 2, 53 ) ); // Purple Dark
1083 
1084  for(; i < wxColourData::NUM_CUSTOM;)
1085  {
1086  definedColors.SetCustomColour( i++, wxColour( 0, 0, 0 ) );
1087  }
1088 
1090  _( "Solder Mask Color" ),
1091  &definedColors );
1092 
1093  if( change )
1094  NewDisplay( true );
1095 
1096  return change;
1097 }
1098 
1099 
1101 {
1102  wxColourData definedColors;
1103  unsigned int i = 0;
1104 
1105  definedColors.SetCustomColour( i++, wxColour( 184, 115, 50) ); // Copper
1106  definedColors.SetCustomColour( i++, wxColour( 191, 155, 58) ); // Gold
1107  definedColors.SetCustomColour( i++, wxColour( 213, 213, 213) ); // Silver
1108  definedColors.SetCustomColour( i++, wxColour( 160, 160, 160) ); // tin
1109 
1110  for(; i < wxColourData::NUM_CUSTOM;)
1111  {
1112  definedColors.SetCustomColour( i++, wxColour( 0, 0, 0 ) );
1113  }
1114 
1116  _( "Copper Color" ),
1117  &definedColors );
1118 
1119  if( change )
1120  NewDisplay( true );
1121 
1122  return change;
1123 }
1124 
1125 
1127 {
1128  wxColourData definedColors;
1129  unsigned int i = 0;
1130 
1131  definedColors.SetCustomColour( i++, wxColour( 51, 43, 22 ) ); // FR4 natural, dark
1132  definedColors.SetCustomColour( i++, wxColour( 109, 116, 75 ) ); // FR4 natural
1133  definedColors.SetCustomColour( i++, wxColour( 78, 14, 5 ) ); // brown/red
1134  definedColors.SetCustomColour( i++, wxColour( 146, 99, 47 ) ); // brown 1
1135  definedColors.SetCustomColour( i++, wxColour( 160, 123, 54 ) ); // brown 2
1136  definedColors.SetCustomColour( i++, wxColour( 146, 99, 47 ) ); // brown 3
1137  definedColors.SetCustomColour( i++, wxColour( 63, 126, 71 ) ); // green 1
1138  definedColors.SetCustomColour( i++, wxColour( 117, 122, 90 ) ); // green 2
1139 
1140  for(; i < wxColourData::NUM_CUSTOM;)
1141  {
1142  definedColors.SetCustomColour( i++, wxColour( 0, 0, 0 ) );
1143  }
1144 
1146  _( "Board Body Color" ),
1147  &definedColors );
1148 
1149  if( change )
1150  NewDisplay( true );
1151 
1152  return change;
1153 }
1154 
1155 
1157 {
1158  wxColourData definedColors;
1159  unsigned int i = 0;
1160 
1161  definedColors.SetCustomColour( i++, wxColour( 128, 128, 128 ) ); // grey
1162  definedColors.SetCustomColour( i++, wxColour( 213, 213, 213 ) ); // Silver
1163  definedColors.SetCustomColour( i++, wxColour( 90, 90, 90 ) ); // grey 2
1164 
1165  for(; i < wxColourData::NUM_CUSTOM;)
1166  {
1167  definedColors.SetCustomColour( i++, wxColour( 0, 0, 0 ) );
1168  }
1169 
1171  _( "Solder Paste Color" ),
1172  &definedColors );
1173 
1174  if( change )
1175  NewDisplay( true );
1176 
1177  return change;
1178 }
static const wxChar keyShowSolderMaskLayers[]
static const wxChar keyShowFootprints_Normal[]
EDA_PANEINFO & HorizontalToolbarPane()
Function HorizontalToolbarPane Change *this to a horizontal toolbar for KiCad.
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:111
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.
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:106
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:356
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:242
PCB_EDIT_FRAME::OnResetModuleTextSizes PCB_EDIT_FRAME::OnSelectOptionToolbar PCB_EDIT_FRAME::OnSelectOptionToolbar PCB_EDIT_FRAME::OnSelectOptionToolbar PCB_EDIT_FRAME::OnSelectOptionToolbar PCB_EDIT_FRAME::ProcessMuWaveFunctions PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event PCB_EDIT_FRAME::OnUpdateHighContrastDisplayMode PCB_EDIT_FRAME::OnUpdateShowMicrowaveToolbar PCB_EDIT_FRAME::OnUpdateSelectCustomTrackWidth EVT_UPDATE_UI_RANGE(ID_POPUP_PCB_SELECT_WIDTH1, ID_POPUP_PCB_SELECT_WIDTH8, PCB_EDIT_FRAME::OnUpdateSelectTrackWidth) EVT_UPDATE_UI_RANGE(ID_POPUP_PCB_SELECT_VIASIZE1
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
static const wxChar keyShowAdhesiveLayers[]
static const wxChar keySilkColor_Green[]
wxAuiManager m_auimgr
SFVEC3D m_BgColorBot
background bottom color
Definition: cinfo3d_visu.h:503
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
Specialization of the wxAuiPaneInfo class for KiCad panels.
static const wxChar keyShowRealisticMode[]
SFVEC3D m_BoardBodyColor
in realistic mode: FR4 board color
Definition: cinfo3d_visu.h:505
EDA_3D_CANVAS * m_canvas
The canvas where the openGL context will be rendered.
static const wxChar keyCopperColor_Blue[]
static const wxChar keySMaskColor_Green[]
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[]
EVT_TOOL(ID_MODVIEW_SELECT_LIB, FOOTPRINT_VIEWER_FRAME::SelectCurrentLibrary) EVT_TOOL(ID_MODVIEW_SELECT_PART
static const wxChar keyShowSilkScreenLayers[]
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
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[]
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
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[]
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.
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[]
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.
bool Set3DColorFromUser(SFVEC3D &aColor, const wxString &aTitle, wxColourData *aPredefinedColors=NULL)
Function Set3DColorFromUser Get a SFVEC3D from a wx colour dialog.
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)
size_t i
Definition: json11.cpp:597
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.
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)
void takeScreenshot(wxCommandEvent &event)
Function TakeScreenshot Create a Screenshot of the current 3D view.