TAPs 0.7.7.3
TAPsAbstractPolyhedron.cpp
Go to the documentation of this file.
00001 /******************************************************************************
00002 TAPsAbstractPolyhedron.cpp
00003 
00004 AbstractPolyhedron class is a class for an AbstractPolyhedron.
00005 
00006 SUKITTI PUNAK   (09/13/2005)
00007 UPDATE          (09/30/2005)
00008 ******************************************************************************/
00009 #include "TAPsAbstractPolyhedron.hpp"
00010 // Using Inclusion Model (i.e. definitions are included in declarations)
00011 //                       (this name.cpp is included in name.hpp)
00012 // Each friend is defined directly inside its declaration.
00013 
00014 BEGIN_NAMESPACE_TAPs
00015 //=============================================================================
00016 // Static Variables
00017 //-----------------------------------------------------------------------------
00018 /* This has to be defined and used in subclass
00019 template <typename T>
00020 bool    AbstractPolyhedron<T>::m_gbHasBeenSet = false;
00021 template <typename T>
00022 std::vector< std::vector<int> > AbstractPolyhedron<T>::m_vVertexValence;
00023 template <typename T>
00024 std::vector< std::vector<int> > AbstractPolyhedron<T>::m_vVertexFace;
00025 template <typename T>
00026 std::vector< std::vector<int> > AbstractPolyhedron<T>::m_vFace(4);
00027 template <typename T>
00028 std::vector< std::vector<int> >::const_iterator AbstractPolyhedron<T>::m_itor;
00029 //*/
00030 //=============================================================================
00031 // Constructors and Destructor
00032 //-----------------------------------------------------------------------------
00033 template <typename T>
00034 AbstractPolyhedron<T>::AbstractPolyhedron ( int iNumVertices, int iNumFaces )
00035 {
00036     m_vVertex.resize( iNumVertices );
00037     m_vVertexNormal.resize( iNumVertices );
00038     m_vFaceNormal.resize( iNumFaces );
00039 }
00040 //-----------------------------------------------------------------------------
00041 template <typename T>
00042 AbstractPolyhedron<T>::~AbstractPolyhedron ()
00043 {}
00044 //-----------------------------------------------------------------------------
00045 //=============================================================================
00046 // Helper Functions
00047 //-----------------------------------------------------------------------------
00048 // DrawVertexNormals Fn
00049 template <typename T>
00050 void AbstractPolyhedron<T>::DrawVertexNormals ()
00051 {
00052     Vector3<T> dst;
00053     glColor3f( 1, 0.5, 0.25 );
00054     glDisable( GL_LIGHTING );
00055     glBegin( GL_LINES );
00056     for ( int p = 0; p < static_cast<int>( m_vVertexNormal.size() ); ++p ) {
00057         dst = m_vVertexNormal[p] + m_vVertex[p];
00058         glVertex3f( m_vVertex[p][0], m_vVertex[p][1], m_vVertex[p][2] );
00059         glVertex3f( dst[0], dst[1], dst[2] );
00060     }
00061     glEnd();
00062     glEnable( GL_LIGHTING );
00063 }
00064 //-----------------------------------------------------------------------------
00065 // DrawFaceNormals Fn
00066 template <typename T>
00067 void AbstractPolyhedron<T>::DrawFaceNormals ()
00068 {
00069     /*
00070     Vector3<T> dst;
00071     glBegin( GL_LINES );
00072     for ( int p = 0; p < static_cast<int>( m_vFaceNormal.size() ); ++p ) {
00073         dst = m_vFaceNormal[p] + m_vVertex[p];
00074         glVertex3f( m_vVertex[p][0], m_vVertex[p][1], m_vVertex[p][2] );
00075         glVertex3f( dst[0], dst[1], dst[2] );
00076     }
00077     glEnd();
00078     //*/
00079 }
00080 //-----------------------------------------------------------------------------
00081 //=============================================================================
00082 END_NAMESPACE_TAPs
00083 //345678901234567890123456789012345678901234567890123456789012345678901234567890
00084 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines