#include <TAPsReadModels.hpp>
Static Public Member Functions | |
| static bool | ReadFile (const char *fileName, OpenGL::MultiMeshModelWithMBV< T > *const prModel, TAPs::Enum::ModelType eModelType=TAPs::Enum::MODEL_TYPE_XPOLYGONAL) |
| static bool | ReadFile (const char *fileName, OpenGL::MultiMeshModel< T > *const prModel, TAPs::Enum::ModelType eModelType=TAPs::Enum::MODEL_TYPE_XPOLYGONAL) |
| static bool | ReadFile (const char *fileName, OpenGL::OpenGLModel< T > *const prModel) |
| static bool | readFile (const char *fileName, OpenGL::MultiMeshModelWithMBV< T > *const prModel, TAPs::Enum::ModelType eModelType=TAPs::Enum::MODEL_TYPE_XPOLYGONAL) |
| static bool | readFile (const char *fileName, OpenGL::MultiMeshModel< T > *const prModel, TAPs::Enum::ModelType eModelType=TAPs::Enum::MODEL_TYPE_XPOLYGONAL) |
| static bool | readFile (const char *fileName, OpenGL::OpenGLModel< T > *const prModel) |
Definition at line 123 of file TAPsReadModels.hpp.
| static bool ReadModels< T >::ReadFile | ( | const char * | fileName, | |
| OpenGL::MultiMeshModelWithMBV< T > *const | prModel, | |||
| TAPs::Enum::ModelType | eModelType = TAPs::Enum::MODEL_TYPE_XPOLYGONAL | |||
| ) | [inline, static] |
Definition at line 147 of file TAPsReadModels.hpp.
00149 { return readFile( fileName, prModel, eModelType ); }
| static bool ReadModels< T >::ReadFile | ( | const char * | fileName, | |
| OpenGL::MultiMeshModel< T > *const | prModel, | |||
| TAPs::Enum::ModelType | eModelType = TAPs::Enum::MODEL_TYPE_XPOLYGONAL | |||
| ) | [inline, static] |
Definition at line 144 of file TAPsReadModels.hpp.
00146 { return readFile( fileName, prModel, eModelType ); }
| static bool ReadModels< T >::ReadFile | ( | const char * | fileName, | |
| OpenGL::OpenGLModel< T > *const | prModel | |||
| ) | [inline, static] |
| bool ReadModels< T >::readFile | ( | const char * | fileName, | |
| OpenGL::MultiMeshModelWithMBV< T > *const | prModel, | |||
| TAPs::Enum::ModelType | eModelType = TAPs::Enum::MODEL_TYPE_XPOLYGONAL | |||
| ) | [inline, static] |
Definition at line 428 of file TAPsReadModels.cpp.
00431 { 00432 //---------------------------------------------------------------- 00433 // Find the format of the file 00434 char *name = new char[ strlen( fileName )+1 ]; 00435 char *format = new char[64]; 00436 strcpy( name, fileName ); 00437 char *token = strtok( name, "." ); 00438 do { 00439 strcpy( format, token ); 00440 token = strtok( '\0', "." ); 00441 } while ( token ); 00442 //---------------------------------------------------------------- 00443 // If model is not created yet! 00444 if ( !prModel ) { 00445 std::cout << "The model must be created first!" << std::endl; 00446 return false; 00447 } 00448 //---------------------------------------------------------------- 00449 // Process .TAPs format 00450 if ( strcmp( format, "TAPs" ) == 0 ) { 00451 } 00452 //---------------------------------------------------------------- 00453 // Process .10 format 00454 else if ( strcmp( format, "10" ) == 0 ) { 00455 } 00456 //---------------------------------------------------------------- 00457 // Process .ASC format 00458 else if ( strcmp( format, "ASC" ) == 0 ) { 00459 } 00460 //---------------------------------------------------------------- 00461 // Process .ASE format 00462 else if ( strcmp( format, "ASE" ) == 0 ) { 00463 //------------------------------------------------- 00464 // Multi Mesh Model 00465 if ( !Read3dsMaxASE<T>::readFile( fileName, prModel->GetMultiMeshModel(), eModelType ) ) { 00466 std::cout << "TAPsReadModels: Read3dsMaxASE<T>::readFile Fn (for MultiMeshWithMBV - Multi Mesh Model Part) returns false!" << std::endl; 00467 return false; 00468 } 00469 char extensionName[] = "MBV"; 00470 char MBVfile[128]; 00471 //------------------------------------------------- 00472 // Multi Bounding Volume 00473 TAPs::Fn::UsefulFn::ChangeFileNameExtension( MBVfile, fileName, extensionName ); 00474 if ( !ReadTAPsMBV<T>::ReadFile( MBVfile, prModel->GetMultiBoundingVolume() ) ) { 00475 std::cout << "TAPsReadModels: Read3dsMaxASE<T>::readFile Fn (for MultiMeshWithMBV - Multi Bounding Volume Part) returns false!" << std::endl; 00476 return false; 00477 } 00478 } 00479 //---------------------------------------------------------------- 00480 // Process .ply format 00481 else if ( strcmp( format, "ply" ) == 0 ) { 00482 } 00483 //---------------------------------------------------------------- 00484 // Process .off format 00485 else if ( strcmp( format, "off" ) == 0 ) { 00486 } 00487 //---------------------------------------------------------------- 00488 // The format of the file is not supported. 00489 else { 00490 std::cout << "The input file (." << format << ") is not supported!" << std::endl; 00491 return false; 00492 } 00493 //---------------------------------------------------------------- 00494 std::cout << typeid( prModel ).name() << std::endl; // Display Model Type Pointer 00495 std::cout << typeid( *prModel ).name() << std::endl; // Display Model Type 00496 //================================================================ 00497 // MODEL INITIALIZATION 00498 prModel->Initialize(); 00499 //================================================================ 00500 return true; 00501 }
| bool ReadModels< T >::readFile | ( | const char * | fileName, | |
| OpenGL::MultiMeshModel< T > *const | prModel, | |||
| TAPs::Enum::ModelType | eModelType = TAPs::Enum::MODEL_TYPE_XPOLYGONAL | |||
| ) | [inline, static] |
Definition at line 359 of file TAPsReadModels.cpp.
00362 { 00363 //---------------------------------------------------------------- 00364 // Find the format of the file 00365 char * name = new char[ strlen( fileName )+1 ]; 00366 char * format = new char[ strlen( fileName )+1 ]; 00367 strcpy( name, fileName ); 00368 char *token = strtok( name, "." ); 00369 do { 00370 strcpy( format, token ); 00371 token = strtok( '\0', "." ); 00372 } while ( token ); 00373 //---------------------------------------------------------------- 00374 // If model is not created yet! 00375 if ( !prModel ) { 00376 std::cout << "The model must be created first!" << std::endl; 00377 return false; 00378 } 00379 //---------------------------------------------------------------- 00380 // Process .TAPs format 00381 if ( strcmp( format, "TAPs" ) == 0 ) { 00382 } 00383 //---------------------------------------------------------------- 00384 // Process .10 format 00385 else if ( strcmp( format, "10" ) == 0 ) { 00386 } 00387 //---------------------------------------------------------------- 00388 // Process .ASC format 00389 else if ( strcmp( format, "ASC" ) == 0 ) { 00390 } 00391 //---------------------------------------------------------------- 00392 // Process .ASE format 00393 else if ( strcmp( format, "ASE" ) == 0 ) { 00394 if ( !Read3dsMaxASE<T>::readFile( fileName, prModel, eModelType ) ) { 00395 std::cout << "TAPsReadModels: Read3dsMaxASE<T>::readFile Fn returns false!" << std::endl; 00396 return false; 00397 } 00398 } 00399 //---------------------------------------------------------------- 00400 // Process .ply format 00401 else if ( strcmp( format, "ply" ) == 0 ) { 00402 } 00403 //---------------------------------------------------------------- 00404 // Process .off format 00405 else if ( strcmp( format, "off" ) == 0 ) { 00406 } 00407 //---------------------------------------------------------------- 00408 // The format of the file is not supported. 00409 else { 00410 std::cout << "The input file (." << format << ") is not supported!" << std::endl; 00411 return false; 00412 } 00413 //---------------------------------------------------------------- 00414 delete [] name; 00415 delete [] format; 00416 //---------------------------------------------------------------- 00417 std::cout << typeid( prModel ).name() << std::endl; // Display Model Type Pointer 00418 std::cout << typeid( *prModel ).name() << std::endl; // Display Model Type 00419 //================================================================ 00420 // MODEL INITIALIZATION 00421 prModel->Initialize(); 00422 //================================================================ 00423 return true; 00424 }
| BEGIN_NAMESPACE_TAPs bool ReadModels< T >::readFile | ( | const char * | fileName, | |
| OpenGL::OpenGLModel< T > *const | prModel | |||
| ) | [inline, static] |
Read an input file
I/P: fileName is the input file to be read.
O/P: prModel is the return pointer to the created model and the created model will have the same type as prModel.
Create a Model Object from an input file (support a variety of formats).
Definition at line 23 of file TAPsReadModels.cpp.
00025 { 00026 //---------------------------------------------------------------- 00027 // Find the format of the file 00028 char * name = new char[ strlen( fileName )+1 ]; 00029 char * format = new char[ strlen( fileName )+1 ]; 00030 strcpy( name, fileName ); 00031 char *token = strtok( name, "." ); 00032 do { 00033 strcpy( format, token ); 00034 token = strtok( '\0', "." ); 00035 } while ( token ); 00036 //---------------------------------------------------------------- 00037 // If model is not created yet! 00038 if ( !prModel ) { 00039 std::cout << "The model must be created first!" << std::endl; 00040 return false; 00041 } 00042 //---------------------------------------------------------------- 00043 // ADD NEW MODEL TYPE HERE and AT Every Process .file format 00044 // Check Model Type 00045 OpenGL::OpenGLPNTriangleModel<T> * prOpenGLPNTriangleModel = 00046 dynamic_cast< OpenGL::OpenGLPNTriangleModel<T> * > ( prModel ); 00047 OpenGL::OpenGLPNTriangleVolPresModel<T> * prOpenGLPNTriangleVolPresModel = 00048 dynamic_cast< OpenGL::OpenGLPNTriangleVolPresModel<T> * > ( prModel ); 00049 OpenGL::OpenGLVolPresPolygonalModel<T> * prOpenGLVolPresPolygonalModel = 00050 dynamic_cast< OpenGL::OpenGLVolPresPolygonalModel<T> * > ( prModel ); 00051 OpenGL::OpenGLVolPresTriModel<T> * prOpenGLVolPresTriModel = 00052 dynamic_cast< OpenGL::OpenGLVolPresTriModel<T> * > ( prModel ); 00053 OpenGL::OpenGLXTrigonalModel<T> * prOpenGLXTrigonalModel = 00054 dynamic_cast< OpenGL::OpenGLXTrigonalModel<T> * > ( prModel ); 00055 OpenGL::OpenGLXPolygonalModel<T> * prOpenGLXPolygonalModel = 00056 dynamic_cast< OpenGL::OpenGLXPolygonalModel<T> * > ( prModel ); 00057 OpenGL::OpenGLTrigonalModel<T> * prOpenGLTrigonalModel = 00058 dynamic_cast< OpenGL::OpenGLTrigonalModel<T> * > ( prModel ); 00059 OpenGL::OpenGLPolygonalModel<T> * prOpenGLPolygonalModel = 00060 dynamic_cast< OpenGL::OpenGLPolygonalModel<T> * > ( prModel ); 00061 OpenGL::OpenGLHalfEdgeModel<T> * prOpenGLHalfEdgeModel = 00062 dynamic_cast< OpenGL::OpenGLHalfEdgeModel<T> * > ( prModel ); 00063 OpenGL::OpenGLSpringHalfEdgeModel<T> * prOpenGLSpringHalfEdgeModel = 00064 dynamic_cast< OpenGL::OpenGLSpringHalfEdgeModel<T> * > ( prModel ); 00065 OpenGL::OpenGLHalfEdgeTrigonalModel<T> * prOpenGLHalfEdgeTrigonalModel = 00066 dynamic_cast< OpenGL::OpenGLHalfEdgeTrigonalModel<T> * > ( prModel ); 00067 OpenGL::OpenGLHETriMeshOneModelMultiParts<T> * prOpenGLHETriMeshOneModelMultiParts = 00068 dynamic_cast< OpenGL::OpenGLHETriMeshOneModelMultiParts<T> * > ( prModel ); 00069 //------------------------------------------- 00070 // 3D Volume Model 00071 OpenGL::OpenGL3DModel<T> * prOpenGL3DModel = 00072 dynamic_cast< OpenGL::OpenGL3DModel<T> * > ( prModel ); 00073 //---------------------------------------------------------------- 00074 // Process .TAPs format 00075 if ( strcmp( format, "TAPs" ) == 0 ) { 00076 if ( prOpenGLPNTriangleModel 00077 || prOpenGLPNTriangleVolPresModel 00078 || prOpenGLVolPresPolygonalModel 00079 || prOpenGLVolPresTriModel 00080 || prOpenGLXTrigonalModel 00081 || prOpenGLXPolygonalModel ) 00082 { 00083 OpenGL::XPolygonalModel<T> * prXPolygonalModel = dynamic_cast< OpenGL::XPolygonalModel<T> * >( prModel ); 00084 if ( !ReadTAPs<T>::readFile( fileName, prXPolygonalModel ) ) { 00085 std::cout << "TAPsReadModels: ReadTAPs<T>::readFile Fn returns false!" << std::endl; 00086 return false; 00087 } 00088 } 00089 else if ( prOpenGLTrigonalModel 00090 || prOpenGLPolygonalModel ) 00091 { 00092 OpenGL::PolygonalModel<T> * prPolygonalModel = dynamic_cast< OpenGL::PolygonalModel<T> * >( prModel ); 00093 if ( !ReadTAPs<T>::readFile( fileName, prPolygonalModel ) ) { 00094 std::cout << "TAPsReadModels: ReadTAPs<T>::readFile Fn returns false!" << std::endl; 00095 return false; 00096 } 00097 } 00098 //else if ( prOpenGLHalfEdgeModel ) 00099 //{ 00100 // OpenGL::HalfEdgeModel<T> * prHalfEdgeModel = dynamic_cast< OpenGL::HalfEdgeModel<T> * >( prModel ); 00101 // if ( !ReadTAPs<T>::readFile( fileName, prHalfEdgeModel ) ) { 00102 // std::cout << "TAPsReadModels: ReadTAPs<T>::readFile Fn returns false!" << std::endl; 00103 // return false; 00104 // } 00105 //} 00106 else { 00107 return false; 00108 } 00109 } 00110 //---------------------------------------------------------------- 00111 // Process .obj format 00112 else if ( strcmp( format, "obj" ) == 0 ) { 00113 if ( prOpenGLPNTriangleModel 00114 || prOpenGLPNTriangleVolPresModel 00115 || prOpenGLVolPresPolygonalModel 00116 || prOpenGLVolPresTriModel 00117 || prOpenGLXTrigonalModel 00118 || prOpenGLXPolygonalModel ) 00119 { 00120 OpenGL::XPolygonalModel<T> * prXPolygonalModel = dynamic_cast< OpenGL::XPolygonalModel<T> * >( prModel ); 00121 if ( !ReadObj<T>::ReadFile( fileName, prXPolygonalModel ) ) { 00122 std::cout << "TAPsReadModels: ReadObj<T>::ReadFile Fn returns false!" << std::endl; 00123 return false; 00124 } 00125 } 00126 else if ( prOpenGLTrigonalModel 00127 || prOpenGLPolygonalModel ) 00128 { 00129 OpenGL::PolygonalModel<T> * prPolygonalModel = dynamic_cast< OpenGL::PolygonalModel<T> * >( prModel ); 00130 if ( !ReadObj<T>::ReadFile( fileName, prPolygonalModel ) ) { 00131 std::cout << "TAPsReadModels: ReadObj<T>::ReadFile Fn returns false!" << std::endl; 00132 return false; 00133 } 00134 } 00135 else if ( prOpenGLHalfEdgeModel ) 00136 { 00137 OpenGL::HalfEdgeModel<T> * prHalfEdgeModel = dynamic_cast< OpenGL::HalfEdgeModel<T> * >( prModel ); 00138 if ( !ReadObj<T>::ReadFile( fileName, prHalfEdgeModel ) ) { 00139 std::cout << "TAPsReadModels: ReadObj<T>::ReadFile Fn returns false!" << std::endl; 00140 return false; 00141 } 00142 } 00143 else { 00144 return false; 00145 } 00146 } 00147 //---------------------------------------------------------------- 00148 // Process .10 format 00149 else if ( strcmp( format, "10" ) == 0 ) { 00150 if ( prOpenGLPNTriangleModel 00151 || prOpenGLPNTriangleVolPresModel 00152 || prOpenGLVolPresPolygonalModel 00153 || prOpenGLVolPresTriModel 00154 || prOpenGLXTrigonalModel 00155 || prOpenGLXPolygonalModel ) 00156 { 00157 OpenGL::XPolygonalModel<T> * prXPolygonalModel = dynamic_cast< OpenGL::XPolygonalModel<T> * >( prModel ); 00158 if ( !ReadDot10<T>::readFile( fileName, prXPolygonalModel ) ) { 00159 std::cout << "TAPsReadModels: ReadDot10<T>::readFile Fn returns false!" << std::endl; 00160 return false; 00161 } 00162 } 00163 else if ( prOpenGLTrigonalModel 00164 || prOpenGLPolygonalModel ) 00165 { 00166 OpenGL::PolygonalModel<T> * prPolygonalModel = dynamic_cast< OpenGL::PolygonalModel<T> * >( prModel ); 00167 if ( !ReadDot10<T>::readFile( fileName, prPolygonalModel ) ) { 00168 std::cout << "TAPsReadModels: ReadDot10<T>::readFile Fn returns false!" << std::endl; 00169 return false; 00170 } 00171 } 00172 //else if ( prOpenGLHalfEdgeModel ) 00173 //{ 00174 // OpenGL::HalfEdgeModel<T> * prHalfEdgeModel = dynamic_cast< OpenGL::HalfEdgeModel<T> * >( prModel ); 00175 // if ( !ReadDot10<T>::readFile( fileName, prHalfEdgeModel ) ) { 00176 // std::cout << "TAPsReadModels: ReadDot10<T>::readFile Fn returns false!" << std::endl; 00177 // return false; 00178 // } 00179 //} 00180 else { 00181 return false; 00182 } 00183 } 00184 //---------------------------------------------------------------- 00185 // Process .ASC format 00186 else if ( strcmp( format, "ASC" ) == 0 ) { 00187 if ( prOpenGLPNTriangleModel 00188 || prOpenGLPNTriangleVolPresModel 00189 || prOpenGLVolPresPolygonalModel 00190 || prOpenGLVolPresTriModel 00191 || prOpenGLXTrigonalModel 00192 || prOpenGLXPolygonalModel 00193 ) { 00194 OpenGL::XPolygonalModel<T> * prXPolygonalModel = dynamic_cast< OpenGL::XPolygonalModel<T> * >( prModel ); 00195 if ( !Read3dsMaxASC<T>::readFile( fileName, prXPolygonalModel ) ) { 00196 std::cout << "TAPsReadModels: Read3dsMaxASC<T>::readFile Fn returns false!" << std::endl; 00197 return false; 00198 } 00199 } 00200 else if ( prOpenGLTrigonalModel 00201 || prOpenGLPolygonalModel 00202 ) { 00203 OpenGL::PolygonalModel<T> * prPolygonalModel = dynamic_cast< OpenGL::PolygonalModel<T> * >( prModel ); 00204 if ( !Read3dsMaxASC<T>::readFile( fileName, prPolygonalModel ) ) { 00205 std::cout << "TAPsReadModels: Read3dsMaxASC<T>::readFile Fn returns false!" << std::endl; 00206 return false; 00207 } 00208 } 00209 else if ( prOpenGLHalfEdgeModel 00210 || prOpenGLSpringHalfEdgeModel 00211 || prOpenGLHalfEdgeTrigonalModel 00212 || prOpenGLHETriMeshOneModelMultiParts 00213 ) { 00214 OpenGL::HalfEdgeModel<T> * prHalfEdgeModel = dynamic_cast< OpenGL::HalfEdgeModel<T> * >( prModel ); 00215 if ( !Read3dsMaxASC<T>::readFile( fileName, prHalfEdgeModel ) ) { 00216 std::cout << "TAPsReadModels: Read3dsMaxASC<T>::readFile Fn returns false!" << std::endl; 00217 return false; 00218 } 00219 } 00220 else { 00221 return false; 00222 } 00223 } 00224 //---------------------------------------------------------------- 00225 // Process .ASE format 00226 else if ( strcmp( format, "ASE" ) == 0 ) { 00227 if ( prOpenGLPNTriangleModel 00228 || prOpenGLPNTriangleVolPresModel 00229 || prOpenGLVolPresPolygonalModel 00230 || prOpenGLVolPresTriModel 00231 || prOpenGLXTrigonalModel 00232 || prOpenGLXPolygonalModel 00233 ) { 00234 OpenGL::XPolygonalModel<T> * prXPolygonalModel = dynamic_cast< OpenGL::XPolygonalModel<T> * >( prModel ); 00235 if ( !Read3dsMaxASE<T>::readFile( fileName, prXPolygonalModel ) ) { 00236 std::cout << "TAPsReadModels: Read3dsMaxASE<T>::readFile Fn returns false!" << std::endl; 00237 return false; 00238 } 00239 } 00240 else if ( prOpenGLTrigonalModel 00241 || prOpenGLPolygonalModel 00242 ) { 00243 OpenGL::PolygonalModel<T> * prPolygonalModel = dynamic_cast< OpenGL::PolygonalModel<T> * >( prModel ); 00244 if ( !Read3dsMaxASE<T>::readFile( fileName, prPolygonalModel ) ) { 00245 std::cout << "TAPsReadModels: Read3dsMaxASE<T>::readFile Fn returns false!" << std::endl; 00246 return false; 00247 } 00248 } 00249 else if ( prOpenGLHalfEdgeModel 00250 || prOpenGLSpringHalfEdgeModel 00251 || prOpenGLHalfEdgeTrigonalModel 00252 || prOpenGLHETriMeshOneModelMultiParts 00253 ) { 00254 OpenGL::HalfEdgeModel<T> * prHalfEdgeModel = dynamic_cast< OpenGL::HalfEdgeModel<T> * >( prModel ); 00255 if ( !Read3dsMaxASE<T>::readFile( fileName, prHalfEdgeModel ) ) { 00256 std::cout << "TAPsReadModels: Read3dsMaxASE<T>::readFile Fn returns false!" << std::endl; 00257 return false; 00258 } 00259 } 00260 else { 00261 return false; 00262 } 00263 } 00264 //---------------------------------------------------------------- 00265 // Process .ply format 00266 else if ( strcmp( format, "ply" ) == 0 ) { 00267 if ( prOpenGLPNTriangleModel 00268 || prOpenGLPNTriangleVolPresModel 00269 || prOpenGLVolPresPolygonalModel 00270 || prOpenGLVolPresTriModel 00271 || prOpenGLXTrigonalModel 00272 || prOpenGLXPolygonalModel ) 00273 { 00274 OpenGL::XPolygonalModel<T> * prXPolygonalModel = dynamic_cast< OpenGL::XPolygonalModel<T> * >( prModel ); 00275 if ( !ReadPly<T>::readFile( fileName, prXPolygonalModel ) ) { 00276 std::cout << "TAPsReadModels: ReadPly<T>::readFile Fn returns false!" << std::endl; 00277 return false; 00278 } 00279 } 00280 else if ( prOpenGLTrigonalModel 00281 || prOpenGLPolygonalModel ) 00282 { 00283 OpenGL::PolygonalModel<T> * prPolygonalModel = dynamic_cast< OpenGL::PolygonalModel<T> * >( prModel ); 00284 if ( !ReadPly<T>::readFile( fileName, prPolygonalModel ) ) { 00285 std::cout << "TAPsReadModels: ReadPly<T>::readFile Fn returns false!" << std::endl; 00286 return false; 00287 } 00288 } 00289 //else if ( prOpenGLHalfEdgeModel ) 00290 //{ 00291 // OpenGL::HalfEdgeModel<T> * prHalfEdgeModel = dynamic_cast< OpenGL::HalfEdgeModel<T> * >( prModel ); 00292 // if ( !ReadPly<T>::readFile( fileName, prHalfEdgeModel ) ) { 00293 // std::cout << "TAPsReadModels: ReadPly<T>::readFile Fn returns false!" << std::endl; 00294 // return false; 00295 // } 00296 //} 00297 else { 00298 return false; 00299 } 00300 } 00301 //---------------------------------------------------------------- 00302 // Process .off format 00303 else if ( strcmp( format, "off" ) == 0 ) { 00304 if ( prOpenGLPNTriangleModel 00305 || prOpenGLPNTriangleVolPresModel 00306 || prOpenGLVolPresPolygonalModel 00307 || prOpenGLVolPresTriModel 00308 || prOpenGLXTrigonalModel 00309 || prOpenGLXPolygonalModel ) 00310 { 00311 OpenGL::XPolygonalModel<T> * prXPolygonalModel = dynamic_cast< OpenGL::XPolygonalModel<T> * >( prModel ); 00312 if ( !ReadOff<T>::readFile( fileName, prXPolygonalModel ) ) { 00313 std::cout << "TAPsReadModels: ReadOff<T>::readFile Fn returns false!" << std::endl; 00314 return false; 00315 } 00316 } 00317 else if ( prOpenGLTrigonalModel 00318 || prOpenGLPolygonalModel ) 00319 { 00320 OpenGL::PolygonalModel<T> * prPolygonalModel = dynamic_cast< OpenGL::PolygonalModel<T> * >( prModel ); 00321 if ( !ReadOff<T>::readFile( fileName, prPolygonalModel ) ) { 00322 std::cout << "TAPsReadModels: ReadOff<T>::readFile Fn returns false!" << std::endl; 00323 return false; 00324 } 00325 } 00326 //else if ( prOpenGLHalfEdgeModel ) 00327 //{ 00328 // OpenGL::HalfEdgeModel<T> * prHalfEdgeModel = dynamic_cast< OpenGL::HalfEdgeModel<T> * >( prModel ); 00329 // if ( !ReadOff<T>::readFile( fileName, prHalfEdgeModel ) ) { 00330 // std::cout << "TAPsReadModels: ReadOff<T>::readFile Fn returns false!" << std::endl; 00331 // return false; 00332 // } 00333 //} 00334 else { 00335 return false; 00336 } 00337 } 00338 //---------------------------------------------------------------- 00339 // The format of the file is not supported. 00340 else { 00341 std::cout << "The input file (." << format << ") is not supported!" << std::endl; 00342 return false; 00343 } 00344 //---------------------------------------------------------------- 00345 delete [] name; 00346 delete [] format; 00347 //---------------------------------------------------------------- 00348 std::cout << typeid( prModel ).name() << std::endl; // Display Model Type Pointer 00349 std::cout << typeid( *prModel ).name() << std::endl; // Display Model Type 00350 //================================================================ 00351 // MODEL INITIALIZATION 00352 prModel->Initialize(); 00353 //================================================================ 00354 return true; 00355 }
1.5.6