![]() |
TAPs 0.7.7.3
|
00001 /****************************************************************************** 00002 TAPsReadDot10.hpp 00003 00004 Create an Opengl polygonal mesh object from a .10 format file. 00005 00006 SUKITTI PUNAK (11/11/2004) 00007 UPDATE (11/11/2004) 00008 ******************************************************************************/ 00009 #ifndef TAPs_READ_DOT_10_HPP 00010 #define TAPs_READ_DOT_10_HPP 00011 00012 // The necessary headers are included in TAPsReadModel.hpp which directly uses 00013 // this header. 00014 /* 00015 #include "../OpenGLModel/TAPsPolygonalModel.hpp" 00016 #include "../OpenGLModel/TAPsXPolygonalModel.hpp" 00017 #include <iomanip> 00018 #include <cmath> 00019 #include <fstream> 00020 #include <cstring> // for string token strtok 00021 #include <cstdlib> // for converting string to numeric (strtod, strtol, strtoul) 00022 */ 00023 00024 BEGIN_NAMESPACE_TAPs 00025 //============================================================================= 00026 template <typename T> class ReadModels; 00027 //============================================================================= 00028 template <typename T> 00029 class ReadDot10 { 00030 friend class ReadModels<T>; 00031 // Member Functions ----------------------------------------------------------- 00032 private: 00033 //------------------------------------------------------------------------- 00034 // Read an input file 00035 // I/P: fileName 00036 // O/P: *prModel 00037 // Two fns per each operation due to the design of Model types; 00038 // One for PolygonalModel and its derived classes 00039 // The other for XPolygonalModel and its derived classes 00040 // 00041 // Each pairs are exactly identical (both declaration and definition) 00042 // except the passed prModel pointer. 00043 static bool readFile( const char *fileName, OpenGL::PolygonalModel<T> * const prModel ); 00044 static bool readFile( const char *fileName, OpenGL::XPolygonalModel<T> * const prModel ); 00045 //------------------------------------------------------------------------- 00046 // Convert the vertex node number n 00047 static void ProcessVertex( char *line, int n, OpenGL::PolygonalModel<T> * const prModel ); 00048 static void ProcessVertex( char *line, int n, OpenGL::XPolygonalModel<T> * const prModel ); 00049 //------------------------------------------------------------------------- 00050 // Convert the face node number n 00051 static void ProcessFace( char *line, int n, OpenGL::PolygonalModel<T> * const prModel ); 00052 static void ProcessFace( char *line, int n, OpenGL::XPolygonalModel<T> * const prModel ); 00053 //----------------------------------------------------------------------------- 00054 // Data Members --------------------------------------------------------------- 00055 private: 00056 static int NumberOfVertices; 00057 static int NumberOfFaces; 00058 static FILE *fileIn; 00059 }; 00060 //============================================================================= 00061 END_NAMESPACE_TAPs 00062 //----------------------------------------------------------------------------- 00063 // Include definition if TAPs_USE_EXPORT is not defined 00064 //#if !defined( TAPs_USE_EXPORT ) 00065 #include "TAPsReadDot10.cpp" 00066 //#endif 00067 //----------------------------------------------------------------------------- 00068 #endif 00069 //345678901234567890123456789012345678901234567890123456789012345678901234567890 00070 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8