KiCad PCB EDA Suite
CLAYERS_OGL_DISP_LISTS Class Reference

The CLAYERS_OGL_DISP_LISTS class stores the openGL display lists to related with a layer. More...

#include <clayer_triangles.h>

Public Member Functions

 CLAYERS_OGL_DISP_LISTS (const CLAYER_TRIANGLES &aLayerTriangles, GLuint aTextureIndexForSegEnds, float aZBot, float aZTop)
 CLAYERS_OGL_DISP_LISTS - Creates the display lists for a layer. More...
 
 ~CLAYERS_OGL_DISP_LISTS ()
 ~CLAYERS_OGL_DISP_LISTS - Destroy this class while free the display lists from GPU mem More...
 
void DrawTopAndMiddle () const
 DrawTopAndMiddle - This function calls the display lists for the top elements and middle contourns. More...
 
void DrawBotAndMiddle () const
 DrawBotAndMiddle - This function calls the display lists for the botton elements and middle contourns. More...
 
void DrawTop () const
 DrawTop - This function calls the display lists for the top elements. More...
 
void DrawBot () const
 DrawBot - This function calls the display lists for the botton elements. More...
 
void DrawMiddle () const
 DrawMiddle - This function calls the display lists for the middle elements. More...
 
void DrawAll (bool aDrawMiddle=true) const
 DrawAll - This function calls all the display lists. More...
 
void DrawAllCameraCulled (float zCameraPos, bool aDrawMiddle=true) const
 DrawAllCameraCulled - Draw all layers if they are visible by the camera. More...
 
void DrawAllCameraCulledSubtractLayer (const CLAYERS_OGL_DISP_LISTS *aLayerToSubtractA, const CLAYERS_OGL_DISP_LISTS *aLayerToSubtractB, bool aDrawMiddle=true) const
 
void ApplyScalePosition (float aZposition, float aZscale)
 
void ClearScalePosition ()
 
void SetItIsTransparent (bool aSetTransparent)
 
float GetZBot () const
 
float GetZTop () const
 

Private Member Functions

GLuint generate_top_or_bot_seg_ends (const CLAYER_TRIANGLE_CONTAINER *aTriangleContainer, bool aIsNormalUp, GLuint aTextureId) const
 
GLuint generate_top_or_bot_triangles (const CLAYER_TRIANGLE_CONTAINER *aTriangleContainer, bool aIsNormalUp) const
 
GLuint generate_middle_triangles (const CLAYER_TRIANGLE_CONTAINER *aTriangleContainer) const
 
void beginTransformation () const
 
void endTransformation () const
 
void setBlendfunction () const
 

Private Attributes

float m_zBot
 
float m_zTop
 
GLuint m_layer_top_segment_ends
 
GLuint m_layer_top_triangles
 
GLuint m_layer_middle_contourns_quads
 
GLuint m_layer_bot_triangles
 
GLuint m_layer_bot_segment_ends
 
bool m_haveTransformation
 
float m_zPositionTransformation
 
float m_zScaleTransformation
 
bool m_draw_it_transparent
 

Detailed Description

The CLAYERS_OGL_DISP_LISTS class stores the openGL display lists to related with a layer.

Definition at line 192 of file clayer_triangles.h.

Constructor & Destructor Documentation

◆ CLAYERS_OGL_DISP_LISTS()

CLAYERS_OGL_DISP_LISTS::CLAYERS_OGL_DISP_LISTS ( const CLAYER_TRIANGLES aLayerTriangles,
GLuint  aTextureIndexForSegEnds,
float  aZBot,
float  aZTop 
)

CLAYERS_OGL_DISP_LISTS - Creates the display lists for a layer.

Parameters
aLayerTrianglescontains the layers array of vertex to render to display lists
aTextureIndexForSegEndstexture index to be used by segment ends. It is a black and white squared texture with a center circle diameter of the size of the texture.

Definition at line 324 of file clayer_triangles.cpp.

328 {
329  m_zBot = aZBot;
330  m_zTop = aZTop;
331 
337 
338  if( aTextureIndexForSegEnds )
339  {
340  wxASSERT( glIsTexture( aTextureIndexForSegEnds ) );
341 
342  if( glIsTexture( aTextureIndexForSegEnds ) )
343  {
346  true,
347  aTextureIndexForSegEnds );
348 
351  false,
352  aTextureIndexForSegEnds );
353  }
354  }
355 
357  true );
358 
360  false );
361 
362 
363  if( aLayerTriangles.m_layer_middle_contourns_quads->GetVertexSize() > 0 )
364  {
367  }
368 
369  m_draw_it_transparent = false;
370  m_haveTransformation = false;
372  m_zScaleTransformation = 0.0f;
373 }
GLuint generate_middle_triangles(const CLAYER_TRIANGLE_CONTAINER *aTriangleContainer) const
CLAYER_TRIANGLE_CONTAINER * m_layer_top_triangles
CLAYER_TRIANGLE_CONTAINER * m_layer_middle_contourns_quads
GLuint generate_top_or_bot_triangles(const CLAYER_TRIANGLE_CONTAINER *aTriangleContainer, bool aIsNormalUp) const
CLAYER_TRIANGLE_CONTAINER * m_layer_bot_segment_ends
CLAYER_TRIANGLE_CONTAINER * m_layer_bot_triangles
GLuint generate_top_or_bot_seg_ends(const CLAYER_TRIANGLE_CONTAINER *aTriangleContainer, bool aIsNormalUp, GLuint aTextureId) const
CLAYER_TRIANGLE_CONTAINER * m_layer_top_segment_ends
unsigned int GetVertexSize() const
GetVertexSize.

References generate_middle_triangles(), generate_top_or_bot_seg_ends(), generate_top_or_bot_triangles(), CLAYER_TRIANGLE_CONTAINER::GetVertexSize(), m_draw_it_transparent, m_haveTransformation, CLAYER_TRIANGLES::m_layer_bot_segment_ends, m_layer_bot_segment_ends, CLAYER_TRIANGLES::m_layer_bot_triangles, m_layer_bot_triangles, CLAYER_TRIANGLES::m_layer_middle_contourns_quads, m_layer_middle_contourns_quads, CLAYER_TRIANGLES::m_layer_top_segment_ends, m_layer_top_segment_ends, CLAYER_TRIANGLES::m_layer_top_triangles, m_layer_top_triangles, m_zBot, m_zPositionTransformation, m_zScaleTransformation, and m_zTop.

◆ ~CLAYERS_OGL_DISP_LISTS()

CLAYERS_OGL_DISP_LISTS::~CLAYERS_OGL_DISP_LISTS ( )

~CLAYERS_OGL_DISP_LISTS - Destroy this class while free the display lists from GPU mem

Definition at line 376 of file clayer_triangles.cpp.

377 {
378  if( glIsList( m_layer_top_segment_ends ) )
379  glDeleteLists( m_layer_top_segment_ends, 1 );
380 
381  if( glIsList( m_layer_top_triangles ) )
382  glDeleteLists( m_layer_top_triangles, 1 );
383 
384  if( glIsList( m_layer_middle_contourns_quads ) )
385  glDeleteLists( m_layer_middle_contourns_quads, 1 );
386 
387  if( glIsList( m_layer_bot_triangles ) )
388  glDeleteLists( m_layer_bot_triangles, 1 );
389 
390  if( glIsList( m_layer_bot_segment_ends ) )
391  glDeleteLists( m_layer_bot_segment_ends, 1 );
392 
398 }

References m_layer_bot_segment_ends, m_layer_bot_triangles, m_layer_middle_contourns_quads, m_layer_top_segment_ends, and m_layer_top_triangles.

Member Function Documentation

◆ ApplyScalePosition()

void CLAYERS_OGL_DISP_LISTS::ApplyScalePosition ( float  aZposition,
float  aZscale 
)

Definition at line 623 of file clayer_triangles.cpp.

625 {
626  wxASSERT( aZscale > FLT_EPSILON );
627 
628  m_zPositionTransformation = aZposition;
629  m_zScaleTransformation = aZscale;
630  m_haveTransformation = true;
631 }

References m_haveTransformation, m_zPositionTransformation, and m_zScaleTransformation.

Referenced by C3D_RENDER_OGL_LEGACY::Redraw(), and C3D_RENDER_OGL_LEGACY::render_solder_mask_layer().

◆ beginTransformation()

void CLAYERS_OGL_DISP_LISTS::beginTransformation ( ) const
private

Definition at line 824 of file clayer_triangles.cpp.

825 {
827  {
828  glPushMatrix();
829  glTranslatef( 0.0f, 0.0f, m_zPositionTransformation );
830  glScalef( 1.0f, 1.0f, m_zScaleTransformation );
831  }
832 }

References m_haveTransformation, m_zPositionTransformation, and m_zScaleTransformation.

Referenced by DrawAll(), DrawBot(), DrawBotAndMiddle(), DrawMiddle(), DrawTop(), and DrawTopAndMiddle().

◆ ClearScalePosition()

void CLAYERS_OGL_DISP_LISTS::ClearScalePosition ( )
inline

Definition at line 262 of file clayer_triangles.h.

References m_haveTransformation.

◆ DrawAll()

void CLAYERS_OGL_DISP_LISTS::DrawAll ( bool  aDrawMiddle = true) const

DrawAll - This function calls all the display lists.

Definition at line 474 of file clayer_triangles.cpp.

475 {
477 
478  if( aDrawMiddle )
479  if( glIsList( m_layer_middle_contourns_quads ) )
480  glCallList( m_layer_middle_contourns_quads );
481 
482  if( glIsList( m_layer_top_triangles ) )
483  glCallList( m_layer_top_triangles );
484 
485  if( glIsList( m_layer_bot_triangles ) )
486  glCallList( m_layer_bot_triangles );
487 
488  if( glIsList( m_layer_top_segment_ends ) )
489  glCallList( m_layer_top_segment_ends );
490 
491  if( glIsList( m_layer_bot_segment_ends ) )
492  glCallList( m_layer_bot_segment_ends );
493 
495 }

References beginTransformation(), endTransformation(), m_layer_bot_segment_ends, m_layer_bot_triangles, m_layer_middle_contourns_quads, m_layer_top_segment_ends, and m_layer_top_triangles.

Referenced by C3D_RENDER_OGL_LEGACY::Redraw().

◆ DrawAllCameraCulled()

void CLAYERS_OGL_DISP_LISTS::DrawAllCameraCulled ( float  zCameraPos,
bool  aDrawMiddle = true 
) const

DrawAllCameraCulled - Draw all layers if they are visible by the camera.

i.e.: if camera position is above the layer. This only works because the board is centered and the planes are always perpendicular to the Z axis.

Parameters
zCameraPoscamera z position

Definition at line 498 of file clayer_triangles.cpp.

499 {
500  zCameraPos = m_haveTransformation?( (zCameraPos - m_zPositionTransformation ) /
501  m_zScaleTransformation ):zCameraPos;
502 
503  if( aDrawMiddle )
504  DrawMiddle();
505 
506  if( zCameraPos > m_zTop )
507  {
508  DrawTop();
509  }
510  else
511  {
512  if( zCameraPos < m_zBot )
513  {
514  DrawBot();
515  }
516  else
517  {
518  // If camera is in the middle dont draw it
519  }
520  }
521 }
void DrawBot() const
DrawBot - This function calls the display lists for the botton elements.
void DrawTop() const
DrawTop - This function calls the display lists for the top elements.
void DrawMiddle() const
DrawMiddle - This function calls the display lists for the middle elements.

References DrawBot(), DrawMiddle(), DrawTop(), m_haveTransformation, m_zBot, m_zPositionTransformation, m_zScaleTransformation, and m_zTop.

Referenced by C3D_RENDER_OGL_LEGACY::Redraw().

◆ DrawAllCameraCulledSubtractLayer()

void CLAYERS_OGL_DISP_LISTS::DrawAllCameraCulledSubtractLayer ( const CLAYERS_OGL_DISP_LISTS aLayerToSubtractA,
const CLAYERS_OGL_DISP_LISTS aLayerToSubtractB,
bool  aDrawMiddle = true 
) const

Definition at line 524 of file clayer_triangles.cpp.

528 {
529  if( aDrawMiddle )
530  DrawMiddle();
531 
532  glClearStencil( 0x00 );
533  glClear( GL_STENCIL_BUFFER_BIT );
534 
535  glEnable( GL_CULL_FACE );
536  glCullFace( GL_BACK );
537 
538  glDisable( GL_DEPTH_TEST );
539  glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE );
540  glDepthMask( GL_FALSE );
541  glEnable( GL_STENCIL_TEST );
542  glStencilFunc( GL_ALWAYS, 1, 0 );
543  glStencilOp( GL_KEEP, GL_KEEP, GL_REPLACE );
544 
545  if( aLayerToSubtractA )
546  aLayerToSubtractA->DrawBot();
547 
548  if( aLayerToSubtractB )
549  aLayerToSubtractB->DrawBot();
550 
551 
552  //if( !m_draw_it_transparent )
553  {
554  glEnable(GL_DEPTH_TEST);
555  glDepthMask(GL_TRUE);
556  }
557 
558  glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
559  glStencilFunc( GL_EQUAL, 0, 1 );
560  glStencilOp( GL_KEEP, GL_KEEP, GL_KEEP );
561  DrawBot();
562 
563  glDisable( GL_DEPTH_TEST );
564  glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE );
565  glDepthMask( GL_FALSE );
566  glEnable( GL_STENCIL_TEST );
567  glStencilFunc( GL_ALWAYS, 2, 0 );
568  glStencilOp( GL_KEEP, GL_KEEP, GL_REPLACE );
569 
570  if( aLayerToSubtractA )
571  aLayerToSubtractA->DrawTop();
572 
573  if( aLayerToSubtractB )
574  aLayerToSubtractB->DrawTop();
575 
576  //if( !m_draw_it_transparent )
577  {
578  glEnable(GL_DEPTH_TEST);
579  glDepthMask(GL_TRUE);
580  }
581 
582  glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
583  glStencilFunc( GL_NOTEQUAL, 2, 0x03 );
584  glStencilOp( GL_KEEP, GL_KEEP, GL_INCR );
585  DrawTop();
586 
587 
588  glLightModeli( GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE );
589 
590  glCullFace( GL_FRONT );
591  glStencilFunc( GL_GEQUAL, 3, 0x03 );
592  glStencilOp( GL_KEEP, GL_KEEP, GL_KEEP );
593  glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
594 
595  if( aDrawMiddle )
596  {
597  if( aLayerToSubtractA )
598  aLayerToSubtractA->DrawMiddle();
599 
600  // It will not render the middle contours of the layer.
601  // It is used with vias and holes (copper vias and to subtract solder
602  // mask holes). But since in the vias, it will draw a cylinder
603  // and in soldermask it doesn't need to draw the contour.
604  // so it is not used the middle part of B
605 // if( aLayerToSubtractB )
606 // aLayerToSubtractB->DrawMiddle();
607  }
608 
609  glLightModeli( GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE );
610 
611  glCullFace( GL_BACK );
612  glDisable( GL_STENCIL_TEST );
613 
614 /*
615  if( m_draw_it_transparent )
616  {
617  glEnable(GL_DEPTH_TEST);
618  glDepthMask(GL_TRUE);
619  }*/
620 }
void DrawBot() const
DrawBot - This function calls the display lists for the botton elements.
void DrawTop() const
DrawTop - This function calls the display lists for the top elements.
void DrawMiddle() const
DrawMiddle - This function calls the display lists for the middle elements.

References DrawBot(), DrawMiddle(), and DrawTop().

Referenced by C3D_RENDER_OGL_LEGACY::Redraw(), and C3D_RENDER_OGL_LEGACY::render_solder_mask_layer().

◆ DrawBot()

void CLAYERS_OGL_DISP_LISTS::DrawBot ( ) const

DrawBot - This function calls the display lists for the botton elements.

Definition at line 449 of file clayer_triangles.cpp.

450 {
452 
453  if( glIsList( m_layer_bot_triangles ) )
454  glCallList( m_layer_bot_triangles );
455 
456  if( glIsList( m_layer_bot_segment_ends ) )
457  glCallList( m_layer_bot_segment_ends );
458 
460 }

References beginTransformation(), endTransformation(), m_layer_bot_segment_ends, and m_layer_bot_triangles.

Referenced by DrawAllCameraCulled(), and DrawAllCameraCulledSubtractLayer().

◆ DrawBotAndMiddle()

void CLAYERS_OGL_DISP_LISTS::DrawBotAndMiddle ( ) const

DrawBotAndMiddle - This function calls the display lists for the botton elements and middle contourns.

Definition at line 418 of file clayer_triangles.cpp.

419 {
421 
422  if( glIsList( m_layer_middle_contourns_quads ) )
423  glCallList( m_layer_middle_contourns_quads );
424 
425  if( glIsList( m_layer_bot_triangles ) )
426  glCallList( m_layer_bot_triangles );
427 
428  if( glIsList( m_layer_bot_segment_ends ) )
429  glCallList( m_layer_bot_segment_ends );
430 
432 }

References beginTransformation(), endTransformation(), m_layer_bot_segment_ends, m_layer_bot_triangles, and m_layer_middle_contourns_quads.

◆ DrawMiddle()

void CLAYERS_OGL_DISP_LISTS::DrawMiddle ( ) const

DrawMiddle - This function calls the display lists for the middle elements.

Definition at line 463 of file clayer_triangles.cpp.

464 {
466 
467  if( glIsList( m_layer_middle_contourns_quads ) )
468  glCallList( m_layer_middle_contourns_quads );
469 
471 }

References beginTransformation(), endTransformation(), and m_layer_middle_contourns_quads.

Referenced by DrawAllCameraCulled(), and DrawAllCameraCulledSubtractLayer().

◆ DrawTop()

void CLAYERS_OGL_DISP_LISTS::DrawTop ( ) const

DrawTop - This function calls the display lists for the top elements.

Definition at line 435 of file clayer_triangles.cpp.

436 {
438 
439  if( glIsList( m_layer_top_triangles ) )
440  glCallList( m_layer_top_triangles );
441 
442  if( glIsList( m_layer_top_segment_ends ) )
443  glCallList( m_layer_top_segment_ends );
444 
446 }

References beginTransformation(), endTransformation(), m_layer_top_segment_ends, and m_layer_top_triangles.

Referenced by DrawAllCameraCulled(), and DrawAllCameraCulledSubtractLayer().

◆ DrawTopAndMiddle()

void CLAYERS_OGL_DISP_LISTS::DrawTopAndMiddle ( ) const

DrawTopAndMiddle - This function calls the display lists for the top elements and middle contourns.

Definition at line 401 of file clayer_triangles.cpp.

402 {
404 
405  if( glIsList( m_layer_middle_contourns_quads ) )
406  glCallList( m_layer_middle_contourns_quads );
407 
408  if( glIsList( m_layer_top_triangles ) )
409  glCallList( m_layer_top_triangles );
410 
411  if( glIsList( m_layer_top_segment_ends ) )
412  glCallList( m_layer_top_segment_ends );
413 
415 }

References beginTransformation(), endTransformation(), m_layer_middle_contourns_quads, m_layer_top_segment_ends, and m_layer_top_triangles.

◆ endTransformation()

void CLAYERS_OGL_DISP_LISTS::endTransformation ( ) const
private

Definition at line 808 of file clayer_triangles.cpp.

809 {
811  {
812  glPopMatrix();
813  }
814 }

References m_haveTransformation.

Referenced by DrawAll(), DrawBot(), DrawBotAndMiddle(), DrawMiddle(), DrawTop(), and DrawTopAndMiddle().

◆ generate_middle_triangles()

GLuint CLAYERS_OGL_DISP_LISTS::generate_middle_triangles ( const CLAYER_TRIANGLE_CONTAINER aTriangleContainer) const
private

Definition at line 757 of file clayer_triangles.cpp.

759 {
760  wxASSERT( aTriangleContainer != NULL );
761 
762  // We expect that it is a multiple of 3 vertex
763  wxASSERT( (aTriangleContainer->GetVertexSize() % 3) == 0 );
764 
765  // We expect that it is a multiple of 6 vertex (because we expect to add quads)
766  wxASSERT( (aTriangleContainer->GetVertexSize() % 6) == 0 );
767 
768  // We expect that there are normals with same size as vertex
769  wxASSERT( aTriangleContainer->GetNormalsSize() == aTriangleContainer->GetVertexSize() );
770 
771 
772  if( ( aTriangleContainer->GetVertexSize() > 0 ) &&
773  ( (aTriangleContainer->GetVertexSize() % 3) == 0 ) &&
774  ( (aTriangleContainer->GetVertexSize() % 6) == 0 ) &&
775  ( aTriangleContainer->GetNormalsSize() == aTriangleContainer->GetVertexSize() ) )
776  {
777  const GLuint listIdx = glGenLists( 1 );
778 
779  if( glIsList( listIdx ) )
780  {
781  glDisableClientState( GL_TEXTURE_COORD_ARRAY );
782  glDisableClientState( GL_COLOR_ARRAY );
783  glEnableClientState( GL_NORMAL_ARRAY );
784  glEnableClientState( GL_VERTEX_ARRAY );
785  glVertexPointer( 3, GL_FLOAT, 0, aTriangleContainer->GetVertexPointer() );
786  glNormalPointer( GL_FLOAT, 0, aTriangleContainer->GetNormalsPointer() );
787 
788  glNewList( listIdx, GL_COMPILE );
789 
791 
792  glDrawArrays( GL_TRIANGLES, 0, aTriangleContainer->GetVertexSize() );
793 
794  glDisable( GL_BLEND );
795  glEndList();
796 
797  glDisableClientState( GL_VERTEX_ARRAY );
798  glDisableClientState( GL_NORMAL_ARRAY );
799 
800  return listIdx;
801  }
802  }
803 
804  return 0;
805 }
const float * GetNormalsPointer() const
GetNormalsPointer - Get the array of normals.
unsigned int GetNormalsSize() const
GetNormalsSize.
const float * GetVertexPointer() const
GetVertexPointer - Get the array of vertexes.
unsigned int GetVertexSize() const
GetVertexSize.

References CLAYER_TRIANGLE_CONTAINER::GetNormalsPointer(), CLAYER_TRIANGLE_CONTAINER::GetNormalsSize(), CLAYER_TRIANGLE_CONTAINER::GetVertexPointer(), CLAYER_TRIANGLE_CONTAINER::GetVertexSize(), and setBlendfunction().

Referenced by CLAYERS_OGL_DISP_LISTS().

◆ generate_top_or_bot_seg_ends()

GLuint CLAYERS_OGL_DISP_LISTS::generate_top_or_bot_seg_ends ( const CLAYER_TRIANGLE_CONTAINER aTriangleContainer,
bool  aIsNormalUp,
GLuint  aTextureId 
) const
private

Definition at line 640 of file clayer_triangles.cpp.

644 {
645  wxASSERT( aTriangleContainer != NULL );
646 
647  wxASSERT( (aTriangleContainer->GetVertexSize() % 3) == 0 );
648 
649  // Top and Bot dont have normals array stored in container
650  wxASSERT( aTriangleContainer->GetNormalsSize() == 0 );
651 
652  if( (aTriangleContainer->GetVertexSize() > 0) &&
653  ((aTriangleContainer->GetVertexSize() % 3) == 0) )
654  {
655  GLuint listIdx = glGenLists( 1 );
656 
657  if( glIsList( listIdx ) )
658  {
659  // Prepare an array of UV text coordinates
660  SFVEC2F *uvArray = new SFVEC2F[aTriangleContainer->GetVertexSize()];
661 
662  for( unsigned int i = 0;
663  i < aTriangleContainer->GetVertexSize();
664  i += 3 )
665  {
666  uvArray[i + 0] = SFVEC2F( 1.0f, 0.0f );
667  uvArray[i + 1] = SFVEC2F( 0.0f, 1.0f );
668  uvArray[i + 2] = SFVEC2F( 0.0f, 0.0f );
669  }
670 
671  glEnableClientState( GL_TEXTURE_COORD_ARRAY );
672  glDisableClientState( GL_COLOR_ARRAY );
673  glDisableClientState( GL_NORMAL_ARRAY );
674  glEnableClientState( GL_VERTEX_ARRAY );
675  glVertexPointer( 3, GL_FLOAT, 0, aTriangleContainer->GetVertexPointer() );
676  glTexCoordPointer( 2, GL_FLOAT, 0, uvArray );
677 
678  glNewList( listIdx, GL_COMPILE );
679 
680  glDisable( GL_COLOR_MATERIAL );
681 
682  glEnable( GL_TEXTURE_2D );
683  glBindTexture( GL_TEXTURE_2D, aTextureId );
684 
686 
687  glAlphaFunc( GL_GREATER, 0.2f );
688  glEnable( GL_ALPHA_TEST );
689 
690  glNormal3f( 0.0f, 0.0f, aIsNormalUp?1.0f:-1.0f );
691 
692  glDrawArrays( GL_TRIANGLES, 0, aTriangleContainer->GetVertexSize() );
693 
694  glDisable( GL_TEXTURE_2D );
695  glDisable( GL_ALPHA_TEST );
696  glDisable( GL_BLEND );
697 
698  glEndList();
699 
700  glDisableClientState( GL_VERTEX_ARRAY );
701  glDisableClientState( GL_TEXTURE_COORD_ARRAY );
702 
703  delete [] uvArray;
704  return listIdx;
705  }
706  }
707 
708  return 0;
709 }
unsigned int GetNormalsSize() const
GetNormalsSize.
const float * GetVertexPointer() const
GetVertexPointer - Get the array of vertexes.
glm::vec2 SFVEC2F
Definition: xv3d_types.h:45
size_t i
Definition: json11.cpp:597
unsigned int GetVertexSize() const
GetVertexSize.

References CLAYER_TRIANGLE_CONTAINER::GetNormalsSize(), CLAYER_TRIANGLE_CONTAINER::GetVertexPointer(), CLAYER_TRIANGLE_CONTAINER::GetVertexSize(), i, and setBlendfunction().

Referenced by CLAYERS_OGL_DISP_LISTS().

◆ generate_top_or_bot_triangles()

GLuint CLAYERS_OGL_DISP_LISTS::generate_top_or_bot_triangles ( const CLAYER_TRIANGLE_CONTAINER aTriangleContainer,
bool  aIsNormalUp 
) const
private

Definition at line 712 of file clayer_triangles.cpp.

715 {
716  wxASSERT( aTriangleContainer != NULL );
717 
718  wxASSERT( (aTriangleContainer->GetVertexSize() % 3) == 0 );
719 
720  // Top and Bot dont have normals array stored in container
721  wxASSERT( aTriangleContainer->GetNormalsSize() == 0 );
722 
723  if( (aTriangleContainer->GetVertexSize() > 0) &&
724  ( (aTriangleContainer->GetVertexSize() % 3) == 0) )
725  {
726  const GLuint listIdx = glGenLists( 1 );
727 
728  if( glIsList( listIdx ) )
729  {
730  glDisableClientState( GL_TEXTURE_COORD_ARRAY );
731  glDisableClientState( GL_COLOR_ARRAY );
732  glDisableClientState( GL_NORMAL_ARRAY );
733  glEnableClientState( GL_VERTEX_ARRAY );
734  glVertexPointer( 3, GL_FLOAT, 0, aTriangleContainer->GetVertexPointer() );
735 
736  glNewList( listIdx, GL_COMPILE );
737 
739 
740  glNormal3f( 0.0f, 0.0f, aIsNormalUp?1.0f:-1.0f );
741 
742  glDrawArrays( GL_TRIANGLES, 0, aTriangleContainer->GetVertexSize() );
743 
744  glDisable( GL_BLEND );
745  glEndList();
746 
747  glDisableClientState( GL_VERTEX_ARRAY );
748 
749  return listIdx;
750  }
751  }
752 
753  return 0;
754 }
unsigned int GetNormalsSize() const
GetNormalsSize.
const float * GetVertexPointer() const
GetVertexPointer - Get the array of vertexes.
unsigned int GetVertexSize() const
GetVertexSize.

References CLAYER_TRIANGLE_CONTAINER::GetNormalsSize(), CLAYER_TRIANGLE_CONTAINER::GetVertexPointer(), CLAYER_TRIANGLE_CONTAINER::GetVertexSize(), and setBlendfunction().

Referenced by CLAYERS_OGL_DISP_LISTS().

◆ GetZBot()

float CLAYERS_OGL_DISP_LISTS::GetZBot ( ) const
inline

Definition at line 266 of file clayer_triangles.h.

266 { return m_zBot; }

References m_zBot.

Referenced by C3D_RENDER_OGL_LEGACY::Redraw().

◆ GetZTop()

float CLAYERS_OGL_DISP_LISTS::GetZTop ( ) const
inline

Definition at line 267 of file clayer_triangles.h.

267 { return m_zTop; }

References m_zTop.

Referenced by C3D_RENDER_OGL_LEGACY::Redraw().

◆ setBlendfunction()

void CLAYERS_OGL_DISP_LISTS::setBlendfunction ( ) const
private

Definition at line 817 of file clayer_triangles.cpp.

818 {
819  glEnable( GL_BLEND );
820  glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
821 }

Referenced by generate_middle_triangles(), generate_top_or_bot_seg_ends(), and generate_top_or_bot_triangles().

◆ SetItIsTransparent()

void CLAYERS_OGL_DISP_LISTS::SetItIsTransparent ( bool  aSetTransparent)

Definition at line 634 of file clayer_triangles.cpp.

635 {
636  m_draw_it_transparent = aSetTransparent;
637 }

References m_draw_it_transparent.

Referenced by C3D_RENDER_OGL_LEGACY::Redraw(), and C3D_RENDER_OGL_LEGACY::render_solder_mask_layer().

Member Data Documentation

◆ m_draw_it_transparent

bool CLAYERS_OGL_DISP_LISTS::m_draw_it_transparent
private

Definition at line 297 of file clayer_triangles.h.

Referenced by CLAYERS_OGL_DISP_LISTS(), and SetItIsTransparent().

◆ m_haveTransformation

bool CLAYERS_OGL_DISP_LISTS::m_haveTransformation
private

◆ m_layer_bot_segment_ends

GLuint CLAYERS_OGL_DISP_LISTS::m_layer_bot_segment_ends
private

◆ m_layer_bot_triangles

GLuint CLAYERS_OGL_DISP_LISTS::m_layer_bot_triangles
private

◆ m_layer_middle_contourns_quads

GLuint CLAYERS_OGL_DISP_LISTS::m_layer_middle_contourns_quads
private

◆ m_layer_top_segment_ends

GLuint CLAYERS_OGL_DISP_LISTS::m_layer_top_segment_ends
private

◆ m_layer_top_triangles

GLuint CLAYERS_OGL_DISP_LISTS::m_layer_top_triangles
private

◆ m_zBot

float CLAYERS_OGL_DISP_LISTS::m_zBot
private

Definition at line 285 of file clayer_triangles.h.

Referenced by CLAYERS_OGL_DISP_LISTS(), DrawAllCameraCulled(), and GetZBot().

◆ m_zPositionTransformation

float CLAYERS_OGL_DISP_LISTS::m_zPositionTransformation
private

◆ m_zScaleTransformation

float CLAYERS_OGL_DISP_LISTS::m_zScaleTransformation
private

◆ m_zTop

float CLAYERS_OGL_DISP_LISTS::m_zTop
private

Definition at line 286 of file clayer_triangles.h.

Referenced by CLAYERS_OGL_DISP_LISTS(), DrawAllCameraCulled(), and GetZTop().


The documentation for this class was generated from the following files: