![]() |
TAPs 0.7.7.3
|
00001 /****************************************************************************** 00002 TAPsReadOff.hpp 00003 00004 Create an OpenGL Model Object from a .off file 00005 00006 SUKITTI PUNAK (05/24/2006) 00007 UPDATE (06/01/2006) 00008 ******************************************************************************/ 00009 #ifndef TAPs_READ_OFF_HPP 00010 #define TAPs_READ_OFF_HPP 00011 00012 // The necessary headers are included in TAPsReadModel.hpp which directly uses 00013 // this header. 00014 00015 BEGIN_NAMESPACE_TAPs 00016 //============================================================================= 00017 template <typename T> class ReadModels; 00018 //============================================================================= 00019 template <typename T> 00020 class ReadOff { 00021 friend class ReadModels<T>; 00022 // Member Functions ---------------------------------------------------------- 00023 public: 00024 //------------------------------------------------------------------------- 00025 // Read an input file 00026 // I/P: fileName 00027 // O/P: *prModel 00028 // More than one fn per each operation due to the design of Model types; 00029 // E.g. 00030 // One for PolygonalModel and its derived classes 00031 // The other for XPolygonalModel and its derived classes 00032 // 00033 // Each pairs are exactly identical (both declaration and definition) 00034 // except the passed prModel pointer. 00035 //------------------------------------------------------------------------- 00036 static bool readFile( const char *fileName, OpenGL::PolygonalModel<T> * const prModel ); 00037 static bool readFile( const char *fileName, OpenGL::XPolygonalModel<T> * const prModel ); 00038 static bool readFile( const char *fileName, OpenGL::HalfEdgeModel<T> * const prModel ); 00039 //------------------------------------------------------------------------- 00040 private: 00041 //------------------------------------------------------------------------- 00042 // Process Each Node 00043 //------------------------------------------------------------------------- 00044 static bool ProcessHEADER( FILE * inputFile, OpenGL::MeshModel<T> * const prModel ); 00045 //------------------------------------------------------------------------- 00046 static void ProcessVERTEX_LIST( FILE * inputFile, OpenGL::PolygonalModel<T> * const prModel ); 00047 static void ProcessVERTEX_LIST( FILE * inputFile, OpenGL::XPolygonalModel<T> * const prModel ); 00048 static void ProcessVERTEX_LIST( FILE * inputFile, OpenGL::HalfEdgeModel<T> * const prModel ); 00049 //------------------------------------------------------------------------- 00050 static void ProcessFACE_LIST( FILE * inputFile, OpenGL::PolygonalModel<T> * const prModel ); 00051 static void ProcessFACE_LIST( FILE * inputFile, OpenGL::XPolygonalModel<T> * const prModel ); 00052 static void ProcessFACE_LIST( FILE * inputFile, OpenGL::HalfEdgeModel<T> * const prModel ); 00053 //------------------------------------------------------------------------- 00054 // Data Members --------------------------------------------------------------- 00055 private: 00056 //--------------------------------------------------------------- 00057 static int vertexNo; // current vertex number 00058 static int halfEdgeCounter; // count number of half-edges 00059 // static FILE *fileIn; 00060 /* 00061 // for half-edge originated vertex look up 00062 static HEVertex<T> ** vertexList; 00063 // hash table for vertex ring list 00064 // used for half-edge pair look up 00065 static HashTableBySTLVector<int> * vertexRingList; 00066 // hash table for halfedge ring list 00067 // used for half-edge pair look up 00068 static HashTableBySTLVector< HEHalfEdge<T>* > * halfEdgeRingList; 00069 // (bounday) half-edges on hole faces 00070 static HEHalfEdge<T> * boundaryHalfEdgePtr; 00071 //*/ 00072 }; 00073 //============================================================================= 00074 END_NAMESPACE_TAPs 00075 //----------------------------------------------------------------------------- 00076 // Include definition if TAPs_USE_EXPORT is not defined 00077 //#if !defined( TAPs_USE_EXPORT ) 00078 #include "TAPsReadOff.cpp" 00079 //#endif 00080 //----------------------------------------------------------------------------- 00081 #endif 00082 //34567890123456789012345678901234567890123456789012345678901234567890123456789 00083 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----