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 189 of file clayer_triangles.h.

Constructor & Destructor Documentation

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

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.

330 {
331  m_zBot = aZBot;
332  m_zTop = aZTop;
333 
339 
340  if( aTextureIndexForSegEnds )
341  {
342  wxASSERT( glIsTexture( aTextureIndexForSegEnds ) );
343 
344  if( glIsTexture( aTextureIndexForSegEnds ) )
345  {
348  true,
349  aTextureIndexForSegEnds );
350 
353  false,
354  aTextureIndexForSegEnds );
355  }
356  }
357 
359  true );
360 
362  false );
363 
364 
365  if( aLayerTriangles.m_layer_middle_contourns_quads->GetVertexSize() > 0 )
366  {
369  }
370 
371  m_draw_it_transparent = false;
372  m_haveTransformation = false;
374  m_zScaleTransformation = 0.0f;
375 }
GLuint generate_middle_triangles(const CLAYER_TRIANGLE_CONTAINER *aTriangleContainer) const
GLuint generate_top_or_bot_seg_ends(const CLAYER_TRIANGLE_CONTAINER *aTriangleContainer, bool aIsNormalUp, GLuint aTextureId) const
CLAYER_TRIANGLE_CONTAINER * m_layer_top_triangles
CLAYER_TRIANGLE_CONTAINER * m_layer_middle_contourns_quads
CLAYER_TRIANGLE_CONTAINER * m_layer_bot_segment_ends
unsigned int GetVertexSize() const
GetVertexSize.
GLuint generate_top_or_bot_triangles(const CLAYER_TRIANGLE_CONTAINER *aTriangleContainer, bool aIsNormalUp) const
CLAYER_TRIANGLE_CONTAINER * m_layer_bot_triangles
CLAYER_TRIANGLE_CONTAINER * m_layer_top_segment_ends
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 378 of file clayer_triangles.cpp.

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.

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

Member Function Documentation

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

Definition at line 625 of file clayer_triangles.cpp.

References m_haveTransformation, m_zPositionTransformation, and m_zScaleTransformation.

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

627 {
628  wxASSERT( aZscale > FLT_EPSILON );
629 
630  m_zPositionTransformation = aZposition;
631  m_zScaleTransformation = aZscale;
632  m_haveTransformation = true;
633 }
void CLAYERS_OGL_DISP_LISTS::beginTransformation ( ) const
private

Definition at line 826 of file clayer_triangles.cpp.

References m_haveTransformation, m_zPositionTransformation, and m_zScaleTransformation.

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

827 {
829  {
830  glPushMatrix();
831  glTranslatef( 0.0f, 0.0f, m_zPositionTransformation );
832  glScalef( 1.0f, 1.0f, m_zScaleTransformation );
833  }
834 }
void CLAYERS_OGL_DISP_LISTS::ClearScalePosition ( )
inline

Definition at line 259 of file clayer_triangles.h.

References m_haveTransformation.

259 { m_haveTransformation = false; }
void CLAYERS_OGL_DISP_LISTS::DrawAll ( bool  aDrawMiddle = true) const

DrawAll - This function calls all the display lists.

Definition at line 476 of file clayer_triangles.cpp.

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().

477 {
479 
480  if( aDrawMiddle )
481  if( glIsList( m_layer_middle_contourns_quads ) )
482  glCallList( m_layer_middle_contourns_quads );
483 
484  if( glIsList( m_layer_top_triangles ) )
485  glCallList( m_layer_top_triangles );
486 
487  if( glIsList( m_layer_bot_triangles ) )
488  glCallList( m_layer_bot_triangles );
489 
490  if( glIsList( m_layer_top_segment_ends ) )
491  glCallList( m_layer_top_segment_ends );
492 
493  if( glIsList( m_layer_bot_segment_ends ) )
494  glCallList( m_layer_bot_segment_ends );
495 
497 }
void beginTransformation() const
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 500 of file clayer_triangles.cpp.

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

Referenced by C3D_RENDER_OGL_LEGACY::Redraw().

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

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

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

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

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

Definition at line 451 of file clayer_triangles.cpp.

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

Referenced by DrawAllCameraCulled(), and DrawAllCameraCulledSubtractLayer().

452 {
454 
455  if( glIsList( m_layer_bot_triangles ) )
456  glCallList( m_layer_bot_triangles );
457 
458  if( glIsList( m_layer_bot_segment_ends ) )
459  glCallList( m_layer_bot_segment_ends );
460 
462 }
void beginTransformation() const
void CLAYERS_OGL_DISP_LISTS::DrawBotAndMiddle ( ) const

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

Definition at line 420 of file clayer_triangles.cpp.

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

421 {
423 
424  if( glIsList( m_layer_middle_contourns_quads ) )
425  glCallList( m_layer_middle_contourns_quads );
426 
427  if( glIsList( m_layer_bot_triangles ) )
428  glCallList( m_layer_bot_triangles );
429 
430  if( glIsList( m_layer_bot_segment_ends ) )
431  glCallList( m_layer_bot_segment_ends );
432 
434 }
void beginTransformation() const
void CLAYERS_OGL_DISP_LISTS::DrawMiddle ( ) const

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

Definition at line 465 of file clayer_triangles.cpp.

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

Referenced by DrawAllCameraCulled(), and DrawAllCameraCulledSubtractLayer().

466 {
468 
469  if( glIsList( m_layer_middle_contourns_quads ) )
470  glCallList( m_layer_middle_contourns_quads );
471 
473 }
void beginTransformation() const
void CLAYERS_OGL_DISP_LISTS::DrawTop ( ) const

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

Definition at line 437 of file clayer_triangles.cpp.

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

Referenced by DrawAllCameraCulled(), and DrawAllCameraCulledSubtractLayer().

438 {
440 
441  if( glIsList( m_layer_top_triangles ) )
442  glCallList( m_layer_top_triangles );
443 
444  if( glIsList( m_layer_top_segment_ends ) )
445  glCallList( m_layer_top_segment_ends );
446 
448 }
void beginTransformation() const
void CLAYERS_OGL_DISP_LISTS::DrawTopAndMiddle ( ) const

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

Definition at line 403 of file clayer_triangles.cpp.

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

404 {
406 
407  if( glIsList( m_layer_middle_contourns_quads ) )
408  glCallList( m_layer_middle_contourns_quads );
409 
410  if( glIsList( m_layer_top_triangles ) )
411  glCallList( m_layer_top_triangles );
412 
413  if( glIsList( m_layer_top_segment_ends ) )
414  glCallList( m_layer_top_segment_ends );
415 
417 }
void beginTransformation() const
void CLAYERS_OGL_DISP_LISTS::endTransformation ( ) const
private

Definition at line 810 of file clayer_triangles.cpp.

References m_haveTransformation.

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

811 {
813  {
814  glPopMatrix();
815  }
816 }
GLuint CLAYERS_OGL_DISP_LISTS::generate_middle_triangles ( const CLAYER_TRIANGLE_CONTAINER aTriangleContainer) const
private

Definition at line 759 of file clayer_triangles.cpp.

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().

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

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

Referenced by CLAYERS_OGL_DISP_LISTS().

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

Definition at line 714 of file clayer_triangles.cpp.

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

Referenced by CLAYERS_OGL_DISP_LISTS().

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

Definition at line 263 of file clayer_triangles.h.

References m_zBot.

Referenced by C3D_RENDER_OGL_LEGACY::Redraw().

263 { return m_zBot; }
float CLAYERS_OGL_DISP_LISTS::GetZTop ( ) const
inline

Definition at line 264 of file clayer_triangles.h.

References m_zTop.

Referenced by C3D_RENDER_OGL_LEGACY::Redraw().

264 { return m_zTop; }
void CLAYERS_OGL_DISP_LISTS::setBlendfunction ( ) const
private

Definition at line 819 of file clayer_triangles.cpp.

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

820 {
821  glEnable( GL_BLEND );
822  glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
823 }
void CLAYERS_OGL_DISP_LISTS::SetItIsTransparent ( bool  aSetTransparent)

Definition at line 636 of file clayer_triangles.cpp.

References m_draw_it_transparent.

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

637 {
638  m_draw_it_transparent = aSetTransparent;
639 }

Member Data Documentation

bool CLAYERS_OGL_DISP_LISTS::m_draw_it_transparent
private

Definition at line 294 of file clayer_triangles.h.

Referenced by CLAYERS_OGL_DISP_LISTS(), and SetItIsTransparent().

bool CLAYERS_OGL_DISP_LISTS::m_haveTransformation
private
GLuint CLAYERS_OGL_DISP_LISTS::m_layer_bot_segment_ends
private
GLuint CLAYERS_OGL_DISP_LISTS::m_layer_bot_triangles
private
GLuint CLAYERS_OGL_DISP_LISTS::m_layer_middle_contourns_quads
private
GLuint CLAYERS_OGL_DISP_LISTS::m_layer_top_segment_ends
private
GLuint CLAYERS_OGL_DISP_LISTS::m_layer_top_triangles
private
float CLAYERS_OGL_DISP_LISTS::m_zBot
private

Definition at line 282 of file clayer_triangles.h.

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

float CLAYERS_OGL_DISP_LISTS::m_zPositionTransformation
private
float CLAYERS_OGL_DISP_LISTS::m_zScaleTransformation
private
float CLAYERS_OGL_DISP_LISTS::m_zTop
private

Definition at line 283 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: