KiCad PCB EDA Suite
eda_3d_viewer.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
5  * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #include "eda_3d_viewer.h"
26 
27 #include "../3d_viewer_id.h"
28 #include "../common_ogl/cogl_att_list.h"
29 #include <3d_actions.h>
30 #include <bitmaps.h>
31 #include <dpi_scaling.h>
32 #include <gestfich.h>
33 #include <pgm_base.h>
34 #include <project.h>
36 #include <tool/tool_manager.h>
37 #include <tool/common_control.h>
38 #include <hotkeys_basic.h>
39 #include <wx/colordlg.h>
40 #include <wx/toolbar.h>
41 
42 
50 const wxChar * EDA_3D_VIEWER::m_logTrace = wxT( "KI_TRACE_EDA_3D_VIEWER" );
51 
52 
53 // Key to store 3D Viewer config
54 
55 static const wxChar keyBgColor_Red[] = wxT( "BgColor_Red" );
56 static const wxChar keyBgColor_Green[] = wxT( "BgColor_Green" );
57 static const wxChar keyBgColor_Blue[] = wxT( "BgColor_Blue" );
58 
59 static const wxChar keyBgColor_Red_Top[] = wxT( "BgColor_Red_Top" );
60 static const wxChar keyBgColor_Green_Top[] = wxT( "BgColor_Green_Top" );
61 static const wxChar keyBgColor_Blue_Top[] = wxT( "BgColor_Blue_Top" );
62 
63 static const wxChar keySMaskColor_Red[] = wxT( "SMaskColor_Red" );
64 static const wxChar keySMaskColor_Green[] = wxT( "SMaskColor_Green" );
65 static const wxChar keySMaskColor_Blue[] = wxT( "SMaskColor_Blue" );
66 
67 static const wxChar keySPasteColor_Red[] = wxT( "SPasteColor_Red" );
68 static const wxChar keySPasteColor_Green[] = wxT( "SPasteColor_Green" );
69 static const wxChar keySPasteColor_Blue[] = wxT( "SPasteColor_Blue" );
70 
71 static const wxChar keySilkColor_Red[] = wxT( "SilkColor_Red" );
72 static const wxChar keySilkColor_Green[] = wxT( "SilkColor_Green" );
73 static const wxChar keySilkColor_Blue[] = wxT( "SilkColor_Blue" );
74 
75 static const wxChar keyCopperColor_Red[] = wxT( "CopperColor_Red" );
76 static const wxChar keyCopperColor_Green[] = wxT( "CopperColor_Green" );
77 static const wxChar keyCopperColor_Blue[] = wxT( "CopperColor_Blue" );
78 
79 static const wxChar keyBoardBodyColor_Red[] = wxT( "BoardBodyColor_Red" );
80 static const wxChar keyBoardBodyColor_Green[] = wxT( "BoardBodyColor_Green" );
81 static const wxChar keyBoardBodyColor_Blue[] = wxT( "BoardBodyColor_Blue" );
82 
83 static const wxChar keyShowRealisticMode[] = wxT( "ShowRealisticMode" );
84 static const wxChar keyRenderEngine[] = wxT( "RenderEngine" );
85 static const wxChar keyRenderMaterial[] = wxT( "Render_Material" );
86 
87 static const wxChar keyRenderOGL_ShowCopperTck[]= wxT( "Render_OGL_ShowCopperThickness" );
88 static const wxChar keyRenderOGL_ShowModelBBox[]= wxT( "Render_OGL_ShowModelBoudingBoxes" );
89 
90 static const wxChar keyRenderRAY_Shadows[] = wxT( "Render_RAY_Shadows" );
91 static const wxChar keyRenderRAY_Backfloor[] = wxT( "Render_RAY_Backfloor" );
92 static const wxChar keyRenderRAY_Refractions[] = wxT( "Render_RAY_Refractions" );
93 static const wxChar keyRenderRAY_Reflections[] = wxT( "Render_RAY_Reflections" );
94 static const wxChar keyRenderRAY_PostProcess[] = wxT( "Render_RAY_PostProcess" );
95 static const wxChar keyRenderRAY_AAliasing[] = wxT( "Render_RAY_AntiAliasing" );
96 static const wxChar keyRenderRAY_ProceduralT[] = wxT( "Render_RAY_ProceduralTextures" );
97 
98 static const wxChar keyShowAxis[] = wxT( "ShowAxis" );
99 static const wxChar keyShowGrid[] = wxT( "ShowGrid3D" );
100 static const wxChar keyShowZones[] = wxT( "ShowZones" );
101 static const wxChar keyShowFootprints_Normal[] = wxT( "ShowFootprints_Normal" );
102 static const wxChar keyShowFootprints_Insert[] = wxT( "ShowFootprints_Insert" );
103 static const wxChar keyShowFootprints_Virtual[] = wxT( "ShowFootprints_Virtual" );
104 static const wxChar keyShowAdhesiveLayers[] = wxT( "ShowAdhesiveLayers" );
105 static const wxChar keyShowSilkScreenLayers[] = wxT( "ShowSilkScreenLayers" );
106 static const wxChar keyShowSolderMaskLayers[] = wxT( "ShowSolderMasLayers" );
107 static const wxChar keyShowSolderPasteLayers[] = wxT( "ShowSolderPasteLayers" );
108 static const wxChar keyShowCommentsLayer[] = wxT( "ShowCommentsLayers" );
109 static const wxChar keyShowBoardBody[] = wxT( "ShowBoardBody" );
110 static const wxChar keyShowEcoLayers[] = wxT( "ShowEcoLayers" );
111 
112 
113 BEGIN_EVENT_TABLE( EDA_3D_VIEWER, EDA_BASE_FRAME )
114 
115  EVT_ACTIVATE( EDA_3D_VIEWER::OnActivate )
116  EVT_SET_FOCUS( EDA_3D_VIEWER::OnSetFocus )
117 
119 
121  EDA_3D_VIEWER::Process_Special_Functions )
122 
123  EVT_TOOL( ID_TOOL_SET_VISIBLE_ITEMS, EDA_3D_VIEWER::Install3DViewOptionDialog )
124 
125  EVT_MENU( wxID_CLOSE, EDA_3D_VIEWER::Exit3DFrame )
126  EVT_MENU( ID_RENDER_CURRENT_VIEW, EDA_3D_VIEWER::OnRenderEngineSelection )
127  EVT_MENU( ID_DISABLE_RAY_TRACING, EDA_3D_VIEWER::OnDisableRayTracing )
128 
130 
131  EVT_CLOSE( EDA_3D_VIEWER::OnCloseWindow )
132 END_EVENT_TABLE()
133 
134 
135 EDA_3D_VIEWER::EDA_3D_VIEWER( KIWAY *aKiway, PCB_BASE_FRAME *aParent,
136  const wxString &aTitle, long style ) :
137  KIWAY_PLAYER( aKiway, aParent,
138  FRAME_PCB_DISPLAY3D, aTitle,
139  wxDefaultPosition, wxDefaultSize,
140  style, QUALIFIED_VIEWER3D_FRAMENAME( aParent ) )
141 {
142  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::EDA_3D_VIEWER %s", aTitle );
143 
144  m_canvas = NULL;
145  m_disable_ray_tracing = false;
146  m_mainToolBar = nullptr;
147  m_AboutTitle = "3D Viewer";
148 
149  // Give it an icon
150  wxIcon icon;
151  icon.CopyFromBitmap( KiBitmap( icon_3d_xpm ) );
152  SetIcon( icon );
153 
154  LoadSettings( config() );
155  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
156 
157  // Create the status line
158  static const int status_dims[4] = { -1, 130, 130, 170 };
159 
160  wxStatusBar *status_bar = CreateStatusBar( arrayDim( status_dims ) );
161  SetStatusWidths( arrayDim( status_dims ), status_dims );
162 
163  m_canvas = new EDA_3D_CANVAS( this,
165  aParent->GetBoard(),
166  m_settings,
167  Prj().Get3DCacheManager() );
168 
169  if( m_canvas )
170  m_canvas->SetStatusBar( status_bar );
171 
172  // Some settings need the canvas
173  loadCommonSettings();
174 
175  // Create the manager
176  m_toolManager = new TOOL_MANAGER;
177  m_toolManager->SetEnvironment( nullptr, nullptr, nullptr, this );
178 
179  // Register tools
180  m_toolManager->RegisterTool( new COMMON_CONTROL );
181  m_actions = new EDA_3D_ACTIONS();
182  m_toolManager->InitTools();
183 
184  CreateMenuBar();
185  ReCreateMainToolbar();
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->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( EDA_3D_VIEWER::OnKeyEvent ),
195  NULL, this );
196 
197  // Fixes bug in Windows (XP and possibly others) where the canvas requires the focus
198  // in order to receive mouse events. Otherwise, the user has to click somewhere on
199  // the canvas before it will respond to mouse wheel events.
200  if( m_canvas )
201  m_canvas->SetFocus();
202 }
203 
204 
206 {
207  m_mainToolBar->Disconnect( wxEVT_KEY_DOWN, wxKeyEventHandler( EDA_3D_VIEWER::OnKeyEvent ),
208  NULL, this );
209 
210  m_auimgr.UnInit();
211 
212  // m_canvas delete will be called by wxWidget manager
213  //delete m_canvas;
214  //m_canvas = nullptr;
215 }
216 
217 
219 {
220  // This will schedule a request to load later
221  if( m_canvas )
222  m_canvas->ReloadRequest( GetBoard(), Prj().Get3DCacheManager() );
223 }
224 
225 
226 void EDA_3D_VIEWER::NewDisplay( bool aForceImmediateRedraw )
227 {
228  ReloadRequest();
229 
230  // After the ReloadRequest call, the refresh often takes a bit of time,
231  // and it is made here only on request.
232  if( aForceImmediateRedraw )
233  m_canvas->Refresh();
234 }
235 
236 
237 void EDA_3D_VIEWER::Exit3DFrame( wxCommandEvent &event )
238 {
239  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::Exit3DFrame" );
240 
241  Close( true );
242 }
243 
244 
245 void EDA_3D_VIEWER::OnCloseWindow( wxCloseEvent &event )
246 {
247  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::OnCloseWindow" );
248 
249  if( m_canvas )
250  m_canvas->Close();
251 
252  // m_canvas delete will be called by wxWidget manager
253  //delete m_canvas;
254  //m_canvas = nullptr;
255 
256  Destroy();
257  event.Skip( true );
258 }
259 
260 #define ROT_ANGLE 10.0
261 
262 void EDA_3D_VIEWER::Process_Special_Functions( wxCommandEvent &event )
263 {
264  int id = event.GetId();
265  bool isChecked = event.IsChecked();
266 
267  wxLogTrace( m_logTrace,
268  "EDA_3D_VIEWER::Process_Special_Functions id %d isChecked %d",
269  id, isChecked );
270 
271  if( m_canvas == NULL )
272  return;
273 
274  switch( id )
275  {
276  case ID_RELOAD3D_BOARD:
277  NewDisplay( true );
278  break;
279 
280  case ID_ROTATE3D_X_POS:
281  m_settings.CameraGet().RotateX( glm::radians(ROT_ANGLE) );
282 
285  else
287 
288  break;
289 
290  case ID_ROTATE3D_X_NEG:
291  m_settings.CameraGet().RotateX( -glm::radians(ROT_ANGLE) );
292 
295  else
297 
298  break;
299 
300  case ID_ROTATE3D_Y_POS:
301  m_settings.CameraGet().RotateY( glm::radians(ROT_ANGLE) );
302 
305  else
307 
308  break;
309 
310  case ID_ROTATE3D_Y_NEG:
311  m_settings.CameraGet().RotateY( -glm::radians(ROT_ANGLE) );
312 
315  else
317 
318  break;
319 
320  case ID_ROTATE3D_Z_POS:
321  m_settings.CameraGet().RotateZ( glm::radians(ROT_ANGLE) );
322 
325  else
327 
328  break;
329 
330  case ID_ROTATE3D_Z_NEG:
331  m_settings.CameraGet().RotateZ( -glm::radians(ROT_ANGLE) );
332 
335  else
337 
338  break;
339 
340  case ID_MOVE3D_LEFT:
341  m_canvas->SetView3D( WXK_LEFT );
342  return;
343 
344  case ID_MOVE3D_RIGHT:
345  m_canvas->SetView3D( WXK_RIGHT );
346  return;
347 
348  case ID_MOVE3D_UP:
349  m_canvas->SetView3D( WXK_UP );
350  return;
351 
352  case ID_MOVE3D_DOWN:
353  m_canvas->SetView3D( WXK_DOWN );
354  return;
355 
356  case ID_ORTHO:
359  return;
360 
364  takeScreenshot( event );
365  return;
366 
368  if( Set3DColorFromUser( m_settings.m_BgColorBot, _( "Background Color, Bottom" ),
369  nullptr ) )
370  {
373  else
374  NewDisplay( true );
375  }
376  return;
377 
379  if( Set3DColorFromUser( m_settings.m_BgColorTop, _( "Background Color, Top" ), nullptr ) )
380  {
383  else
384  NewDisplay( true );
385  }
386  return;
387 
390  return;
391 
394  return;
395 
398  return;
399 
402  break;
403 
406  break;
407 
410  NewDisplay( true );
411  return;
412 
415  NewDisplay( true );
416  return;
417 
420  NewDisplay( true );
421  return;
422 
425  NewDisplay( true );
426  return;
427 
430  NewDisplay( true );
431  return;
432 
436  return;
437 
441  return;
442 
445  NewDisplay( true );
446  return;
447 
450  NewDisplay( true );
451  return;
452 
456  return;
457 
461  return;
462 
465  NewDisplay( true );
466  return;
467 
471  return;
472 
474  m_settings.SetFlag( FL_SHOW_BOARD_BODY, isChecked );
475  NewDisplay( true );
476  return;
477 
479  m_settings.SetFlag( FL_AXIS, isChecked );
481  return;
482 
485  NewDisplay( true );
486  return;
487 
490  NewDisplay( true );
491  return;
492 
495  NewDisplay( true );
496  return;
497 
499  m_settings.SetFlag( FL_ZONE, isChecked );
500  NewDisplay( true );
501  return;
502 
504  m_settings.SetFlag( FL_ADHESIVE, isChecked );
505  NewDisplay( true );
506  return;
507 
509  m_settings.SetFlag( FL_SILKSCREEN, isChecked );
510  NewDisplay( true );
511  return;
512 
514  m_settings.SetFlag( FL_SOLDERMASK, isChecked );
515  NewDisplay( true );
516  return;
517 
519  m_settings.SetFlag( FL_SOLDERPASTE, isChecked );
520  NewDisplay( true );
521  return;
522 
524  m_settings.SetFlag( FL_COMMENTS, isChecked );
525  NewDisplay( true );
526  return;
527 
528  case ID_MENU3D_ECO_ONOFF:
529  m_settings.SetFlag( FL_ECO, isChecked );
530  NewDisplay( true );
531  return;
532 
534  {
535  // Reload settings with a dummy config, so it will load the defaults
536  wxConfig *fooconfig = new wxConfig( "FooBarApp" );
537  LoadSettings( fooconfig );
538  delete fooconfig;
539 
540  // Tell canvas that we (may have) changed the render engine
542 
543  NewDisplay( true );
544  }
545  return;
546 
547  default:
548  wxFAIL_MSG( "Invalid event in EDA_3D_VIEWER::Process_Special_Functions()" );
549  return;
550  }
551 }
552 
553 
554 void EDA_3D_VIEWER::On3DGridSelection( wxCommandEvent &event )
555 {
556  int id = event.GetId();
557 
558  wxASSERT( id < ID_MENU3D_GRID_END );
559  wxASSERT( id > ID_MENU3D_GRID );
560 
561  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::On3DGridSelection id %d", id );
562 
563  switch( id )
564  {
570 
571  default: wxFAIL_MSG( "Invalid event in EDA_3D_VIEWER::On3DGridSelection()" );
572  }
573 
574  if( m_canvas )
576 }
577 
578 
579 void EDA_3D_VIEWER::OnRenderEngineSelection( wxCommandEvent &event )
580 {
581  const RENDER_ENGINE old_engine = m_settings.RenderEngineGet();
582 
583  if( old_engine == RENDER_ENGINE_OPENGL_LEGACY )
585  else
587 
588  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::OnRenderEngineSelection type %s ",
590  "Ray Trace" : "OpenGL Legacy" );
591 
592  if( old_engine != m_settings.RenderEngineGet() )
593  {
595  }
596 }
597 
598 
599 void EDA_3D_VIEWER::ProcessZoom( wxCommandEvent &event )
600 {
601  int id = event.GetId();
602 
603  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::ProcessZoom id:%d", id );
604 
605  if( m_canvas == NULL )
606  return;
607 
608  switch( id )
609  {
610  case ID_ZOOM_PAGE: m_canvas->SetView3D( WXK_HOME ); break;
611  case ID_ZOOM_IN: m_canvas->SetView3D( WXK_F1 ); break;
612  case ID_ZOOM_OUT: m_canvas->SetView3D( WXK_F2 ); break;
613  case ID_ZOOM_REDRAW: m_canvas->Request_refresh(); break;
614  default: wxFAIL_MSG( "Invalid event in EDA_3D_VIEWER::ProcessZoom()" );
615  }
616 
618 }
619 
620 
621 void EDA_3D_VIEWER::OnDisableRayTracing( wxCommandEvent& aEvent )
622 {
623  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::%s disabling ray tracing.", __WXFUNCTION__ );
624 
625  m_disable_ray_tracing = true;
627 }
628 
629 
630 void EDA_3D_VIEWER::OnActivate( wxActivateEvent &event )
631 {
632  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::OnActivate" );
633 
634  if( m_canvas )
635  {
636  // Reload data if 3D frame shows a board,
637  // because it can be changed since last frame activation
640 
641  // Activates again the focus of the canvas so it will catch mouse and key events
642  m_canvas->SetFocus();
643  }
644 
645  event.Skip(); // required under wxMAC
646 }
647 
648 
649 void EDA_3D_VIEWER::OnSetFocus(wxFocusEvent &event)
650 {
651  // Activates again the focus of the canvas so it will catch mouse and key events
652  if( m_canvas )
653  m_canvas->SetFocus();
654 
655  event.Skip();
656 }
657 
658 
659 void EDA_3D_VIEWER::LoadSettings( wxConfigBase *aCfg )
660 {
662 
663  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::LoadSettings" );
664 
665  aCfg->Read( keyBgColor_Red, &m_settings.m_BgColorBot.r, 0.4 );
666  aCfg->Read( keyBgColor_Green, &m_settings.m_BgColorBot.g, 0.4 );
667  aCfg->Read( keyBgColor_Blue, &m_settings.m_BgColorBot.b, 0.5 );
668 
669  aCfg->Read( keyBgColor_Red_Top, &m_settings.m_BgColorTop.r, 0.8 );
670  aCfg->Read( keyBgColor_Green_Top, &m_settings.m_BgColorTop.g, 0.8 );
671  aCfg->Read( keyBgColor_Blue_Top, &m_settings.m_BgColorTop.b, 0.9 );
672 
673  // m_SolderMaskColor default value = dark grey-green
674  aCfg->Read( keySMaskColor_Red, &m_settings.m_SolderMaskColor.r, 100.0 * 0.2 / 255.0 );
675  aCfg->Read( keySMaskColor_Green, &m_settings.m_SolderMaskColor.g, 255.0 * 0.2 / 255.0 );
676  aCfg->Read( keySMaskColor_Blue, &m_settings.m_SolderMaskColor.b, 180.0 * 0.2 / 255.0 );
677 
678  // m_SolderPasteColor default value = light grey
679  aCfg->Read( keySPasteColor_Red, &m_settings.m_SolderPasteColor.r, 128.0 /255.0 );
680  aCfg->Read( keySPasteColor_Green, &m_settings.m_SolderPasteColor.g, 128.0 /255.0 );
681  aCfg->Read( keySPasteColor_Blue, &m_settings.m_SolderPasteColor.b, 128.0 /255.0 );
682 
683  // m_SilkScreenColor default value = white
684  aCfg->Read( keySilkColor_Red, &m_settings.m_SilkScreenColor.r, 0.9 );
685  aCfg->Read( keySilkColor_Green, &m_settings.m_SilkScreenColor.g, 0.9 );
686  aCfg->Read( keySilkColor_Blue, &m_settings.m_SilkScreenColor.b, 0.9 );
687 
688  // m_CopperColor default value = gold
689  aCfg->Read( keyCopperColor_Red, &m_settings.m_CopperColor.r, 255.0 * 0.7 / 255.0 );
690  aCfg->Read( keyCopperColor_Green, &m_settings.m_CopperColor.g, 223.0 * 0.7 / 255.0 );
691  aCfg->Read( keyCopperColor_Blue, &m_settings.m_CopperColor.b, 0.0 );
692 
693  // m_BoardBodyColor default value = FR4, in realistic mode
694  aCfg->Read( keyBoardBodyColor_Red, &m_settings.m_BoardBodyColor.r, 51.0 / 255.0 );
695  aCfg->Read( keyBoardBodyColor_Green, &m_settings.m_BoardBodyColor.g, 43.0 / 255.0 );
696  aCfg->Read( keyBoardBodyColor_Blue, &m_settings.m_BoardBodyColor.b, 22.0 /255.0 );
697 
698 
699  bool tmp;
700  aCfg->Read( keyShowRealisticMode, &tmp, true );
702 
703  // OpenGL options
704  aCfg->Read( keyRenderOGL_ShowCopperTck, &tmp, true );
706 
707  aCfg->Read( keyRenderOGL_ShowModelBBox, &tmp, false );
709 
710  // Raytracing options
711  aCfg->Read( keyRenderRAY_Shadows, &tmp, true );
713 
714  aCfg->Read( keyRenderRAY_Backfloor, &tmp, true );
716 
717  aCfg->Read( keyRenderRAY_Refractions, &tmp, true );
719 
720  aCfg->Read( keyRenderRAY_Reflections, &tmp, true );
722 
723  aCfg->Read( keyRenderRAY_PostProcess, &tmp, true );
725 
726  aCfg->Read( keyRenderRAY_AAliasing, &tmp, true );
728 
729  aCfg->Read( keyRenderRAY_ProceduralT, &tmp, true );
731 
732  aCfg->Read( keyShowAxis, &tmp, true );
733  m_settings.SetFlag( FL_AXIS, tmp );
734 
735  aCfg->Read( keyShowFootprints_Normal, &tmp, true );
737 
738  aCfg->Read( keyShowFootprints_Insert, &tmp, true );
740 
741  aCfg->Read( keyShowFootprints_Virtual, &tmp, true );
743 
744  aCfg->Read( keyShowZones, &tmp, true );
745  m_settings.SetFlag( FL_ZONE, tmp );
746 
747  aCfg->Read( keyShowAdhesiveLayers, &tmp, true );
749 
750  aCfg->Read( keyShowSilkScreenLayers, &tmp, true );
752 
753  aCfg->Read( keyShowSolderMaskLayers, &tmp, true );
755 
756  aCfg->Read( keyShowSolderPasteLayers, &tmp, true );
758 
759  aCfg->Read( keyShowCommentsLayer, &tmp, true );
761 
762  aCfg->Read( keyShowEcoLayers, &tmp, true );
763  m_settings.SetFlag( FL_ECO, tmp );
764 
765  aCfg->Read( keyShowBoardBody, &tmp, true );
767 
768  int tmpi;
769  aCfg->Read( keyShowGrid, &tmpi, (int)GRID3D_NONE );
770  m_settings.GridSet( (GRID3D_TYPE)tmpi );
771 
772  aCfg->Read( keyRenderEngine, &tmpi, (int)RENDER_ENGINE_OPENGL_LEGACY );
773  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::LoadSettings render setting %s",
774  ( (RENDER_ENGINE)tmpi == RENDER_ENGINE_RAYTRACING ) ? "Ray Trace" : "OpenGL" );
776 
777  aCfg->Read( keyRenderMaterial, &tmpi, (int)MATERIAL_MODE_NORMAL );
779 }
780 
781 
782 void EDA_3D_VIEWER::SaveSettings( wxConfigBase *aCfg )
783 {
785 
786  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::SaveSettings" );
787 
788  aCfg->Write( keyBgColor_Red, m_settings.m_BgColorBot.r );
789  aCfg->Write( keyBgColor_Green, m_settings.m_BgColorBot.g );
790  aCfg->Write( keyBgColor_Blue, m_settings.m_BgColorBot.b );
791 
792  aCfg->Write( keyBgColor_Red_Top, m_settings.m_BgColorTop.r );
793  aCfg->Write( keyBgColor_Green_Top, m_settings.m_BgColorTop.g );
794  aCfg->Write( keyBgColor_Blue_Top, m_settings.m_BgColorTop.b );
795 
799 
803 
807 
808  aCfg->Write( keyCopperColor_Red, m_settings.m_CopperColor.r );
810  aCfg->Write( keyCopperColor_Blue, m_settings.m_CopperColor.b );
811 
815 
817 
818  aCfg->Write( keyRenderEngine, (int)m_settings.RenderEngineGet() );
819  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::SaveSettings render setting %s",
820  ( m_settings.RenderEngineGet() == RENDER_ENGINE_RAYTRACING ) ? "Ray Trace" : "OpenGL" );
821 
822  aCfg->Write( keyRenderMaterial, (int)m_settings.MaterialModeGet() );
823 
824  // OpenGL options
825  aCfg->Write( keyRenderOGL_ShowCopperTck,
827  aCfg->Write( keyRenderOGL_ShowModelBBox,
829 
830  // Raytracing options
838 
839  aCfg->Write( keyShowAxis, m_settings.GetFlag( FL_AXIS ) );
840  aCfg->Write( keyShowGrid, (int)m_settings.GridGet() );
841 
845 
846  aCfg->Write( keyShowZones, m_settings.GetFlag( FL_ZONE ) );
852  aCfg->Write( keyShowEcoLayers, m_settings.GetFlag( FL_ECO ) );
854 }
855 
856 
857 void EDA_3D_VIEWER::CommonSettingsChanged( bool aEnvVarsChanged )
858 {
859  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::CommonSettingsChanged" );
860 
861  // Regen menu bars, etc
862  EDA_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged );
863 
864  // There is no base class that handles toolbars for this frame
866 
868 
869  NewDisplay( true );
870 }
871 
872 
873 void EDA_3D_VIEWER::OnKeyEvent( wxKeyEvent& event )
874 {
875  if( m_canvas )
876  return m_canvas->OnKeyEvent( event );
877 
878  event.Skip();
879 }
880 
881 
882 void EDA_3D_VIEWER::takeScreenshot( wxCommandEvent& event )
883 {
884  wxString fullFileName;
885  bool fmt_is_jpeg = false;
886 
887  if( event.GetId() == ID_MENU_SCREENCOPY_JPEG )
888  fmt_is_jpeg = true;
889 
890  if( event.GetId() != ID_TOOL_SCREENCOPY_TOCLIBBOARD )
891  {
892  // Remember path between saves during this session only.
893  const wxString wildcard = fmt_is_jpeg ? JpegFileWildcard() : PngFileWildcard();
894  const wxString ext = fmt_is_jpeg ? JpegFileExtension : PngFileExtension;
895 
896  // First time path is set to the project path.
897  if( !m_defaultSaveScreenshotFileName.IsOk() )
899 
900  m_defaultSaveScreenshotFileName.SetExt( ext );
901 
902  wxFileDialog dlg( this, _( "3D Image File Name" ),
904  m_defaultSaveScreenshotFileName.GetFullName(), wildcard,
905  wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
906 
907  if( dlg.ShowModal() == wxID_CANCEL )
908  return;
909 
910  m_defaultSaveScreenshotFileName = dlg.GetPath();
911 
912  if( m_defaultSaveScreenshotFileName.GetExt().IsEmpty() )
913  m_defaultSaveScreenshotFileName.SetExt( ext );
914 
915  fullFileName = m_defaultSaveScreenshotFileName.GetFullPath();
916 
917  // Be sure the screen area destroyed by the file dialog is redrawn
918  // before making a screen copy.
919  // Without this call, under Linux the screen refresh is made to late.
920  wxYield();
921  }
922 
923  // Be sure we have the latest 3D view (remember 3D view is buffered)
924  m_canvas->Request_refresh( true );
925  wxYield();
926 
927  // Build image from the 3D buffer
928  wxWindowUpdateLocker noUpdates( this );
929 
930  wxImage screenshotImage;
931 
932  if( m_canvas )
933  m_canvas->GetScreenshot( screenshotImage );
934 
935  if( event.GetId() == ID_TOOL_SCREENCOPY_TOCLIBBOARD )
936  {
937  wxBitmap bitmap( screenshotImage );
938 
939  if( wxTheClipboard->Open() )
940  {
941  wxBitmapDataObject* dobjBmp = new wxBitmapDataObject( bitmap );
942 
943  if( !wxTheClipboard->SetData( dobjBmp ) )
944  wxMessageBox( _( "Failed to copy image to clipboard" ) );
945 
946  wxTheClipboard->Flush(); /* the data in clipboard will stay
947  * available after the application exits */
948  wxTheClipboard->Close();
949  }
950  }
951  else
952  {
953  if( !screenshotImage.SaveFile( fullFileName,
954  fmt_is_jpeg ? wxBITMAP_TYPE_JPEG : wxBITMAP_TYPE_PNG ) )
955  wxMessageBox( _( "Can't save file" ) );
956 
957  screenshotImage.Destroy();
958  }
959 
960 }
961 
962 
964 {
965  wxLogTrace( m_logTrace, "EDA_3D_VIEWER::RenderEngineChanged()" );
966 
967  if( m_canvas )
969 }
970 
971 
972 bool EDA_3D_VIEWER::Set3DColorFromUser( SFVEC3D &aColor, const wxString& aTitle,
973  CUSTOM_COLORS_LIST* aPredefinedColors )
974 {
975  KIGFX::COLOR4D newcolor;
976  KIGFX::COLOR4D oldcolor( aColor.r,aColor.g, aColor.b, 1.0 );
977 
978  DIALOG_COLOR_PICKER picker( this, oldcolor, false, aPredefinedColors );
979 
980  if( picker.ShowModal() != wxID_OK )
981  return false;
982 
983  newcolor = picker.GetColor();
984 
985  if( newcolor == oldcolor )
986  return false;
987 
988  aColor.r = newcolor.r;
989  aColor.g = newcolor.g;
990  aColor.b = newcolor.b;
991 
992  return true;
993 }
994 
995 
997 {
999 
1000  colors.push_back( CUSTOM_COLOR_ITEM( 241.0/255.0, 241.0/255.0, 241.0/255.0, "White" ) );
1001  colors.push_back( CUSTOM_COLOR_ITEM( 4.0/255.0, 18.0/255.0, 21.0/255.0, "Dark" ) );
1002 
1003  if( Set3DColorFromUser( m_settings.m_SilkScreenColor, _( "Silkscreen Color" ), &colors ) )
1004  {
1005  NewDisplay( true );
1006  return true;
1007  }
1008 
1009  return false;
1010 }
1011 
1012 
1014 {
1016 
1017  colors.push_back( CUSTOM_COLOR_ITEM( 20/255.0, 51/255.0, 36/255.0, "Green" ) );
1018  colors.push_back( CUSTOM_COLOR_ITEM( 91/255.0, 168/255.0, 12/255.0, "Light Green" ) );
1019  colors.push_back( CUSTOM_COLOR_ITEM( 13/255.0, 104/255.0, 11/255.0, "Saturated Green" ) );
1020  colors.push_back( CUSTOM_COLOR_ITEM( 181/255.0, 19/255.0, 21/255.0, "Red" ) );
1021  colors.push_back( CUSTOM_COLOR_ITEM( 239/255.0, 53/255.0, 41/255.0, "Red Light Orange" ) );
1022  colors.push_back( CUSTOM_COLOR_ITEM( 210/255.0, 40/255.0, 14/255.0, "Red 2" ) );
1023  colors.push_back( CUSTOM_COLOR_ITEM( 2/255.0, 59/255.0, 162/255.0, "Blue" ) );
1024  colors.push_back( CUSTOM_COLOR_ITEM( 54/255.0, 79/255.0, 116/255.0, "Light blue 1" ) );
1025  colors.push_back( CUSTOM_COLOR_ITEM( 61/255.0, 85/255.0, 130/255.0, "Light blue 2" ) );
1026  colors.push_back( CUSTOM_COLOR_ITEM( 21/255.0, 70/255.0, 80/255.0, "Green blue (dark)" ) );
1027  colors.push_back( CUSTOM_COLOR_ITEM( 11/255.0, 11/255.0, 11/255.0, "Black" ) );
1028  colors.push_back( CUSTOM_COLOR_ITEM( 245/255.0, 245/255.0, 245/255.0, "White" ) );
1029  colors.push_back( CUSTOM_COLOR_ITEM( 119/255.0, 31/255.0, 91/255.0, "Purple" ) );
1030  colors.push_back( CUSTOM_COLOR_ITEM( 32/255.0, 2/255.0, 53/255.0, "Purple Dark" ) );
1031 
1032  if( Set3DColorFromUser( m_settings.m_SolderMaskColor, _( "Solder Mask Color" ), &colors ) )
1033  {
1034  NewDisplay( true );
1035  return true;
1036  }
1037 
1038  return false;
1039 }
1040 
1041 
1043 {
1045 
1046  colors.push_back( CUSTOM_COLOR_ITEM( 184/255.0, 115/255.0, 50/255.0, "Copper" ) );
1047  colors.push_back( CUSTOM_COLOR_ITEM( 178/255.0, 156/255.0, 0.0, "Gold" ) );
1048  colors.push_back( CUSTOM_COLOR_ITEM( 213/255.0, 213/255.0, 213/255.0, "Silver" ) );
1049  colors.push_back( CUSTOM_COLOR_ITEM( 160/255.0, 160/255.0, 160/255.0, "Tin" ) );
1050 
1051  if( Set3DColorFromUser( m_settings.m_CopperColor, _( "Copper Color" ), &colors ) )
1052  {
1053  NewDisplay( true );
1054  return true;
1055  }
1056 
1057  return false;
1058 }
1059 
1060 
1062 {
1064 
1065  colors.push_back( CUSTOM_COLOR_ITEM( 51/255.0, 43/255.0, 22/255.0, "FR4 natural, dark" ) );
1066  colors.push_back( CUSTOM_COLOR_ITEM( 109/255.0, 116/255.0, 75/255.0, "FR4 natural" ) );
1067  colors.push_back( CUSTOM_COLOR_ITEM( 78/255.0, 14/255.0, 5/255.0, "brown/red" ) );
1068  colors.push_back( CUSTOM_COLOR_ITEM( 146/255.0, 99/255.0, 47/255.0, "brown 1" ) );
1069  colors.push_back( CUSTOM_COLOR_ITEM( 160/255.0, 123/255.0, 54/255.0, "brown 2" ) );
1070  colors.push_back( CUSTOM_COLOR_ITEM( 146/255.0, 99/255.0, 47/255.0, "brown 3" ) );
1071  colors.push_back( CUSTOM_COLOR_ITEM( 63/255.0, 126/255.0, 71/255.0, "green 1" ) );
1072  colors.push_back( CUSTOM_COLOR_ITEM( 117/255.0, 122/255.0, 90/255.0, "green 2" ) );
1073 
1074  if( Set3DColorFromUser( m_settings.m_BoardBodyColor, _( "Board Body Color" ), &colors ) )
1075  {
1076  NewDisplay( true );
1077  return true;
1078  }
1079 
1080  return false;
1081 }
1082 
1083 
1085 {
1087 
1088  colors.push_back( CUSTOM_COLOR_ITEM( 128/255.0, 128/255.0, 128/255.0, "grey" ) );
1089  colors.push_back( CUSTOM_COLOR_ITEM( 213/255.0, 213/255.0, 213/255.0, "Silver" ) );
1090  colors.push_back( CUSTOM_COLOR_ITEM( 90/255.0, 90/255.0, 90/255.0, "grey 2" ) );
1091 
1092  if( Set3DColorFromUser( m_settings.m_SolderPasteColor, _( "Solder Paste Color" ), &colors ) )
1093  {
1094  NewDisplay( true );
1095  return true;
1096  }
1097 
1098  return false;
1099 }
1100 
1101 
1103 {
1104  wxCHECK_RET( m_canvas, "Cannot load settings to null canvas" );
1105 
1106  wxConfigBase& cmnCfg = *Pgm().CommonSettings();
1107 
1108  {
1109  const DPI_SCALING dpi{ &cmnCfg, this };
1110  m_canvas->SetScaleFactor( dpi.GetScaleFactor() );
1111  }
1112 
1113  {
1114  bool option;
1115  cmnCfg.Read( ENBL_MOUSEWHEEL_PAN_KEY, &option, false );
1117  }
1118 }
static const wxChar keyShowSolderMaskLayers[]
static const wxChar keyShowFootprints_Normal[]
static const wxChar keyRenderRAY_ProceduralT[]
static const wxChar keyShowGrid[]
bool Set3DCopperColorFromUser()
Set the copper color from a set of colors.
Class KIWAY_PLAYER is a wxFrame capable of the OpenProjectFiles function, meaning it can load a porti...
Definition: kiway_player.h:59
static const wxChar keyShowBoardBody[]
Use only diffuse material properties.
Definition: 3d_enums.h:93
static const int * GetAttributesList(bool aUseAntiAliasing)
Get a list of attributes to pass to wxGLCanvas.
static const wxChar keyRenderRAY_Reflections[]
void CommonSettingsChanged(bool aEnvVarsChanged) override
Notification that common settings are updated.
const std::string JpegFileExtension
CINFO3D_VISU m_settings
static const wxChar keyBgColor_Red_Top[]
void On3DGridSelection(wxCommandEvent &event)
This file is part of the common library TODO brief description.
static const wxChar keySilkColor_Blue[]
static const wxChar keyBgColor_Blue_Top[]
bool Set3DSolderMaskColorFromUser()
Set the solder mask color from a set of colors.
void GridSet(GRID3D_TYPE aGridType)
GridSet - set the current grid.
Definition: cinfo3d_visu.h:222
static const wxChar keyRenderEngine[]
static const wxChar keyBgColor_Red[]
SFVEC3D m_CopperColor
in realistic mode: copper color
Definition: cinfo3d_visu.h:503
void LoadSettings(wxConfigBase *aCfg) override
Load common frame parameters from a configuration file.
PROJECT & Prj()
Definition: kicad.cpp:297
void OnKeyEvent(wxKeyEvent &event)
void RotateY(float aAngleInRadians)
Definition: ccamera.cpp:503
static const wxChar keyShowFootprints_Insert[]
virtual void SaveSettings(wxConfigBase *aCfg)
Saves common frame parameters to a configuration data file.
Class EDA_3D_ACTIONS.
Definition: 3d_actions.h:41
Definition: id.h:215
static const wxChar keyCopperColor_Green[]
static const wxChar keyShowFootprints_Virtual[]
void SetStatusBar(wxStatusBar *aStatusBar)
Definition: eda_3d_canvas.h:73
void SaveSettings(wxConfigBase *aCfg) override
Saves common frame parameters to a configuration data file.
GRID3D_TYPE GridGet() const
GridGet - get the current grid.
Definition: cinfo3d_visu.h:216
Implement a canvas based on a wxGLCanvas.
Definition: eda_3d_canvas.h:52
bool IsReloadRequestPending() const
IsReloadRequestPending - Query if there is a pending reload request.
Definition: eda_3d_canvas.h:81
double g
Green component.
Definition: color4d.h:302
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:65
static const wxChar keyShowAdhesiveLayers[]
a class to handle a custom color (predefined color) for the color picker dialog
wxString JpegFileWildcard()
static const wxChar keySilkColor_Green[]
wxAuiManager m_auimgr
SFVEC3D m_BgColorBot
background bottom color
Definition: cinfo3d_visu.h:497
std::vector< CUSTOM_COLOR_ITEM > CUSTOM_COLORS_LIST
void DisplayStatus()
DisplayStatus - Update the status bar with the position information.
void Request_refresh(bool aRedrawImmediately=true)
Request_refresh - Schedule a refresh update of the canvas.
void ReloadRequest(BOARD *aBoard=NULL, S3D_CACHE *aCachePointer=NULL)
SFVEC3D m_BgColorTop
background top color
Definition: cinfo3d_visu.h:498
void Exit3DFrame(wxCommandEvent &event)
Called when user press the File->Exit.
void MaterialModeSet(MATERIAL_MODE aMaterialMode)
MaterialModeSet.
Definition: cinfo3d_visu.h:240
EVT_TOOL(ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, CVPCB_MAINFRAME::OnSelectFilteringFootprint) EVT_TOOL(ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST
bool GetFlag(DISPLAY3D_FLG aFlag) const
GetFlag - get a configuration status of a flag.
void loadCommonSettings()
Load configuration from common settings.
static const wxChar keyShowRealisticMode[]
Class to handle configuration and automatic determination of the DPI scale to use for canvases.
Definition: dpi_scaling.h:35
SFVEC3D m_BoardBodyColor
in realistic mode: FR4 board color
Definition: cinfo3d_visu.h:499
double b
Blue component.
Definition: color4d.h:303
EDA_3D_CANVAS * m_canvas
static const wxChar keyCopperColor_Blue[]
static const wxChar keySMaskColor_Green[]
bool Set3DColorFromUser(SFVEC3D &aColor, const wxString &aTitle, CUSTOM_COLORS_LIST *aPredefinedColors)
Get a SFVEC3D from a wx colour dialog.
static const wxChar keyBgColor_Green_Top[]
static const wxChar keyShowSolderPasteLayers[]
MATERIAL_MODE MaterialModeGet() const
MaterialModeGet.
Definition: cinfo3d_visu.h:246
void RenderEngineSet(RENDER_ENGINE aRenderEngine)
RenderEngineSet.
Definition: cinfo3d_visu.h:228
static const wxChar keySPasteColor_Red[]
static const wxChar keyShowSilkScreenLayers[]
Class TOOL_MANAGER.
Definition: tool_manager.h:50
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
void OnActivate(wxActivateEvent &event)
static const wxChar keyCopperColor_Red[]
void RotateZ(float aAngleInRadians)
Definition: ccamera.cpp:510
void RotateX(float aAngleInRadians)
Definition: ccamera.cpp:496
void OnDisableRayTracing(wxCommandEvent &aEvent)
CCAMERA & CameraGet() const
CameraGet - get current camera in use.
Definition: cinfo3d_visu.h:210
void RenderRaytracingRequest()
RenderRaytracingRequest - Request to render the current view in Raytracing mode.
wxAuiToolBar * m_mainToolBar
void OnKeyEvent(wxKeyEvent &event)
static const wxChar keyShowZones[]
static const wxChar keyRenderMaterial[]
static const wxChar keyRenderRAY_AAliasing[]
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
void RenderEngineChanged()
RenderEngineChanged - Notify that the render engine was changed.
bool Set3DSilkScreenColorFromUser()
Set the silkscreen color from a set of colors.
virtual void LoadSettings(wxConfigBase *aCfg)
Load common frame parameters from a configuration file.
void ToggleProjection()
Definition: ccamera.cpp:417
#define ENBL_MOUSEWHEEL_PAN_KEY
Definition: pgm_base.h:51
Definition of file extensions used in Kicad.
Use a gray shading based on diffuse material.
Definition: 3d_enums.h:94
Class KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within...
Definition: kiway.h:258
glm::dvec3 SFVEC3D
Definition: xv3d_types.h:48
void OnCloseWindow(wxCloseEvent &event)
static const wxChar keyBgColor_Green[]
static const wxChar keyBoardBodyColor_Blue[]
void ReCreateMainToolbar()
Equivalent of EDA_DRAW_FRAME::ReCreateHToolbar.
Definition: 3d_toolbar.cpp:39
VTBL_ENTRY const wxString GetProjectFullName() const
Function GetProjectFullName returns the full path and name of the project.
Definition: project.cpp:96
Class COMMON_CONTROL.
MATERIAL_MODE
Render 3d model shape materials mode.
Definition: 3d_enums.h:90
SFVEC3D m_SolderPasteColor
in realistic mode: solder paste color
Definition: cinfo3d_visu.h:501
bool Set3DSolderPasteColorFromUser()
Set the solder mask color from a set of colors.
#define _(s)
VTBL_ENTRY wxConfigBase * CommonSettings() const
Definition: pgm_base.h:201
Specialization of the wxAuiPaneInfo class for KiCad panels.
SFVEC3D m_SolderMaskColor
in realistic mode: solder mask color
Definition: cinfo3d_visu.h:500
EVT_MENU_RANGE(ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, KICAD_MANAGER_FRAME::language_change) KICAD_MANAGER_FRAME
GRID3D_TYPE
Grid types.
Definition: 3d_enums.h:71
static const wxChar keyRenderOGL_ShowModelBBox[]
wxString PngFileWildcard()
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:108
void RenderEngineChanged()
RenderEngineChanged - Update toolbar icon and call canvas RenderEngineChanged.
RENDER_ENGINE RenderEngineGet() const
RenderEngineGet.
Definition: cinfo3d_visu.h:234
static const wxChar keySPasteColor_Green[]
virtual void CommonSettingsChanged(bool aEnvVarsChanged)
Notification event that some of the common (suite-wide) settings have changed.
Use all material properties from model file.
Definition: 3d_enums.h:92
static const wxChar keyBoardBodyColor_Red[]
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
void GetScreenshot(wxImage &aDstImage)
Request a screenshot and output it to the aDstImage.
SFVEC3D m_SilkScreenColor
in realistic mode: SilkScreen color
Definition: cinfo3d_visu.h:502
static const wxChar keySilkColor_Red[]
static const wxChar keyBgColor_Blue[]
static const wxChar keySMaskColor_Red[]
static const wxChar keyRenderRAY_Refractions[]
see class PGM_BASE
Declaration of the eda_3d_viewer class.
static const wxChar keyRenderOGL_ShowCopperTck[]
static const wxChar keyRenderRAY_Backfloor[]
wxFileName m_defaultSaveScreenshotFileName
bool SetView3D(int aKeycode)
SetView3D - Helper function to call view commands.
void ProcessZoom(wxCommandEvent &event)
#define ROT_ANGLE
static const wxChar keySMaskColor_Blue[]
The base frame for deriving all KiCad main window classes.
void OnRenderEngineSelection(wxCommandEvent &event)
PCB_BASE_FRAME * Parent() const
Definition: eda_3d_viewer.h:67
KIGFX::COLOR4D GetColor()
const std::string PngFileExtension
void SetEnvironment(EDA_ITEM *aModel, KIGFX::VIEW *aView, KIGFX::VIEW_CONTROLS *aViewControls, EDA_BASE_FRAME *aFrame)
Sets the work environment (model, view, view controls and the parent window).
void SetScaleFactor(double aFactor)
Set the canvas scale factor, probably for a hi-DPI display.
RENDER_ENGINE
Render engine mode.
Definition: 3d_enums.h:82
static const wxChar keyBoardBodyColor_Green[]
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
void OnSetFocus(wxFocusEvent &event)
static const wxChar keyShowAxis[]
static const wxChar keySPasteColor_Blue[]
Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard.
Definition: eda_3d_viewer.h:56
double r
Red component.
Definition: color4d.h:301
void SetFlag(DISPLAY3D_FLG aFlag, bool aState)
SetFlag - set the status of a flag.
static const wxChar keyShowEcoLayers[]
static const wxChar keyShowCommentsLayer[]
void NewDisplay(bool aForceImmediateRedraw=false)
Reload and refresh (rebuild) the 3D scene.
static const wxChar keyRenderRAY_Shadows[]
EVT_TOOL_RANGE(ID_START_COMMAND_3D, ID_MENU_COMMAND_END, EDA_3D_VIEWER::Process_Special_Functions) EDA_3D_VIEWER
#define QUALIFIED_VIEWER3D_FRAMENAME(parent)
Definition: eda_3d_viewer.h:50
static VRML_COLOR colors[VRML_COLOR_LAST]
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
BOARD * GetBoard()
Definition: eda_3d_viewer.h:69
bool m_disable_ray_tracing
bool Set3DBoardBodyColorFromUser()
Set the copper color from a set of colors.
static const wxChar keyRenderRAY_PostProcess[]
void ReloadRequest()
Request reloading the 3D view.
void Process_Special_Functions(wxCommandEvent &event)
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.