// This file is part of libigl, a simple c++ geometry processing library. // // Copyright (C) 2013 Alec Jacobson // // This Source Code Form is subject to the terms of the Mozilla Public License // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. #include "read.h" #include "readOBJ.h" #include "readOFF.h" #include "pathinfo.h" #include #include template IGL_INLINE bool igl::read( const std::string str, std::vector > & V, std::vector > & F) { using namespace std; using namespace igl; // dirname, basename, extension and filename string d,b,e,f; pathinfo(str,d,b,e,f); // Convert extension to lower case std::transform(e.begin(), e.end(), e.begin(), ::tolower); vector > TC, N; vector > FTC, FN; if(e == "obj") { return readOBJ(str,V,TC,N,F,FTC,FN); }else if(e == "off") { return readOFF(str,V,F,N); } cerr<<"Error: "<<__FUNCTION__<<": "<< str<<" is not a recognized mesh file format."< IGL_INLINE bool igl::read( const std::string str, Eigen::PlainObjectBase& V, Eigen::PlainObjectBase& F) { const char* p; for (p = str.c_str(); *p != '\0'; p++) ; while (*p != '.') p--; if (!strcmp(p, ".obj") || !strcmp(p, ".OBJ")) { return igl::readOBJ(str,V,F); }else if (!strcmp(p, ".off") || !strcmp(p, ".OFF")) { return igl::readOFF(str,V,F); } else { fprintf(stderr,"read() does not recognize extension: %s\n",p); return false; } } #endif #ifndef IGL_HEADER_ONLY // Explicit template specialization // generated by autoexplicit.sh template bool igl::read, Eigen::Matrix >(std::basic_string, std::allocator >, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); template bool igl::read(std::basic_string, std::allocator >, std::vector >, std::allocator > > >&, std::vector >, std::allocator > > >&); template bool igl::read, Eigen::Matrix >(std::string, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); #endif