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  if( aStatusTextReporter )
477  aStatusTextReporter->Report( _( "Loading..." ) );
478 
479  reload( aStatusTextReporter );
480  setupMaterials();
481 
482  // generate a new 3D grid as the size of the board may had changed
485  }
486  else
487  {
488  // Check if grid was changed
490  {
491  // and generate a new one
494  }
495  }
496 
497  // Initial setup
498  // /////////////////////////////////////////////////////////////////////////
499  glDepthFunc( GL_LESS );
500  glEnable( GL_CULL_FACE );
501  glFrontFace( GL_CCW ); // This is the openGL default
502  glEnable( GL_NORMALIZE ); // This allow openGL to normalize the normals after transformations
503 
504  glViewport( 0, 0, m_windowSize.x, m_windowSize.y );
505 
506 
507  // clear color and depth buffers
508  // /////////////////////////////////////////////////////////////////////////
509  glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
510  glClearDepth( 1.0f );
511  glClearStencil( 0x00 );
512  glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
513 
514 
515  // Draw the background ( rectangle with color gradient)
516  // /////////////////////////////////////////////////////////////////////////
519 
520  glEnable( GL_DEPTH_TEST );
521 
522 
523  // Set projection and modelview matrixes
524  // /////////////////////////////////////////////////////////////////////////
525  glMatrixMode( GL_PROJECTION );
526  glLoadMatrixf( glm::value_ptr( m_settings.CameraGet().GetProjectionMatrix() ) );
527 
528  glMatrixMode( GL_MODELVIEW );
529  glLoadIdentity();
530  glLoadMatrixf( glm::value_ptr( m_settings.CameraGet().GetViewMatrix() ) );
531 
532 
533  // Position the headlight
534  // /////////////////////////////////////////////////////////////////////////
535 
536  setLight_Front( true );
537  setLight_Top( true );
538  setLight_Bottom( true );
539 
540  glEnable( GL_LIGHTING );
541 
542  {
543  const SFVEC3F &cameraPos = m_settings.CameraGet().GetPos();
544 
545  // Place the light at a minimun Z so the diffuse factor will not drop
546  // and the board will still look with good light.
547  float zpos;
548 
549  if( cameraPos.z > 0.0f )
550  {
551  zpos = glm::max( cameraPos.z, 0.5f ) + cameraPos.z * cameraPos.z;
552  }
553  else
554  {
555  zpos = glm::min( cameraPos.z,-0.5f ) - cameraPos.z * cameraPos.z;
556  }
557 
558  const GLfloat headlight_pos[] = { cameraPos.x,
559  cameraPos.y,
560  zpos,
561  1.0f }; // This is a point light
562 
563  glLightfv( GL_LIGHT0, GL_POSITION, headlight_pos );
564  }
565 
566 
567  // Display board body
568  // /////////////////////////////////////////////////////////////////////////
570  {
572  {
575 
576  OGL_SetMaterial( m_materials.m_EpoxyBoard );
577 
579 
581  {
585 
588  NULL );
589  }
590  else
591  {
593  }
594  }
595  }
596 
597 
599  {
600  // Draw vias and pad holes with copper material
602  }
603  else
604  {
605  OGL_SetMaterial( m_materials.m_GrayMaterial );
606  }
607 
608  if( m_ogl_disp_list_via )
609  {
611  }
612 
614  {
616  }
617 
618 
619  // Display copper and tech layers
620  // /////////////////////////////////////////////////////////////////////////
621  for( MAP_OGL_DISP_LISTS::const_iterator ii = m_ogl_disp_lists_layers.begin();
622  ii != m_ogl_disp_lists_layers.end();
623  ++ii )
624  {
625 
626  const PCB_LAYER_ID layer_id = (PCB_LAYER_ID)(ii->first);
627 
628  // Mask kayers are not processed here because they are a special case
629  if( (layer_id == B_Mask) || (layer_id == F_Mask) )
630  continue;
631 
632  // Do not show inner layers when it is displaying the board
634  {
635  if( (layer_id > F_Cu) && (layer_id < B_Cu) )
636  continue;
637  }
638 
639  glPushMatrix();
640 
641  // !TODO: if we want to increase the separation between layers
642  //glScalef( 1.0f, 1.0f, 3.0f );
643 
644 
645  CLAYERS_OGL_DISP_LISTS *pLayerDispList = static_cast<CLAYERS_OGL_DISP_LISTS*>(ii->second);
646  set_layer_material( layer_id );
647 
650  pLayerDispList->GetZBot(),
651  pLayerDispList->GetZTop() - pLayerDispList->GetZBot() );
652 
653  if( (layer_id >= F_Cu) && (layer_id <= B_Cu) )
654  {
655  if( m_ogl_disp_lists_layers_holes_outer.find( layer_id ) !=
657  {
658  const CLAYERS_OGL_DISP_LISTS* viasHolesLayer =
660 
661  wxASSERT( viasHolesLayer != NULL );
662 
663  if( viasHolesLayer != NULL )
664  {
665  pLayerDispList->DrawAllCameraCulledSubtractLayer(
667  viasHolesLayer,
668  (aIsMoving == false) );
669  }
670  }
671  else
672  {
673  pLayerDispList->DrawAllCameraCulledSubtractLayer(
675  NULL,
676  (aIsMoving == false) );
677  }
678  }
679  else
680  {
681  pLayerDispList->DrawAllCameraCulled( m_settings.CameraGet().GetPos().z,
682  (aIsMoving == false) );
683  }
684 
685  glPopMatrix();
686  }
687 
688 
689  // Render 3D Models (Non-transparent)
690  // /////////////////////////////////////////////////////////////////////////
691 
692  //setLight_Top( false );
693  //setLight_Bottom( true );
694  render_3D_models( false, false );
695 
696  //setLight_Top( true );
697  //setLight_Bottom( false );
698  render_3D_models( true, false );
699 
700 
701  // Display transparent mask layers
702  // /////////////////////////////////////////////////////////////////////////
704  {
705  //setLight_Top( true );
706  //setLight_Bottom( true );
707 
708  if( m_settings.CameraGet().GetPos().z > 0 )
709  {
711  aIsMoving );
712 
714  aIsMoving );
715  }
716  else
717  {
719  aIsMoving );
720 
722  aIsMoving );
723  }
724  }
725 
726 
727  // Render 3D Models (Transparent)
728  // /////////////////////////////////////////////////////////////////////////
729 
730  //setLight_Top( false );
731  //setLight_Bottom( true );
732  render_3D_models( false, true );
733 
734  //setLight_Top( true );
735  //setLight_Bottom( false );
736  render_3D_models( true, true );
737 
738 
739  // Render Grid
740  // /////////////////////////////////////////////////////////////////////////
741 
742  if( m_settings.GridGet() != GRID3D_NONE )
743  {
744  glDisable( GL_LIGHTING );
745 
746  if( glIsList( m_ogl_disp_list_grid ) )
747  glCallList( m_ogl_disp_list_grid );
748 
749  glEnable( GL_LIGHTING );
750  }
751 
752 
753  // Render 3D arrows
754  // /////////////////////////////////////////////////////////////////////////
755  if( m_settings.GetFlag( FL_AXIS ) )
757 
758  // Return back to the original viewport (this is important if we want
759  // to take a screenshot after the render)
760  // /////////////////////////////////////////////////////////////////////////
761  glViewport( 0, 0, m_windowSize.x, m_windowSize.y );
762 
763  return false;
764 }
765 
766 
768 {
769  glEnable( GL_LINE_SMOOTH );
770  glShadeModel( GL_SMOOTH );
771 
772  // 4-byte pixel alignment
773  glPixelStorei( GL_UNPACK_ALIGNMENT, 4 );
774 
775  // Initialize the open GL texture to draw the filled semi-circle of the segments
777 
778  if( !circleImage )
779  return false;
780 
781  circleImage->CircleFilled( (SIZE_OF_CIRCLE_TEXTURE / 2) - 0,
782  (SIZE_OF_CIRCLE_TEXTURE / 2) - 0,
783  (SIZE_OF_CIRCLE_TEXTURE / 2) - 4,
784  0xFF );
785 
786  //circleImage->CircleFilled( (SIZE_OF_CIRCLE_TEXTURE / 4)*1.5f - 1,
787  // (SIZE_OF_CIRCLE_TEXTURE / 4)*1.5f - 1,
788  // (SIZE_OF_CIRCLE_TEXTURE / 4)*1.5f - 2, 0xFF );
789 
790  CIMAGE *circleImage_Copy = new CIMAGE( *circleImage );
791 
792  circleImage->EfxFilter( circleImage_Copy, FILTER_BLUR_3X3 );
793 
794  m_ogl_circle_texture = OGL_LoadTexture( *circleImage );
795 
796  //circleImage_Copy->SaveAsPNG("circleImage.png");
797  delete circleImage_Copy;
798  circleImage_Copy = 0;
799 
800  //circleImage->SaveAsPNG("circleImage_blured.png");
801  delete circleImage;
802  circleImage = 0;
803 
804  init_lights();
805 
806  // Use this mode if you want see the triangle lines (debug proposes)
807  //glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
808 
810 
811  return true;
812 }
813 
814 
816 {
817  glEnable( GL_COLOR_MATERIAL );
818  glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
819 
820  const SFVEC4F ambient = SFVEC4F( 0.0f, 0.0f, 0.0f, 1.0f );
821  const SFVEC4F diffuse = SFVEC4F( 0.0f, 0.0f, 0.0f, 1.0f );
822  const SFVEC4F emissive = SFVEC4F( 0.0f, 0.0f, 0.0f, 1.0f );
823  const SFVEC4F specular = SFVEC4F( 0.1f, 0.1f, 0.1f, 1.0f );
824 
825  glMaterialfv( GL_FRONT_AND_BACK, GL_SPECULAR, &specular.r );
826  glMaterialf( GL_FRONT_AND_BACK, GL_SHININESS, 96.0f );
827 
828  glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT, &ambient.r );
829  glMaterialfv( GL_FRONT_AND_BACK, GL_DIFFUSE, &diffuse.r );
830  glMaterialfv( GL_FRONT_AND_BACK, GL_EMISSION, &emissive.r );
831 }
832 
833 
835 {
836  if( glIsList( m_ogl_disp_list_grid ) )
837  glDeleteLists( m_ogl_disp_list_grid, 1 );
838 
840 
841  for( MAP_OGL_DISP_LISTS::const_iterator ii = m_ogl_disp_lists_layers.begin();
842  ii != m_ogl_disp_lists_layers.end();
843  ++ii )
844  {
845  CLAYERS_OGL_DISP_LISTS *pLayerDispList = static_cast<CLAYERS_OGL_DISP_LISTS*>(ii->second);
846  delete pLayerDispList;
847  }
848 
849  m_ogl_disp_lists_layers.clear();
850 
851 
852  for( MAP_OGL_DISP_LISTS::const_iterator ii = m_ogl_disp_lists_layers_holes_outer.begin();
854  ++ii )
855  {
856  CLAYERS_OGL_DISP_LISTS *pLayerDispList = static_cast<CLAYERS_OGL_DISP_LISTS*>(ii->second);
857  delete pLayerDispList;
858  }
859 
861 
862 
863  for( MAP_OGL_DISP_LISTS::const_iterator ii = m_ogl_disp_lists_layers_holes_inner.begin();
865  ++ii )
866  {
867  CLAYERS_OGL_DISP_LISTS *pLayerDispList = static_cast<CLAYERS_OGL_DISP_LISTS*>(ii->second);
868  delete pLayerDispList;
869  }
870 
872 
873  for( MAP_TRIANGLES::const_iterator ii = m_triangles.begin();
874  ii != m_triangles.end();
875  ++ii )
876  {
877  CLAYER_TRIANGLES *pointer = static_cast<CLAYER_TRIANGLES*>(ii->second);
878  delete pointer;
879  }
880 
881  m_triangles.clear();
882 
883 
884  for( MAP_3DMODEL::const_iterator ii = m_3dmodel_map.begin();
885  ii != m_3dmodel_map.end();
886  ++ii )
887  {
888  C_OGL_3DMODEL *pointer = static_cast<C_OGL_3DMODEL*>(ii->second);
889  delete pointer;
890  }
891 
892  m_3dmodel_map.clear();
893 
894 
895  delete m_ogl_disp_list_board;
897 
900 
903 
906 
909 
910  delete m_ogl_disp_list_via;
912 
915 
918 }
919 
920 
922  float aZPosition,
923  bool aIsRenderingOnPreviewMode )
924 {
925  wxASSERT( (aLayerID == B_Mask) || (aLayerID == F_Mask) );
926 
928  {
929  if( m_ogl_disp_lists_layers.find( aLayerID ) !=
931  {
932  CLAYERS_OGL_DISP_LISTS *pLayerDispListMask = m_ogl_disp_lists_layers.at( aLayerID );
933 
936  aZPosition,
938 
940  aZPosition,
942 
943  set_layer_material( aLayerID );
944 
946 
948  pLayerDispListMask,
950  !aIsRenderingOnPreviewMode );
951  }
952  else
953  {
954  // This case there is no layer with mask, so we will render the full board as mask
955 
958  aZPosition,
960 
962  aZPosition,
964 
965  set_layer_material( aLayerID );
966 
968 
970  NULL,
972  !aIsRenderingOnPreviewMode );
973  }
974  }
975 }
976 
977 
978 void C3D_RENDER_OGL_LEGACY::render_3D_models( bool aRenderTopOrBot,
979  bool aRenderTransparentOnly )
980 {
981  // Go for all modules
983  {
984  for( const MODULE* module = m_settings.GetBoard()->m_Modules;
985  module;
986  module = module->Next() )
987  {
988  if( !module->Models().empty() )
989  if( m_settings.ShouldModuleBeDisplayed( (MODULE_ATTR_T)module->GetAttributes() ) )
990  if( ( aRenderTopOrBot && !module->IsFlipped()) ||
991  (!aRenderTopOrBot && module->IsFlipped()) )
992  render_3D_module( module, aRenderTransparentOnly );
993  }
994  }
995 }
996 
997 
999  bool aRenderTransparentOnly )
1000 {
1001  if( !module->Models().empty() )
1002  {
1003  const double zpos = m_settings.GetModulesZcoord3DIU( module->IsFlipped() );
1004 
1005  glPushMatrix();
1006 
1007  wxPoint pos = module->GetPosition();
1008 
1009  glTranslatef( pos.x * m_settings.BiuTo3Dunits(),
1010  -pos.y * m_settings.BiuTo3Dunits(),
1011  zpos );
1012 
1013  if( module->GetOrientation() )
1014  glRotated( (double) module->GetOrientation() / 10.0, 0.0, 0.0, 1.0 );
1015 
1016  if( module->IsFlipped() )
1017  {
1018  glRotatef( 180.0f, 0.0f, 1.0f, 0.0f );
1019  glRotatef( 180.0f, 0.0f, 0.0f, 1.0f );
1020  }
1021 
1022  double modelunit_to_3d_units_factor = m_settings.BiuTo3Dunits() * UNITS3D_TO_UNITSPCB;
1023 
1024  glScaled( modelunit_to_3d_units_factor,
1025  modelunit_to_3d_units_factor,
1026  modelunit_to_3d_units_factor );
1027 
1028  // Get the list of model files for this model
1029  std::list<S3D_INFO>::const_iterator sM = module->Models().begin();
1030  std::list<S3D_INFO>::const_iterator eM = module->Models().end();
1031 
1032  while( sM != eM )
1033  {
1034  if( !sM->m_Filename.empty() )
1035  {
1036  // Check if the model is present in our cache map
1037  if( m_3dmodel_map.find( sM->m_Filename ) != m_3dmodel_map.end() )
1038  {
1039  // It is not present, try get it from cache
1040  const C_OGL_3DMODEL *modelPtr = m_3dmodel_map[ sM->m_Filename ];
1041 
1042  if( modelPtr )
1043  {
1044  if( ( (!aRenderTransparentOnly) && modelPtr->Have_opaque() ) ||
1045  ( aRenderTransparentOnly && modelPtr->Have_transparent() ) )
1046  {
1047  glPushMatrix();
1048 
1049  glTranslatef( sM->m_Offset.x * 25.4f,
1050  sM->m_Offset.y * 25.4f,
1051  sM->m_Offset.z * 25.4f );
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)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
Definition: common.h:107
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.
const wxPoint & GetPosition() const override
Definition: class_module.h:144
float GetNonCopperLayerThickness3DU() const
GetNonCopperLayerThickness3DU - Get the current non copper layers thickness.
Definition: cinfo3d_visu.h:159
MODULE * Next() const
Definition: class_module.h:100
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
std::list< S3D_INFO > & Models()
Definition: class_module.h:140
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:77
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:176
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:141
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:148
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:215
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:72
CLAYERS_OGL_DISP_LISTS * m_ogl_disp_list_via
float GetEpoxyThickness3DU() const
GetEpoxyThickness3DU - Get the current epoxy thickness.
Definition: cinfo3d_visu.h:153
struct C3D_RENDER_OGL_LEGACY::@38 m_materials
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
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.
#define max(a, b)
Definition: auxiliary.h:86
DLIST< MODULE > m_Modules
Definition: class_board.h:243
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 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.