KiCad PCB EDA Suite
c3d_render_ogl_legacy.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-2016 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 
31 #include "c3d_render_ogl_legacy.h"
32 #include "ogl_legacy_utils.h"
33 #include "common_ogl/ogl_utils.h"
34 #include "../cimage.h"
35 #include <class_board.h>
36 #include <class_module.h>
37 #include <3d_math.h>
38 
39 #include <base_units.h>
40 
44 #define UNITS3D_TO_UNITSPCB (IU_PER_MM)
45 
47  C3D_RENDER_BASE( aSettings )
48 {
49  wxLogTrace( m_logTrace, wxT( "C3D_RENDER_OGL_LEGACY::C3D_RENDER_OGL_LEGACY" ) );
50 
54  m_triangles.clear();
55  m_ogl_disp_list_board = NULL;
56 
61  //m_ogl_disp_list_through_holes_vias_inner = NULL;
62  m_ogl_disp_list_via = NULL;
65 
69 
70  m_3dmodel_map.clear();
71 }
72 
73 
75 {
76  wxLogTrace( m_logTrace, wxT( "C3D_RENDER_OGL_LEGACY::~C3D_RENDER_OGL_LEGACY" ) );
77 
79 
80  glDeleteTextures( 1, &m_ogl_circle_texture );
81 }
82 
83 
85 {
86  return 50; // ms
87 }
88 
89 
90 void C3D_RENDER_OGL_LEGACY::SetCurWindowSize( const wxSize &aSize )
91 {
92  if( m_windowSize != aSize )
93  {
94  m_windowSize = aSize;
95  glViewport( 0, 0, m_windowSize.x, m_windowSize.y );
96 
97  // Initialize here any screen dependent data here
98  }
99 }
100 
101 
103 {
104  if( enabled )
105  glEnable( GL_LIGHT0 );
106  else
107  glDisable( GL_LIGHT0 );
108 }
109 
110 
112 {
113  if( enabled )
114  glEnable( GL_LIGHT1 );
115  else
116  glDisable( GL_LIGHT1 );
117 }
118 
119 
121 {
122  if( enabled )
123  glEnable( GL_LIGHT2 );
124  else
125  glDisable( GL_LIGHT2 );
126 }
127 
128 
130 {
131  const float arrow_size = RANGE_SCALE_3D * 0.30f;
132 
133  glDisable( GL_CULL_FACE );
134 
135  // YxY squared view port, this is on propose
136  glViewport( 4, 4, m_windowSize.y / 8 , m_windowSize.y / 8 );
137  glClear( GL_DEPTH_BUFFER_BIT );
138 
139  glMatrixMode( GL_PROJECTION );
140  glLoadIdentity();
141  gluPerspective( 45.0f, 1.0f, 0.001f, RANGE_SCALE_3D );
142 
143  glMatrixMode( GL_MODELVIEW );
144  glLoadIdentity();
145 
146  const glm::mat4 TranslationMatrix = glm::translate(
147  glm::mat4(1.0f),
148  SFVEC3F( 0.0f, 0.0f, -(arrow_size * 2.75f) ) );
149 
150  const glm::mat4 ViewMatrix = TranslationMatrix *
152 
153  glLoadMatrixf( glm::value_ptr( ViewMatrix ) );
154 
156 
157  glColor3f( 0.9f, 0.0f, 0.0f );
158  OGL_draw_arrow( SFVEC3F( 0.0f, 0.0f, 0.0f ),
159  SFVEC3F( arrow_size, 0.0f, 0.0f ),
160  0.275f );
161 
162  glColor3f( 0.0f, 0.9f, 0.0f );
163  OGL_draw_arrow( SFVEC3F( 0.0f, 0.0f, 0.0f ),
164  SFVEC3F( 0.0f, arrow_size, 0.0f ),
165  0.275f );
166 
167  glColor3f( 0.0f, 0.0f, 0.9f );
168  OGL_draw_arrow( SFVEC3F( 0.0f, 0.0f, 0.0f ),
169  SFVEC3F( 0.0f, 0.0f, arrow_size ),
170  0.275f );
171 
172  glEnable( GL_CULL_FACE );
173 }
174 
175 
177 {
178  m_materials = {};
179 
181  {
182  // http://devernay.free.fr/cours/opengl/materials.html
183 
184  // Copper material mixed with the copper color
185  m_materials.m_Copper.m_Ambient = SFVEC3F( m_settings.m_CopperColor.r * 0.1f,
186  m_settings.m_CopperColor.g * 0.1f,
187  m_settings.m_CopperColor.b * 0.1f);
188 
189  m_materials.m_Copper.m_Specular = SFVEC3F( m_settings.m_CopperColor.r * 0.75f + 0.25f,
190  m_settings.m_CopperColor.g * 0.75f + 0.25f,
191  m_settings.m_CopperColor.b * 0.75f + 0.25f );
192 
193  // This guess the material type(ex: copper vs gold) to determine the
194  // shininess factor between 0.1 and 0.4
195  float shininessfactor = 0.40f - mapf( fabs( m_settings.m_CopperColor.r -
197  0.15f, 1.00f,
198  0.00f, 0.30f );
199 
200  m_materials.m_Copper.m_Shininess = shininessfactor * 128.0f;
201 
202 
203  // Paste material mixed with paste color
204  m_materials.m_Paste.m_Ambient = SFVEC3F( m_settings.m_SolderPasteColor.r,
207 
208  m_materials.m_Paste.m_Specular = SFVEC3F( m_settings.m_SolderPasteColor.r *
214 
215  m_materials.m_Paste.m_Shininess = 0.1f * 128.0f;
216 
217 
218  // Silk screen material mixed with silk screen color
219  m_materials.m_SilkS.m_Ambient = SFVEC3F( m_settings.m_SilkScreenColor.r,
222 
223  m_materials.m_SilkS.m_Specular = SFVEC3F( m_settings.m_SilkScreenColor.r *
224  m_settings.m_SilkScreenColor.r + 0.10f,
226  m_settings.m_SilkScreenColor.g + 0.10f,
228  m_settings.m_SilkScreenColor.b + 0.10f );
229 
230  m_materials.m_SilkS.m_Shininess = 0.078125f * 128.0f;
231 
232 
233  // Solder mask material mixed with solder mask color
234  m_materials.m_SolderMask.m_Ambient = SFVEC3F( m_settings.m_SolderMaskColor.r * 0.3f,
235  m_settings.m_SolderMaskColor.g * 0.3f,
236  m_settings.m_SolderMaskColor.b * 0.3f );
237 
238  m_materials.m_SolderMask.m_Specular = SFVEC3F( m_settings.m_SolderMaskColor.r *
244 
245  m_materials.m_SolderMask.m_Shininess = 0.8f * 128.0f;
246  m_materials.m_SolderMask.m_Transparency = 0.17f;
247 
248 
249  // Epoxy material
250  m_materials.m_EpoxyBoard.m_Ambient = SFVEC3F( 117.0f / 255.0f,
251  97.0f / 255.0f,
252  47.0f / 255.0f );
253 
254  m_materials.m_EpoxyBoard.m_Diffuse = m_settings.m_BoardBodyColor;
255 
256  m_materials.m_EpoxyBoard.m_Specular = SFVEC3F( 18.0f / 255.0f,
257  3.0f / 255.0f,
258  20.0f / 255.0f );
259 
260  m_materials.m_EpoxyBoard.m_Shininess = 0.1f * 128.0f;
261  }
262  else // Technical Mode
263  {
264  const SFVEC3F matAmbientColor = SFVEC3F( 0.10f );
265  const SFVEC3F matSpecularColor = SFVEC3F( 0.10f );
266  const float matShininess = 0.1f * 128.0f;
267 
268  // Copper material
269  m_materials.m_Copper.m_Ambient = matAmbientColor;
270  m_materials.m_Copper.m_Specular = matSpecularColor;
271  m_materials.m_Copper.m_Shininess = matShininess;
272 
273  // Paste material
274  m_materials.m_Paste.m_Ambient = matAmbientColor;
275  m_materials.m_Paste.m_Specular = matSpecularColor;
276  m_materials.m_Paste.m_Shininess = matShininess;
277 
278  // Silk screen material
279  m_materials.m_SilkS.m_Ambient = matAmbientColor;
280  m_materials.m_SilkS.m_Specular = matSpecularColor;
281  m_materials.m_SilkS.m_Shininess = matShininess;
282 
283  // Solder mask material
284  m_materials.m_SolderMask.m_Ambient = matAmbientColor;
285  m_materials.m_SolderMask.m_Specular = matSpecularColor;
286  m_materials.m_SolderMask.m_Shininess = matShininess;
287  m_materials.m_SolderMask.m_Transparency = 0.17f;
288 
289  // Epoxy material
290  m_materials.m_EpoxyBoard.m_Ambient = matAmbientColor;
291  m_materials.m_EpoxyBoard.m_Diffuse = m_settings.m_BoardBodyColor;
292  m_materials.m_EpoxyBoard.m_Specular = matSpecularColor;
293  m_materials.m_EpoxyBoard.m_Shininess = matShininess;
294 
295  // Gray material (used for example in technical vias and pad holes)
296  m_materials.m_GrayMaterial.m_Ambient = SFVEC3F( 0.8f, 0.8f, 0.8f );
297  m_materials.m_GrayMaterial.m_Diffuse = SFVEC3F( 0.3f, 0.3f, 0.3f );
298  m_materials.m_GrayMaterial.m_Specular = SFVEC3F( 0.4f, 0.4f, 0.4f );
299  m_materials.m_GrayMaterial.m_Shininess = 0.01f * 128.0f;
300  }
301 }
302 
303 
305 {
306  switch( aLayerID )
307  {
308  case B_Mask:
309  case F_Mask:
310  m_materials.m_SolderMask.m_Diffuse = get_layer_color( aLayerID );
311  OGL_SetMaterial( m_materials.m_SolderMask );
312  break;
313 
314  case B_Paste:
315  case F_Paste:
316  m_materials.m_Paste.m_Diffuse = get_layer_color( aLayerID );
317  OGL_SetMaterial( m_materials.m_Paste );
318  break;
319 
320  case B_SilkS:
321  case F_SilkS:
322  m_materials.m_SilkS.m_Diffuse = get_layer_color( aLayerID );
323  OGL_SetMaterial( m_materials.m_SilkS );
324  break;
325 
326  case B_Adhes:
327  case F_Adhes:
328  case Dwgs_User:
329  case Cmts_User:
330  case Eco1_User:
331  case Eco2_User:
332  case Edge_Cuts:
333  case Margin:
334  case B_CrtYd:
335  case F_CrtYd:
336  case B_Fab:
337  case F_Fab:
338  m_materials.m_Plastic.m_Diffuse = get_layer_color( aLayerID );
339  m_materials.m_Plastic.m_Ambient = SFVEC3F(
340  m_materials.m_Plastic.m_Diffuse.r * 0.05f,
341  m_materials.m_Plastic.m_Diffuse.g * 0.05f,
342  m_materials.m_Plastic.m_Diffuse.b * 0.05f );
343 
344  m_materials.m_Plastic.m_Specular = SFVEC3F(
345  m_materials.m_Plastic.m_Diffuse.r * 0.7f,
346  m_materials.m_Plastic.m_Diffuse.g * 0.7f,
347  m_materials.m_Plastic.m_Diffuse.b * 0.7f );
348 
349  m_materials.m_Plastic.m_Shininess = 0.078125f * 128.0f;
350  OGL_SetMaterial( m_materials.m_Plastic );
351  break;
352 
353  default:
354  m_materials.m_Copper.m_Diffuse = get_layer_color( aLayerID );
355  OGL_SetMaterial( m_materials.m_Copper );
356 
357  break;
358  }
359 }
360 
361 
363 {
364  SFVEC3F layerColor = m_settings.GetLayerColor( aLayerID );
365 
367  {
368  switch( aLayerID )
369  {
370  case B_Adhes:
371  case F_Adhes:
372  break;
373 
374  case B_Mask:
375  case F_Mask:
376  layerColor = m_settings.m_SolderMaskColor;
377  break;
378 
379  case B_Paste:
380  case F_Paste:
381  layerColor = m_settings.m_SolderPasteColor;
382  break;
383 
384  case B_SilkS:
385  case F_SilkS:
386  layerColor = m_settings.m_SilkScreenColor;
387  break;
388 
389  case Dwgs_User:
390  case Cmts_User:
391  case Eco1_User:
392  case Eco2_User:
393  case Edge_Cuts:
394  case Margin:
395  break;
396 
397  case B_CrtYd:
398  case F_CrtYd:
399  break;
400 
401  case B_Fab:
402  case F_Fab:
403  break;
404 
405  default:
406  layerColor = m_settings.m_CopperColor;
407  break;
408  }
409  }
410 
411  return layerColor;
412 }
413 
414 void init_lights(void)
415 {
416  // Setup light
417  // https://www.opengl.org/sdk/docs/man2/xhtml/glLight.xml
418  // /////////////////////////////////////////////////////////////////////////
419  const GLfloat ambient[] = { 0.084f, 0.084f, 0.084f, 1.0f };
420  const GLfloat diffuse0[] = { 0.3f, 0.3f, 0.3f, 1.0f };
421  const GLfloat specular0[] = { 0.5f, 0.5f, 0.5f, 1.0f };
422 
423  glLightfv( GL_LIGHT0, GL_AMBIENT, ambient );
424  glLightfv( GL_LIGHT0, GL_DIFFUSE, diffuse0 );
425  glLightfv( GL_LIGHT0, GL_SPECULAR, specular0 );
426 
427  const GLfloat diffuse12[] = { 0.7f, 0.7f, 0.7f, 1.0f };
428  const GLfloat specular12[] = { 0.7f, 0.7f, 0.7f, 1.0f };
429 
430  // defines a directional light that points along the negative z-axis
431  GLfloat position[4] = { 0.0f, 0.0f, 1.0f, 0.0f };
432 
433  // This makes a vector slight not perpendicular with XZ plane
434  const SFVEC3F vectorLight = SphericalToCartesian( glm::pi<float>() * 0.03f,
435  glm::pi<float>() * 0.25f );
436 
437  position[0] = vectorLight.x;
438  position[1] = vectorLight.y;
439  position[2] = vectorLight.z;
440 
441  glLightfv( GL_LIGHT1, GL_AMBIENT, ambient );
442  glLightfv( GL_LIGHT1, GL_DIFFUSE, diffuse12 );
443  glLightfv( GL_LIGHT1, GL_SPECULAR, specular12 );
444  glLightfv( GL_LIGHT1, GL_POSITION, position );
445 
446 
447  // defines a directional light that points along the positive z-axis
448  position[2] = -position[2];
449 
450  glLightfv( GL_LIGHT2, GL_AMBIENT, ambient );
451  glLightfv( GL_LIGHT2, GL_DIFFUSE, diffuse12 );
452  glLightfv( GL_LIGHT2, GL_SPECULAR, specular12 );
453  glLightfv( GL_LIGHT2, GL_POSITION, position );
454 
455  const GLfloat lmodel_ambient[] = { 0.0f, 0.0f, 0.0f, 1.0f };
456 
457  glLightModelfv( GL_LIGHT_MODEL_AMBIENT, lmodel_ambient );
458 
459  glLightModeli( GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE );
460 }
461 
462 
463 bool C3D_RENDER_OGL_LEGACY::Redraw( bool aIsMoving,
464  REPORTER *aStatusTextReporter )
465 {
466  // Initialize openGL
468  {
469  if( !initializeOpenGL() )
470  return false;
471  }
472 
473  if( m_reloadRequested )
474  {
475  std::unique_ptr<BUSY_INDICATOR> busy = CreateBusyIndicator();
476 
477  if( aStatusTextReporter )
478  aStatusTextReporter->Report( _( "Loading..." ) );
479 
480  reload( aStatusTextReporter );
481  setupMaterials();
482 
483  // generate a new 3D grid as the size of the board may had changed
486  }
487  else
488  {
489  // Check if grid was changed
491  {
492  // and generate a new one
495  }
496  }
497 
498  // Initial setup
499  // /////////////////////////////////////////////////////////////////////////
500  glDepthFunc( GL_LESS );
501  glEnable( GL_CULL_FACE );
502  glFrontFace( GL_CCW ); // This is the openGL default
503  glEnable( GL_NORMALIZE ); // This allow openGL to normalize the normals after transformations
504 
505  glViewport( 0, 0, m_windowSize.x, m_windowSize.y );
506 
507 
508  // clear color and depth buffers
509  // /////////////////////////////////////////////////////////////////////////
510  glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
511  glClearDepth( 1.0f );
512  glClearStencil( 0x00 );
513  glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
514 
515 
516  // Draw the background ( rectangle with color gradient)
517  // /////////////////////////////////////////////////////////////////////////
520 
521  glEnable( GL_DEPTH_TEST );
522 
523 
524  // Set projection and modelview matrixes
525  // /////////////////////////////////////////////////////////////////////////
526  glMatrixMode( GL_PROJECTION );
527  glLoadMatrixf( glm::value_ptr( m_settings.CameraGet().GetProjectionMatrix() ) );
528 
529  glMatrixMode( GL_MODELVIEW );
530  glLoadIdentity();
531  glLoadMatrixf( glm::value_ptr( m_settings.CameraGet().GetViewMatrix() ) );
532 
533 
534  // Position the headlight
535  // /////////////////////////////////////////////////////////////////////////
536 
537  setLight_Front( true );
538  setLight_Top( true );
539  setLight_Bottom( true );
540 
541  glEnable( GL_LIGHTING );
542 
543  {
544  const SFVEC3F &cameraPos = m_settings.CameraGet().GetPos();
545 
546  // Place the light at a minimun Z so the diffuse factor will not drop
547  // and the board will still look with good light.
548  float zpos;
549 
550  if( cameraPos.z > 0.0f )
551  {
552  zpos = glm::max( cameraPos.z, 0.5f ) + cameraPos.z * cameraPos.z;
553  }
554  else
555  {
556  zpos = glm::min( cameraPos.z,-0.5f ) - cameraPos.z * cameraPos.z;
557  }
558 
559  const GLfloat headlight_pos[] = { cameraPos.x,
560  cameraPos.y,
561  zpos,
562  1.0f }; // This is a point light
563 
564  glLightfv( GL_LIGHT0, GL_POSITION, headlight_pos );
565  }
566 
567 
568  // Display board body
569  // /////////////////////////////////////////////////////////////////////////
571  {
573  {
576 
577  OGL_SetMaterial( m_materials.m_EpoxyBoard );
578 
580 
582  {
586 
589  NULL );
590  }
591  else
592  {
594  }
595  }
596  }
597 
598 
600  {
601  // Draw vias and pad holes with copper material
603  }
604  else
605  {
606  OGL_SetMaterial( m_materials.m_GrayMaterial );
607  }
608 
609  if( m_ogl_disp_list_via )
610  {
612  }
613 
615  {
617  }
618 
619 
620  // Display copper and tech layers
621  // /////////////////////////////////////////////////////////////////////////
622  for( MAP_OGL_DISP_LISTS::const_iterator ii = m_ogl_disp_lists_layers.begin();
623  ii != m_ogl_disp_lists_layers.end();
624  ++ii )
625  {
626 
627  const PCB_LAYER_ID layer_id = (PCB_LAYER_ID)(ii->first);
628 
629  // Mask kayers are not processed here because they are a special case
630  if( (layer_id == B_Mask) || (layer_id == F_Mask) )
631  continue;
632 
633  // Do not show inner layers when it is displaying the board
635  {
636  if( (layer_id > F_Cu) && (layer_id < B_Cu) )
637  continue;
638  }
639 
640  glPushMatrix();
641 
642  // !TODO: if we want to increase the separation between layers
643  //glScalef( 1.0f, 1.0f, 3.0f );
644 
645 
646  CLAYERS_OGL_DISP_LISTS *pLayerDispList = static_cast<CLAYERS_OGL_DISP_LISTS*>(ii->second);
647  set_layer_material( layer_id );
648 
651  pLayerDispList->GetZBot(),
652  pLayerDispList->GetZTop() - pLayerDispList->GetZBot() );
653 
654  if( (layer_id >= F_Cu) && (layer_id <= B_Cu) )
655  {
656  if( m_ogl_disp_lists_layers_holes_outer.find( layer_id ) !=
658  {
659  const CLAYERS_OGL_DISP_LISTS* viasHolesLayer =
661 
662  wxASSERT( viasHolesLayer != NULL );
663 
664  if( viasHolesLayer != NULL )
665  {
666  pLayerDispList->DrawAllCameraCulledSubtractLayer(
668  viasHolesLayer,
669  (aIsMoving == false) );
670  }
671  }
672  else
673  {
674  pLayerDispList->DrawAllCameraCulledSubtractLayer(
676  NULL,
677  (aIsMoving == false) );
678  }
679  }
680  else
681  {
682  pLayerDispList->DrawAllCameraCulled( m_settings.CameraGet().GetPos().z,
683  (aIsMoving == false) );
684  }
685 
686  glPopMatrix();
687  }
688 
689 
690  // Render 3D Models (Non-transparent)
691  // /////////////////////////////////////////////////////////////////////////
692 
693  //setLight_Top( false );
694  //setLight_Bottom( true );
695  render_3D_models( false, false );
696 
697  //setLight_Top( true );
698  //setLight_Bottom( false );
699  render_3D_models( true, false );
700 
701 
702  // Display transparent mask layers
703  // /////////////////////////////////////////////////////////////////////////
705  {
706  //setLight_Top( true );
707  //setLight_Bottom( true );
708 
709  if( m_settings.CameraGet().GetPos().z > 0 )
710  {
712  aIsMoving );
713 
715  aIsMoving );
716  }
717  else
718  {
720  aIsMoving );
721 
723  aIsMoving );
724  }
725  }
726 
727 
728  // Render 3D Models (Transparent)
729  // /////////////////////////////////////////////////////////////////////////
730 
731  //setLight_Top( false );
732  //setLight_Bottom( true );
733  render_3D_models( false, true );
734 
735  //setLight_Top( true );
736  //setLight_Bottom( false );
737  render_3D_models( true, true );
738 
739 
740  // Render Grid
741  // /////////////////////////////////////////////////////////////////////////
742 
743  if( m_settings.GridGet() != GRID3D_NONE )
744  {
745  glDisable( GL_LIGHTING );
746 
747  if( glIsList( m_ogl_disp_list_grid ) )
748  glCallList( m_ogl_disp_list_grid );
749 
750  glEnable( GL_LIGHTING );
751  }
752 
753 
754  // Render 3D arrows
755  // /////////////////////////////////////////////////////////////////////////
756  if( m_settings.GetFlag( FL_AXIS ) )
758 
759  // Return back to the original viewport (this is important if we want
760  // to take a screenshot after the render)
761  // /////////////////////////////////////////////////////////////////////////
762  glViewport( 0, 0, m_windowSize.x, m_windowSize.y );
763 
764  return false;
765 }
766 
767 
769 {
770  glEnable( GL_LINE_SMOOTH );
771  glShadeModel( GL_SMOOTH );
772 
773  // 4-byte pixel alignment
774  glPixelStorei( GL_UNPACK_ALIGNMENT, 4 );
775 
776  // Initialize the open GL texture to draw the filled semi-circle of the segments
778 
779  if( !circleImage )
780  return false;
781 
782  circleImage->CircleFilled( (SIZE_OF_CIRCLE_TEXTURE / 2) - 0,
783  (SIZE_OF_CIRCLE_TEXTURE / 2) - 0,
784  (SIZE_OF_CIRCLE_TEXTURE / 2) - 4,
785  0xFF );
786 
787  //circleImage->CircleFilled( (SIZE_OF_CIRCLE_TEXTURE / 4)*1.5f - 1,
788  // (SIZE_OF_CIRCLE_TEXTURE / 4)*1.5f - 1,
789  // (SIZE_OF_CIRCLE_TEXTURE / 4)*1.5f - 2, 0xFF );
790 
791  CIMAGE *circleImage_Copy = new CIMAGE( *circleImage );
792 
793  circleImage->EfxFilter( circleImage_Copy, FILTER_BLUR_3X3 );
794 
795  m_ogl_circle_texture = OGL_LoadTexture( *circleImage );
796 
797  //circleImage_Copy->SaveAsPNG("circleImage.png");
798  delete circleImage_Copy;
799  circleImage_Copy = 0;
800 
801  //circleImage->SaveAsPNG("circleImage_blured.png");
802  delete circleImage;
803  circleImage = 0;
804 
805  init_lights();
806 
807  // Use this mode if you want see the triangle lines (debug proposes)
808  //glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
809 
811 
812  return true;
813 }
814 
815 
817 {
818  glEnable( GL_COLOR_MATERIAL );
819  glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
820 
821  const SFVEC4F ambient = SFVEC4F( 0.0f, 0.0f, 0.0f, 1.0f );
822  const SFVEC4F diffuse = SFVEC4F( 0.0f, 0.0f, 0.0f, 1.0f );
823  const SFVEC4F emissive = SFVEC4F( 0.0f, 0.0f, 0.0f, 1.0f );
824  const SFVEC4F specular = SFVEC4F( 0.1f, 0.1f, 0.1f, 1.0f );
825 
826  glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR, &specular.r );
827  glMaterialf( GL_FRONT_AND_BACK, GL_SHININESS, 96.0f );
828 
829  glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT, &ambient.r );
830  glMaterialfv( GL_FRONT_AND_BACK, GL_DIFFUSE, &diffuse.r );
831  glMaterialfv( GL_FRONT_AND_BACK, GL_EMISSION, &emissive.r );
832 }
833 
834 
836 {
837  if( glIsList( m_ogl_disp_list_grid ) )
838  glDeleteLists( m_ogl_disp_list_grid, 1 );
839 
841 
842  for( MAP_OGL_DISP_LISTS::const_iterator ii = m_ogl_disp_lists_layers.begin();
843  ii != m_ogl_disp_lists_layers.end();
844  ++ii )
845  {
846  CLAYERS_OGL_DISP_LISTS *pLayerDispList = static_cast<CLAYERS_OGL_DISP_LISTS*>(ii->second);
847  delete pLayerDispList;
848  }
849 
850  m_ogl_disp_lists_layers.clear();
851 
852 
853  for( MAP_OGL_DISP_LISTS::const_iterator ii = m_ogl_disp_lists_layers_holes_outer.begin();
855  ++ii )
856  {
857  CLAYERS_OGL_DISP_LISTS *pLayerDispList = static_cast<CLAYERS_OGL_DISP_LISTS*>(ii->second);
858  delete pLayerDispList;
859  }
860 
862 
863 
864  for( MAP_OGL_DISP_LISTS::const_iterator ii = m_ogl_disp_lists_layers_holes_inner.begin();
866  ++ii )
867  {
868  CLAYERS_OGL_DISP_LISTS *pLayerDispList = static_cast<CLAYERS_OGL_DISP_LISTS*>(ii->second);
869  delete pLayerDispList;
870  }
871 
873 
874  for( MAP_TRIANGLES::const_iterator ii = m_triangles.begin();
875  ii != m_triangles.end();
876  ++ii )
877  {
878  CLAYER_TRIANGLES *pointer = static_cast<CLAYER_TRIANGLES*>(ii->second);
879  delete pointer;
880  }
881 
882  m_triangles.clear();
883 
884 
885  for( MAP_3DMODEL::const_iterator ii = m_3dmodel_map.begin();
886  ii != m_3dmodel_map.end();
887  ++ii )
888  {
889  C_OGL_3DMODEL *pointer = static_cast<C_OGL_3DMODEL*>(ii->second);
890  delete pointer;
891  }
892 
893  m_3dmodel_map.clear();
894 
895 
896  delete m_ogl_disp_list_board;
898 
901 
904 
907 
910 
911  delete m_ogl_disp_list_via;
913 
916 
919 }
920 
921 
923  float aZPosition,
924  bool aIsRenderingOnPreviewMode )
925 {
926  wxASSERT( (aLayerID == B_Mask) || (aLayerID == F_Mask) );
927 
929  {
930  if( m_ogl_disp_lists_layers.find( aLayerID ) !=
932  {
933  CLAYERS_OGL_DISP_LISTS *pLayerDispListMask = m_ogl_disp_lists_layers.at( aLayerID );
934 
937  aZPosition,
939 
941  aZPosition,
943 
944  set_layer_material( aLayerID );
945 
947 
949  pLayerDispListMask,
951  !aIsRenderingOnPreviewMode );
952  }
953  else
954  {
955  // This case there is no layer with mask, so we will render the full board as mask
956 
959  aZPosition,
961 
963  aZPosition,
965 
966  set_layer_material( aLayerID );
967 
969 
971  NULL,
973  !aIsRenderingOnPreviewMode );
974  }
975  }
976 }
977 
978 
979 void C3D_RENDER_OGL_LEGACY::render_3D_models( bool aRenderTopOrBot,
980  bool aRenderTransparentOnly )
981 {
982  // Go for all modules
983  for( auto module : m_settings.GetBoard()->Modules() )
984  {
985  if( !module->Models().empty() )
986  if( m_settings.ShouldModuleBeDisplayed( (MODULE_ATTR_T) module->GetAttributes() ) )
987  if( ( aRenderTopOrBot && !module->IsFlipped() )
988  || ( !aRenderTopOrBot && module->IsFlipped() ) )
989  render_3D_module( module, aRenderTransparentOnly );
990  }
991 }
992 
993 
995  bool aRenderTransparentOnly )
996 {
997  if( !module->Models().empty() )
998  {
999  const double zpos = m_settings.GetModulesZcoord3DIU( module->IsFlipped() );
1000 
1001  glPushMatrix();
1002 
1003  wxPoint pos = module->GetPosition();
1004 
1005  glTranslatef( pos.x * m_settings.BiuTo3Dunits(),
1006  -pos.y * m_settings.BiuTo3Dunits(),
1007  zpos );
1008 
1009  if( module->GetOrientation() )
1010  glRotated( (double) module->GetOrientation() / 10.0, 0.0, 0.0, 1.0 );
1011 
1012  if( module->IsFlipped() )
1013  {
1014  glRotatef( 180.0f, 0.0f, 1.0f, 0.0f );
1015  glRotatef( 180.0f, 0.0f, 0.0f, 1.0f );
1016  }
1017 
1018  double modelunit_to_3d_units_factor = m_settings.BiuTo3Dunits() * UNITS3D_TO_UNITSPCB;
1019 
1020  glScaled( modelunit_to_3d_units_factor,
1021  modelunit_to_3d_units_factor,
1022  modelunit_to_3d_units_factor );
1023 
1024  // Get the list of model files for this model
1025  auto sM = module->Models().begin();
1026  auto eM = module->Models().end();
1027 
1028  while( sM != eM )
1029  {
1030  if( !sM->m_Filename.empty() )
1031  {
1032  // Check if the model is present in our cache map
1033  if( m_3dmodel_map.find( sM->m_Filename ) != m_3dmodel_map.end() )
1034  {
1035  // It is not present, try get it from cache
1036  const C_OGL_3DMODEL *modelPtr = m_3dmodel_map[ sM->m_Filename ];
1037 
1038  if( modelPtr )
1039  {
1040  if( ( (!aRenderTransparentOnly) && modelPtr->Have_opaque() ) ||
1041  ( aRenderTransparentOnly && modelPtr->Have_transparent() ) )
1042  {
1043  glPushMatrix();
1044 
1045  glTranslatef( sM->m_Offset.x, sM->m_Offset.y, sM->m_Offset.z );
1046 
1047  glRotatef( -sM->m_Rotation.z, 0.0f, 0.0f, 1.0f );
1048  glRotatef( -sM->m_Rotation.y, 0.0f, 1.0f, 0.0f );
1049  glRotatef( -sM->m_Rotation.x, 1.0f, 0.0f, 0.0f );
1050 
1051  glScalef( sM->m_Scale.x, sM->m_Scale.y, sM->m_Scale.z );
1052 
1053  if( aRenderTransparentOnly )
1054  modelPtr->Draw_transparent();
1055  else
1056  modelPtr->Draw_opaque();
1057 
1059  {
1060  glEnable( GL_BLEND );
1061  glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
1062 
1063  glLineWidth( 1 );
1064  modelPtr->Draw_bboxes();
1065 
1066  glDisable( GL_LIGHTING );
1067 
1068  glColor4f( 0.0f, 1.0f, 0.0f, 1.0f );
1069 
1070  glLineWidth( 4 );
1071  modelPtr->Draw_bbox();
1072 
1073  glEnable( GL_LIGHTING );
1074  }
1075 
1076  glPopMatrix();
1077  }
1078  }
1079  }
1080  }
1081 
1082  ++sM;
1083  }
1084 
1085  glPopMatrix();
1086  }
1087 }
1088 
1089 
1090 // create a 3D grid to an openGL display list: an horizontal grid (XY plane and Z = 0,
1091 // and a vertical grid (XZ plane and Y = 0)
1093 {
1094  if( glIsList( m_ogl_disp_list_grid ) )
1095  glDeleteLists( m_ogl_disp_list_grid, 1 );
1096 
1098 
1099  if( aGridType == GRID3D_NONE )
1100  return;
1101 
1102  m_ogl_disp_list_grid = glGenLists( 1 );
1103 
1104  if( !glIsList( m_ogl_disp_list_grid ) )
1105  return;
1106 
1107  glNewList( m_ogl_disp_list_grid, GL_COMPILE );
1108 
1109  glEnable( GL_BLEND );
1110  glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
1111 
1112  const double zpos = 0.0;
1113 
1114  // Color of grid lines
1115  const SFVEC3F gridColor = m_settings.GetColor( DARKGRAY );
1116 
1117  // Color of grid lines every 5 lines
1118  const SFVEC3F gridColor_marker = m_settings.GetColor( LIGHTGRAY );
1119  const double scale = m_settings.BiuTo3Dunits();
1120  const double transparency = 0.35;
1121 
1122  double griSizeMM = 0.0;
1123 
1124  switch( aGridType )
1125  {
1126  default:
1127  case GRID3D_NONE:
1128  return;
1129  case GRID3D_1MM:
1130  griSizeMM = 1.0;
1131  break;
1132  case GRID3D_2P5MM:
1133  griSizeMM = 2.5;
1134  break;
1135  case GRID3D_5MM:
1136  griSizeMM = 5.0;
1137  break;
1138  case GRID3D_10MM:
1139  griSizeMM = 10.0;
1140  break;
1141  }
1142 
1143  glNormal3f( 0.0, 0.0, 1.0 );
1144 
1145  const wxSize brd_size = m_settings.GetBoardSizeBIU();
1146  wxPoint brd_center_pos = m_settings.GetBoardPosBIU();
1147 
1148  brd_center_pos.y = -brd_center_pos.y;
1149 
1150  const int xsize = std::max( brd_size.x, Millimeter2iu( 100 ) ) * 1.2;
1151  const int ysize = std::max( brd_size.y, Millimeter2iu( 100 ) ) * 1.2;
1152 
1153  // Grid limits, in 3D units
1154  double xmin = (brd_center_pos.x - xsize / 2) * scale;
1155  double xmax = (brd_center_pos.x + xsize / 2) * scale;
1156  double ymin = (brd_center_pos.y - ysize / 2) * scale;
1157  double ymax = (brd_center_pos.y + ysize / 2) * scale;
1158  double zmin = Millimeter2iu( -50 ) * scale;
1159  double zmax = Millimeter2iu( 100 ) * scale;
1160 
1161  // Draw horizontal grid centered on 3D origin (center of the board)
1162  for( int ii = 0; ; ii++ )
1163  {
1164  if( (ii % 5) )
1165  glColor4f( gridColor.r, gridColor.g, gridColor.b, transparency );
1166  else
1167  glColor4f( gridColor_marker.r,
1168  gridColor_marker.g,
1169  gridColor_marker.b,
1170  transparency );
1171 
1172  const int delta = KiROUND( ii * griSizeMM * IU_PER_MM );
1173 
1174  if( delta <= xsize / 2 ) // Draw grid lines parallel to X axis
1175  {
1176  glBegin( GL_LINES );
1177  glVertex3f( (brd_center_pos.x + delta) * scale, -ymin, zpos );
1178  glVertex3f( (brd_center_pos.x + delta) * scale, -ymax, zpos );
1179  glEnd();
1180 
1181  if( ii != 0 )
1182  {
1183  glBegin( GL_LINES );
1184  glVertex3f( (brd_center_pos.x - delta) * scale, -ymin, zpos );
1185  glVertex3f( (brd_center_pos.x - delta) * scale, -ymax, zpos );
1186  glEnd();
1187  }
1188  }
1189 
1190  if( delta <= ysize / 2 ) // Draw grid lines parallel to Y axis
1191  {
1192  glBegin( GL_LINES );
1193  glVertex3f( xmin, -(brd_center_pos.y + delta) * scale, zpos );
1194  glVertex3f( xmax, -(brd_center_pos.y + delta) * scale, zpos );
1195  glEnd();
1196 
1197  if( ii != 0 )
1198  {
1199  glBegin( GL_LINES );
1200  glVertex3f( xmin, -(brd_center_pos.y - delta) * scale, zpos );
1201  glVertex3f( xmax, -(brd_center_pos.y - delta) * scale, zpos );
1202  glEnd();
1203  }
1204  }
1205 
1206  if( ( delta > ysize / 2 ) && ( delta > xsize / 2 ) )
1207  break;
1208  }
1209 
1210  // Draw vertical grid on Z axis
1211  glNormal3f( 0.0, -1.0, 0.0 );
1212 
1213  // Draw vertical grid lines (parallel to Z axis)
1214  double posy = -brd_center_pos.y * scale;
1215 
1216  for( int ii = 0; ; ii++ )
1217  {
1218  if( (ii % 5) )
1219  glColor4f( gridColor.r, gridColor.g, gridColor.b, transparency );
1220  else
1221  glColor4f( gridColor_marker.r,
1222  gridColor_marker.g,
1223  gridColor_marker.b,
1224  transparency );
1225 
1226  const double delta = ii * griSizeMM * IU_PER_MM;
1227 
1228  glBegin( GL_LINES );
1229  xmax = (brd_center_pos.x + delta) * scale;
1230 
1231  glVertex3f( xmax, posy, zmin );
1232  glVertex3f( xmax, posy, zmax );
1233  glEnd();
1234 
1235  if( ii != 0 )
1236  {
1237  glBegin( GL_LINES );
1238  xmin = (brd_center_pos.x - delta) * scale;
1239  glVertex3f( xmin, posy, zmin );
1240  glVertex3f( xmin, posy, zmax );
1241  glEnd();
1242  }
1243 
1244  if( delta > xsize / 2.0f )
1245  break;
1246  }
1247 
1248  // Draw horizontal grid lines on Z axis (parallel to X axis)
1249  for( int ii = 0; ; ii++ )
1250  {
1251  if( (ii % 5) )
1252  glColor4f( gridColor.r, gridColor.g, gridColor.b, transparency );
1253  else
1254  glColor4f( gridColor_marker.r,
1255  gridColor_marker.g,
1256  gridColor_marker.b,
1257  transparency );
1258 
1259  const double delta = ii * griSizeMM * IU_PER_MM * scale;
1260 
1261  if( delta <= zmax )
1262  {
1263  // Draw grid lines on Z axis (positive Z axis coordinates)
1264  glBegin( GL_LINES );
1265  glVertex3f( xmin, posy, delta );
1266  glVertex3f( xmax, posy, delta );
1267  glEnd();
1268  }
1269 
1270  if( delta <= -zmin && ( ii != 0 ) )
1271  {
1272  // Draw grid lines on Z axis (negative Z axis coordinates)
1273  glBegin( GL_LINES );
1274  glVertex3f( xmin, posy, -delta );
1275  glVertex3f( xmax, posy, -delta );
1276  glEnd();
1277  }
1278 
1279  if( ( delta > zmax ) && ( delta > -zmin ) )
1280  break;
1281  }
1282 
1283  glDisable( GL_BLEND );
1284 
1285  glEndList();
1286 }
MAP_OGL_DISP_LISTS m_ogl_disp_lists_layers
double GetOrientation() const
Definition: class_module.h:193
void DrawAllCameraCulledSubtractLayer(const CLAYERS_OGL_DISP_LISTS *aLayerToSubtractA, const CLAYERS_OGL_DISP_LISTS *aLayerToSubtractB, bool aDrawMiddle=true) const
void generate_new_3DGrid(GRID3D_TYPE aGridType)
wxSize GetBoardSizeBIU() const
GetBoardSizeBIU - Get the board size.
Definition: cinfo3d_visu.h:177
The CLAYER_TRIANGLES class stores arrays of triangles to be used to create display lists.
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:115
bool IsFlipped() const
function IsFlipped
Definition: class_module.h:263
Implementation of conversion functions that require both schematic and board internal units.
SFVEC3D m_CopperColor
in realistic mode: copper color
Definition: cinfo3d_visu.h:503
MAP_OGL_DISP_LISTS m_ogl_disp_lists_layers_holes_outer
void render_3D_models(bool aRenderTopOrBot, bool aRenderTransparentOnly)
render_3D_models
glm::vec4 SFVEC4F
Definition: xv3d_types.h:49
float mapf(float x, float in_min, float in_max, float out_min, float out_max)
Definition: 3d_math.h:136
GRID3D_TYPE GridGet() const
GridGet - get the current grid.
Definition: cinfo3d_visu.h:216
void init_lights(void)
#define RANGE_SCALE_3D
This defines the range that all coord will have to be rendered.
Definition: cinfo3d_visu.h:63
const SFVEC3F & GetPos() const
Definition: ccamera.h:110
SFVEC3D m_BgColorBot
background bottom color
Definition: cinfo3d_visu.h:497
Class REPORTER is a pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:61
void CircleFilled(int aCx, int aCy, int aRadius, unsigned char aValue)
CircleFilled.
Definition: cimage.cpp:172
CINFO3D_VISU & m_settings
settings refrence in use for this render
SFVEC3D m_BgColorTop
background top color
Definition: cinfo3d_visu.h:498
void ApplyScalePosition(float aZposition, float aZscale)
SFVEC3F GetLayerColor(PCB_LAYER_ID aLayerId) const
GetLayerColor - get the technical color of a layer.
void setLight_Top(bool enabled)
float GetLayerBottomZpos3DU(PCB_LAYER_ID aLayerId) const
GetLayerBottomZpos3DU - Get the bottom z position.
Definition: cinfo3d_visu.h:287
GRID3D_TYPE m_last_grid_type
Stores the last grid computed.
GLuint OGL_LoadTexture(const CIMAGE &aImage)
OGL_LoadTexture - generate a new OpenGL texture.
Definition: ogl_utils.cpp:80
bool GetFlag(DISPLAY3D_FLG aFlag) const
GetFlag - get a configuration status of a flag.
SFVEC3D m_BoardBodyColor
in realistic mode: FR4 board color
Definition: cinfo3d_visu.h:499
double BiuTo3Dunits() const
BiuTo3Dunits - Board integer units To 3D units.
Definition: cinfo3d_visu.h:141
void Draw_transparent() const
Draw_transparent - render the model into the current context.
int GetWaitForEditingTimeOut() override
GetWaitForEditingTimeOut - Give the interface the time (in ms) that it should wait for editing or mov...
const glm::mat4 GetRotationMatrix() const
Function GetRotationMatrix Get the rotation matrix to be applied in a transformation camera.
Definition: ccamera.cpp:130
#define UNITS3D_TO_UNITSPCB
Scale convertion from 3d model units to pcb units.
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_through_holes_inner
void OGL_DrawBackground(const SFVEC3F &aTopColor, const SFVEC3F &aBotColor)
OGL_DrawBackground.
Definition: ogl_utils.cpp:179
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_through_holes_outer
const BOARD * GetBoard() const
GetBoard - Get current board to be rendered.
Definition: cinfo3d_visu.h:128
void OGL_SetMaterial(const SMATERIAL &aMaterial)
OGL_SetMaterial - Set OpenGL materials.
Definition: ogl_utils.cpp:144
PCB_LAYER_ID
A quick note on layer IDs:
CCAMERA & CameraGet() const
CameraGet - get current camera in use.
Definition: cinfo3d_visu.h:210
void setLight_Front(bool enabled)
MODULES & Modules()
Definition: class_board.h:236
void render_3D_module(const MODULE *module, bool aRenderTransparentOnly)
void setLight_Bottom(bool enabled)
bool m_is_opengl_initialized
flag if the opengl specific for this render was already initialized
wxPoint GetBoardPosBIU() const
GetBoardPosBIU - Get the board size.
Definition: cinfo3d_visu.h:183
struct C3D_RENDER_OGL_LEGACY::@32 m_materials
C3D_RENDER_OGL_LEGACY(CINFO3D_VISU &aSettings)
float GetNonCopperLayerThickness3DU() const
GetNonCopperLayerThickness3DU - Get the current non copper layers thickness.
Definition: cinfo3d_visu.h:159
Class CINFO3D_VISU Helper class to handle information needed to display 3D board.
Definition: cinfo3d_visu.h:70
void SetCurWindowSize(const wxSize &aSize) override
SetCurWindowSize - Before each render, the canvas will tell the render what is the size of its window...
void render_solder_mask_layer(PCB_LAYER_ID aLayerID, float aZPosition, bool aIsRenderingOnPreviewMode)
bool Have_opaque() const
Have_opaque - return true if have opaque meshs to render.
void reload(REPORTER *aStatusTextReporter)
bool Redraw(bool aIsMoving, REPORTER *aStatusTextReporter) override
Redraw - Ask to redraw the view.
wxSize m_windowSize
The window size that this camera is working.
MODULE_ATTR_T
Enum MODULE_ATTR_T is the set of attributes allowed within a MODULE, using MODULE::SetAttributes() an...
Definition: class_module.h:73
float GetLayerTopZpos3DU(PCB_LAYER_ID aLayerId) const
GetLayerTopZpos3DU - Get the top z position.
Definition: cinfo3d_visu.h:280
float GetEpoxyThickness3DU() const
GetEpoxyThickness3DU - Get the current epoxy thickness.
Definition: cinfo3d_visu.h:153
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_through_holes_vias_outer
void DrawAllCameraCulled(float zCameraPos, bool aDrawMiddle=true) const
DrawAllCameraCulled - Draw all layers if they are visible by the camera.
SFVEC3D m_SolderPasteColor
in realistic mode: solder paste color
Definition: cinfo3d_visu.h:501
#define _(s)
std::unique_ptr< BUSY_INDICATOR > CreateBusyIndicator() const
Return a created busy indicator, if a factory has been set, else a null pointer.
SFVEC3F GetColor(COLOR4D aColor) const
GetColor.
SFVEC3D m_SolderMaskColor
in realistic mode: solder mask color
Definition: cinfo3d_visu.h:500
GRID3D_TYPE
Grid types.
Definition: 3d_enums.h:71
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_via
GLuint m_ogl_disp_list_grid
oGL list that stores current grid
void DrawAll(bool aDrawMiddle=true) const
DrawAll - This function calls all the display lists.
MAP_OGL_DISP_LISTS m_ogl_disp_lists_layers_holes_inner
The CLAYERS_OGL_DISP_LISTS class stores the openGL display lists to related with a layer.
#define SIZE_OF_CIRCLE_TEXTURE
bool Have_transparent() const
Have_transparent - return true if have transparent meshs to render.
SFVEC3D m_SilkScreenColor
in realistic mode: SilkScreen color
Definition: cinfo3d_visu.h:502
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_through_holes_outer_with_npth
std::list< MODULE_3D_SETTINGS > & Models()
Definition: class_module.h:183
const int scale
const glm::mat4 & GetViewMatrix() const
Definition: ccamera.cpp:389
bool m_reloadRequested
!TODO: this must be reviewed in order to flag change types
#define max(a, b)
Definition: auxiliary.h:86
void Draw_opaque() const
Draw_opaque - render the model into the current context.
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47
void Draw_bboxes() const
Draw_bboxes - draw individual bounding boxes of each mesh.
void SetItIsTransparent(bool aSetTransparent)
SFVEC3F SphericalToCartesian(float aInclination, float aAzimuth)
SphericalToCartesian.
Definition: 3d_math.h:43
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_board
implements generic openGL functions that are common to any openGL target
const glm::mat4 & GetProjectionMatrix() const
Definition: ccamera.cpp:359
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.
Defines math related functions.
Class CIMAGE manages a 8-bit channel image.
Definition: cimage.h:86
Module description (excepted pads)
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_vias_and_pad_holes_outer_contourn_and_caps
void Draw_bbox() const
Draw_bbox - draw main bounding box of the model.
void set_layer_material(PCB_LAYER_ID aLayerID)
bool ShouldModuleBeDisplayed(MODULE_ATTR_T aModuleAttributs) const
ShouldModuleBeDisplayed - Test if module should be displayed in relation to attributs and the flags.
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_pads_holes
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
SFVEC3F get_layer_color(PCB_LAYER_ID aLayerID)
const wxPoint GetPosition() const override
Definition: class_module.h:188
float GetModulesZcoord3DIU(bool aIsFlipped) const
GetModulesZcoord3DIU - Get the position of the module in 3d integer units considering if it is flippe...
void EfxFilter(CIMAGE *aInImg, E_FILTER aFilterType)
Function EfxFilter apply a filter to the input image and stores it in the image class this <- FilterT...
Definition: cimage.cpp:469
#define min(a, b)
Definition: auxiliary.h:85
void OGL_draw_arrow(SFVEC3F aPosition, SFVEC3F aTargetPos, float aSize)
OGL_draw_arrow - draw a round arrow.
This is a base class to hold data and functions for render targets.