TAPs 0.7.7.3
TAPsReadModels.cpp
Go to the documentation of this file.
00001 /******************************************************************************
00002 TAPsReadModels.cpp
00003 ******************************************************************************/
00007 /******************************************************************************
00008 SUKITTI PUNAK   (11/11/2004)
00009 UPDATE          (04/29/2007)
00010 ******************************************************************************/
00011 #include "TAPsReadModels.hpp"
00012 // Using Inclusion Model (i.e. definitions are included in declarations)
00013 //                       (this name.cpp is included in name.hpp)
00014 // Each friend is defined directly inside its declaration.
00015 
00016 BEGIN_NAMESPACE_TAPs
00017 //=============================================================================
00018 // CLASS: ReadModels ***********************************************************
00019 //-----------------------------------------------------------------------------
00020 // Read an input file
00021 template <typename T>
00022 bool ReadModels<T>::readFile( const char *fileName, 
00023                         OpenGL::OpenGLModel<T> * const prModel )
00024 {
00025     //----------------------------------------------------------------
00026     // Find the format of the file
00027     char * name   = new char[ strlen( fileName )+1 ];
00028     char * format = new char[ strlen( fileName )+1 ];
00029     strcpy( name, fileName );
00030     char *token = strtok( name, "." );
00031     do {
00032         strcpy( format, token );
00033         token = strtok( '\0', "." );
00034     } while ( token );
00035     //----------------------------------------------------------------
00036     // If model is not created yet!
00037     if ( !prModel ) {
00038         std::cout << "The model must be created first!" << std::endl;
00039         return false;
00040     }
00041     //----------------------------------------------------------------
00042     // ADD NEW MODEL TYPE HERE and AT Every Process .file format
00043     // Check Model Type
00044     OpenGL::OpenGLPNTriangleModel<T> * prOpenGLPNTriangleModel = 
00045         dynamic_cast< OpenGL::OpenGLPNTriangleModel<T> * > ( prModel );
00046     OpenGL::OpenGLPNTriangleVolPresModel<T> * prOpenGLPNTriangleVolPresModel = 
00047         dynamic_cast< OpenGL::OpenGLPNTriangleVolPresModel<T> * > ( prModel );
00048     OpenGL::OpenGLVolPresPolygonalModel<T> * prOpenGLVolPresPolygonalModel = 
00049         dynamic_cast< OpenGL::OpenGLVolPresPolygonalModel<T> * > ( prModel );
00050     OpenGL::OpenGLVolPresTriModel<T> * prOpenGLVolPresTriModel = 
00051         dynamic_cast< OpenGL::OpenGLVolPresTriModel<T> * > ( prModel );
00052     OpenGL::OpenGLXTrigonalModel<T> * prOpenGLXTrigonalModel = 
00053         dynamic_cast< OpenGL::OpenGLXTrigonalModel<T> * > ( prModel );
00054     OpenGL::OpenGLXPolygonalModel<T> * prOpenGLXPolygonalModel = 
00055         dynamic_cast< OpenGL::OpenGLXPolygonalModel<T> * > ( prModel );
00056     OpenGL::OpenGLTrigonalModel<T> * prOpenGLTrigonalModel = 
00057         dynamic_cast< OpenGL::OpenGLTrigonalModel<T> * > ( prModel );
00058     OpenGL::OpenGLPolygonalModel<T> * prOpenGLPolygonalModel = 
00059         dynamic_cast< OpenGL::OpenGLPolygonalModel<T> * > ( prModel );
00060     OpenGL::OpenGLHalfEdgeModel<T> * prOpenGLHalfEdgeModel = 
00061         dynamic_cast< OpenGL::OpenGLHalfEdgeModel<T> * > ( prModel );
00062     OpenGL::OpenGLSpringHalfEdgeModel<T> * prOpenGLSpringHalfEdgeModel = 
00063         dynamic_cast< OpenGL::OpenGLSpringHalfEdgeModel<T> * > ( prModel );
00064     OpenGL::OpenGLHalfEdgeTrigonalModel<T> * prOpenGLHalfEdgeTrigonalModel = 
00065         dynamic_cast< OpenGL::OpenGLHalfEdgeTrigonalModel<T> * > ( prModel );
00066     OpenGL::OpenGLHETriMeshOneModelMultiParts<T> * prOpenGLHETriMeshOneModelMultiParts = 
00067         dynamic_cast< OpenGL::OpenGLHETriMeshOneModelMultiParts<T> * > ( prModel );
00068     //-------------------------------------------
00069     // 3D Volume Model
00070     OpenGL::OpenGL3DModel<T> * prOpenGL3DModel = 
00071         dynamic_cast< OpenGL::OpenGL3DModel<T> * > ( prModel );
00072     //----------------------------------------------------------------
00073 
00074     //std::cout << "format: << " << format << "\n";
00075 
00076     // Process .TAPs format
00077     if ( strcmp( format, "TAPs" ) == 0 ) {
00078         if ( prOpenGLPNTriangleModel
00079           || prOpenGLPNTriangleVolPresModel
00080           || prOpenGLVolPresPolygonalModel 
00081           || prOpenGLVolPresTriModel 
00082           || prOpenGLXTrigonalModel 
00083           || prOpenGLXPolygonalModel )
00084         {
00085             OpenGL::XPolygonalModel<T> * prXPolygonalModel = dynamic_cast< OpenGL::XPolygonalModel<T> * >( prModel );
00086             if ( !ReadTAPs<T>::readFile( fileName, prXPolygonalModel ) ) {
00087                 std::cout << "TAPsReadModels: ReadTAPs<T>::readFile Fn returns false!" << std::endl;
00088                 return false;
00089             }
00090         }
00091         else if ( prOpenGLTrigonalModel
00092                || prOpenGLPolygonalModel ) 
00093         {
00094             OpenGL::PolygonalModel<T> * prPolygonalModel = dynamic_cast< OpenGL::PolygonalModel<T> * >( prModel );
00095             if ( !ReadTAPs<T>::readFile( fileName, prPolygonalModel ) ) {
00096                 std::cout << "TAPsReadModels: ReadTAPs<T>::readFile Fn returns false!" << std::endl;
00097                 return false;
00098             }
00099         }
00100         //else if ( prOpenGLHalfEdgeModel )
00101         //{
00102         //  OpenGL::HalfEdgeModel<T> * prHalfEdgeModel = dynamic_cast< OpenGL::HalfEdgeModel<T> * >( prModel );
00103         //  if ( !ReadTAPs<T>::readFile( fileName, prHalfEdgeModel ) ) {
00104         //      std::cout << "TAPsReadModels: ReadTAPs<T>::readFile Fn returns false!" << std::endl;
00105         //      return false;
00106         //  }
00107         //}
00108         else {
00109             return false;
00110         }
00111     }
00112     //----------------------------------------------------------------
00113     // Process .obj format
00114     else if ( strcmp( format, "obj" ) == 0 ) {
00115         if ( prOpenGLPNTriangleModel
00116           || prOpenGLPNTriangleVolPresModel
00117           || prOpenGLVolPresPolygonalModel 
00118           || prOpenGLVolPresTriModel 
00119           || prOpenGLXTrigonalModel 
00120           || prOpenGLXPolygonalModel )
00121         {
00122             OpenGL::XPolygonalModel<T> * prXPolygonalModel = dynamic_cast< OpenGL::XPolygonalModel<T> * >( prModel );
00123             if ( !ReadObj<T>::ReadFile( fileName, prXPolygonalModel ) ) {
00124                 std::cout << "TAPsReadModels: ReadObj<T>::ReadFile Fn returns false!" << std::endl;
00125                 return false;
00126             }
00127         }
00128         else if ( prOpenGLTrigonalModel
00129                || prOpenGLPolygonalModel ) 
00130         {
00131             OpenGL::PolygonalModel<T> * prPolygonalModel = dynamic_cast< OpenGL::PolygonalModel<T> * >( prModel );
00132             if ( !ReadObj<T>::ReadFile( fileName, prPolygonalModel ) ) {
00133                 std::cout << "TAPsReadModels: ReadObj<T>::ReadFile Fn returns false!" << std::endl;
00134                 return false;
00135             }
00136         }
00137         else if ( prOpenGLHalfEdgeModel 
00138                || prOpenGLSpringHalfEdgeModel
00139                || prOpenGLHalfEdgeTrigonalModel
00140                || prOpenGLHETriMeshOneModelMultiParts )
00141         {
00142             OpenGL::HalfEdgeModel<T> * prHalfEdgeModel = dynamic_cast< OpenGL::HalfEdgeModel<T> * >( prModel );
00143             if ( !ReadObj<T>::ReadFile( fileName, prHalfEdgeModel ) ) {
00144                 std::cout << "TAPsReadModels: ReadObj<T>::ReadFile Fn returns false!" << std::endl;
00145                 return false;
00146             }
00147         }
00148         else {
00149             return false;
00150         }
00151     }
00152     //----------------------------------------------------------------
00153     // Process .10 format
00154     else if ( strcmp( format, "10" ) == 0 ) {
00155         if ( prOpenGLPNTriangleModel
00156           || prOpenGLPNTriangleVolPresModel
00157           || prOpenGLVolPresPolygonalModel 
00158           || prOpenGLVolPresTriModel 
00159           || prOpenGLXTrigonalModel 
00160           || prOpenGLXPolygonalModel ) 
00161         {
00162             OpenGL::XPolygonalModel<T> * prXPolygonalModel = dynamic_cast< OpenGL::XPolygonalModel<T> * >( prModel );
00163             if ( !ReadDot10<T>::readFile( fileName, prXPolygonalModel ) ) {
00164                 std::cout << "TAPsReadModels: ReadDot10<T>::readFile Fn returns false!" << std::endl;
00165                 return false;
00166             }
00167         }
00168         else if ( prOpenGLTrigonalModel
00169                || prOpenGLPolygonalModel ) 
00170         {
00171             OpenGL::PolygonalModel<T> * prPolygonalModel = dynamic_cast< OpenGL::PolygonalModel<T> * >( prModel );
00172             if ( !ReadDot10<T>::readFile( fileName, prPolygonalModel ) ) {
00173                 std::cout << "TAPsReadModels: ReadDot10<T>::readFile Fn returns false!" << std::endl;
00174                 return false;
00175             }
00176         }
00177         //else if ( prOpenGLHalfEdgeModel )
00178         //{
00179         //  OpenGL::HalfEdgeModel<T> * prHalfEdgeModel = dynamic_cast< OpenGL::HalfEdgeModel<T> * >( prModel );
00180         //  if ( !ReadDot10<T>::readFile( fileName, prHalfEdgeModel ) ) {
00181         //      std::cout << "TAPsReadModels: ReadDot10<T>::readFile Fn returns false!" << std::endl;
00182         //      return false;
00183         //  }
00184         //}
00185         else {
00186             return false;
00187         }
00188     }
00189     //----------------------------------------------------------------
00190     // Process .ASC format
00191     else if ( strcmp( format, "ASC" ) == 0 ) {
00192         if ( prOpenGLPNTriangleModel
00193           || prOpenGLPNTriangleVolPresModel
00194           || prOpenGLVolPresPolygonalModel 
00195           || prOpenGLVolPresTriModel
00196           || prOpenGLXTrigonalModel
00197           || prOpenGLXPolygonalModel
00198         ) {
00199             OpenGL::XPolygonalModel<T> * prXPolygonalModel = dynamic_cast< OpenGL::XPolygonalModel<T> * >( prModel );
00200             if ( !Read3dsMaxASC<T>::readFile( fileName, prXPolygonalModel ) ) {
00201                 std::cout << "TAPsReadModels: Read3dsMaxASC<T>::readFile Fn returns false!" << std::endl;
00202                 return false;
00203             }
00204         }
00205         else if ( prOpenGLTrigonalModel
00206                || prOpenGLPolygonalModel
00207         ) {
00208             OpenGL::PolygonalModel<T> * prPolygonalModel = dynamic_cast< OpenGL::PolygonalModel<T> * >( prModel );
00209             if ( !Read3dsMaxASC<T>::readFile( fileName, prPolygonalModel ) ) {
00210                 std::cout << "TAPsReadModels: Read3dsMaxASC<T>::readFile Fn returns false!" << std::endl;
00211                 return false;
00212             }
00213         }
00214         else if ( prOpenGLHalfEdgeModel
00215                || prOpenGLSpringHalfEdgeModel
00216                || prOpenGLHalfEdgeTrigonalModel
00217                || prOpenGLHETriMeshOneModelMultiParts
00218         ) {
00219             OpenGL::HalfEdgeModel<T> * prHalfEdgeModel = dynamic_cast< OpenGL::HalfEdgeModel<T> * >( prModel );
00220             if ( !Read3dsMaxASC<T>::readFile( fileName, prHalfEdgeModel ) ) {
00221                 std::cout << "TAPsReadModels: Read3dsMaxASC<T>::readFile Fn returns false!" << std::endl;
00222                 return false;
00223             }
00224         }
00225         else {
00226             return false;
00227         }
00228     }
00229     //----------------------------------------------------------------
00230     // Process .ASE format
00231     else if ( strcmp( format, "ASE" ) == 0 ) {
00232         if ( prOpenGLPNTriangleModel
00233           || prOpenGLPNTriangleVolPresModel
00234           || prOpenGLVolPresPolygonalModel
00235           || prOpenGLVolPresTriModel
00236           || prOpenGLXTrigonalModel
00237           || prOpenGLXPolygonalModel
00238         ) {
00239             OpenGL::XPolygonalModel<T> * prXPolygonalModel = dynamic_cast< OpenGL::XPolygonalModel<T> * >( prModel );
00240             if ( !Read3dsMaxASE<T>::readFile( fileName, prXPolygonalModel ) ) {
00241                 std::cout << "TAPsReadModels: Read3dsMaxASE<T>::readFile Fn returns false!" << std::endl;
00242                 return false;
00243             }
00244         }
00245         else if ( prOpenGLTrigonalModel
00246                || prOpenGLPolygonalModel
00247         ) {
00248             OpenGL::PolygonalModel<T> * prPolygonalModel = dynamic_cast< OpenGL::PolygonalModel<T> * >( prModel );
00249             if ( !Read3dsMaxASE<T>::readFile( fileName, prPolygonalModel ) ) {
00250                 std::cout << "TAPsReadModels: Read3dsMaxASE<T>::readFile Fn returns false!" << std::endl;
00251                 return false;
00252             }
00253         }
00254         else if ( prOpenGLHalfEdgeModel
00255                || prOpenGLSpringHalfEdgeModel
00256                || prOpenGLHalfEdgeTrigonalModel
00257                || prOpenGLHETriMeshOneModelMultiParts
00258         ) {
00259             OpenGL::HalfEdgeModel<T> * prHalfEdgeModel = dynamic_cast< OpenGL::HalfEdgeModel<T> * >( prModel );
00260             if ( !Read3dsMaxASE<T>::readFile( fileName, prHalfEdgeModel ) ) {
00261                 std::cout << "TAPsReadModels: Read3dsMaxASE<T>::readFile Fn returns false!" << std::endl;
00262                 return false;
00263             }
00264         }
00265         else {
00266             return false;
00267         }
00268     }
00269     //----------------------------------------------------------------
00270     // Process .ply format
00271     else if ( strcmp( format, "ply" ) == 0 ) {
00272         if ( prOpenGLPNTriangleModel
00273           || prOpenGLPNTriangleVolPresModel
00274           || prOpenGLVolPresPolygonalModel 
00275           || prOpenGLVolPresTriModel 
00276           || prOpenGLXTrigonalModel 
00277           || prOpenGLXPolygonalModel ) 
00278         {
00279             OpenGL::XPolygonalModel<T> * prXPolygonalModel = dynamic_cast< OpenGL::XPolygonalModel<T> * >( prModel );
00280             if ( !ReadPly<T>::readFile( fileName, prXPolygonalModel ) ) {
00281                 std::cout << "TAPsReadModels: ReadPly<T>::readFile Fn returns false!" << std::endl;
00282                 return false;
00283             }
00284         }
00285         else if ( prOpenGLTrigonalModel
00286                || prOpenGLPolygonalModel ) 
00287         {
00288             OpenGL::PolygonalModel<T> * prPolygonalModel = dynamic_cast< OpenGL::PolygonalModel<T> * >( prModel );
00289             if ( !ReadPly<T>::readFile( fileName, prPolygonalModel ) ) {
00290                 std::cout << "TAPsReadModels: ReadPly<T>::readFile Fn returns false!" << std::endl;
00291                 return false;
00292             }
00293         }
00294         //else if ( prOpenGLHalfEdgeModel )
00295         //{
00296         //  OpenGL::HalfEdgeModel<T> * prHalfEdgeModel = dynamic_cast< OpenGL::HalfEdgeModel<T> * >( prModel );
00297         //  if ( !ReadPly<T>::readFile( fileName, prHalfEdgeModel ) ) {
00298         //      std::cout << "TAPsReadModels: ReadPly<T>::readFile Fn returns false!" << std::endl;
00299         //      return false;
00300         //  }
00301         //}
00302         else {
00303             return false;
00304         }
00305     }
00306     //----------------------------------------------------------------
00307     // Process .off format
00308     else if ( strcmp( format, "off" ) == 0 ) {
00309         if ( prOpenGLPNTriangleModel
00310           || prOpenGLPNTriangleVolPresModel
00311           || prOpenGLVolPresPolygonalModel 
00312           || prOpenGLVolPresTriModel 
00313           || prOpenGLXTrigonalModel 
00314           || prOpenGLXPolygonalModel ) 
00315         {
00316             OpenGL::XPolygonalModel<T> * prXPolygonalModel = dynamic_cast< OpenGL::XPolygonalModel<T> * >( prModel );
00317             if ( !ReadOff<T>::readFile( fileName, prXPolygonalModel ) ) {
00318                 std::cout << "TAPsReadModels: ReadOff<T>::readFile Fn returns false!" << std::endl;
00319                 return false;
00320             }
00321         }
00322         else if ( prOpenGLTrigonalModel
00323                || prOpenGLPolygonalModel ) 
00324         {
00325             OpenGL::PolygonalModel<T> * prPolygonalModel = dynamic_cast< OpenGL::PolygonalModel<T> * >( prModel );
00326             if ( !ReadOff<T>::readFile( fileName, prPolygonalModel ) ) {
00327                 std::cout << "TAPsReadModels: ReadOff<T>::readFile Fn returns false!" << std::endl;
00328                 return false;
00329             }
00330         }
00331         //else if ( prOpenGLHalfEdgeModel )
00332         //{
00333         //  OpenGL::HalfEdgeModel<T> * prHalfEdgeModel = dynamic_cast< OpenGL::HalfEdgeModel<T> * >( prModel );
00334         //  if ( !ReadOff<T>::readFile( fileName, prHalfEdgeModel ) ) {
00335         //      std::cout << "TAPsReadModels: ReadOff<T>::readFile Fn returns false!" << std::endl;
00336         //      return false;
00337         //  }
00338         //}
00339         else {
00340             return false;
00341         }
00342     }
00343     //----------------------------------------------------------------
00344     // The format of the file is not supported.
00345     else {
00346         std::cout << "The input file (." << format << ") is not supported!" << std::endl;
00347         return false;
00348     }
00349     //----------------------------------------------------------------
00350     delete [] name;
00351     delete [] format;
00352     //----------------------------------------------------------------
00353     std::cout << typeid( prModel ).name() << std::endl;     // Display Model Type Pointer
00354     std::cout << typeid( *prModel ).name() << std::endl;    // Display Model Type
00355     //================================================================
00356     // MODEL INITIALIZATION
00357     prModel->Initialize();
00358     //================================================================
00359     return true;
00360 }
00361 //-----------------------------------------------------------------------------
00362 // Read an input file
00363 template <typename T>
00364 bool ReadModels<T>::readFile( const char *fileName, 
00365                         OpenGL::MultiMeshModel<T> * const prModel, 
00366                         TAPs::Enum::ModelType eModelType )
00367 {
00368     //----------------------------------------------------------------
00369     // Find the format of the file
00370     char * name   = new char[ strlen( fileName )+1 ];
00371     char * format = new char[ strlen( fileName )+1 ];
00372     strcpy( name, fileName );
00373     char *token = strtok( name, "." );
00374     do {
00375         strcpy( format, token );
00376         token = strtok( '\0', "." );
00377     } while ( token );
00378     //----------------------------------------------------------------
00379     // If model is not created yet!
00380     if ( !prModel ) {
00381         std::cout << "The model must be created first!" << std::endl;
00382         return false;
00383     }
00384     //----------------------------------------------------------------
00385     // Process .TAPs format
00386     if ( strcmp( format, "TAPs" ) == 0 ) {
00387     }
00388     //----------------------------------------------------------------
00389     // Process .10 format
00390     else if ( strcmp( format, "10" ) == 0 ) {
00391     }
00392     //----------------------------------------------------------------
00393     // Process .ASC format
00394     else if ( strcmp( format, "ASC" ) == 0 ) {
00395     }
00396     //----------------------------------------------------------------
00397     // Process .ASE format
00398     else if ( strcmp( format, "ASE" ) == 0 ) {
00399         if ( !Read3dsMaxASE<T>::readFile( fileName, prModel, eModelType ) ) {
00400             std::cout << "TAPsReadModels: Read3dsMaxASE<T>::readFile Fn returns false!" << std::endl;
00401             return false;
00402         }
00403     }
00404     //----------------------------------------------------------------
00405     // Process .ply format
00406     else if ( strcmp( format, "ply" ) == 0 ) {
00407     }
00408     //----------------------------------------------------------------
00409     // Process .off format
00410     else if ( strcmp( format, "off" ) == 0 ) {
00411     }
00412     //----------------------------------------------------------------
00413     // The format of the file is not supported.
00414     else {
00415         std::cout << "The input file (." << format << ") is not supported!" << std::endl;
00416         return false;
00417     }
00418     //----------------------------------------------------------------
00419     delete [] name;
00420     delete [] format;
00421     //----------------------------------------------------------------
00422     std::cout << typeid( prModel ).name() << std::endl;     // Display Model Type Pointer
00423     std::cout << typeid( *prModel ).name() << std::endl;    // Display Model Type
00424     //================================================================
00425     // MODEL INITIALIZATION
00426     prModel->Initialize();
00427     //================================================================
00428     return true;
00429 }
00430 //-----------------------------------------------------------------------------
00431 // Read an input file
00432 template <typename T>
00433 bool ReadModels<T>::readFile( const char *fileName, 
00434                         OpenGL::MultiMeshModelWithMBV<T> * const prModel, 
00435                         TAPs::Enum::ModelType eModelType )
00436 {
00437     //----------------------------------------------------------------
00438     // Find the format of the file
00439     char *name = new char[ strlen( fileName )+1 ];
00440     char *format = new char[64];
00441     strcpy( name, fileName );
00442     char *token = strtok( name, "." );
00443     do {
00444         strcpy( format, token );
00445         token = strtok( '\0', "." );
00446     } while ( token );
00447     //----------------------------------------------------------------
00448     // If model is not created yet!
00449     if ( !prModel ) {
00450         std::cout << "The model must be created first!" << std::endl;
00451         return false;
00452     }
00453     //----------------------------------------------------------------
00454     // Process .TAPs format
00455     if ( strcmp( format, "TAPs" ) == 0 ) {
00456     }
00457     //----------------------------------------------------------------
00458     // Process .10 format
00459     else if ( strcmp( format, "10" ) == 0 ) {
00460     }
00461     //----------------------------------------------------------------
00462     // Process .ASC format
00463     else if ( strcmp( format, "ASC" ) == 0 ) {
00464     }
00465     //----------------------------------------------------------------
00466     // Process .ASE format
00467     else if ( strcmp( format, "ASE" ) == 0 ) {
00468         //-------------------------------------------------
00469         // Multi Mesh Model
00470         if ( !Read3dsMaxASE<T>::readFile( fileName, prModel->GetMultiMeshModel(), eModelType ) ) {
00471             std::cout << "TAPsReadModels: Read3dsMaxASE<T>::readFile Fn (for MultiMeshWithMBV - Multi Mesh Model Part) returns false!" << std::endl;
00472             return false;
00473         }
00474         char extensionName[] = "MBV";
00475         char MBVfile[128];
00476         //-------------------------------------------------
00477         // Multi Bounding Volume
00478         TAPs::Fn::UsefulFn::ChangeFileNameExtension( MBVfile, fileName, extensionName );
00479         if ( !ReadTAPsMBV<T>::ReadFile( MBVfile, prModel->GetMultiBoundingVolume() ) ) {
00480             std::cout << "TAPsReadModels: Read3dsMaxASE<T>::readFile Fn (for MultiMeshWithMBV - Multi Bounding Volume Part) returns false!" << std::endl;
00481             return false;
00482         }
00483     }
00484     //----------------------------------------------------------------
00485     // Process .ply format
00486     else if ( strcmp( format, "ply" ) == 0 ) {
00487     }
00488     //----------------------------------------------------------------
00489     // Process .off format
00490     else if ( strcmp( format, "off" ) == 0 ) {
00491     }
00492     //----------------------------------------------------------------
00493     // The format of the file is not supported.
00494     else {
00495         std::cout << "The input file (." << format << ") is not supported!" << std::endl;
00496         return false;
00497     }
00498     //----------------------------------------------------------------
00499     std::cout << typeid( prModel ).name() << std::endl;     // Display Model Type Pointer
00500     std::cout << typeid( *prModel ).name() << std::endl;    // Display Model Type
00501     //================================================================
00502     // MODEL INITIALIZATION
00503     prModel->Initialize();
00504     //================================================================
00505     return true;
00506 }
00507 //-----------------------------------------------------------------------------
00508 // Read an input file
00509 template <typename T>
00510 bool ReadModels<T>::readFile( 
00511     const char *fileName, 
00512     std::vector< OpenGL::OpenGLHETriMeshOneModelMultiParts<T> * > & modelList 
00513 )
00514 {
00515     //----------------------------------------------------------------
00516     // Find the format of the file
00517     char * name   = new char[ strlen( fileName )+1 ];
00518     char * format = new char[ strlen( fileName )+1 ];
00519     strcpy( name, fileName );
00520     char *token = strtok( name, "." );
00521     do {
00522         strcpy( format, token );
00523         token = strtok( '\0', "." );
00524     } while ( token );
00525     //----------------------------------------------------------------
00526     // Process .TAPs format
00527     if ( strcmp( format, "TAPs" ) == 0 ) {
00528     }
00529     //----------------------------------------------------------------
00530     // Process .10 format
00531     else if ( strcmp( format, "10" ) == 0 ) {
00532     }
00533     //----------------------------------------------------------------
00534     // Process .ASC format
00535     else if ( strcmp( format, "ASC" ) == 0 ) {
00536     }
00537     //----------------------------------------------------------------
00538     // Process .ASE format
00539     else if ( strcmp( format, "ASE" ) == 0 ) {
00540         if ( !Read3dsMaxASE<T>::readFile( fileName, modelList ) ) {
00541             std::cout << "TAPsReadModels: Read3dsMaxASE<T>::readFile Fn returns false!" << std::endl;
00542             return false;
00543         }
00544     }
00545     //----------------------------------------------------------------
00546     // Process .ply format
00547     else if ( strcmp( format, "ply" ) == 0 ) {
00548     }
00549     //----------------------------------------------------------------
00550     // Process .off format
00551     else if ( strcmp( format, "off" ) == 0 ) {
00552     }
00553     //----------------------------------------------------------------
00554     // The format of the file is not supported.
00555     else {
00556         std::cout << "The input file (." << format << ") is not supported!" << std::endl;
00557         return false;
00558     }
00559     //----------------------------------------------------------------
00560     delete [] name;
00561     delete [] format;
00562     //----------------------------------------------------------------
00563     std::cout << typeid( modelList ).name() << std::endl;   // Display Model Type Pointer
00564     //================================================================
00565     return true;
00566 }
00567 //-----------------------------------------------------------------------------
00568 //=============================================================================
00569 END_NAMESPACE_TAPs
00570 //-----------------------------------------------------------------------------
00571 //345678901234567890123456789012345678901234567890123456789012345678901234567890
00572 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines