meshing/IO.cpp
///Import will try to determine the file type via the file extension
Import will try to determine the file type via the file extension
Import will try to determine the file type via the file extension
bool Import(const char* fn,TriMesh& tri)
{
  const char* ext=FileExtension(fn);
  if(0==strcmp(ext,"tri")) {
    return LoadMultipleTriMeshes(fn,tri);
  }
  else if(0==strcmp(ext,"off")) {
    ifstream in(fn,ios::in);
    if(!in) return false;
    return LoadOFF(in,tri);
  }
  else {
#if HAVE_ASSIMP
    if(!LoadAssimp(fn,tri)) {
      LOG4CXX_ERROR(KrisLibrary::logger(),"Import(TriMesh): file "<<fn);
      return false;
    }
    else {
      return true;
    }
#else
    if(0==strcmp(ext,"wrl")) {
      ifstream in(fn,ios::in);
      if(!in) return false;
      return LoadVRML(in,tri);
    }
    else {
      LOG4CXX_ERROR(KrisLibrary::logger(),"Import(TriMesh): file extension "<<ext);
      return false;
    }
#endif
  }
}
bool Import ( const char * fn , TriMesh & tri ) { const char * ext = FileExtension ( fn ) ; if ( 0 == strcmp ( ext , " " ) ) { return LoadMultipleTriMeshes ( fn , tri ) ; } else if ( 0 == strcmp ( ext , " " ) ) { ifstream in ( fn , ios :: in ) ; if ( ! in ) return false ; return LoadOFF ( in , tri ) ; } else { #if HAVE_ASSIMP if ( ! LoadAssimp ( fn , tri ) ) { LOG4CXX_ERROR ( KrisLibrary :: logger ( ) , " " << fn ) ; return false ; } else { return true ; } #else if ( 0 == strcmp ( ext , " " ) ) { ifstream in ( fn , ios :: in ) ; if ( ! in ) return false ; return LoadVRML ( in , tri ) ; } else { LOG4CXX_ERROR ( KrisLibrary :: logger ( ) , " " << ext ) ; return false ; } #endif } }
Import will try to determine the file type via the file extension
Import will try to determine the file type via the file extension