Commit 7db271ad authored by Pierre Kraemer's avatar Pierre Kraemer

Merge cgogn:~vanhoey/CGoGN

parents e401dc09 74a22c4f
...@@ -245,7 +245,11 @@ void Viewer::exportMesh(std::string& filename) ...@@ -245,7 +245,11 @@ void Viewer::exportMesh(std::string& filename)
if (extension == std::string(".off")) if (extension == std::string(".off"))
Algo::Export::exportOFF<PFP>(myMap, position, filename.c_str(), allDarts) ; Algo::Export::exportOFF<PFP>(myMap, position, filename.c_str(), allDarts) ;
else if (extension.compare(0, 4, std::string(".ply")) == 0) else if (extension.compare(0, 4, std::string(".ply")) == 0)
Algo::Export::exportPLY<PFP>(myMap, position, filename.c_str(), allDarts) ; {
std::vector<typename PFP::TVEC3* > attributes ;
attributes.push_back(&position) ;
Algo::Export::exportPLYnew<PFP>(myMap, attributes, filename.c_str(), true, allDarts) ;
}
else if (extension == std::string(".map")) else if (extension == std::string(".map"))
myMap.saveMapBin(filename) ; myMap.saveMapBin(filename) ;
else else
......
...@@ -207,7 +207,7 @@ void Approximator_MidEdge<PFP>::approximate(Dart d) ...@@ -207,7 +207,7 @@ void Approximator_MidEdge<PFP>::approximate(Dart d)
Dart d2 = m.phi2(m.phi_1(d)) ; Dart d2 = m.phi2(m.phi_1(d)) ;
Dart dd2 = m.phi2(m.phi_1(dd)) ; Dart dd2 = m.phi2(m.phi_1(dd)) ;
VEC3 v2 = this->m_attrV[dd] ; // VEC3 v2 = this->m_attrV[dd] ;
// temporary edge collapse // temporary edge collapse
m.extractTrianglePair(d) ; m.extractTrianglePair(d) ;
...@@ -297,9 +297,9 @@ void Approximator_CornerCutting<PFP>::approximate(Dart d) ...@@ -297,9 +297,9 @@ void Approximator_CornerCutting<PFP>::approximate(Dart d)
// get some darts // get some darts
Dart dd = m.phi2(d) ; Dart dd = m.phi2(d) ;
Dart d1 = m.phi2(m.phi1(d)) ; // Dart d1 = m.phi2(m.phi1(d)) ;
Dart d2 = m.phi2(m.phi_1(d)) ; Dart d2 = m.phi2(m.phi_1(d)) ;
Dart dd1 = m.phi2(m.phi1(dd)) ; // Dart dd1 = m.phi2(m.phi1(dd)) ;
Dart dd2 = m.phi2(m.phi_1(dd)) ; Dart dd2 = m.phi2(m.phi_1(dd)) ;
// get the contracted edge vertices positions // get the contracted edge vertices positions
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#define __EXPORT_H__ #define __EXPORT_H__
#include "Topology/generic/attributeHandler.h" #include "Topology/generic/attributeHandler.h"
#include <stdint.h>
namespace CGoGN namespace CGoGN
{ {
...@@ -39,11 +40,24 @@ namespace Export ...@@ -39,11 +40,24 @@ namespace Export
/** /**
* export the map into a PLY file * export the map into a PLY file
* @param the_map map to be exported * @param the_map map to be exported
* @param position the position container
* @param filename filename of ply file * @param filename filename of ply file
* @param binary write in binary mode
* @return true * @return true
*/ */
template <typename PFP> template <typename PFP>
bool exportPLY(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good = allDarts) ; bool exportPLY(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const bool binary, const FunctorSelect& good = allDarts) ;
/**
* export the map into a PLY file
* @param the_map map to be exported
* @param vertexAttrNames the vertex attribute names
* @param filename filename of ply file
* @param binary write in binary mode
* @return true
*/
template <typename PFP>
bool exportPLYnew(typename PFP::MAP& map, const std::vector<typename PFP::TVEC3* >& attributeHandlers, const char* filename, const bool binary, const FunctorSelect& good = allDarts) ;
/** /**
* export the map into a OFF file * export the map into a OFF file
...@@ -74,7 +88,7 @@ bool exportTrian(typename PFP::MAP& map, const typename PFP::TVEC3& position, ch ...@@ -74,7 +88,7 @@ bool exportTrian(typename PFP::MAP& map, const typename PFP::TVEC3& position, ch
* @param filename filename of ply file * @param filename filename of ply file
* @param position the position container * @param position the position container
* @return true * @return true
*/ *
template <typename PFP> template <typename PFP>
bool exportPlySLFgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good = allDarts) ; bool exportPlySLFgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good = allDarts) ;
...@@ -89,7 +103,7 @@ bool exportPlySLFgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& posi ...@@ -89,7 +103,7 @@ bool exportPlySLFgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& posi
* @param filename filename of ply file * @param filename filename of ply file
* @param position the position container * @param position the position container
* @return true * @return true
*/ *
template <typename PFP> template <typename PFP>
bool exportPlySLFgenericBin(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good = allDarts) ; bool exportPlySLFgenericBin(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good = allDarts) ;
......
...@@ -38,12 +38,18 @@ namespace Export ...@@ -38,12 +38,18 @@ namespace Export
{ {
template <typename PFP> template <typename PFP>
bool exportPLY(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good) bool exportPLY(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, bool binary, const FunctorSelect& good)
{ {
typedef typename PFP::MAP MAP; typedef typename PFP::MAP MAP;
typedef typename PFP::VEC3 VEC3; typedef typename PFP::VEC3 VEC3;
std::ofstream out(filename, std::ios::out) ; // open file
std::ofstream out ;
if (!binary)
out.open(filename, std::ios::out) ;
else
out.open(filename, std::ios::out | std::ios::binary) ;
if (!out.good()) if (!out.good())
{ {
CGoGNerr << "Unable to open file " << CGoGNendl ; CGoGNerr << "Unable to open file " << CGoGNendl ;
...@@ -60,6 +66,7 @@ bool exportPLY(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons ...@@ -60,6 +66,7 @@ bool exportPLY(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons
std::vector<unsigned int> vertices ; std::vector<unsigned int> vertices ;
vertices.reserve(nbDarts/6) ; vertices.reserve(nbDarts/6) ;
// Go over all faces
CellMarker markV(map, VERTEX) ; CellMarker markV(map, VERTEX) ;
TraversorF<MAP> t(map, good) ; TraversorF<MAP> t(map, good) ;
for(Dart d = t.begin(); d != t.end(); d = t.next()) for(Dart d = t.begin(); d != t.end(); d = t.next())
...@@ -84,31 +91,231 @@ bool exportPLY(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons ...@@ -84,31 +91,231 @@ bool exportPLY(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons
facesIdx.push_back(fidx) ; facesIdx.push_back(fidx) ;
} }
// Start writing the file
out << "ply" << std::endl ; out << "ply" << std::endl ;
out << "format ascii 1.0" << std::endl ; // ascii or binary
out << "comment no comment" << std::endl ; if (!binary)
out << "format ascii 1.0" << std::endl ;
else
{ // test endianness
union
{
uint32_t i ;
char c[4] ;
} bint = {0x01020304} ;
if (bint.c[0] == 1) // big endian
out << "format binary_big_endian 1.0" << std::endl ;
else
out << "format binary_little_endian 1.0" << std::endl ;
}
out << "comment File generated by the CGoGN library" << std::endl ;
out << "comment See : http://cgogn.unistra.fr/" << std::endl ;
out << "comment or contact : cgogn@unistra.fr" << std::endl ;
// Vertex elements
out << "element vertex " << vertices.size() << std::endl ; out << "element vertex " << vertices.size() << std::endl ;
out << "property float x" << std::endl ; // Position property
out << "property float y" << std::endl ; if (position.isValid())
out << "property float z" << std::endl ; {
out << "property " << nameOfTypePly(position[0][0]) << " x" << std::endl ;
out << "property " << nameOfTypePly(position[0][1]) << " y" << std::endl ;
out << "property " << nameOfTypePly(position[0][2]) << " z" << std::endl ;
}
// Face element
out << "element face " << facesSize.size() << std::endl ; out << "element face " << facesSize.size() << std::endl ;
out << "property list uchar int vertex_indices" << std::endl ; out << "property list uint8 uint" << 8 * sizeof(facesIdx[0][0]) << " vertex_indices" << std::endl ;
out << "end_header" << std::endl ; out << "end_header" << std::endl ;
for(unsigned int i = 0; i < vertices.size(); ++i) if (!binary) // ascii
{ {
const VEC3& v = position[vertices[i]] ; // ascii vertices
out << v[0] << " " << v[1] << " " << v[2] << std::endl ; for(unsigned int i = 0; i < vertices.size(); ++i)
out << position[vertices[i]] << std::endl ;
// ascii faces
for(unsigned int i = 0; i < facesSize.size(); ++i)
{
out << facesSize[i] ;
for(unsigned int j = 0; j < facesIdx[i].size(); ++j)
out << " " << facesIdx[i][j] ;
out << std::endl ;
}
} }
for(unsigned int i = 0; i < facesSize.size(); ++i) else // binary
{ {
out << facesSize[i] ; // binary vertices
for(unsigned int j = 0; j < facesIdx[i].size(); ++j) for(unsigned int i = 0; i < vertices.size(); ++i)
out << " " << facesIdx[i][j] ; {
out << std::endl ; Geom::Vec3f v = position[vertices[i]] ;
out.write((char*)(&(v[0])), sizeof(v)) ;
}
// binary faces
for(unsigned int i = 0; i < facesSize.size(); ++i)
{
unsigned char nbe = facesSize[i] ;
out.write((char*)(&nbe), sizeof(unsigned char)) ;
out.write((char*)(&(facesIdx[i][0])), facesSize[i] * sizeof(facesIdx[i][0])) ;
}
}
out.close() ;
return true ;
}
template <typename PFP>
bool exportPLYnew(typename PFP::MAP& map, const std::vector<typename PFP::TVEC3*>& attributeHandlers, const char* filename, bool binary, const FunctorSelect& good)
{
typedef typename PFP::MAP MAP;
typedef typename PFP::VEC3 VEC3;
// open file
std::ofstream out ;
if (!binary)
out.open(filename, std::ios::out) ;
else
out.open(filename, std::ios::out | std::ios::binary) ;
if (!out.good())
{
CGoGNerr << "Unable to open file " << CGoGNendl ;
return false ;
}
unsigned int nbDarts = map.getNbDarts() ;
std::vector<unsigned int> facesSize ;
std::vector<std::vector<unsigned int> > facesIdx ;
facesSize.reserve(nbDarts/3) ;
facesIdx.reserve(nbDarts/3) ;
std::map<unsigned int, unsigned int> vIndex ;
unsigned int vCpt = 0 ;
std::vector<unsigned int> vertices ;
vertices.reserve(nbDarts/6) ;
// Go over all faces
CellMarker markV(map, VERTEX) ;
TraversorF<MAP> t(map, good) ;
for(Dart d = t.begin(); d != t.end(); d = t.next())
{
std::vector<unsigned int> fidx ;
fidx.reserve(8) ;
unsigned int degree = 0 ;
Traversor2FV<typename PFP::MAP> tfv(map, d) ;
for(Dart it = tfv.begin(); it != tfv.end(); it = tfv.next())
{
++degree ;
unsigned int vNum = map.getEmbedding(VERTEX, it) ;
if(!markV.isMarked(it))
{
markV.mark(it) ;
vIndex[vNum] = vCpt++ ;
vertices.push_back(vNum) ;
}
fidx.push_back(vIndex[vNum]) ;
}
facesSize.push_back(degree) ;
facesIdx.push_back(fidx) ;
}
// Start writing the file
out << "ply" << std::endl ;
// ascii or binary
if (!binary)
out << "format ascii 1.0" << std::endl ;
else
{ // test endianness
union
{
uint32_t i ;
char c[4] ;
} bint = {0x01020304} ;
if (bint.c[0] == 1) // big endian
out << "format binary_big_endian 1.0" << std::endl ;
else
out << "format binary_little_endian 1.0" << std::endl ;
}
out << "comment File generated by the CGoGN library" << std::endl ;
out << "comment See : http://cgogn.unistra.fr/" << std::endl ;
out << "comment or contact : cgogn@unistra.fr" << std::endl ;
// Vertex elements
out << "element vertex " << vertices.size() << std::endl ;
for (typename std::vector<typename PFP::TVEC3* >::const_iterator attrHandler = attributeHandlers.begin() ; attrHandler != attributeHandlers.end() ; ++attrHandler)
{
if ((*attrHandler)->isValid() && ((*attrHandler)->getOrbit() == VERTEX) )
{
if ((*attrHandler)->name().compare("position") == 0) // Vertex position property
{
out << "property " << nameOfTypePly((*(*attrHandler))[0][0]) << " x" << std::endl ;
out << "property " << nameOfTypePly((*(*attrHandler))[0][1]) << " y" << std::endl ;
out << "property " << nameOfTypePly((*(*attrHandler))[0][2]) << " z" << std::endl ;
}
else if ((*attrHandler)->name().compare("normal") == 0) // normal property
{
out << "property " << nameOfTypePly((*(*attrHandler))[0][0]) << " nx" << std::endl ;
out << "property " << nameOfTypePly((*(*attrHandler))[0][1]) << " ny" << std::endl ;
out << "property " << nameOfTypePly((*(*attrHandler))[0][2]) << " nz" << std::endl ;
}
else if ((*attrHandler)->name().compare("color") == 0) // vertex color property
{
out << "property " << nameOfTypePly((*(*attrHandler))[0][0]) << " red" << std::endl ;
out << "property " << nameOfTypePly((*(*attrHandler))[0][1]) << " green" << std::endl ;
out << "property " << nameOfTypePly((*(*attrHandler))[0][2]) << " blue" << std::endl ;
}
else // other vertex properties
{
out << "property " << nameOfTypePly((*(*attrHandler))[0][0]) << " " << (*attrHandler)->name() << "_0" << std::endl ;
out << "property " << nameOfTypePly((*(*attrHandler))[0][1]) << " " << (*attrHandler)->name() << "_1" << std::endl ;
out << "property " << nameOfTypePly((*(*attrHandler))[0][2]) << " " << (*attrHandler)->name() << "_2" << std::endl ;
}
}
}
// Face element
out << "element face " << facesSize.size() << std::endl ;
out << "property list uint8 " << nameOfTypePly(facesIdx[0][0]) << " vertex_indices" << std::endl ;
out << "end_header" << std::endl ;
if (!binary) // ascii
{
// ascii vertices
for(unsigned int i = 0; i < vertices.size(); ++i)
for (typename std::vector<typename PFP::TVEC3* >::const_iterator attrHandler = attributeHandlers.begin() ; attrHandler != attributeHandlers.end() ; ++attrHandler)
if ((*attrHandler)->isValid() && (*attrHandler)->getOrbit() == VERTEX)
out << (*(*attrHandler))[vertices[i]] << std::endl ;
// ascii faces
for(unsigned int i = 0; i < facesSize.size(); ++i)
{
out << facesSize[i] ;
for(unsigned int j = 0; j < facesIdx[i].size(); ++j)
out << " " << facesIdx[i][j] ;
out << std::endl ;
}
}
else // binary
{
// binary vertices
for(unsigned int i = 0; i < vertices.size(); ++i)
for (typename std::vector<typename PFP::TVEC3*>::const_iterator attrHandler = attributeHandlers.begin() ; attrHandler != attributeHandlers.end() ; ++attrHandler)
if ((*attrHandler)->isValid() && (*attrHandler)->getOrbit() == VERTEX)
{
const typename PFP::VEC3& v = (*(*attrHandler))[vertices[i]] ;
out.write((char*)(&(v[0])), sizeof(v)) ;
}
// binary faces
for(unsigned int i = 0; i < facesSize.size(); ++i)
{
uint8_t nbe = facesSize[i] ;
out.write((char*)(&nbe), sizeof(unsigned char)) ;
out.write((char*)(&(facesIdx[i][0])), facesSize[i] * sizeof(facesIdx[i][0])) ;
}
} }
out.close() ; out.close() ;
return true ; return true ;
} }
...@@ -320,7 +527,7 @@ bool exportPlyPTMgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& posi ...@@ -320,7 +527,7 @@ bool exportPlyPTMgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& posi
out.close() ; out.close() ;
return true ; return true ;
} }
/*
template <typename PFP> template <typename PFP>
bool exportPlySLFgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good) bool exportPlySLFgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& position, const char* filename, const FunctorSelect& good)
{ {
...@@ -596,7 +803,7 @@ bool exportPlySLFgenericBin(typename PFP::MAP& map, const typename PFP::TVEC3& p ...@@ -596,7 +803,7 @@ bool exportPlySLFgenericBin(typename PFP::MAP& map, const typename PFP::TVEC3& p
out.close() ; out.close() ;
return true ; return true ;
} }
*/
template <typename PFP> template <typename PFP>
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)
......
...@@ -52,7 +52,7 @@ namespace Import ...@@ -52,7 +52,7 @@ namespace Import
namespace ImportSurfacique namespace ImportSurfacique
{ {
enum ImportType { UNKNOWNSURFACE, TRIAN, TRIANBGZ, MESHBIN, PLY, PLYPTM, PLYSLFgeneric, PLYSLFgenericBin, OFF, OBJ, VRML, AHEM }; enum ImportType { UNKNOWNSURFACE, TRIAN, TRIANBGZ, MESHBIN, PLY, /*PLYPTM, PLYSLFgeneric, PLYSLFgenericBin, */OFF, OBJ, VRML, AHEM };
} }
namespace ImportVolumique namespace ImportVolumique
...@@ -115,10 +115,10 @@ public: ...@@ -115,10 +115,10 @@ public:
bool importPly(const std::string& filename, std::vector<std::string>& attrNames); bool importPly(const std::string& filename, std::vector<std::string>& attrNames);
bool importPlyPTM(const std::string& filename, std::vector<std::string>& attrNames); /* bool importPlyPTM(const std::string& filename, std::vector<std::string>& attrNames);
bool importPlySLFgeneric(const std::string& filename, std::vector<std::string>& attrNames); bool importPlySLFgeneric(const std::string& filename, std::vector<std::string>& attrNames);
bool importPlySLFgenericBin(const std::string& filename, std::vector<std::string>& attrNames); bool importPlySLFgenericBin(const std::string& filename, std::vector<std::string>& attrNames);
*/
#ifdef WITH_ASSIMP #ifdef WITH_ASSIMP
bool importASSIMP(const std::string& filename, std::vector<std::string>& attrNames); bool importASSIMP(const std::string& filename, std::vector<std::string>& attrNames);
#endif #endif
......
...@@ -55,7 +55,7 @@ ImportSurfacique::ImportType MeshTablesSurface<PFP>::getFileType(const std::stri ...@@ -55,7 +55,7 @@ ImportSurfacique::ImportType MeshTablesSurface<PFP>::getFileType(const std::stri
if ((filename.rfind(".meshbin")!=std::string::npos) || (filename.rfind(".MESHBIN")!=std::string::npos)) if ((filename.rfind(".meshbin")!=std::string::npos) || (filename.rfind(".MESHBIN")!=std::string::npos))
return ImportSurfacique::MESHBIN; return ImportSurfacique::MESHBIN;
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(".plyPTMextBin")!=std::string::npos) || (filename.rfind(".plySHrealBin")!=std::string::npos)) if ((filename.rfind(".plyPTMextBin")!=std::string::npos) || (filename.rfind(".plySHrealBin")!=std::string::npos))
...@@ -63,7 +63,7 @@ ImportSurfacique::ImportType MeshTablesSurface<PFP>::getFileType(const std::stri ...@@ -63,7 +63,7 @@ ImportSurfacique::ImportType MeshTablesSurface<PFP>::getFileType(const std::stri
if ((filename.rfind(".plyPTMext")!=std::string::npos) || (filename.rfind(".plySHreal")!=std::string::npos)) if ((filename.rfind(".plyPTMext")!=std::string::npos) || (filename.rfind(".plySHreal")!=std::string::npos))
return ImportSurfacique::PLYSLFgeneric; 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;
...@@ -108,7 +108,7 @@ bool MeshTablesSurface<PFP>::importMesh(const std::string& filename, std::vector ...@@ -108,7 +108,7 @@ bool MeshTablesSurface<PFP>::importMesh(const std::string& filename, std::vector
CGoGNout << "TYPE: PLY" << CGoGNendl; CGoGNout << "TYPE: PLY" << CGoGNendl;
return importPly(filename, attrNames); return importPly(filename, attrNames);
break; break;
case ImportSurfacique::PLYPTM: /* case ImportSurfacique::PLYPTM:
CGoGNout << "TYPE: PLYPTM" << CGoGNendl; CGoGNout << "TYPE: PLYPTM" << CGoGNendl;
return importPlyPTM(filename, attrNames); return importPlyPTM(filename, attrNames);
break; break;
...@@ -120,7 +120,7 @@ bool MeshTablesSurface<PFP>::importMesh(const std::string& filename, std::vector ...@@ -120,7 +120,7 @@ bool MeshTablesSurface<PFP>::importMesh(const std::string& filename, std::vector
CGoGNout << "TYPE: PLYSLFgenericBin" << CGoGNendl; CGoGNout << "TYPE: PLYSLFgenericBin" << CGoGNendl;
return importPlySLFgenericBin(filename, attrNames); return importPlySLFgenericBin(filename, attrNames);
break; break;
*/
case ImportSurfacique::OBJ: case ImportSurfacique::OBJ:
CGoGNout << "TYPE: OBJ" << CGoGNendl; CGoGNout << "TYPE: OBJ" << CGoGNendl;
return importObj(filename, attrNames); return importObj(filename, attrNames);
...@@ -652,9 +652,9 @@ bool MeshTablesSurface<PFP>::importPly(const std::string& filename, std::vector< ...@@ -652,9 +652,9 @@ bool MeshTablesSurface<PFP>::importPly(const std::string& filename, std::vector<
* @param attrNames reference that will be filled with the attribute names * @param attrNames reference that will be filled with the attribute names
* the number of attrNames returned depends on the degree of the polynomials / level of the SH : * the number of attrNames returned depends on the degree of the polynomials / level of the SH :
* - 1 attrName for geometric position (VEC3) : name = "position" ; * - 1 attrName for geometric position (VEC3) : name = "position" ;
* - 3 attrNames for local frame (3xVEC3) : names are "Frame_T" (Tangent), "Frame_B" (Binormal) and "Frame_N" (Normal) ; * - 3 attrNames for local frame (3xVEC3) : names are "frameT" (Tangent), "frameB" (Binormal) and "frameN" (Normal) ;
* - N attrNames for the function coefficients (NxVEC3) : N RGB coefficients being successively the constants, the linears (v then u), the quadratics, etc. : : a0 + a1*v + a2*u + a3*u*v + a4*v^2 + a5*u^2. * - N attrNames for the function coefficients (NxVEC3) : N RGB coefficients being successively the constants, the linears (v then u), the quadratics, etc. : : a0 + a1*v + a2*u + a3*u*v + a4*v^2 + a5*u^2.
* Their names are : "SLFcoefs_<i>" (where <i> is a number from 0 to N-1). * Their names are : "SLFcoefs<i>" (where <i> is a number from 0 to N-1).
* N = 1 for constant polynomial, * N = 1 for constant polynomial,
* N = 3 for linear polynomial, * N = 3 for linear polynomial,
* N = 6 for quadratic polynomial, * N = 6 for quadratic polynomial,
...@@ -665,7 +665,7 @@ bool MeshTablesSurface<PFP>::importPly(const std::string& filename, std::vector< ...@@ -665,7 +665,7 @@ bool MeshTablesSurface<PFP>::importPly(const std::string& filename, std::vector<
* ... * ...
* - K remaining attrNames named "remainderNo<k>" where k is an integer from 0 to K-1. * - K remaining attrNames named "remainderNo<k>" where k is an integer from 0 to K-1.
* @return bool : success. * @return bool : success.
*/ *
template <typename PFP> template <typename PFP>
bool MeshTablesSurface<PFP>::importPlySLFgeneric(const std::string& filename, std::vector<std::string>& attrNames) bool MeshTablesSurface<PFP>::importPlySLFgeneric(const std::string& filename, std::vector<std::string>& attrNames)
{ {
...@@ -708,13 +708,13 @@ bool MeshTablesSurface<PFP>::importPlySLFgeneric(const std::string& filename, st ...@@ -708,13 +708,13 @@ bool MeshTablesSurface<PFP>::importPlySLFgeneric(const std::string& filename, st
if (tag == std::string("x") || tag == std::string("y") || tag == std::string("z")) if (tag == std::string("x") || tag == std::string("y") || tag == std::string("z"))
position = true ; position = true ;
else if (tag == std::string("tx") || tag == std::string("ty") || tag == std::string("tz")) else if (tag == std::string("FrameT_0") || tag == std::string("FrameT_1") || tag == std::string("FrameT_2"))
tangent = true ; tangent = true ;
else if (tag == std::string("bx") || tag == std::string("by") || tag == std::string("bz")) else if (tag == std::string("FrameB_0") || tag == std::string("FrameB_1") || tag == std::string("FrameB_2"))
binormal = true ; binormal = true ;
else if (tag == std::string("nx") || tag == std::string("ny") || tag == std::string("nz")) else if (tag == std::string("FrameN_0") || tag == std::string("FrameN_1") || tag == std::string("FrameN_2"))
normal = true ; normal = true ;
if (tag.substr(0,1) == std::string("C") && tag.substr(2,1) == std::string("_")) if ((tag.substr(3,5) == std::string("coefs") && tag.substr(8,1) == std::string("_")) || (tag.substr(2,5) == std::string("coefs") && tag.substr(7,1) == std::string("_")))
++nbCoefs ; ++nbCoefs ;
} while (tag != std::string("face")) ; } while (tag != std::string("face")) ;
unsigned int nbRemainders = nbProps ; // # remaining properties unsigned int nbRemainders = nbProps ; // # remaining properties
...@@ -735,9 +735,9 @@ bool MeshTablesSurface<PFP>::importPlySLFgeneric(const std::string& filename, st ...@@ -735,9 +735,9 @@ bool MeshTablesSurface<PFP>::importPlySLFgeneric(const std::string& filename, st
attrNames.push_back(positions.name()) ; attrNames.push_back(positions.name()) ;
AttributeHandler<typename PFP::VEC3> *frame = new AttributeHandler<typename PFP::VEC3>[3] ; AttributeHandler<typename PFP::VEC3> *frame = new AttributeHandler<typename PFP::VEC3>[3] ;