From 38f91aa0939e331b0e7f553906ebcee10e962680 Mon Sep 17 00:00:00 2001 From: Kenneth Vanhoey Date: Fri, 2 Mar 2012 20:22:18 +0100 Subject: [PATCH] =?UTF-8?q?export=20pour=20SLF=20generique=20(rangement=20?= =?UTF-8?q?=C3=A0=20venir)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/.gitignore | 0 include/Algo/Export/export.h | 2 +- include/Algo/Export/export.hpp | 7 ++++++- include/Algo/Import/import2tablesSurface.hpp | 4 ++-- 4 files changed, 9 insertions(+), 4 deletions(-) delete mode 100644 build/.gitignore diff --git a/build/.gitignore b/build/.gitignore deleted file mode 100644 index e69de29b..00000000 diff --git a/include/Algo/Export/export.h b/include/Algo/Export/export.h index 11426008..0dab9fa7 100644 --- a/include/Algo/Export/export.h +++ b/include/Algo/Export/export.h @@ -103,7 +103,7 @@ bool exportPlyPTMgeneric(typename PFP::MAP& map, const char* filename, const typ * @return true */ template -bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& position, const typename PFP::TVEC3 frame[3], const typename PFP::TVEC3 colorPTM[6], const FunctorSelect& good) ; +bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& position, const typename PFP::TVEC3 frame[3], const typename PFP::TVEC3 colorPTM[6], const FunctorSelect& good = allDarts) ; } // namespace Export diff --git a/include/Algo/Export/export.hpp b/include/Algo/Export/export.hpp index 4223f598..c40ff67b 100644 --- a/include/Algo/Export/export.hpp +++ b/include/Algo/Export/export.hpp @@ -387,9 +387,14 @@ bool exportPlySLF(typename PFP::MAP& map, const char* filename, const typename P coefs[i] = map.template getAttribute(VERTEX,name.str()) ; } + std::string file(filename) ; + size_t pos = file.rfind(".") ; // position of "." in filename + std::cout << file << " ; " << pos << std::endl ; + std::string extension = file.substr(pos) ; + out << "ply" << std::endl ; out << "format ascii 1.0" << std::endl ; - out << "comment ply SLF (K. Vanhoey generic format)" << std::endl ; + out << "comment ply SLF (K. Vanhoey generic format): SLF_" << ((extension == ".plyPTMext") ? "PTMext" : "SHreal") << std::endl ; out << "element vertex " << vertices.size() << std::endl ; out << "property float x" << std::endl ; out << "property float y" << std::endl ; diff --git a/include/Algo/Import/import2tablesSurface.hpp b/include/Algo/Import/import2tablesSurface.hpp index 2ab44844..d8e1e1a2 100644 --- a/include/Algo/Import/import2tablesSurface.hpp +++ b/include/Algo/Import/import2tablesSurface.hpp @@ -682,7 +682,7 @@ bool MeshTablesSurface::importPlyPTMgeneric(const std::string& filename, st binormal = true ; else if (tag == std::string("nx") || tag == std::string("ny") || tag == std::string("nz")) normal = true ; - else if (tag.substr(2,2) == std::string("_a")) + if (tag.substr(0,1) == std::string("C") && tag.substr(2,1) == std::string("_")) ++nbCoefsPerPol ; } while (tag != std::string("face")) ; unsigned int nbRemainders = nbProps ; // # remaining properties @@ -758,7 +758,7 @@ bool MeshTablesSurface::importPlyPTMgeneric(const std::string& filename, st // Read faces index m_nbEdges.reserve(m_nbFaces) ; - m_emb.reserve(3*m_nbFaces) ; + m_emb.reserve(3 * m_nbFaces) ; for (unsigned int i = 0 ; i < m_nbFaces ; ++i) { // read the indices of vertices for current face -- GitLab