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 622 of file clayer_triangles.cpp.

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

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 823 of file clayer_triangles.cpp.

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

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

808 {
810  {
811  glPopMatrix();
812  }
813 }

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 756 of file clayer_triangles.cpp.

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

References CLAYER_TRIANGLE_CONTAINER::GetNormalsPointer(), CLAYER_TRIANGLE_CONTAINER::GetNormalsSize(), CLAYER_TRIANGLE_CONTAINER::GetVertexPointer(), CLAYER_TRIANGLE_CONTAINER::GetVertexSize(), NULL, 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 639 of file clayer_triangles.cpp.

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

References CLAYER_TRIANGLE_CONTAINER::GetNormalsSize(), CLAYER_TRIANGLE_CONTAINER::GetVertexPointer(), CLAYER_TRIANGLE_CONTAINER::GetVertexSize(), NULL, 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 711 of file clayer_triangles.cpp.

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

References CLAYER_TRIANGLE_CONTAINER::GetNormalsSize(), CLAYER_TRIANGLE_CONTAINER::GetVertexPointer(), CLAYER_TRIANGLE_CONTAINER::GetVertexSize(), NULL, 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 816 of file clayer_triangles.cpp.

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

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 633 of file clayer_triangles.cpp.

634 {
635  m_draw_it_transparent = aSetTransparent;
636 }

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: