OpenGLHalfEdgeModel< T > Class Template Reference

#include <TAPsOpenGLHalfEdgeModel.hpp>

Inheritance diagram for OpenGLHalfEdgeModel< T >:

Inheritance graph
[legend]
Collaboration diagram for OpenGLHalfEdgeModel< T >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

void DrawHalfEdgeByNextPtrs ()
void DrawHalfEdgeByPrevPtrs ()
void DrawHalfEdgePairs (const HEHalfEdge< T > *pHalfEdge, Vector3< T > &color1, Vector3< T > &color2)
void DrawVertexNormals ()
void DrawVertexSimulationStatus ()
 OpenGLHalfEdgeModel ()
virtual void ToggleDisplayVertexNormals ()
virtual ~OpenGLHalfEdgeModel ()

Public Attributes

int gCount

Protected Member Functions

virtual void DrawGL (GLenum)

Protected Attributes

bool bIsDisplayVertexNormals

Friends

std::ostream & operator<< (std::ostream &output, OpenGLHalfEdgeModel< T > const &o)


Detailed Description

template<typename T>
class OpenGLHalfEdgeModel< T >

Definition at line 22 of file TAPsOpenGLHalfEdgeModel.hpp.


Constructor & Destructor Documentation

template<typename T>
BEGIN_NAMESPACE_TAPs__OpenGL OpenGLHalfEdgeModel< T >::OpenGLHalfEdgeModel (  )  [inline]

Definition at line 21 of file TAPsOpenGLHalfEdgeModel.cpp.

00022     : HalfEdgeModel<T>(), bIsDisplayVertexNormals( false )
00023 {
00024     #ifdef  TAPs_DEBUG_MODE
00025     std::cout << "OpenGLHalfEdgeModel<" << typeid(T).name() << "> constructor\n";
00026     #endif//TAPs_DEBUG_MODE
00027 
00028     gCount = 0;
00029 }

template<typename T>
OpenGLHalfEdgeModel< T >::~OpenGLHalfEdgeModel (  )  [inline, virtual]

Definition at line 33 of file TAPsOpenGLHalfEdgeModel.cpp.

00034 {
00035     #ifdef  TAPs_DEBUG_MODE
00036     std::cout << "OpenGLHalfEdgeModel<" << typeid(T).name() << "> destructor\n";
00037     #endif//TAPs_DEBUG_MODE
00038 }


Member Function Documentation

template<typename T>
void OpenGLHalfEdgeModel< T >::DrawGL ( GLenum  drawMode  )  [inline, protected, virtual]

Implements OpenGLSupport.

Definition at line 43 of file TAPsOpenGLHalfEdgeModel.cpp.

00044 {
00045 #ifdef  TAPs_USE_DATA_POOL
00046     glPushClientAttrib( GL_CLIENT_VERTEX_ARRAY_BIT );
00047 #endif//TAPs_USE_DATA_POOL
00048     //----------------------------------------------------------------
00049     //if ( true ) {
00050     if ( drawMode == OpenGL::Enum::POINT ) {
00051 
00052         #ifdef  TAPs_USE_DATA_POOL
00053         glEnableClientState( GL_VERTEX_ARRAY );
00054         if ( typeid(T) == typeid(float) )
00055         {
00056             glVertexPointer( 3, GL_FLOAT, 0, GetArrayOfVertexPositions().GetAddressOfDataNumber(0) );
00057         }
00058         else //if ( typeid(T) == typeid(double) )
00059         {
00060             glVertexPointer( 3, GL_DOUBLE, 0, GetArrayOfVertexPositions().GetAddressOfDataNumber(0) );
00061         }
00062         glPointSize( 2 );
00063         glDrawArrays( GL_POINTS, 0, GetArrayOfVertexPositions().GetSize() );
00064 
00065         #else //TAPs_USE_DATA_POOL
00066         HEVertex<T> *ptr = m_listVertex->Head();
00067         glBegin( drawMode );
00068         while ( ptr != NULL ) {
00069             // Draw the vertex
00070             glVertex3f ( 
00071                 static_cast<float>( (*ptr)[0] ), 
00072                 static_cast<float>( (*ptr)[1] ), 
00073                 static_cast<float>( (*ptr)[2] ) );
00074             ptr = ptr->Next();
00075         }
00076         glEnd();
00077 
00078         #endif//TAPs_USE_DATA_POOL
00079     }
00080     else if ( isFacetShading ) {
00081         // Draw the object
00082         //glEnable( GL_TEXTURE_2D );
00083         HEFace<T> *facePtr = m_listFace->Head();
00084         HEHalfEdge<T> *halfEdgePtr;
00085         //for ( int f = 0; f < GetNoFaces(); ++f ) {
00086         while ( facePtr != NULL ) {
00087 
00088             // Submaterial supported by .ASE
00089             #ifdef  TAPs_SUPPORT_ASE_FORMAT
00090             int matID = facePtr->GetMaterialID();
00091             if ( matID < static_cast<int>( this->submaterials.size() ) ) {
00092                 this->submaterials[ matID ]->ApplyMaterial();
00093             }
00094             #endif//TAPs_SUPPORT_ASE_FORMAT
00095 
00096             halfEdgePtr = facePtr->IncidentHalfEdge();
00097             glBegin( drawMode );
00098             //for ( int i = 0; i < 3; ++i ) {
00099             do {
00101                 //if ( m_prFace[i].GetNoTexCoords() != 0 ) {
00102                 //  glTexCoord2f( static_cast<float>( m_prFace[i].GetTexCoordHalfNo( j*2 ) ), 
00103                 //                static_cast<float>( m_prFace[i].GetTexCoordHalfNo( j*2+1 ) ) );
00104                 //}
00105                 // Normal of the face
00106                 glNormal3f (
00107                     static_cast<float>( facePtr->GetNormal()[0] ),
00108                     static_cast<float>( facePtr->GetNormal()[1] ),
00109                     static_cast<float>( facePtr->GetNormal()[2] )
00110                 );
00111                 // Draw the vertex
00112                 glVertex3f ( 
00113                     static_cast<float>( halfEdgePtr->Vertex()->GetPosition()[0] ),
00114                     static_cast<float>( halfEdgePtr->Vertex()->GetPosition()[1] ),
00115                     static_cast<float>( halfEdgePtr->Vertex()->GetPosition()[2] )
00116                 );
00117                 // DEBUG:
00118                 //std::cout << halfEdgePtr->Vertex()->GetPosition()[0];
00119                 //std::cout << halfEdgePtr->Vertex()->GetPosition()[1];
00120                 //std::cout << halfEdgePtr->Vertex()->GetPosition()[2];
00121                 //std::cout << "\n";
00122                 halfEdgePtr = halfEdgePtr->Next();
00123             } while ( halfEdgePtr != facePtr->IncidentHalfEdge() );
00124             //std::cout << "\n";
00125             //}
00126             glEnd();
00127             facePtr = facePtr->Next();
00128         }
00129 
00130         // Draw the object
00131         //for ( int i = 0; i < m_iNoFaces; i++ )
00132         //{
00133         //  glBegin( drawMode );
00134         //  for ( int j = 0; j < m_prFace[i].GetNoVertices(); ++j )
00135         //  {
00136         //      // Draw texture
00137         //      if ( m_prFace[i].GetNoTexCoords() != 0 ) {
00138         //          glTexCoord2f( static_cast<float>( m_prFace[i].GetTexCoordHalfNo( j*2 ) ), 
00139         //                        static_cast<float>( m_prFace[i].GetTexCoordHalfNo( j*2+1 ) ) );
00140         //      }
00141         //      // Normal of the face
00142         //      //glNormal3f ( static_cast<float>( m_prFace[i].GetNormal()[0] ), 
00143         //      //           static_cast<float>( m_prFace[i].GetNormal()[1] ), 
00144         //      //           static_cast<float>( m_prFace[i].GetNormal()[2] ) );
00145         //      // Draw the vertex
00146         //      glVertex3f ( 
00147         //          static_cast<float>( m_prXVertex[ m_prFace[i].GetVertexNo( j ) ][0] ), 
00148         //          static_cast<float>( m_prXVertex[ m_prFace[i].GetVertexNo( j ) ][1] ), 
00149         //          static_cast<float>( m_prXVertex[ m_prFace[i].GetVertexNo( j ) ][2] ) );
00150         //  }
00151         //  glEnd();
00152         //}
00154     }
00155     else {
00156         // Draw the object
00157 
00158         #ifdef  TAPs_USE_DATA_POOL
00159         glEnableClientState( GL_VERTEX_ARRAY );
00160         glEnableClientState( GL_NORMAL_ARRAY );
00161         if ( typeid(T) == typeid(float) )
00162         {
00163             glVertexPointer( 3, GL_FLOAT, 0, GetArrayOfVertexPositions().GetAddressOfDataNumber(0) );
00164             glNormalPointer( GL_FLOAT, 0, GetArrayOfVertexNormals().GetAddressOfDataNumber(0) );
00165         }
00166         else //if ( typeid(T) == typeid(double) )
00167         {
00168             glVertexPointer( 3, GL_DOUBLE, 0, GetArrayOfVertexPositions().GetAddressOfDataNumber(0) );
00169             glNormalPointer( GL_DOUBLE, 0, GetArrayOfVertexNormals().GetAddressOfDataNumber(0) );
00170         }
00171 
00172         #ifdef  TAPs_SUPPORT_ASE_FORMAT
00173         int i = 0;
00174         HEFace<T> *facePtr = m_listFace->Head();
00175         while ( facePtr != NULL ) {
00176 
00177             // Submaterial supported by .ASE
00178             int matID = facePtr->GetMaterialID();
00179             if ( matID < static_cast<int>( this->submaterials.size() ) ) {
00180                 this->submaterials[ matID ]->ApplyMaterial();
00181             }
00182             glDrawElements( 
00183                 GL_TRIANGLES, 
00184                 3, 
00185                 GL_UNSIGNED_INT, 
00186                 GetArrayOfIndexFaces().GetAddressOfDataNumber(i++) 
00187             );
00188             facePtr = facePtr->Next();
00189         }
00190         #else //TAPs_SUPPORT_ASE_FORMAT
00191         glDrawElements( 
00192             GL_TRIANGLES, 
00193             GetArrayOfIndexFaces().GetSize()*GetArrayOfIndexFaces().GetStride(), 
00194             GL_UNSIGNED_INT, 
00195             GetArrayOfIndexFaces().GetAddressOfDataNumber(0) 
00196         );
00197         #endif//TAPs_SUPPORT_ASE_FORMAT
00198 
00199         #else //TAPs_USE_DATA_POOL
00200         //glEnable( GL_TEXTURE_2D );
00201         HEFace<T> *facePtr = m_listFace->Head();
00202         HEHalfEdge<T> *halfEdgePtr;
00203         //for ( int f = 0; f < GetNoFaces(); ++f ) {
00204         while ( facePtr != NULL ) {
00205 
00206             // Submaterial supported by .ASE
00207             #ifdef  TAPs_SUPPORT_ASE_FORMAT
00208             int matID = facePtr->GetMaterialID();
00209             if ( matID < static_cast<int>( this->submaterials.size() ) ) {
00210                 this->submaterials[ matID ]->ApplyMaterial();
00211             }
00212             #endif//TAPs_SUPPORT_ASE_FORMAT
00213 
00214             halfEdgePtr = facePtr->IncidentHalfEdge();
00215             glBegin( drawMode );
00216             //for ( int i = 0; i < 3; ++i ) {
00217             do {
00219                 //if ( m_prFace[i].GetNoTexCoords() != 0 ) {
00220                 //  glTexCoord2f( static_cast<float>( m_prFace[i].GetTexCoordHalfNo( j*2 ) ), 
00221                 //                static_cast<float>( m_prFace[i].GetTexCoordHalfNo( j*2+1 ) ) );
00222                 //}
00224                 glNormal3f ( 
00225                     static_cast<float>( halfEdgePtr->Vertex()->GetNormal()[0] ),
00226                     static_cast<float>( halfEdgePtr->Vertex()->GetNormal()[1] ),
00227                     static_cast<float>( halfEdgePtr->Vertex()->GetNormal()[2] )
00228                 );
00229                 // Draw the vertex
00230                 glVertex3f ( 
00231                     static_cast<float>( halfEdgePtr->Vertex()->GetPosition()[0] ),
00232                     static_cast<float>( halfEdgePtr->Vertex()->GetPosition()[1] ),
00233                     static_cast<float>( halfEdgePtr->Vertex()->GetPosition()[2] )
00234                 );
00235                 // DEBUG:
00236                 //std::cout << halfEdgePtr->Vertex()->GetPosition()[0];
00237                 //std::cout << halfEdgePtr->Vertex()->GetPosition()[1];
00238                 //std::cout << halfEdgePtr->Vertex()->GetPosition()[2];
00239                 //std::cout << "\n";
00240                 halfEdgePtr = halfEdgePtr->Next();
00241             } while ( halfEdgePtr != facePtr->IncidentHalfEdge() );
00242             //std::cout << "\n";
00243             //}
00244             glEnd();
00245             facePtr = facePtr->Next();
00246         }
00247 
00248         #endif//TAPs_USE_DATA_POOL
00249 
00252         //for ( int i = 0; i < m_iNoFaces; i++ )
00253         //{
00254         //  glBegin( drawMode );
00255         //  for ( int j = 0; j < m_prFace[i].GetNoVertices(); ++j )
00256         //  {
00257         //      // Draw texture
00258         //      if ( m_prFace[i].GetNoTexCoords() != 0 ) {
00259         //          glTexCoord2f( static_cast<float>( m_prFace[i].GetTexCoordHalfNo( j*2 ) ), 
00260         //                        static_cast<float>( m_prFace[i].GetTexCoordHalfNo( j*2+1 ) ) );
00261         //      }
00262         //      // Normal of the vertex
00263         //      glNormal3f ( static_cast<float>( m_prXVertex[ m_prFace[i].GetVertexNo( j ) ].GetNormal()[0] ), 
00264         //                   static_cast<float>( m_prXVertex[ m_prFace[i].GetVertexNo( j ) ].GetNormal()[1] ), 
00265         //                   static_cast<float>( m_prXVertex[ m_prFace[i].GetVertexNo( j ) ].GetNormal()[2] ) ); 
00266         //      // Draw the vertex
00267         //      glVertex3f ( 
00268         //          static_cast<float>( m_prXVertex[ m_prFace[i].GetVertexNo( j ) ][0] ), 
00269         //          static_cast<float>( m_prXVertex[ m_prFace[i].GetVertexNo( j ) ][1] ), 
00270         //          static_cast<float>( m_prXVertex[ m_prFace[i].GetVertexNo( j ) ][2] ) );
00271         //  }
00272         //  glEnd();
00273         //}
00275     }
00276 
00277     // Draw Boundary
00278     //if ( drawMode == OpenGL::Enum::POLYGON_WITH_WIRE_FRAME ) {
00279     //if ( true ) {
00280     //  glColor3f( 1.0f, 0.0f, 0.0f );
00281     //  glDisable( GL_LIGHTING );
00282     //  glBegin( GL_LINES );
00283     //  HEFace<T> *facePtr = m_listFace->Head();
00284     //  HEHalfEdge<T> *halfEdgePtr;
00285     //  while ( facePtr != NULL ) {
00286     //      halfEdgePtr = facePtr->IncidentHalfEdge();
00287     //      do {
00288     //          if ( !halfEdgePtr->Pair() ) {
00289     //              // Draw the vertex
00290     //              glVertex3f ( 
00291     //                  static_cast<float>( halfEdgePtr->Vertex()->GetPosition()[0] ),
00292     //                  static_cast<float>( halfEdgePtr->Vertex()->GetPosition()[1] ),
00293     //                  static_cast<float>( halfEdgePtr->Vertex()->GetPosition()[2] )
00294     //              );
00295     //              glVertex3f ( 
00296     //                  static_cast<float>( halfEdgePtr->Next()->Vertex()->GetPosition()[0] ),
00297     //                  static_cast<float>( halfEdgePtr->Next()->Vertex()->GetPosition()[1] ),
00298     //                  static_cast<float>( halfEdgePtr->Next()->Vertex()->GetPosition()[2] )
00299     //              );
00300     //          }
00301     //          halfEdgePtr = halfEdgePtr->Next();
00302     //      } while ( halfEdgePtr != facePtr->IncidentHalfEdge() );
00303     //      facePtr = facePtr->Next();
00304     //  }
00305     //  glEnd();
00306     //  glEnable( GL_LIGHTING );
00307     //}
00308 
00309     // Draw Boundary
00310     if ( true ) {
00311         glColor3f( 1.0f, 0.0f, 0.0f );
00312         glPushAttrib( GL_LIGHTING_BIT );
00313         glDisable( GL_LIGHTING );
00314         glBegin( GL_LINES );
00315         if ( m_listHoleFace != NULL ) {
00316             HEFace<T> *facePtr = m_listHoleFace->Head();
00317             HEHalfEdge<T> *halfEdgePtr;
00318             while ( facePtr != NULL ) {
00319                 halfEdgePtr = facePtr->IncidentHalfEdge();
00320                 do {
00321                     //if ( halfEdgePtr && halfEdgePtr->Next() ) {
00322                         // Draw the vertex
00323                         glVertex3f ( 
00324                             static_cast<float>( halfEdgePtr->Vertex()->GetPosition()[0] ),
00325                             static_cast<float>( halfEdgePtr->Vertex()->GetPosition()[1] ),
00326                             static_cast<float>( halfEdgePtr->Vertex()->GetPosition()[2] )
00327                         );
00328                         glVertex3f ( 
00329                             static_cast<float>( halfEdgePtr->Next()->Vertex()->GetPosition()[0] ),
00330                             static_cast<float>( halfEdgePtr->Next()->Vertex()->GetPosition()[1] ),
00331                             static_cast<float>( halfEdgePtr->Next()->Vertex()->GetPosition()[2] )
00332                         );
00333                     //}
00334                     halfEdgePtr = halfEdgePtr->Next();
00335                 } while ( halfEdgePtr && halfEdgePtr != facePtr->IncidentHalfEdge() );
00336                 facePtr = facePtr->Next();
00337             }
00338         }
00339         glEnd();
00340         //glEnable( GL_LIGHTING );
00341         glPopAttrib();
00342     }
00343     //---------------------------------------------------------------
00344     static HEFace<T> * g_pFace = m_listFace->Head();
00345     //static int gCount = 0;
00346     //int gCount = 0;
00347     static int gCount2 = gCount;
00348     //static clock_t start = clock(), finish, delay;
00349 
00350     //---------------------------------------------------------------
00351     // Draw Vertex Normals
00352     if ( bIsDisplayVertexNormals ) {
00353         glPushAttrib( GL_LIGHTING_BIT | GL_CURRENT_BIT );
00354         glDisable( GL_LIGHTING );
00355         glColor3ub( 110, 50, 220 );
00356         HEVertex<T> * pVertex = GetVertexList()->Head();
00357         for ( int i = 0; i < GetNoVertices(); ++i ) {
00358             Fn::Draw3DLine( pVertex->GetPosition(), pVertex->GetPosition() + pVertex->GetNormal() );
00359             pVertex = pVertex->Next();
00360         }
00361         glPopAttrib();
00362     }
00363     
00364     //---------------------------------------------------------------
00365     // Draw HalfEdge Loop(s)
00366     if ( bIsDisplayVertexNormals ) {
00367         // For Delay
00368         //delay = clock();
00369         //if ( delay - start > 100 ) {
00370         //  start = delay;
00371         //  ++gCount;
00372         //}
00373         //++gCount;
00374 
00375         glPushAttrib( GL_LIGHTING_BIT | GL_CURRENT_BIT );
00376         glDisable( GL_LIGHTING );
00377         glEnable( GL_COLOR_MATERIAL );
00378         
00379         //glColor3ub( 175, 50, 70 );
00380         //DrawVertexNormals();
00381 
00382         /*
00383         glColor3ub( 75, 50, 175 );
00384         DrawHalfEdgeByPrevPtrs();
00385 
00386         glColor3ub( 175, 150, 70 );
00387         DrawHalfEdgeByNextPtrs();
00388         //*/
00389 
00390 //      while ( g_pFace ) {
00391         if ( g_pFace ) {
00392             HEHalfEdge<T> * pHalfEdge = g_pFace->IncidentHalfEdge();
00393             HEHalfEdge<T> * pStartHalfEdge = pHalfEdge;
00394             Vector3<T> color[20];
00395 
00396             color[0] = Vector3<T>( 0.0, 1.0, 0.0 );
00397             color[1] = Vector3<T>( 1.0, 0.0, 0.0 );
00398 
00399             color[2] = Vector3<T>( 0.0, 0.5, 0.0 );
00400             color[3] = Vector3<T>( 0.5, 1.0, 0.5 );
00401 
00402             color[4] = Vector3<T>( 0.0, 0.0, 0.5 );
00403             color[5] = Vector3<T>( 0.5, 0.5, 1.0 );
00404 
00405             color[6] = Vector3<T>( 0.5, 0.5, 0.0 );
00406             color[7] = Vector3<T>( 0.3, 0.5, 0.5 );
00407 
00408             color[8] = Vector3<T>( 0.5, 0.0, 0.0 );
00409             color[9] = Vector3<T>( 1.0, 0.5, 0.5 );
00410 
00411             int count = 0;
00412             do {
00413                 //std::cout << ++count << "\n";
00414                 DrawHalfEdgePairs( pHalfEdge, color[count], color[count+1] );
00415                 count += 2;
00416                 if ( count >= 10 )  count = 0;
00417                 pHalfEdge = pHalfEdge->Next();
00418             } while ( pHalfEdge != pStartHalfEdge );
00419             //if ( gCount % 25 == 0 ) {
00420             if ( gCount > gCount2 ) {
00421                 g_pFace = g_pFace->Next();
00422                 gCount2 = gCount;
00423             }
00424         }
00425         else {
00426             g_pFace = m_listFace->Head();
00427         }
00428 
00429         glPopAttrib();
00430     }
00431 
00432     //DrawVertexSimulationStatus();
00433 
00434     // Draw AABB Bounding Box
00435     //DrawBoundingAABB();
00436     //DrawBoundingEllipsoid();
00437     //DrawBoundingSphere();
00438     //----------------------------------------------------------------
00439 #ifdef  TAPs_USE_DATA_POOL
00440     glPopClientAttrib();
00441 #endif//TAPs_USE_DATA_POOL
00442 }

template<typename T>
void OpenGLHalfEdgeModel< T >::DrawHalfEdgeByNextPtrs (  )  [inline]

Definition at line 1257 of file TAPsOpenGLHalfEdgeModel.cpp.

01258 {
01259     HEFace<T> * pFace = m_listFace->Head();
01260     while ( pFace ) {
01261         HEHalfEdge<T> * pHalfEdge = pFace->IncidentHalfEdge();
01262         HEHalfEdge<T> * pNextHalfEdge = pHalfEdge->Next();
01263         HEHalfEdge<T> * pStartHalfEdge = pHalfEdge;
01264         do {
01265             OpenGLUsefulObj<T>::DrawOneHeadArrow( 
01266                     pHalfEdge->Vertex()->GetPosition()     + pFace->GetNormal()/5, 
01267                     pNextHalfEdge->Vertex()->GetPosition() + pFace->GetNormal()/5 );
01268             pHalfEdge     = pHalfEdge->Next();
01269             pNextHalfEdge = pNextHalfEdge->Next();
01270         } while ( pHalfEdge != pStartHalfEdge );
01271         pFace = pFace->Next();
01272     }
01273 }

template<typename T>
void OpenGLHalfEdgeModel< T >::DrawHalfEdgeByPrevPtrs (  )  [inline]

Definition at line 1276 of file TAPsOpenGLHalfEdgeModel.cpp.

01277 {
01278     HEFace<T> * pFace = m_listFace->Head();
01279     while ( pFace ) {
01280         HEHalfEdge<T> * pHalfEdge = pFace->IncidentHalfEdge();
01281         HEHalfEdge<T> * pPrevHalfEdge = pHalfEdge->Prev();
01282         HEHalfEdge<T> * pStartHalfEdge = pHalfEdge;
01283         do {
01284             OpenGLUsefulObj<T>::DrawOneHeadArrow( 
01285                     pHalfEdge->Vertex()->GetPosition()     + pFace->GetNormal()/10, 
01286                     pPrevHalfEdge->Vertex()->GetPosition() + pFace->GetNormal()/10 );
01287             pHalfEdge     = pHalfEdge->Next();
01288             pPrevHalfEdge = pPrevHalfEdge->Next();
01289         } while ( pHalfEdge != pStartHalfEdge );
01290         pFace = pFace->Next();
01291     }
01292 }

template<typename T>
void OpenGLHalfEdgeModel< T >::DrawHalfEdgePairs ( const HEHalfEdge< T > *  pHalfEdge,
Vector3< T > &  color1,
Vector3< T > &  color2 
) [inline]

Definition at line 1295 of file TAPsOpenGLHalfEdgeModel.cpp.

01296 {
01297     glPushAttrib( GL_LIGHTING_BIT | GL_ENABLE_BIT );
01298     glDisable( GL_LIGHTING );
01299     glEnable( GL_COLOR_MATERIAL );
01300     
01301     //*
01302     glColor3f( color1[0], color1[1], color1[2] );
01303     OpenGLUsefulObj<T>::DrawOneHeadArrow( 
01304             pHalfEdge->Vertex()->GetPosition()     + pHalfEdge->Face()->GetNormal()/2, 
01305             pHalfEdge->Next()->Vertex()->GetPosition() + pHalfEdge->Face()->GetNormal()/2 );
01306     //*/
01307     
01308     //*
01309     HEHalfEdge<T> * pPair = pHalfEdge->Pair();
01310     glColor3f( color2[0], color2[1], color2[2] );
01311     OpenGLUsefulObj<T>::DrawOneHeadArrow( 
01312             pPair->Vertex()->GetPosition()     + pHalfEdge->Face()->GetNormal()/4, 
01313             pPair->Next()->Vertex()->GetPosition() + pHalfEdge->Face()->GetNormal()/4 );
01314     //*/
01315 
01316     glPopAttrib();
01317 }

template<typename T>
void OpenGLHalfEdgeModel< T >::DrawVertexNormals (  )  [inline, virtual]

Reimplemented from OpenGLModel< T >.

Definition at line 1247 of file TAPsOpenGLHalfEdgeModel.cpp.

01248 {
01249     HEVertex<T> * pVertex = m_listVertex->Head();
01250     while ( pVertex ) {
01251         OpenGLUsefulObj<T>::DrawOneHeadArrow( pVertex->GetPosition(), pVertex->GetPosition() + pVertex->GetNormal() );
01252         pVertex = pVertex->Next();
01253     }
01254 }

template<typename T>
void OpenGLHalfEdgeModel< T >::DrawVertexSimulationStatus (  )  [inline]

Definition at line 98 of file TAPsOpenGLHalfEdgeModel.hpp.

00098 {}

template<typename T>
virtual void OpenGLHalfEdgeModel< T >::ToggleDisplayVertexNormals (  )  [inline, virtual]

Reimplemented from OpenGLModel< T >.

Definition at line 80 of file TAPsOpenGLHalfEdgeModel.hpp.

00081     {
00082         if ( !bIsDisplayVertexNormals ) {
00083             bIsDisplayVertexNormals = !bIsDisplayVertexNormals;
00084         }
00085         ++gCount;
00086     }


Friends And Related Function Documentation

template<typename T>
std::ostream& operator<< ( std::ostream &  output,
OpenGLHalfEdgeModel< T > const &  o 
) [friend]

Definition at line 25 of file TAPsOpenGLHalfEdgeModel.hpp.

00026     {
00027         output  << "\n======================\n"
00028                 <<   "TAPs::OpenGL::OpenGLHalfEdgeModel<"
00029                 << typeid(T).name() << "> Class\n"
00030                 <<   "======================\n";
00031         //----------------------------------------------------------------
00032         /*
00033         // Material Node from OpenGLSupport
00034         output  << "\nMaterial Node" << "\n{\n" << o.material << "\n}";
00035         //----------------------------------------------------------------
00036         // Nodes from XPolygonalModel<T>
00037         output  << "\n\nVertices " << o.m_iNoVertices << "\n{";
00038         for ( int i = 0; i < o.m_iNoVertices; ++i ) {
00039             output << "\n  #" << i << "\t" << o.m_prXVertex[i];
00040         }
00041         output  << "\n}";
00042         //----------------------------------------------------------------
00043         // Neighbor vertex ring#1
00044         if ( o.m_pviVertexRing1List ) {
00045             std::vector<int>::const_iterator iterator;
00046             output  << "\n\nVertexRing1 " << o.m_iNoVertices << "\n{";
00047             for ( int i = 0; i < o.m_iNoVertices; ++i ) {
00048                 output << "\n  #" << i;
00049                 for (   iterator = o.m_pviVertexRing1List[i].begin(); 
00050                         iterator != o.m_pviVertexRing1List[i].end();
00051                         ++iterator )
00052                 {
00053                     output << "\t" << *iterator;
00054                 }
00055             }
00056             output  << "\n}";
00057         }
00058         //----------------------------------------------------------------
00059         // Faces Node
00060         output  << "\n\nFaces " << o.m_iNoFaces  << "\n{";
00061         for ( int i = 0; i < o.m_iNoFaces; ++i ) {
00062             output << "\n  #" << i << "\t" << o.m_prFace[i];
00063         }
00064         output  << "\n}";
00065         */
00066         return output;
00067     }


Member Data Documentation

template<typename T>
bool OpenGLHalfEdgeModel< T >::bIsDisplayVertexNormals [protected]

Definition at line 119 of file TAPsOpenGLHalfEdgeModel.hpp.

template<typename T>
int OpenGLHalfEdgeModel< T >::gCount

Definition at line 87 of file TAPsOpenGLHalfEdgeModel.hpp.


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

Generated on Mon Oct 13 11:45:43 2008 for TAPs by  doxygen 1.5.6