KiCad PCB EDA Suite
OPENGL_RENDER_LIST Class Reference

Store the OpenGL display lists to related with a layer. More...

#include <layer_triangles.h>

Public Member Functions

 OPENGL_RENDER_LIST (const TRIANGLE_DISPLAY_LIST &aLayerTriangles, GLuint aTextureIndexForSegEnds, float aZBot, float aZTop)
 Create the display lists for a layer. More...
 
 ~OPENGL_RENDER_LIST ()
 Destroy this class while free the display lists from GPU memory. More...
 
void DrawTopAndMiddle () const
 Call the display lists for the top elements and middle contours. More...
 
void DrawBotAndMiddle () const
 Call the display lists for the bottom elements and middle contours. More...
 
void DrawTop () const
 Call the display lists for the top elements. More...
 
void DrawBot () const
 Call the display lists for the bottom elements. More...
 
void DrawMiddle () const
 Call the display lists for the middle elements. More...
 
void DrawAll (bool aDrawMiddle=true) const
 Call to draw all the display lists. More...
 
void DrawAllCameraCulled (float zCameraPos, bool aDrawMiddle=true) const
 Draw all layers if they are visible by the camera if camera position is above the layer. More...
 
void DrawAllCameraCulledSubtractLayer (bool aDrawMiddle, const OPENGL_RENDER_LIST *aLayerToSubtractA=nullptr, const OPENGL_RENDER_LIST *aLayerToSubtractB=nullptr, const OPENGL_RENDER_LIST *aLayerToSubtractC=nullptr, const OPENGL_RENDER_LIST *aLayerToSubtractD=nullptr) 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 TRIANGLE_LIST *aTriangleContainer, bool aIsNormalUp, GLuint aTextureId) const
 
GLuint generate_top_or_bot_triangles (const TRIANGLE_LIST *aTriangleContainer, bool aIsNormalUp) const
 
GLuint generate_middle_triangles (const TRIANGLE_LIST *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

Store the OpenGL display lists to related with a layer.

Definition at line 139 of file layer_triangles.h.

Constructor & Destructor Documentation

◆ OPENGL_RENDER_LIST()

OPENGL_RENDER_LIST::OPENGL_RENDER_LIST ( const TRIANGLE_DISPLAY_LIST aLayerTriangles,
GLuint  aTextureIndexForSegEnds,
float  aZBot,
float  aZTop 
)

Create the display lists for a layer.

Parameters
aLayerTrianglescontains the layers array of vertex to render to display lists.
aTextureIndexForSegEndsis the texture 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 303 of file layer_triangles.cpp.

306{
307 m_zBot = aZBot;
308 m_zTop = aZTop;
309
315
316 if( aTextureIndexForSegEnds )
317 {
318 wxASSERT( glIsTexture( aTextureIndexForSegEnds ) );
319
320 if( glIsTexture( aTextureIndexForSegEnds ) )
321 {
324 true, aTextureIndexForSegEnds );
325
328 false, aTextureIndexForSegEnds );
329 }
330 }
331
333 true );
334
336 false );
337
338
339 if( aLayerTriangles.m_layer_middle_contourns_quads->GetVertexSize() > 0 )
340 {
343 }
344
345 m_draw_it_transparent = false;
346 m_haveTransformation = false;
349}
GLuint generate_middle_triangles(const TRIANGLE_LIST *aTriangleContainer) const
GLuint m_layer_middle_contourns_quads
GLuint generate_top_or_bot_seg_ends(const TRIANGLE_LIST *aTriangleContainer, bool aIsNormalUp, GLuint aTextureId) const
GLuint generate_top_or_bot_triangles(const TRIANGLE_LIST *aTriangleContainer, bool aIsNormalUp) const
TRIANGLE_LIST * m_layer_bot_segment_ends
TRIANGLE_LIST * m_layer_top_segment_ends
TRIANGLE_LIST * m_layer_bot_triangles
TRIANGLE_LIST * m_layer_top_triangles
TRIANGLE_LIST * m_layer_middle_contourns_quads
unsigned int GetVertexSize() const

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

◆ ~OPENGL_RENDER_LIST()

OPENGL_RENDER_LIST::~OPENGL_RENDER_LIST ( )

Destroy this class while free the display lists from GPU memory.

Definition at line 352 of file layer_triangles.cpp.

353{
354 if( glIsList( m_layer_top_segment_ends ) )
355 glDeleteLists( m_layer_top_segment_ends, 1 );
356
357 if( glIsList( m_layer_top_triangles ) )
358 glDeleteLists( m_layer_top_triangles, 1 );
359
360 if( glIsList( m_layer_middle_contourns_quads ) )
361 glDeleteLists( m_layer_middle_contourns_quads, 1 );
362
363 if( glIsList( m_layer_bot_triangles ) )
364 glDeleteLists( m_layer_bot_triangles, 1 );
365
366 if( glIsList( m_layer_bot_segment_ends ) )
367 glDeleteLists( m_layer_bot_segment_ends, 1 );
368
374}

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 OPENGL_RENDER_LIST::ApplyScalePosition ( float  aZposition,
float  aZscale 
)

Definition at line 589 of file layer_triangles.cpp.

590{
591 wxASSERT( aZscale > FLT_EPSILON );
592
593 m_zPositionTransformation = aZposition;
594 m_zScaleTransformation = aZscale;
596}

References m_haveTransformation, m_zPositionTransformation, and m_zScaleTransformation.

Referenced by RENDER_3D_OPENGL::Redraw(), RENDER_3D_OPENGL::renderBoardBody(), and RENDER_3D_OPENGL::renderSolderMaskLayer().

◆ beginTransformation()

void OPENGL_RENDER_LIST::beginTransformation ( ) const
private

Definition at line 782 of file layer_triangles.cpp.

783{
785 {
786 glPushMatrix();
787 glTranslatef( 0.0f, 0.0f, m_zPositionTransformation );
788 glScalef( 1.0f, 1.0f, m_zScaleTransformation );
789 }
790}

References m_haveTransformation, m_zPositionTransformation, and m_zScaleTransformation.

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

◆ ClearScalePosition()

void OPENGL_RENDER_LIST::ClearScalePosition ( )
inline

Definition at line 207 of file layer_triangles.h.

207{ m_haveTransformation = false; }

References m_haveTransformation.

◆ DrawAll()

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

Call to draw all the display lists.

Definition at line 450 of file layer_triangles.cpp.

451{
453
454 if( aDrawMiddle )
455 if( glIsList( m_layer_middle_contourns_quads ) )
456 glCallList( m_layer_middle_contourns_quads );
457
458 if( glIsList( m_layer_top_triangles ) )
459 glCallList( m_layer_top_triangles );
460
461 if( glIsList( m_layer_bot_triangles ) )
462 glCallList( m_layer_bot_triangles );
463
464 if( glIsList( m_layer_top_segment_ends ) )
465 glCallList( m_layer_top_segment_ends );
466
467 if( glIsList( m_layer_bot_segment_ends ) )
468 glCallList( m_layer_bot_segment_ends );
469
471}
void beginTransformation() const
void endTransformation() const

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 RENDER_3D_OPENGL::Redraw(), and RENDER_3D_OPENGL::renderBoardBody().

◆ DrawAllCameraCulled()

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

Draw all layers if they are visible by the camera 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
zCameraPosis the camera z axis position.

Definition at line 474 of file layer_triangles.cpp.

475{
476 zCameraPos = m_haveTransformation
478 : zCameraPos;
479
480 if( aDrawMiddle )
481 DrawMiddle();
482
483 if( zCameraPos > m_zTop )
484 {
485 DrawTop();
486 }
487 else
488 {
489 if( zCameraPos < m_zBot )
490 {
491 DrawBot();
492 }
493 else
494 {
495 // If camera is in the middle dont draw it.
496 }
497 }
498}
void DrawMiddle() const
Call the display lists for the middle elements.
void DrawTop() const
Call the display lists for the top elements.
void DrawBot() const
Call the display lists for the bottom elements.

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

Referenced by RENDER_3D_OPENGL::Redraw(), and RENDER_3D_OPENGL::renderSolderMaskLayer().

◆ DrawAllCameraCulledSubtractLayer()

void OPENGL_RENDER_LIST::DrawAllCameraCulledSubtractLayer ( bool  aDrawMiddle,
const OPENGL_RENDER_LIST aLayerToSubtractA = nullptr,
const OPENGL_RENDER_LIST aLayerToSubtractB = nullptr,
const OPENGL_RENDER_LIST aLayerToSubtractC = nullptr,
const OPENGL_RENDER_LIST aLayerToSubtractD = nullptr 
) const

Definition at line 501 of file layer_triangles.cpp.

506{
507 glClearStencil( 0x00 );
508 glClear( GL_STENCIL_BUFFER_BIT );
509
510 glEnable( GL_CULL_FACE );
511 glCullFace( GL_BACK );
512
513 glDisable( GL_DEPTH_TEST );
514 glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE );
515 glDepthMask( GL_FALSE );
516 glEnable( GL_STENCIL_TEST );
517 glStencilFunc( GL_ALWAYS, 1, 0 );
518 glStencilOp( GL_KEEP, GL_KEEP, GL_REPLACE );
519
520 if( aLayerToSubtractA )
521 aLayerToSubtractA->DrawBot();
522
523 if( aLayerToSubtractB )
524 aLayerToSubtractB->DrawBot();
525
526 if( aLayerToSubtractC )
527 aLayerToSubtractC->DrawBot();
528
529 if( aLayerToSubtractD )
530 aLayerToSubtractD->DrawBot();
531
532 glEnable(GL_DEPTH_TEST);
533 glDepthMask(GL_TRUE);
534
535 glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
536 glStencilFunc( GL_EQUAL, 0, 1 );
537 glStencilOp( GL_KEEP, GL_KEEP, GL_KEEP );
538 DrawBot();
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, 2, 0 );
545 glStencilOp( GL_KEEP, GL_KEEP, GL_REPLACE );
546
547 if( aLayerToSubtractA )
548 aLayerToSubtractA->DrawTop();
549
550 if( aLayerToSubtractB )
551 aLayerToSubtractB->DrawTop();
552
553 if( aLayerToSubtractC )
554 aLayerToSubtractC->DrawTop();
555
556 if( aLayerToSubtractD )
557 aLayerToSubtractD->DrawTop();
558
559 glEnable(GL_DEPTH_TEST);
560 glDepthMask(GL_TRUE);
561 glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
562 glStencilFunc( GL_NOTEQUAL, 2, 0x03 );
563 glStencilOp( GL_KEEP, GL_KEEP, GL_INCR );
564 DrawTop();
565
566 if( aDrawMiddle )
567 DrawMiddle();
568
569 glLightModeli( GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE );
570
571 glCullFace( GL_FRONT );
572 glStencilFunc( GL_GEQUAL, 3, 0x03 );
573 glStencilOp( GL_KEEP, GL_KEEP, GL_KEEP );
574 glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
575
576 if( aDrawMiddle )
577 {
578 if( aLayerToSubtractA )
579 aLayerToSubtractA->DrawMiddle();
580 }
581
582 glLightModeli( GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE );
583
584 glCullFace( GL_BACK );
585 glDisable( GL_STENCIL_TEST );
586}

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

Referenced by RENDER_3D_OPENGL::Redraw(), and RENDER_3D_OPENGL::renderSolderMaskLayer().

◆ DrawBot()

void OPENGL_RENDER_LIST::DrawBot ( ) const

Call the display lists for the bottom elements.

Definition at line 425 of file layer_triangles.cpp.

426{
428
429 if( glIsList( m_layer_bot_triangles ) )
430 glCallList( m_layer_bot_triangles );
431
432 if( glIsList( m_layer_bot_segment_ends ) )
433 glCallList( m_layer_bot_segment_ends );
434
436}

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

Referenced by DrawAllCameraCulled(), and DrawAllCameraCulledSubtractLayer().

◆ DrawBotAndMiddle()

void OPENGL_RENDER_LIST::DrawBotAndMiddle ( ) const

Call the display lists for the bottom elements and middle contours.

Definition at line 394 of file layer_triangles.cpp.

395{
397
398 if( glIsList( m_layer_middle_contourns_quads ) )
399 glCallList( m_layer_middle_contourns_quads );
400
401 if( glIsList( m_layer_bot_triangles ) )
402 glCallList( m_layer_bot_triangles );
403
404 if( glIsList( m_layer_bot_segment_ends ) )
405 glCallList( m_layer_bot_segment_ends );
406
408}

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

◆ DrawMiddle()

void OPENGL_RENDER_LIST::DrawMiddle ( ) const

Call the display lists for the middle elements.

Definition at line 439 of file layer_triangles.cpp.

440{
442
443 if( glIsList( m_layer_middle_contourns_quads ) )
444 glCallList( m_layer_middle_contourns_quads );
445
447}

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

Referenced by DrawAllCameraCulled(), and DrawAllCameraCulledSubtractLayer().

◆ DrawTop()

void OPENGL_RENDER_LIST::DrawTop ( ) const

Call the display lists for the top elements.

Definition at line 411 of file layer_triangles.cpp.

412{
414
415 if( glIsList( m_layer_top_triangles ) )
416 glCallList( m_layer_top_triangles );
417
418 if( glIsList( m_layer_top_segment_ends ) )
419 glCallList( m_layer_top_segment_ends );
420
422}

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

Referenced by DrawAllCameraCulled(), and DrawAllCameraCulledSubtractLayer().

◆ DrawTopAndMiddle()

void OPENGL_RENDER_LIST::DrawTopAndMiddle ( ) const

Call the display lists for the top elements and middle contours.

Definition at line 377 of file layer_triangles.cpp.

378{
380
381 if( glIsList( m_layer_middle_contourns_quads ) )
382 glCallList( m_layer_middle_contourns_quads );
383
384 if( glIsList( m_layer_top_triangles ) )
385 glCallList( m_layer_top_triangles );
386
387 if( glIsList( m_layer_top_segment_ends ) )
388 glCallList( m_layer_top_segment_ends );
389
391}

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

◆ endTransformation()

void OPENGL_RENDER_LIST::endTransformation ( ) const
private

Definition at line 766 of file layer_triangles.cpp.

767{
769 {
770 glPopMatrix();
771 }
772}

References m_haveTransformation.

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

◆ generate_middle_triangles()

GLuint OPENGL_RENDER_LIST::generate_middle_triangles ( const TRIANGLE_LIST aTriangleContainer) const
private

Definition at line 716 of file layer_triangles.cpp.

718{
719 wxASSERT( aTriangleContainer != nullptr );
720
721 // We expect that it is a multiple of 3 vertex
722 wxASSERT( ( aTriangleContainer->GetVertexSize() % 3 ) == 0 );
723
724 // We expect that it is a multiple of 6 vertex (because we expect to add quads)
725 wxASSERT( (aTriangleContainer->GetVertexSize() % 6 ) == 0 );
726
727 // We expect that there are normals with same size as vertex
728 wxASSERT( aTriangleContainer->GetNormalsSize() == aTriangleContainer->GetVertexSize() );
729
730 if( ( aTriangleContainer->GetVertexSize() > 0 )
731 && ( ( aTriangleContainer->GetVertexSize() % 3 ) == 0 )
732 && ( ( aTriangleContainer->GetVertexSize() % 6 ) == 0 )
733 && ( aTriangleContainer->GetNormalsSize() == aTriangleContainer->GetVertexSize() ) )
734 {
735 const GLuint listIdx = glGenLists( 1 );
736
737 if( glIsList( listIdx ) )
738 {
739 glDisableClientState( GL_TEXTURE_COORD_ARRAY );
740 glDisableClientState( GL_COLOR_ARRAY );
741 glEnableClientState( GL_NORMAL_ARRAY );
742 glEnableClientState( GL_VERTEX_ARRAY );
743 glVertexPointer( 3, GL_FLOAT, 0, aTriangleContainer->GetVertexPointer() );
744 glNormalPointer( GL_FLOAT, 0, aTriangleContainer->GetNormalsPointer() );
745
746 glNewList( listIdx, GL_COMPILE );
747
749
750 glDrawArrays( GL_TRIANGLES, 0, aTriangleContainer->GetVertexSize() );
751
752 glDisable( GL_BLEND );
753 glEndList();
754
755 glDisableClientState( GL_VERTEX_ARRAY );
756 glDisableClientState( GL_NORMAL_ARRAY );
757
758 return listIdx;
759 }
760 }
761
762 return 0;
763}
void setBlendfunction() const
const float * GetVertexPointer() const
Get the array of vertices.
unsigned int GetNormalsSize() const
const float * GetNormalsPointer() const
Get the array of normals.

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

Referenced by OPENGL_RENDER_LIST().

◆ generate_top_or_bot_seg_ends()

GLuint OPENGL_RENDER_LIST::generate_top_or_bot_seg_ends ( const TRIANGLE_LIST aTriangleContainer,
bool  aIsNormalUp,
GLuint  aTextureId 
) const
private

Definition at line 605 of file layer_triangles.cpp.

607{
608 wxASSERT( aTriangleContainer != nullptr );
609
610 wxASSERT( ( aTriangleContainer->GetVertexSize() % 3 ) == 0 );
611
612 // Top and Bot dont have normals array stored in container
613 wxASSERT( aTriangleContainer->GetNormalsSize() == 0 );
614
615 if( ( aTriangleContainer->GetVertexSize() > 0 )
616 && ( ( aTriangleContainer->GetVertexSize() % 3 ) == 0 ) )
617 {
618 GLuint listIdx = glGenLists( 1 );
619
620 if( glIsList( listIdx ) )
621 {
622 // Prepare an array of UV text coordinates
623 SFVEC2F* uvArray = new SFVEC2F[aTriangleContainer->GetVertexSize()];
624
625 for( unsigned int i = 0; i < aTriangleContainer->GetVertexSize(); i += 3 )
626 {
627 uvArray[i + 0] = SFVEC2F( 1.0f, 0.0f );
628 uvArray[i + 1] = SFVEC2F( 0.0f, 1.0f );
629 uvArray[i + 2] = SFVEC2F( 0.0f, 0.0f );
630 }
631
632 glEnableClientState( GL_TEXTURE_COORD_ARRAY );
633 glDisableClientState( GL_COLOR_ARRAY );
634 glDisableClientState( GL_NORMAL_ARRAY );
635 glEnableClientState( GL_VERTEX_ARRAY );
636 glVertexPointer( 3, GL_FLOAT, 0, aTriangleContainer->GetVertexPointer() );
637 glTexCoordPointer( 2, GL_FLOAT, 0, uvArray );
638
639 glNewList( listIdx, GL_COMPILE );
640
641 glDisable( GL_COLOR_MATERIAL );
642
643 glEnable( GL_TEXTURE_2D );
644 glBindTexture( GL_TEXTURE_2D, aTextureId );
645
646 glAlphaFunc( GL_GREATER, 0.2f );
647 glEnable( GL_ALPHA_TEST );
648
649 glNormal3f( 0.0f, 0.0f, aIsNormalUp?1.0f:-1.0f );
650
651 glDrawArrays( GL_TRIANGLES, 0, aTriangleContainer->GetVertexSize() );
652
653 glBindTexture( GL_TEXTURE_2D, 0 );
654 glDisable( GL_TEXTURE_2D );
655 glDisable( GL_ALPHA_TEST );
656 glDisable( GL_BLEND );
657
658 glEndList();
659
660 glDisableClientState( GL_VERTEX_ARRAY );
661 glDisableClientState( GL_TEXTURE_COORD_ARRAY );
662
663 delete [] uvArray;
664 return listIdx;
665 }
666 }
667
668 return 0;
669}
glm::vec2 SFVEC2F
Definition: xv3d_types.h:42

References TRIANGLE_LIST::GetNormalsSize(), TRIANGLE_LIST::GetVertexPointer(), and TRIANGLE_LIST::GetVertexSize().

Referenced by OPENGL_RENDER_LIST().

◆ generate_top_or_bot_triangles()

GLuint OPENGL_RENDER_LIST::generate_top_or_bot_triangles ( const TRIANGLE_LIST aTriangleContainer,
bool  aIsNormalUp 
) const
private

Definition at line 672 of file layer_triangles.cpp.

674{
675 wxASSERT( aTriangleContainer != nullptr );
676
677 wxASSERT( ( aTriangleContainer->GetVertexSize() % 3 ) == 0 );
678
679 // Top and Bot dont have normals array stored in container
680 wxASSERT( aTriangleContainer->GetNormalsSize() == 0 );
681
682 if( ( aTriangleContainer->GetVertexSize() > 0 )
683 && ( ( aTriangleContainer->GetVertexSize() % 3 ) == 0 ) )
684 {
685 const GLuint listIdx = glGenLists( 1 );
686
687 if( glIsList( listIdx ) )
688 {
689 glDisableClientState( GL_TEXTURE_COORD_ARRAY );
690 glDisableClientState( GL_COLOR_ARRAY );
691 glDisableClientState( GL_NORMAL_ARRAY );
692 glEnableClientState( GL_VERTEX_ARRAY );
693 glVertexPointer( 3, GL_FLOAT, 0, aTriangleContainer->GetVertexPointer() );
694
695 glNewList( listIdx, GL_COMPILE );
696
698
699 glNormal3f( 0.0f, 0.0f, aIsNormalUp?1.0f:-1.0f );
700
701 glDrawArrays( GL_TRIANGLES, 0, aTriangleContainer->GetVertexSize() );
702
703 glDisable( GL_BLEND );
704 glEndList();
705
706 glDisableClientState( GL_VERTEX_ARRAY );
707
708 return listIdx;
709 }
710 }
711
712 return 0;
713}

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

Referenced by OPENGL_RENDER_LIST().

◆ GetZBot()

float OPENGL_RENDER_LIST::GetZBot ( ) const
inline

Definition at line 211 of file layer_triangles.h.

211{ return m_zBot; }

References m_zBot.

Referenced by RENDER_3D_OPENGL::Redraw().

◆ GetZTop()

float OPENGL_RENDER_LIST::GetZTop ( ) const
inline

Definition at line 212 of file layer_triangles.h.

212{ return m_zTop; }

References m_zTop.

Referenced by RENDER_3D_OPENGL::Redraw().

◆ setBlendfunction()

void OPENGL_RENDER_LIST::setBlendfunction ( ) const
private

Definition at line 775 of file layer_triangles.cpp.

776{
777 glEnable( GL_BLEND );
778 glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
779}

Referenced by generate_middle_triangles(), and generate_top_or_bot_triangles().

◆ SetItIsTransparent()

void OPENGL_RENDER_LIST::SetItIsTransparent ( bool  aSetTransparent)

Member Data Documentation

◆ m_draw_it_transparent

bool OPENGL_RENDER_LIST::m_draw_it_transparent
private

Definition at line 241 of file layer_triangles.h.

Referenced by OPENGL_RENDER_LIST(), and SetItIsTransparent().

◆ m_haveTransformation

bool OPENGL_RENDER_LIST::m_haveTransformation
private

◆ m_layer_bot_segment_ends

GLuint OPENGL_RENDER_LIST::m_layer_bot_segment_ends
private

◆ m_layer_bot_triangles

GLuint OPENGL_RENDER_LIST::m_layer_bot_triangles
private

◆ m_layer_middle_contourns_quads

GLuint OPENGL_RENDER_LIST::m_layer_middle_contourns_quads
private

◆ m_layer_top_segment_ends

GLuint OPENGL_RENDER_LIST::m_layer_top_segment_ends
private

◆ m_layer_top_triangles

GLuint OPENGL_RENDER_LIST::m_layer_top_triangles
private

◆ m_zBot

float OPENGL_RENDER_LIST::m_zBot
private

Definition at line 229 of file layer_triangles.h.

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

◆ m_zPositionTransformation

float OPENGL_RENDER_LIST::m_zPositionTransformation
private

◆ m_zScaleTransformation

float OPENGL_RENDER_LIST::m_zScaleTransformation
private

◆ m_zTop

float OPENGL_RENDER_LIST::m_zTop
private

Definition at line 230 of file layer_triangles.h.

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


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