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  wxBusyCursor dummy;
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
984  {
985  for( const MODULE* module = m_settings.GetBoard()->m_Modules;
986  module;
987  module = module->Next() )
988  {
989  if( !module->Models().empty() )
990  if( m_settings.ShouldModuleBeDisplayed( (MODULE_ATTR_T)module->GetAttributes() ) )
991  if( ( aRenderTopOrBot && !module->IsFlipped()) ||
992  (!aRenderTopOrBot && module->IsFlipped()) )
993  render_3D_module( module, aRenderTransparentOnly );
994  }
995  }
996 }
997 
998 
1000  bool aRenderTransparentOnly )
1001 {
1002  if( !module->Models().empty() )
1003  {
1004  const double zpos = m_settings.GetModulesZcoord3DIU( module->IsFlipped() );
1005 
1006  glPushMatrix();
1007 
1008  wxPoint pos = module->GetPosition();
1009 
1010  glTranslatef( pos.x * m_settings.BiuTo3Dunits(),
1011  -pos.y * m_settings.BiuTo3Dunits(),
1012  zpos );
1013 
1014  if( module->GetOrientation() )
1015  glRotated( (double) module->GetOrientation() / 10.0, 0.0, 0.0, 1.0 );
1016 
1017  if( module->IsFlipped() )
1018  {
1019  glRotatef( 180.0f, 0.0f, 1.0f, 0.0f );
1020  glRotatef( 180.0f, 0.0f, 0.0f, 1.0f );
1021  }
1022 
1023  double modelunit_to_3d_units_factor = m_settings.BiuTo3Dunits() * UNITS3D_TO_UNITSPCB;
1024 
1025  glScaled( modelunit_to_3d_units_factor,
1026  modelunit_to_3d_units_factor,
1027  modelunit_to_3d_units_factor );
1028 
1029  // Get the list of model files for this model
1030  auto sM = module->Models().begin();
1031  auto eM = module->Models().end();
1032 
1033  while( sM != eM )
1034  {
1035  if( !sM->m_Filename.empty() )
1036  {
1037  // Check if the model is present in our cache map
1038  if( m_3dmodel_map.find( sM->m_Filename ) != m_3dmodel_map.end() )
1039  {
1040  // It is not present, try get it from cache
1041  const C_OGL_3DMODEL *modelPtr = m_3dmodel_map[ sM->m_Filename ];
1042 
1043  if( modelPtr )
1044  {
1045  if( ( (!aRenderTransparentOnly) && modelPtr->Have_opaque() ) ||
1046  ( aRenderTransparentOnly && modelPtr->Have_transparent() ) )
1047  {
1048  glPushMatrix();
1049 
1050  glTranslatef( sM->m_Offset.x, sM->m_Offset.y, sM->m_Offset.z );
1051 
1052  glRotatef( -sM->m_Rotation.z, 0.0f, 0.0f, 1.0f );
1053  glRotatef( -sM->m_Rotation.y, 0.0f, 1.0f, 0.0f );
1054  glRotatef( -sM->m_Rotation.x, 1.0f, 0.0f, 0.0f );
1055 
1056  glScalef( sM->m_Scale.x, sM->m_Scale.y, sM->m_Scale.z );
1057 
1058  if( aRenderTransparentOnly )
1059  modelPtr->Draw_transparent();
1060  else
1061  modelPtr->Draw_opaque();
1062 
1064  {
1065  glEnable( GL_BLEND );
1066  glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
1067 
1068  glLineWidth( 1 );
1069  modelPtr->Draw_bboxes();
1070 
1071  glDisable( GL_LIGHTING );
1072 
1073  glColor4f( 0.0f, 1.0f, 0.0f, 1.0f );
1074 
1075  glLineWidth( 4 );
1076  modelPtr->Draw_bbox();
1077 
1078  glEnable( GL_LIGHTING );
1079  }
1080 
1081  glPopMatrix();
1082  }
1083  }
1084  }
1085  }
1086 
1087  ++sM;
1088  }
1089 
1090  glPopMatrix();
1091  }
1092 }
1093 
1094 
1095 // create a 3D grid to an openGL display list: an horizontal grid (XY plane and Z = 0,
1096 // and a vertical grid (XZ plane and Y = 0)
1098 {
1099  if( glIsList( m_ogl_disp_list_grid ) )
1100  glDeleteLists( m_ogl_disp_list_grid, 1 );
1101 
1103 
1104  if( aGridType == GRID3D_NONE )
1105  return;
1106 
1107  m_ogl_disp_list_grid = glGenLists( 1 );
1108 
1109  if( !glIsList( m_ogl_disp_list_grid ) )
1110  return;
1111 
1112  glNewList( m_ogl_disp_list_grid, GL_COMPILE );
1113 
1114  glEnable( GL_BLEND );
1115  glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
1116 
1117  const double zpos = 0.0;
1118 
1119  // Color of grid lines
1120  const SFVEC3F gridColor = m_settings.GetColor( DARKGRAY );
1121 
1122  // Color of grid lines every 5 lines
1123  const SFVEC3F gridColor_marker = m_settings.GetColor( LIGHTGRAY );
1124  const double scale = m_settings.BiuTo3Dunits();
1125  const double transparency = 0.35;
1126 
1127  double griSizeMM = 0.0;
1128 
1129  switch( aGridType )
1130  {
1131  default:
1132  case GRID3D_NONE:
1133  return;
1134  case GRID3D_1MM:
1135  griSizeMM = 1.0;
1136  break;
1137  case GRID3D_2P5MM:
1138  griSizeMM = 2.5;
1139  break;
1140  case GRID3D_5MM:
1141  griSizeMM = 5.0;
1142  break;
1143  case GRID3D_10MM:
1144  griSizeMM = 10.0;
1145  break;
1146  }
1147 
1148  glNormal3f( 0.0, 0.0, 1.0 );
1149 
1150  const wxSize brd_size = m_settings.GetBoardSizeBIU();
1151  wxPoint brd_center_pos = m_settings.GetBoardPosBIU();
1152 
1153  brd_center_pos.y = -brd_center_pos.y;
1154 
1155  const int xsize = std::max( brd_size.x, Millimeter2iu( 100 ) ) * 1.2;
1156  const int ysize = std::max( brd_size.y, Millimeter2iu( 100 ) ) * 1.2;
1157 
1158  // Grid limits, in 3D units
1159  double xmin = (brd_center_pos.x - xsize / 2) * scale;
1160  double xmax = (brd_center_pos.x + xsize / 2) * scale;
1161  double ymin = (brd_center_pos.y - ysize / 2) * scale;
1162  double ymax = (brd_center_pos.y + ysize / 2) * scale;
1163  double zmin = Millimeter2iu( -50 ) * scale;
1164  double zmax = Millimeter2iu( 100 ) * scale;
1165 
1166  // Draw horizontal grid centered on 3D origin (center of the board)
1167  for( int ii = 0; ; ii++ )
1168  {
1169  if( (ii % 5) )
1170  glColor4f( gridColor.r, gridColor.g, gridColor.b, transparency );
1171  else
1172  glColor4f( gridColor_marker.r,
1173  gridColor_marker.g,
1174  gridColor_marker.b,
1175  transparency );
1176 
1177  const int delta = KiROUND( ii * griSizeMM * IU_PER_MM );
1178 
1179  if( delta <= xsize / 2 ) // Draw grid lines parallel to X axis
1180  {
1181  glBegin( GL_LINES );
1182  glVertex3f( (brd_center_pos.x + delta) * scale, -ymin, zpos );
1183  glVertex3f( (brd_center_pos.x + delta) * scale, -ymax, zpos );
1184  glEnd();
1185 
1186  if( ii != 0 )
1187  {
1188  glBegin( GL_LINES );
1189  glVertex3f( (brd_center_pos.x - delta) * scale, -ymin, zpos );
1190  glVertex3f( (brd_center_pos.x - delta) * scale, -ymax, zpos );
1191  glEnd();
1192  }
1193  }
1194 
1195  if( delta <= ysize / 2 ) // Draw grid lines parallel to Y axis
1196  {
1197  glBegin( GL_LINES );
1198  glVertex3f( xmin, -(brd_center_pos.y + delta) * scale, zpos );
1199  glVertex3f( xmax, -(brd_center_pos.y + delta) * scale, zpos );
1200  glEnd();
1201 
1202  if( ii != 0 )
1203  {
1204  glBegin( GL_LINES );
1205  glVertex3f( xmin, -(brd_center_pos.y - delta) * scale, zpos );
1206  glVertex3f( xmax, -(brd_center_pos.y - delta) * scale, zpos );
1207  glEnd();
1208  }
1209  }
1210 
1211  if( ( delta > ysize / 2 ) && ( delta > xsize / 2 ) )
1212  break;
1213  }
1214 
1215  // Draw vertical grid on Z axis
1216  glNormal3f( 0.0, -1.0, 0.0 );
1217 
1218  // Draw vertical grid lines (parallel to Z axis)
1219  double posy = -brd_center_pos.y * scale;
1220 
1221  for( int ii = 0; ; ii++ )
1222  {
1223  if( (ii % 5) )
1224  glColor4f( gridColor.r, gridColor.g, gridColor.b, transparency );
1225  else
1226  glColor4f( gridColor_marker.r,
1227  gridColor_marker.g,
1228  gridColor_marker.b,
1229  transparency );
1230 
1231  const double delta = ii * griSizeMM * IU_PER_MM;
1232 
1233  glBegin( GL_LINES );
1234  xmax = (brd_center_pos.x + delta) * scale;
1235 
1236  glVertex3f( xmax, posy, zmin );
1237  glVertex3f( xmax, posy, zmax );
1238  glEnd();
1239 
1240  if( ii != 0 )
1241  {
1242  glBegin( GL_LINES );
1243  xmin = (brd_center_pos.x - delta) * scale;
1244  glVertex3f( xmin, posy, zmin );
1245  glVertex3f( xmin, posy, zmax );
1246  glEnd();
1247  }
1248 
1249  if( delta > xsize / 2.0f )
1250  break;
1251  }
1252 
1253  // Draw horizontal grid lines on Z axis (parallel to X axis)
1254  for( int ii = 0; ; ii++ )
1255  {
1256  if( (ii % 5) )
1257  glColor4f( gridColor.r, gridColor.g, gridColor.b, transparency );
1258  else
1259  glColor4f( gridColor_marker.r,
1260  gridColor_marker.g,
1261  gridColor_marker.b,
1262  transparency );
1263 
1264  const double delta = ii * griSizeMM * IU_PER_MM * scale;
1265 
1266  if( delta <= zmax )
1267  {
1268  // Draw grid lines on Z axis (positive Z axis coordinates)
1269  glBegin( GL_LINES );
1270  glVertex3f( xmin, posy, delta );
1271  glVertex3f( xmax, posy, delta );
1272  glEnd();
1273  }
1274 
1275  if( delta <= -zmin && ( ii != 0 ) )
1276  {
1277  // Draw grid lines on Z axis (negative Z axis coordinates)
1278  glBegin( GL_LINES );
1279  glVertex3f( xmin, posy, -delta );
1280  glVertex3f( xmax, posy, -delta );
1281  glEnd();
1282  }
1283 
1284  if( ( delta > zmax ) && ( delta > -zmin ) )
1285  break;
1286  }
1287 
1288  glDisable( GL_BLEND );
1289 
1290  glEndList();
1291 }
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:120
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:123
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)
#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:172
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:
struct C3D_RENDER_OGL_LEGACY::@34 m_materials
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:189
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:259
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:179
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:248
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:184
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:469
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.