Commit 23ed036a authored by Kenneth Vanhoey's avatar Kenneth Vanhoey

export pour SLF generique (rangement à venir)

parent a06adb1c
...@@ -76,7 +76,7 @@ bool exportTrian(typename PFP::MAP& map, const typename PFP::TVEC3& position, ch ...@@ -76,7 +76,7 @@ bool exportTrian(typename PFP::MAP& map, const typename PFP::TVEC3& position, ch
* @return true * @return true
*/ */
template <typename PFP> template <typename PFP>
bool exportPlySLFgeneric(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& position, const unsigned int& nbCoefs, const FunctorSelect& good = allDarts) ; bool exportPlySLFgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good = allDarts) ;
/** /**
* export the map into a PLYSLF file (K. Vanhoey generic format). * export the map into a PLYSLF file (K. Vanhoey generic format).
...@@ -91,7 +91,7 @@ bool exportPlySLFgeneric(typename PFP::MAP& map, const char* filename, const typ ...@@ -91,7 +91,7 @@ bool exportPlySLFgeneric(typename PFP::MAP& map, const char* filename, const typ
* @return true * @return true
*/ */
template <typename PFP> template <typename PFP>
bool exportPlyPTMgeneric(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& position, const unsigned int& nbCoefs, const FunctorSelect& good = allDarts) ; bool exportPlyPTMgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const unsigned int& nbCoefs, const FunctorSelect& good = allDarts) ;
/** /**
* export the map into a PLYPTMgeneric file (K. Vanhoey generic format) * export the map into a PLYPTMgeneric file (K. Vanhoey generic format)
......
...@@ -180,7 +180,7 @@ bool exportOFF(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons ...@@ -180,7 +180,7 @@ bool exportOFF(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons
} }
template <typename PFP> template <typename PFP>
bool exportPlyPTMgeneric(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& position, const FunctorSelect& good) bool exportPlyPTMgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good)
{ {
typedef typename PFP::MAP MAP; typedef typename PFP::MAP MAP;
typedef typename PFP::VEC3 VEC3; typedef typename PFP::VEC3 VEC3;
...@@ -322,7 +322,7 @@ bool exportPlyPTMgeneric(typename PFP::MAP& map, const char* filename, const typ ...@@ -322,7 +322,7 @@ bool exportPlyPTMgeneric(typename PFP::MAP& map, const char* filename, const typ
} }
template <typename PFP> template <typename PFP>
bool exportPlySLFgeneric(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& position, const unsigned int& nbCoefs, const FunctorSelect& good) bool exportPlySLFgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good)
{ {
typedef typename PFP::MAP MAP; typedef typename PFP::MAP MAP;
typedef typename PFP::VEC3 VEC3; typedef typename PFP::VEC3 VEC3;
...@@ -375,21 +375,25 @@ bool exportPlySLFgeneric(typename PFP::MAP& map, const char* filename, const typ ...@@ -375,21 +375,25 @@ bool exportPlySLFgeneric(typename PFP::MAP& map, const char* filename, const typ
} }
TVEC3 frame[3] ; TVEC3 frame[3] ;
TVEC3 coefs[nbCoefs] ; std::vector<TVEC3> coefs ;
frame[0] = map.template getAttribute<VEC3>(VERTEX, "frame_T") ; frame[0] = map.template getAttribute<VEC3>(VERTEX, "frame_T") ;
frame[1] = map.template getAttribute<VEC3>(VERTEX, "frame_B") ; frame[1] = map.template getAttribute<VEC3>(VERTEX, "frame_B") ;
frame[2] = map.template getAttribute<VEC3>(VERTEX, "frame_N") ; frame[2] = map.template getAttribute<VEC3>(VERTEX, "frame_N") ;
for (unsigned i = 0 ; i < nbCoefs ; ++i)
{ unsigned int i = 0 ;
do {
std::stringstream name ; std::stringstream name ;
name << "SLFcoefs_" << i ; name << "SLFcoefs_" << i++ ;
coefs[i] = map.template getAttribute<VEC3>(VERTEX,name.str()) ; coefs.push_back(map.template getAttribute<VEC3>(VERTEX, name.str())) ;
} } while (coefs[i-1].isValid()) ;
const unsigned int nbCoefs = i - 1 ; // last valid one is i-2
for(unsigned int coefI = 0 ; coefI < nbCoefs ; ++coefI)
assert(coefs[coefI].isValid()) ;
std::string file(filename) ; std::string file(filename) ;
size_t pos = file.rfind(".") ; // position of "." in filename size_t pos = file.rfind(".") ; // position of "." in filename
std::cout << file << " ; " << pos << std::endl ;
std::string extension = file.substr(pos) ; std::string extension = file.substr(pos) ;
out << "ply" << std::endl ; out << "ply" << std::endl ;
......
...@@ -58,6 +58,9 @@ ImportSurfacique::ImportType MeshTablesSurface<PFP>::getFileType(const std::stri ...@@ -58,6 +58,9 @@ ImportSurfacique::ImportType MeshTablesSurface<PFP>::getFileType(const std::stri
if ((filename.rfind(".plyptm")!=std::string::npos) || (filename.rfind(".PLYGEN")!=std::string::npos)) if ((filename.rfind(".plyptm")!=std::string::npos) || (filename.rfind(".PLYGEN")!=std::string::npos))
return ImportSurfacique::PLYPTM; return ImportSurfacique::PLYPTM;
if ((filename.rfind(".plyPTMext")!=std::string::npos) || (filename.rfind(".plySHreal")!=std::string::npos))
return ImportSurfacique::PLYSLFgeneric;
if ((filename.rfind(".ply")!=std::string::npos) || (filename.rfind(".PLY")!=std::string::npos)) if ((filename.rfind(".ply")!=std::string::npos) || (filename.rfind(".PLY")!=std::string::npos))
return ImportSurfacique::PLY; return ImportSurfacique::PLY;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment