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 
179  memset( &m_materials, 0, sizeof( m_materials ) );
180 
182  {
183  // http://devernay.free.fr/cours/opengl/materials.html
184 
185  // Copper material mixed with the copper color
186  m_materials.m_Copper.m_Ambient = SFVEC3F( m_settings.m_CopperColor.r * 0.1f,
187  m_settings.m_CopperColor.g * 0.1f,
188  m_settings.m_CopperColor.b * 0.1f);
189 
190  m_materials.m_Copper.m_Specular = SFVEC3F( m_settings.m_CopperColor.r * 0.75f + 0.25f,
191  m_settings.m_CopperColor.g * 0.75f + 0.25f,
192  m_settings.m_CopperColor.b * 0.75f + 0.25f );
193 
194  // This guess the material type(ex: copper vs gold) to determine the
195  // shininess factor between 0.1 and 0.4
196  float shininessfactor = 0.40f - mapf( fabs( m_settings.m_CopperColor.r -
198  0.15f, 1.00f,
199  0.00f, 0.30f );
200 
201  m_materials.m_Copper.m_Shininess = shininessfactor * 128.0f;
202 
203 
204  // Paste material mixed with paste color
205  m_materials.m_Paste.m_Ambient = SFVEC3F( m_settings.m_SolderPasteColor.r,
208 
209  m_materials.m_Paste.m_Specular = SFVEC3F( m_settings.m_SolderPasteColor.r *
215 
216  m_materials.m_Paste.m_Shininess = 0.1f * 128.0f;
217 
218 
219  // Silk screen material mixed with silk screen color
220  m_materials.m_SilkS.m_Ambient = SFVEC3F( m_settings.m_SilkScreenColor.r,
223 
224  m_materials.m_SilkS.m_Specular = SFVEC3F( m_settings.m_SilkScreenColor.r *
225  m_settings.m_SilkScreenColor.r + 0.10f,
227  m_settings.m_SilkScreenColor.g + 0.10f,
229  m_settings.m_SilkScreenColor.b + 0.10f );
230 
231  m_materials.m_SilkS.m_Shininess = 0.078125f * 128.0f;
232 
233 
234  // Solder mask material mixed with solder mask color
235  m_materials.m_SolderMask.m_Ambient = SFVEC3F( m_settings.m_SolderMaskColor.r * 0.3f,
236  m_settings.m_SolderMaskColor.g * 0.3f,
237  m_settings.m_SolderMaskColor.b * 0.3f );
238 
239  m_materials.m_SolderMask.m_Specular = SFVEC3F( m_settings.m_SolderMaskColor.r *
245 
246  m_materials.m_SolderMask.m_Shininess = 0.8f * 128.0f;
247  m_materials.m_SolderMask.m_Transparency = 0.17f;
248 
249 
250  // Epoxy material
251  m_materials.m_EpoxyBoard.m_Ambient = SFVEC3F( 117.0f / 255.0f,
252  97.0f / 255.0f,
253  47.0f / 255.0f );
254 
255  m_materials.m_EpoxyBoard.m_Diffuse = m_settings.m_BoardBodyColor;
256 
257  m_materials.m_EpoxyBoard.m_Specular = SFVEC3F( 18.0f / 255.0f,
258  3.0f / 255.0f,
259  20.0f / 255.0f );
260 
261  m_materials.m_EpoxyBoard.m_Shininess = 0.1f * 128.0f;
262  }
263  else // Technical Mode
264  {
265  const SFVEC3F matAmbientColor = SFVEC3F( 0.10f );
266  const SFVEC3F matSpecularColor = SFVEC3F( 0.10f );
267  const float matShininess = 0.1f * 128.0f;
268 
269  // Copper material
270  m_materials.m_Copper.m_Ambient = matAmbientColor;
271  m_materials.m_Copper.m_Specular = matSpecularColor;
272  m_materials.m_Copper.m_Shininess = matShininess;
273 
274  // Paste material
275  m_materials.m_Paste.m_Ambient = matAmbientColor;
276  m_materials.m_Paste.m_Specular = matSpecularColor;
277  m_materials.m_Paste.m_Shininess = matShininess;
278 
279  // Silk screen material
280  m_materials.m_SilkS.m_Ambient = matAmbientColor;
281  m_materials.m_SilkS.m_Specular = matSpecularColor;
282  m_materials.m_SilkS.m_Shininess = matShininess;
283 
284  // Solder mask material
285  m_materials.m_SolderMask.m_Ambient = matAmbientColor;
286  m_materials.m_SolderMask.m_Specular = matSpecularColor;
287  m_materials.m_SolderMask.m_Shininess = matShininess;
288  m_materials.m_SolderMask.m_Transparency = 0.17f;
289 
290  // Epoxy material
291  m_materials.m_EpoxyBoard.m_Ambient = matAmbientColor;
292  m_materials.m_EpoxyBoard.m_Diffuse = m_settings.m_BoardBodyColor;
293  m_materials.m_EpoxyBoard.m_Specular = matSpecularColor;
294  m_materials.m_EpoxyBoard.m_Shininess = matShininess;
295 
296  // Gray material (used for example in technical vias and pad holes)
297  m_materials.m_GrayMaterial.m_Ambient = SFVEC3F( 0.8f, 0.8f, 0.8f );
298  m_materials.m_GrayMaterial.m_Diffuse = SFVEC3F( 0.3f, 0.3f, 0.3f );
299  m_materials.m_GrayMaterial.m_Specular = SFVEC3F( 0.4f, 0.4f, 0.4f );
300  m_materials.m_GrayMaterial.m_Shininess = 0.01f * 128.0f;
301  }
302 }
303 
304 
306 {
307  switch( aLayerID )
308  {
309  case B_Mask:
310  case F_Mask:
311  m_materials.m_SolderMask.m_Diffuse = get_layer_color( aLayerID );
312  OGL_SetMaterial( m_materials.m_SolderMask );
313  break;
314 
315  case B_Paste:
316  case F_Paste:
317  m_materials.m_Paste.m_Diffuse = get_layer_color( aLayerID );
318  OGL_SetMaterial( m_materials.m_Paste );
319  break;
320 
321  case B_SilkS:
322  case F_SilkS:
323  m_materials.m_SilkS.m_Diffuse = get_layer_color( aLayerID );
324  OGL_SetMaterial( m_materials.m_SilkS );
325  break;
326 
327  case B_Adhes:
328  case F_Adhes:
329  case Dwgs_User:
330  case Cmts_User:
331  case Eco1_User:
332  case Eco2_User:
333  case Edge_Cuts:
334  case Margin:
335  case B_CrtYd:
336  case F_CrtYd:
337  case B_Fab:
338  case F_Fab:
339  m_materials.m_Plastic.m_Diffuse = get_layer_color( aLayerID );
340  m_materials.m_Plastic.m_Ambient = SFVEC3F(
341  m_materials.m_Plastic.m_Diffuse.r * 0.05f,
342  m_materials.m_Plastic.m_Diffuse.g * 0.05f,
343  m_materials.m_Plastic.m_Diffuse.b * 0.05f );
344 
345  m_materials.m_Plastic.m_Specular = SFVEC3F(
346  m_materials.m_Plastic.m_Diffuse.r * 0.7f,
347  m_materials.m_Plastic.m_Diffuse.g * 0.7f,
348  m_materials.m_Plastic.m_Diffuse.b * 0.7f );
349 
350  m_materials.m_Plastic.m_Shininess = 0.078125f * 128.0f;
351  OGL_SetMaterial( m_materials.m_Plastic );
352  break;
353 
354  default:
355  m_materials.m_Copper.m_Diffuse = get_layer_color( aLayerID );
356  OGL_SetMaterial( m_materials.m_Copper );
357 
358  break;
359  }
360 }
361 
362 
364 {
365  SFVEC3F layerColor = m_settings.GetLayerColor( aLayerID );
366 
368  {
369  switch( aLayerID )
370  {
371  case B_Adhes:
372  case F_Adhes:
373  break;
374 
375  case B_Mask:
376  case F_Mask:
377  layerColor = m_settings.m_SolderMaskColor;
378  break;
379 
380  case B_Paste:
381  case F_Paste:
382  layerColor = m_settings.m_SolderPasteColor;
383  break;
384 
385  case B_SilkS:
386  case F_SilkS:
387  layerColor = m_settings.m_SilkScreenColor;
388  break;
389 
390  case Dwgs_User:
391  case Cmts_User:
392  case Eco1_User:
393  case Eco2_User:
394  case Edge_Cuts:
395  case Margin:
396  break;
397 
398  case B_CrtYd:
399  case F_CrtYd:
400  break;
401 
402  case B_Fab:
403  case F_Fab:
404  break;
405 
406  default:
407  layerColor = m_settings.m_CopperColor;
408  break;
409  }
410  }
411 
412  return layerColor;
413 }
414 
415 void init_lights(void)
416 {
417  // Setup light
418  // https://www.opengl.org/sdk/docs/man2/xhtml/glLight.xml
419  // /////////////////////////////////////////////////////////////////////////
420  const GLfloat ambient[] = { 0.084f, 0.084f, 0.084f, 1.0f };
421  const GLfloat diffuse0[] = { 0.3f, 0.3f, 0.3f, 1.0f };
422  const GLfloat specular0[] = { 0.5f, 0.5f, 0.5f, 1.0f };
423 
424  glLightfv( GL_LIGHT0, GL_AMBIENT, ambient );
425  glLightfv( GL_LIGHT0, GL_DIFFUSE, diffuse0 );
426  glLightfv( GL_LIGHT0, GL_SPECULAR, specular0 );
427 
428  const GLfloat diffuse12[] = { 0.7f, 0.7f, 0.7f, 1.0f };
429  const GLfloat specular12[] = { 0.7f, 0.7f, 0.7f, 1.0f };
430 
431  // defines a directional light that points along the negative z-axis
432  GLfloat position[4] = { 0.0f, 0.0f, 1.0f, 0.0f };
433 
434  // This makes a vector slight not perpendicular with XZ plane
435  const SFVEC3F vectorLight = SphericalToCartesian( glm::pi<float>() * 0.03f,
436  glm::pi<float>() * 0.25f );
437 
438  position[0] = vectorLight.x;
439  position[1] = vectorLight.y;
440  position[2] = vectorLight.z;
441 
442  glLightfv( GL_LIGHT1, GL_AMBIENT, ambient );
443  glLightfv( GL_LIGHT1, GL_DIFFUSE, diffuse12 );
444  glLightfv( GL_LIGHT1, GL_SPECULAR, specular12 );
445  glLightfv( GL_LIGHT1, GL_POSITION, position );
446 
447 
448  // defines a directional light that points along the positive z-axis
449  position[2] = -position[2];
450 
451  glLightfv( GL_LIGHT2, GL_AMBIENT, ambient );
452  glLightfv( GL_LIGHT2, GL_DIFFUSE, diffuse12 );
453  glLightfv( GL_LIGHT2, GL_SPECULAR, specular12 );
454  glLightfv( GL_LIGHT2, GL_POSITION, position );
455 
456  const GLfloat lmodel_ambient[] = { 0.0f, 0.0f, 0.0f, 1.0f };
457 
458  glLightModelfv( GL_LIGHT_MODEL_AMBIENT, lmodel_ambient );
459 
460  glLightModeli( GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE );
461 }
462 
463 
464 bool C3D_RENDER_OGL_LEGACY::Redraw( bool aIsMoving,
465  REPORTER *aStatusTextReporter )
466 {
467  // Initialize openGL
469  {
470  if( !initializeOpenGL() )
471  return false;
472  }
473 
474  if( m_reloadRequested )
475  {
476  wxBusyCursor dummy;
477 
478  if( aStatusTextReporter )
479  aStatusTextReporter->Report( _( "Loading..." ) );
480 
481  reload( aStatusTextReporter );
482  setupMaterials();
483 
484  // generate a new 3D grid as the size of the board may had changed
487  }
488  else
489  {
490  // Check if grid was changed
492  {
493  // and generate a new one
496  }
497  }
498 
499  // Initial setup
500  // /////////////////////////////////////////////////////////////////////////
501  glDepthFunc( GL_LESS );
502  glEnable( GL_CULL_FACE );
503  glFrontFace( GL_CCW ); // This is the openGL default
504  glEnable( GL_NORMALIZE ); // This allow openGL to normalize the normals after transformations
505 
506  glViewport( 0, 0, m_windowSize.x, m_windowSize.y );
507 
508 
509  // clear color and depth buffers
510  // /////////////////////////////////////////////////////////////////////////
511  glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
512  glClearDepth( 1.0f );
513  glClearStencil( 0x00 );
514  glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
515 
516 
517  // Draw the background ( rectangle with color gradient)
518  // /////////////////////////////////////////////////////////////////////////
521 
522  glEnable( GL_DEPTH_TEST );
523 
524 
525  // Set projection and modelview matrixes
526  // /////////////////////////////////////////////////////////////////////////
527  glMatrixMode( GL_PROJECTION );
528  glLoadMatrixf( glm::value_ptr( m_settings.CameraGet().GetProjectionMatrix() ) );
529 
530  glMatrixMode( GL_MODELVIEW );
531  glLoadIdentity();
532  glLoadMatrixf( glm::value_ptr( m_settings.CameraGet().GetViewMatrix() ) );
533 
534 
535  // Position the headlight
536  // /////////////////////////////////////////////////////////////////////////
537 
538  setLight_Front( true );
539  setLight_Top( true );
540  setLight_Bottom( true );
541 
542  glEnable( GL_LIGHTING );
543 
544  {
545  const SFVEC3F &cameraPos = m_settings.CameraGet().GetPos();
546 
547  // Place the light at a minimun Z so the diffuse factor will not drop
548  // and the board will still look with good light.
549  float zpos;
550 
551  if( cameraPos.z > 0.0f )
552  {
553  zpos = glm::max( cameraPos.z, 0.5f ) + cameraPos.z * cameraPos.z;
554  }
555  else
556  {
557  zpos = glm::min( cameraPos.z,-0.5f ) - cameraPos.z * cameraPos.z;
558  }
559 
560  const GLfloat headlight_pos[] = { cameraPos.x,
561  cameraPos.y,
562  zpos,
563  1.0f }; // This is a point light
564 
565  glLightfv( GL_LIGHT0, GL_POSITION, headlight_pos );
566  }
567 
568 
569  // Display board body
570  // /////////////////////////////////////////////////////////////////////////
572  {
574  {
577 
578  OGL_SetMaterial( m_materials.m_EpoxyBoard );
579 
581 
583  {
587 
590  NULL );
591  }
592  else
593  {
595  }
596  }
597  }
598 
599 
601  {
602  // Draw vias and pad holes with copper material
604  }
605  else
606  {
607  OGL_SetMaterial( m_materials.m_GrayMaterial );
608  }
609 
610  if( m_ogl_disp_list_via )
611  {
613  }
614 
616  {
618  }
619 
620 
621  // Display copper and tech layers
622  // /////////////////////////////////////////////////////////////////////////
623  for( MAP_OGL_DISP_LISTS::const_iterator ii = m_ogl_disp_lists_layers.begin();
624  ii != m_ogl_disp_lists_layers.end();
625  ++ii )
626  {
627 
628  const PCB_LAYER_ID layer_id = (PCB_LAYER_ID)(ii->first);
629 
630  // Mask kayers are not processed here because they are a special case
631  if( (layer_id == B_Mask) || (layer_id == F_Mask) )
632  continue;
633 
634  // Do not show inner layers when it is displaying the board
636  {
637  if( (layer_id > F_Cu) && (layer_id < B_Cu) )
638  continue;
639  }
640 
641  glPushMatrix();
642 
643  // !TODO: if we want to increase the separation between layers
644  //glScalef( 1.0f, 1.0f, 3.0f );
645 
646 
647  CLAYERS_OGL_DISP_LISTS *pLayerDispList = static_cast<CLAYERS_OGL_DISP_LISTS*>(ii->second);
648  set_layer_material( layer_id );
649 
652  pLayerDispList->GetZBot(),
653  pLayerDispList->GetZTop() - pLayerDispList->GetZBot() );
654 
655  if( (layer_id >= F_Cu) && (layer_id <= B_Cu) )
656  {
657  if( m_ogl_disp_lists_layers_holes_outer.find( layer_id ) !=
659  {
660  const CLAYERS_OGL_DISP_LISTS* viasHolesLayer =
662 
663  wxASSERT( viasHolesLayer != NULL );
664 
665  if( viasHolesLayer != NULL )
666  {
667  pLayerDispList->DrawAllCameraCulledSubtractLayer(
669  viasHolesLayer,
670  (aIsMoving == false) );
671  }
672  }
673  else
674  {
675  pLayerDispList->DrawAllCameraCulledSubtractLayer(
677  NULL,
678  (aIsMoving == false) );
679  }
680  }
681  else
682  {
683  pLayerDispList->DrawAllCameraCulled( m_settings.CameraGet().GetPos().z,
684  (aIsMoving == false) );
685  }
686 
687  glPopMatrix();
688  }
689 
690 
691  // Render 3D Models (Non-transparent)
692  // /////////////////////////////////////////////////////////////////////////
693 
694  //setLight_Top( false );
695  //setLight_Bottom( true );
696  render_3D_models( false, false );
697 
698  //setLight_Top( true );
699  //setLight_Bottom( false );
700  render_3D_models( true, false );
701 
702 
703  // Display transparent mask layers
704  // /////////////////////////////////////////////////////////////////////////
706  {
707  //setLight_Top( true );
708  //setLight_Bottom( true );
709 
710  if( m_settings.CameraGet().GetPos().z > 0 )
711  {
713  aIsMoving );
714 
716  aIsMoving );
717  }
718  else
719  {
721  aIsMoving );
722 
724  aIsMoving );
725  }
726  }
727 
728 
729  // Render 3D Models (Transparent)
730  // /////////////////////////////////////////////////////////////////////////
731 
732  //setLight_Top( false );
733  //setLight_Bottom( true );
734  render_3D_models( false, true );
735 
736  //setLight_Top( true );
737  //setLight_Bottom( false );
738  render_3D_models( true, true );
739 
740 
741  // Render Grid
742  // /////////////////////////////////////////////////////////////////////////
743 
744  if( m_settings.GridGet() != GRID3D_NONE )
745  {
746  glDisable( GL_LIGHTING );
747 
748  if( glIsList( m_ogl_disp_list_grid ) )
749  glCallList( m_ogl_disp_list_grid );
750 
751  glEnable( GL_LIGHTING );
752  }
753 
754 
755  // Render 3D arrows
756  // /////////////////////////////////////////////////////////////////////////
757  if( m_settings.GetFlag( FL_AXIS ) )
759 
760  // Return back to the original viewport (this is important if we want
761  // to take a screenshot after the render)
762  // /////////////////////////////////////////////////////////////////////////
763  glViewport( 0, 0, m_windowSize.x, m_windowSize.y );
764 
765  return false;
766 }
767 
768 
770 {
771  glEnable( GL_LINE_SMOOTH );
772  glShadeModel( GL_SMOOTH );
773 
774  // 4-byte pixel alignment
775  glPixelStorei( GL_UNPACK_ALIGNMENT, 4 );
776 
777  // Initialize the open GL texture to draw the filled semi-circle of the segments
779 
780  if( !circleImage )
781  return false;
782 
783  circleImage->CircleFilled( (SIZE_OF_CIRCLE_TEXTURE / 2) - 0,
784  (SIZE_OF_CIRCLE_TEXTURE / 2) - 0,
785  (SIZE_OF_CIRCLE_TEXTURE / 2) - 4,
786  0xFF );
787 
788  //circleImage->CircleFilled( (SIZE_OF_CIRCLE_TEXTURE / 4)*1.5f - 1,
789  // (SIZE_OF_CIRCLE_TEXTURE / 4)*1.5f - 1,
790  // (SIZE_OF_CIRCLE_TEXTURE / 4)*1.5f - 2, 0xFF );
791 
792  CIMAGE *circleImage_Copy = new CIMAGE( *circleImage );
793 
794  circleImage->EfxFilter( circleImage_Copy, FILTER_BLUR_3X3 );
795 
796  m_ogl_circle_texture = OGL_LoadTexture( *circleImage );
797 
798  //circleImage_Copy->SaveAsPNG("circleImage.png");
799  delete circleImage_Copy;
800  circleImage_Copy = 0;
801 
802  //circleImage->SaveAsPNG("circleImage_blured.png");
803  delete circleImage;
804  circleImage = 0;
805 
806  init_lights();
807 
808  // Use this mode if you want see the triangle lines (debug proposes)
809  //glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
810 
812 
813  return true;
814 }
815 
816 
818 {
819  glEnable( GL_COLOR_MATERIAL );
820  glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
821 
822  const SFVEC4F ambient = SFVEC4F( 0.0f, 0.0f, 0.0f, 1.0f );
823  const SFVEC4F diffuse = SFVEC4F( 0.0f, 0.0f, 0.0f, 1.0f );
824  const SFVEC4F emissive = SFVEC4F( 0.0f, 0.0f, 0.0f, 1.0f );
825  const SFVEC4F specular = SFVEC4F( 0.1f, 0.1f, 0.1f, 1.0f );
826 
827  glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR, &specular.r );
828  glMaterialf( GL_FRONT_AND_BACK, GL_SHININESS, 96.0f );
829 
830  glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT, &ambient.r );
831  glMaterialfv( GL_FRONT_AND_BACK, GL_DIFFUSE, &diffuse.r );
832  glMaterialfv( GL_FRONT_AND_BACK, GL_EMISSION, &emissive.r );
833 }
834 
835 
837 {
838  if( glIsList( m_ogl_disp_list_grid ) )
839  glDeleteLists( m_ogl_disp_list_grid, 1 );
840 
842 
843  for( MAP_OGL_DISP_LISTS::const_iterator ii = m_ogl_disp_lists_layers.begin();
844  ii != m_ogl_disp_lists_layers.end();
845  ++ii )
846  {
847  CLAYERS_OGL_DISP_LISTS *pLayerDispList = static_cast<CLAYERS_OGL_DISP_LISTS*>(ii->second);
848  delete pLayerDispList;
849  }
850 
851  m_ogl_disp_lists_layers.clear();
852 
853 
854  for( MAP_OGL_DISP_LISTS::const_iterator ii = m_ogl_disp_lists_layers_holes_outer.begin();
856  ++ii )
857  {
858  CLAYERS_OGL_DISP_LISTS *pLayerDispList = static_cast<CLAYERS_OGL_DISP_LISTS*>(ii->second);
859  delete pLayerDispList;
860  }
861 
863 
864 
865  for( MAP_OGL_DISP_LISTS::const_iterator ii = m_ogl_disp_lists_layers_holes_inner.begin();
867  ++ii )
868  {
869  CLAYERS_OGL_DISP_LISTS *pLayerDispList = static_cast<CLAYERS_OGL_DISP_LISTS*>(ii->second);
870  delete pLayerDispList;
871  }
872 
874 
875  for( MAP_TRIANGLES::const_iterator ii = m_triangles.begin();
876  ii != m_triangles.end();
877  ++ii )
878  {
879  CLAYER_TRIANGLES *pointer = static_cast<CLAYER_TRIANGLES*>(ii->second);
880  delete pointer;
881  }
882 
883  m_triangles.clear();
884 
885 
886  for( MAP_3DMODEL::const_iterator ii = m_3dmodel_map.begin();
887  ii != m_3dmodel_map.end();
888  ++ii )
889  {
890  C_OGL_3DMODEL *pointer = static_cast<C_OGL_3DMODEL*>(ii->second);
891  delete pointer;
892  }
893 
894  m_3dmodel_map.clear();
895 
896 
897  delete m_ogl_disp_list_board;
899 
902 
905 
908 
911 
912  delete m_ogl_disp_list_via;
914 
917 
920 }
921 
922 
924  float aZPosition,
925  bool aIsRenderingOnPreviewMode )
926 {
927  wxASSERT( (aLayerID == B_Mask) || (aLayerID == F_Mask) );
928 
930  {
931  if( m_ogl_disp_lists_layers.find( aLayerID ) !=
933  {
934  CLAYERS_OGL_DISP_LISTS *pLayerDispListMask = m_ogl_disp_lists_layers.at( aLayerID );
935 
938  aZPosition,
940 
942  aZPosition,
944 
945  set_layer_material( aLayerID );
946 
948 
950  pLayerDispListMask,
952  !aIsRenderingOnPreviewMode );
953  }
954  else
955  {
956  // This case there is no layer with mask, so we will render the full board as mask
957 
960  aZPosition,
962 
964  aZPosition,
966 
967  set_layer_material( aLayerID );
968 
970 
972  NULL,
974  !aIsRenderingOnPreviewMode );
975  }
976  }
977 }
978 
979 
980 void C3D_RENDER_OGL_LEGACY::render_3D_models( bool aRenderTopOrBot,
981  bool aRenderTransparentOnly )
982 {
983  // Go for all modules
985  {
986  for( const MODULE* module = m_settings.GetBoard()->m_Modules;
987  module;
988  module = module->Next() )
989  {
990  if( !module->Models().empty() )
991  if( m_settings.ShouldModuleBeDisplayed( (MODULE_ATTR_T)module->GetAttributes() ) )
992  if( ( aRenderTopOrBot && !module->IsFlipped()) ||
993  (!aRenderTopOrBot && module->IsFlipped()) )
994  render_3D_module( module, aRenderTransparentOnly );
995  }
996  }
997 }
998 
999 
1001  bool aRenderTransparentOnly )
1002 {
1003  if( !module->Models().empty() )
1004  {
1005  const double zpos = m_settings.GetModulesZcoord3DIU( module->IsFlipped() );
1006 
1007  glPushMatrix();
1008 
1009  wxPoint pos = module->GetPosition();
1010 
1011  glTranslatef( pos.x * m_settings.BiuTo3Dunits(),
1012  -pos.y * m_settings.BiuTo3Dunits(),
1013  zpos );
1014 
1015  if( module->GetOrientation() )
1016  glRotated( (double) module->GetOrientation() / 10.0, 0.0, 0.0, 1.0 );
1017 
1018  if( module->IsFlipped() )
1019  {
1020  glRotatef( 180.0f, 0.0f, 1.0f, 0.0f );
1021  glRotatef( 180.0f, 0.0f, 0.0f, 1.0f );
1022  }
1023 
1024  double modelunit_to_3d_units_factor = m_settings.BiuTo3Dunits() * UNITS3D_TO_UNITSPCB;
1025 
1026  glScaled( modelunit_to_3d_units_factor,
1027  modelunit_to_3d_units_factor,
1028  modelunit_to_3d_units_factor );
1029 
1030  // Get the list of model files for this model
1031  auto sM = module->Models().begin();
1032  auto eM = module->Models().end();
1033 
1034  while( sM != eM )
1035  {
1036  if( !sM->m_Filename.empty() )
1037  {
1038  // Check if the model is present in our cache map
1039  if( m_3dmodel_map.find( sM->m_Filename ) != m_3dmodel_map.end() )
1040  {
1041  // It is not present, try get it from cache
1042  const C_OGL_3DMODEL *modelPtr = m_3dmodel_map[ sM->m_Filename ];
1043 
1044  if( modelPtr )
1045  {
1046  if( ( (!aRenderTransparentOnly) && modelPtr->Have_opaque() ) ||
1047  ( aRenderTransparentOnly && modelPtr->Have_transparent() ) )
1048  {
1049  glPushMatrix();
1050 
1051  glTranslatef( sM->m_Offset.x, sM->m_Offset.y, sM->m_Offset.z );
1052 
1053  glRotatef( -sM->m_Rotation.z, 0.0f, 0.0f, 1.0f );
1054  glRotatef( -sM->m_Rotation.y, 0.0f, 1.0f, 0.0f );
1055  glRotatef( -sM->m_Rotation.x, 1.0f, 0.0f, 0.0f );
1056 
1057  glScalef( sM->m_Scale.x, sM->m_Scale.y, sM->m_Scale.z );
1058 
1059  if( aRenderTransparentOnly )
1060  modelPtr->Draw_transparent();
1061  else
1062  modelPtr->Draw_opaque();
1063 
1065  {
1066  glEnable( GL_BLEND );
1067  glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
1068 
1069  glLineWidth( 1 );
1070  modelPtr->Draw_bboxes();
1071 
1072  glDisable( GL_LIGHTING );
1073 
1074  glColor4f( 0.0f, 1.0f, 0.0f, 1.0f );
1075 
1076  glLineWidth( 4 );
1077  modelPtr->Draw_bbox();
1078 
1079  glEnable( GL_LIGHTING );
1080  }
1081 
1082  glPopMatrix();
1083  }
1084  }
1085  }
1086  }
1087 
1088  ++sM;
1089  }
1090 
1091  glPopMatrix();
1092  }
1093 }
1094 
1095 
1096 // create a 3D grid to an openGL display list: an horizontal grid (XY plane and Z = 0,
1097 // and a vertical grid (XZ plane and Y = 0)
1099 {
1100  if( glIsList( m_ogl_disp_list_grid ) )
1101  glDeleteLists( m_ogl_disp_list_grid, 1 );
1102 
1104 
1105  if( aGridType == GRID3D_NONE )
1106  return;
1107 
1108  m_ogl_disp_list_grid = glGenLists( 1 );
1109 
1110  if( !glIsList( m_ogl_disp_list_grid ) )
1111  return;
1112 
1113  glNewList( m_ogl_disp_list_grid, GL_COMPILE );
1114 
1115  glEnable( GL_BLEND );
1116  glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
1117 
1118  const double zpos = 0.0;
1119 
1120  // Color of grid lines
1121  const SFVEC3F gridColor = m_settings.GetColor( DARKGRAY );
1122 
1123  // Color of grid lines every 5 lines
1124  const SFVEC3F gridColor_marker = m_settings.GetColor( LIGHTGRAY );
1125  const double scale = m_settings.BiuTo3Dunits();
1126  const double transparency = 0.35;
1127 
1128  double griSizeMM = 0.0;
1129 
1130  switch( aGridType )
1131  {
1132  default:
1133  case GRID3D_NONE:
1134  return;
1135  case GRID3D_1MM:
1136  griSizeMM = 1.0;
1137  break;
1138  case GRID3D_2P5MM:
1139  griSizeMM = 2.5;
1140  break;
1141  case GRID3D_5MM:
1142  griSizeMM = 5.0;
1143  break;
1144  case GRID3D_10MM:
1145  griSizeMM = 10.0;
1146  break;
1147  }
1148 
1149  glNormal3f( 0.0, 0.0, 1.0 );
1150 
1151  const wxSize brd_size = m_settings.GetBoardSizeBIU();
1152  wxPoint brd_center_pos = m_settings.GetBoardPosBIU();
1153 
1154  brd_center_pos.y = -brd_center_pos.y;
1155 
1156  const int xsize = std::max( brd_size.x, Millimeter2iu( 100 ) ) * 1.2;
1157  const int ysize = std::max( brd_size.y, Millimeter2iu( 100 ) ) * 1.2;
1158 
1159  // Grid limits, in 3D units
1160  double xmin = (brd_center_pos.x - xsize / 2) * scale;
1161  double xmax = (brd_center_pos.x + xsize / 2) * scale;
1162  double ymin = (brd_center_pos.y - ysize / 2) * scale;
1163  double ymax = (brd_center_pos.y + ysize / 2) * scale;
1164  double zmin = Millimeter2iu( -50 ) * scale;
1165  double zmax = Millimeter2iu( 100 ) * scale;
1166 
1167  // Draw horizontal grid centered on 3D origin (center of the board)
1168  for( int ii = 0; ; ii++ )
1169  {
1170  if( (ii % 5) )
1171  glColor4f( gridColor.r, gridColor.g, gridColor.b, transparency );
1172  else
1173  glColor4f( gridColor_marker.r,
1174  gridColor_marker.g,
1175  gridColor_marker.b,
1176  transparency );
1177 
1178  const int delta = KiROUND( ii * griSizeMM * IU_PER_MM );
1179 
1180  if( delta <= xsize / 2 ) // Draw grid lines parallel to X axis
1181  {
1182  glBegin( GL_LINES );
1183  glVertex3f( (brd_center_pos.x + delta) * scale, -ymin, zpos );
1184  glVertex3f( (brd_center_pos.x + delta) * scale, -ymax, zpos );
1185  glEnd();
1186 
1187  if( ii != 0 )
1188  {
1189  glBegin( GL_LINES );
1190  glVertex3f( (brd_center_pos.x - delta) * scale, -ymin, zpos );
1191  glVertex3f( (brd_center_pos.x - delta) * scale, -ymax, zpos );
1192  glEnd();
1193  }
1194  }
1195 
1196  if( delta <= ysize / 2 ) // Draw grid lines parallel to Y axis
1197  {
1198  glBegin( GL_LINES );
1199  glVertex3f( xmin, -(brd_center_pos.y + delta) * scale, zpos );
1200  glVertex3f( xmax, -(brd_center_pos.y + delta) * scale, zpos );
1201  glEnd();
1202 
1203  if( ii != 0 )
1204  {
1205  glBegin( GL_LINES );
1206  glVertex3f( xmin, -(brd_center_pos.y - delta) * scale, zpos );
1207  glVertex3f( xmax, -(brd_center_pos.y - delta) * scale, zpos );
1208  glEnd();
1209  }
1210  }
1211 
1212  if( ( delta > ysize / 2 ) && ( delta > xsize / 2 ) )
1213  break;
1214  }
1215 
1216  // Draw vertical grid on Z axis
1217  glNormal3f( 0.0, -1.0, 0.0 );
1218 
1219  // Draw vertical grid lines (parallel to Z axis)
1220  double posy = -brd_center_pos.y * scale;
1221 
1222  for( int ii = 0; ; ii++ )
1223  {
1224  if( (ii % 5) )
1225  glColor4f( gridColor.r, gridColor.g, gridColor.b, transparency );
1226  else
1227  glColor4f( gridColor_marker.r,
1228  gridColor_marker.g,
1229  gridColor_marker.b,
1230  transparency );
1231 
1232  const double delta = ii * griSizeMM * IU_PER_MM;
1233 
1234  glBegin( GL_LINES );
1235  xmax = (brd_center_pos.x + delta) * scale;
1236 
1237  glVertex3f( xmax, posy, zmin );
1238  glVertex3f( xmax, posy, zmax );
1239  glEnd();
1240 
1241  if( ii != 0 )
1242  {
1243  glBegin( GL_LINES );
1244  xmin = (brd_center_pos.x - delta) * scale;
1245  glVertex3f( xmin, posy, zmin );
1246  glVertex3f( xmin, posy, zmax );
1247  glEnd();
1248  }
1249 
1250  if( delta > xsize / 2.0f )
1251  break;
1252  }
1253 
1254  // Draw horizontal grid lines on Z axis (parallel to X axis)
1255  for( int ii = 0; ; ii++ )
1256  {
1257  if( (ii % 5) )
1258  glColor4f( gridColor.r, gridColor.g, gridColor.b, transparency );
1259  else
1260  glColor4f( gridColor_marker.r,
1261  gridColor_marker.g,
1262  gridColor_marker.b,
1263  transparency );
1264 
1265  const double delta = ii * griSizeMM * IU_PER_MM * scale;
1266 
1267  if( delta <= zmax )
1268  {
1269  // Draw grid lines on Z axis (positive Z axis coordinates)
1270  glBegin( GL_LINES );
1271  glVertex3f( xmin, posy, delta );
1272  glVertex3f( xmax, posy, delta );
1273  glEnd();
1274  }
1275 
1276  if( delta <= -zmin && ( ii != 0 ) )
1277  {
1278  // Draw grid lines on Z axis (negative Z axis coordinates)
1279  glBegin( GL_LINES );
1280  glVertex3f( xmin, posy, -delta );
1281  glVertex3f( xmax, posy, -delta );
1282  glEnd();
1283  }
1284 
1285  if( ( delta > zmax ) && ( delta > -zmin ) )
1286  break;
1287  }
1288 
1289  glDisable( GL_BLEND );
1290 
1291  glEndList();
1292 }
MAP_OGL_DISP_LISTS m_ogl_disp_lists_layers
GRID3D_TYPE GridGet() const
GridGet - get the current grid.
Definition: cinfo3d_visu.h:216
void generate_new_3DGrid(GRID3D_TYPE aGridType)
SFVEC3F GetLayerColor(PCB_LAYER_ID aLayerId) const
GetLayerColor - get the technical color of a layer.
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:106
Implementation of conversion functions that require both schematic and board internal units...
SFVEC3D m_CopperColor
in realistic mode: copper color
Definition: cinfo3d_visu.h:509
MAP_OGL_DISP_LISTS m_ogl_disp_lists_layers_holes_outer
bool Have_transparent() const
Have_transparent - return true if have transparent meshs to render.
void render_3D_models(bool aRenderTopOrBot, bool aRenderTransparentOnly)
render_3D_models
glm::vec4 SFVEC4F
Definition: xv3d_types.h:49
Class BOARD to handle a board.
float GetNonCopperLayerThickness3DU() const
GetNonCopperLayerThickness3DU - Get the current non copper layers thickness.
Definition: cinfo3d_visu.h:159
MODULE * Next() const
Definition: class_module.h:121
const glm::mat4 & GetProjectionMatrix() const
Definition: ccamera.cpp:359
float mapf(float x, float in_min, float in_max, float out_min, float out_max)
Definition: 3d_math.h:136
void init_lights(void)
struct C3D_RENDER_OGL_LEGACY::@28 m_materials
#define RANGE_SCALE_3D
This defines the range that all coord will have to be rendered.
Definition: cinfo3d_visu.h:63
const glm::mat4 & GetViewMatrix() const
Definition: ccamera.cpp:389
void Draw_transparent() const
Draw_transparent - render the model into the current context.
void Draw_opaque() const
Draw_opaque - render the model into the current context.
SFVEC3D m_BgColorBot
background bottom color
Definition: cinfo3d_visu.h:503
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:168
CINFO3D_VISU & m_settings
settings refrence in use for this render
void Draw_bbox() const
Draw_bbox - draw main bounding box of the model.
float GetLayerTopZpos3DU(PCB_LAYER_ID aLayerId) const
GetLayerTopZpos3DU - Get the top z position.
Definition: cinfo3d_visu.h:280
SFVEC3D m_BgColorTop
background top color
Definition: cinfo3d_visu.h:504
void ApplyScalePosition(float aZposition, float aZscale)
static const int delta[8][2]
Definition: solve.cpp:112
void setLight_Top(bool enabled)
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
SFVEC3D m_BoardBodyColor
in realistic mode: FR4 board color
Definition: cinfo3d_visu.h:505
int GetWaitForEditingTimeOut() override
GetWaitForEditingTimeOut - Give the interface the time (in ms) that it should wait for editing or mov...
#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
void OGL_SetMaterial(const SMATERIAL &aMaterial)
OGL_SetMaterial - Set OpenGL materials.
Definition: ogl_utils.cpp:144
bool Have_opaque() const
Have_opaque - return true if have opaque meshs to render.
PCB_LAYER_ID
A quick note on layer IDs:
void setLight_Front(bool enabled)
float GetLayerBottomZpos3DU(PCB_LAYER_ID aLayerId) const
GetLayerBottomZpos3DU - Get the bottom z position.
Definition: cinfo3d_visu.h:287
void render_3D_module(const MODULE *module, bool aRenderTransparentOnly)
void setLight_Bottom(bool enabled)
double GetOrientation() const
Definition: class_module.h:187
bool m_is_opengl_initialized
flag if the opengl specific for this render was already initialized
bool IsFlipped() const
function IsFlipped
Definition: class_module.h:254
C3D_RENDER_OGL_LEGACY(CINFO3D_VISU &aSettings)
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)
void Draw_bboxes() const
Draw_bboxes - draw individual bounding boxes of each mesh.
void reload(REPORTER *aStatusTextReporter)
wxPoint GetBoardPosBIU() const
GetBoardPosBIU - Get the board size.
Definition: cinfo3d_visu.h:183
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:74
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_through_holes_vias_outer
SFVEC3D m_SolderPasteColor
in realistic mode: solder paste color
Definition: cinfo3d_visu.h:507
SFVEC3D m_SolderMaskColor
in realistic mode: solder mask color
Definition: cinfo3d_visu.h:506
SFVEC3F GetColor(COLOR4D aColor) const
GetColor.
GRID3D_TYPE
Grid types.
Definition: 3d_enums.h:71
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_via
float GetEpoxyThickness3DU() const
GetEpoxyThickness3DU - Get the current epoxy thickness.
Definition: cinfo3d_visu.h:153
GLuint m_ogl_disp_list_grid
oGL list that stores current grid
float GetModulesZcoord3DIU(bool aIsFlipped) const
GetModulesZcoord3DIU - Get the position of the module in 3d integer units considering if it is flippe...
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 GetFlag(DISPLAY3D_FLG aFlag) const
GetFlag - get a configuration status of a flag.
SFVEC3D m_SilkScreenColor
in realistic mode: SilkScreen color
Definition: cinfo3d_visu.h:508
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_through_holes_outer_with_npth
std::list< MODULE_3D_SETTINGS > & Models()
Definition: class_module.h:177
void DrawAllCameraCulledSubtractLayer(const CLAYERS_OGL_DISP_LISTS *aLayerToSubtractA, const CLAYERS_OGL_DISP_LISTS *aLayerToSubtractB, bool aDrawMiddle=true) const
const int scale
bool ShouldModuleBeDisplayed(MODULE_ATTR_T aModuleAttributs) const
ShouldModuleBeDisplayed - Test if module should be displayed in relation to attributs and the flags...
bool m_reloadRequested
!TODO: this must be reviewed in order to flag change types
void DrawAllCameraCulled(float zCameraPos, bool aDrawMiddle=true) const
DrawAllCameraCulled - Draw all layers if they are visible by the camera.
static LIB_PART * dummy()
Used when a LIB_PART is not found in library to draw a dummy shape This component is a 400 mils squar...
#define max(a, b)
Definition: auxiliary.h:86
DLIST< MODULE > m_Modules
Definition: class_board.h:247
CCAMERA & CameraGet() const
CameraGet - get current camera in use.
Definition: cinfo3d_visu.h:210
glm::vec3 SFVEC3F
Definition: xv3d_types.h:47
const glm::mat4 GetRotationMatrix() const
Function GetRotationMatrix Get the rotation matrix to be applied in a transformation camera...
Definition: ccamera.cpp:130
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
wxSize GetBoardSizeBIU() const
GetBoardSizeBIU - Get the board size.
Definition: cinfo3d_visu.h:177
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.
unsigned GetCount() const
Function GetCount returns the number of elements in the list.
Definition: dlist.h:126
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 set_layer_material(PCB_LAYER_ID aLayerID)
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_pads_holes
const SFVEC3F & GetPos() const
Definition: ccamera.h:110
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:182
const BOARD * GetBoard() const
GetBoard - Get current board to be rendered.
Definition: cinfo3d_visu.h:128
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:465
double BiuTo3Dunits() const
BiuTo3Dunits - Board integer units To 3D units.
Definition: cinfo3d_visu.h:141
void DrawAll(bool aDrawMiddle=true) const
DrawAll - This function calls all the display lists.
#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.