Commit 1d9d93b1 authored by Pierre Kraemer's avatar Pierre Kraemer
Browse files

warnings

parent ddefb9a1
...@@ -88,9 +88,9 @@ bool exportTrian(typename PFP::MAP& map, const typename PFP::TVEC3& position, ch ...@@ -88,9 +88,9 @@ 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) ;
/** /**
* export the map into a PLYPTMgeneric file (K. Vanhoey generic format). * export the map into a PLYPTMgeneric file (K. Vanhoey generic format).
...@@ -103,9 +103,9 @@ bool exportPlySLFgeneric(typename PFP::MAP& map, const typename PFP::TVEC3& posi ...@@ -103,9 +103,9 @@ 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) ;
/** /**
* export the map into a PLYSLF file (K. Vanhoey generic format). * export the map into a PLYSLF file (K. Vanhoey generic format).
......
...@@ -665,305 +665,305 @@ bool MeshTablesSurface<PFP>::importPly(const std::string& filename, std::vector< ...@@ -665,305 +665,305 @@ 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)
{ //{
// Open file // // Open file
std::ifstream fp(filename.c_str(), std::ios::in) ; // std::ifstream fp(filename.c_str(), std::ios::in) ;
if (!fp.good()) // if (!fp.good())
{ // {
CGoGNerr << "Unable to open file " << filename << CGoGNendl ; // CGoGNerr << "Unable to open file " << filename << CGoGNendl ;
return false ; // return false ;
} // }
//
// Read quantities : #vertices, #faces, #properties, degree of polynomials // // Read quantities : #vertices, #faces, #properties, degree of polynomials
std::string tag ; // std::string tag ;
//
fp >> tag; // fp >> tag;
if (tag != std::string("ply")) // verify file type // if (tag != std::string("ply")) // verify file type
{ // {
CGoGNerr << filename << " is not a ply file !" << CGoGNout ; // CGoGNerr << filename << " is not a ply file !" << CGoGNout ;
return false ; // return false ;
} // }
//
do // go to #vertices // do // go to #vertices
{ // {
fp >> tag ; // fp >> tag ;
} while (tag != std::string("vertex")) ; // } while (tag != std::string("vertex")) ;
unsigned int nbVertices ; // unsigned int nbVertices ;
fp >> nbVertices ; // Read #vertices // fp >> nbVertices ; // Read #vertices
//
bool position = false ; // bool position = false ;
bool tangent = false ; // bool tangent = false ;
bool binormal = false ; // bool binormal = false ;
bool normal = false ; // bool normal = false ;
unsigned int nbProps = 0 ; // # properties // unsigned int nbProps = 0 ; // # properties
unsigned int nbCoefs = 0 ; // # coefficients per polynomial // unsigned int nbCoefs = 0 ; // # coefficients per polynomial
do // go to #faces and count #properties // do // go to #faces and count #properties
{ // {
fp >> tag ; // fp >> tag ;
if (tag == std::string("property")) // if (tag == std::string("property"))
++nbProps ; // ++nbProps ;
//
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("FrameT_0") || tag == std::string("FrameT_1") || tag == std::string("FrameT_2")) // 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("FrameB_0") || tag == std::string("FrameB_1") || tag == std::string("FrameB_2")) // 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("FrameN_0") || tag == std::string("FrameN_1") || tag == std::string("FrameN_2")) // else if (tag == std::string("FrameN_0") || tag == std::string("FrameN_1") || tag == std::string("FrameN_2"))
normal = true ; // normal = true ;
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("_"))) // 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
nbRemainders -= nbCoefs + 3*(position==true) + 3*(tangent==true) + 3*(binormal==true) + 3*(normal==true) ; // nbRemainders -= nbCoefs + 3*(position==true) + 3*(tangent==true) + 3*(binormal==true) + 3*(normal==true) ;
nbCoefs /= 3 ; // nbCoefs /= 3 ;
//
fp >> m_nbFaces ; // Read #vertices // fp >> m_nbFaces ; // Read #vertices
//
do // go to end of header // do // go to end of header
{ // {
fp >> tag ; // fp >> tag ;
} while (tag != std::string("end_header")) ; // } while (tag != std::string("end_header")) ;
//
// Define containers // // Define containers
AttributeHandler<typename PFP::VEC3> positions = m_map.template getAttribute<typename PFP::VEC3>(VERTEX, "position") ; // AttributeHandler<typename PFP::VEC3> positions = m_map.template getAttribute<typename PFP::VEC3>(VERTEX, "position") ;
if (!positions.isValid()) // if (!positions.isValid())
positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX, "position") ; // positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX, "position") ;
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] ;
frame[0] = m_map.template addAttribute<typename PFP::VEC3>(VERTEX, "frameT") ; // Tangent // frame[0] = m_map.template addAttribute<typename PFP::VEC3>(VERTEX, "frameT") ; // Tangent
frame[1] = m_map.template addAttribute<typename PFP::VEC3>(VERTEX, "frameB") ; // Bitangent // frame[1] = m_map.template addAttribute<typename PFP::VEC3>(VERTEX, "frameB") ; // Bitangent
frame[2] = m_map.template addAttribute<typename PFP::VEC3>(VERTEX, "frameN") ; // Normal // frame[2] = m_map.template addAttribute<typename PFP::VEC3>(VERTEX, "frameN") ; // Normal
attrNames.push_back(frame[0].name()) ; // attrNames.push_back(frame[0].name()) ;
attrNames.push_back(frame[1].name()) ; // attrNames.push_back(frame[1].name()) ;
attrNames.push_back(frame[2].name()) ; // attrNames.push_back(frame[2].name()) ;
//
AttributeHandler<typename PFP::VEC3> *SLFcoefs = new AttributeHandler<typename PFP::VEC3>[nbCoefs] ; // AttributeHandler<typename PFP::VEC3> *SLFcoefs = new AttributeHandler<typename PFP::VEC3>[nbCoefs] ;
for (unsigned int i = 0 ; i < nbCoefs ; ++i) // for (unsigned int i = 0 ; i < nbCoefs ; ++i)
{ // {
std::stringstream name ; // std::stringstream name ;
name << "SLFcoefs" << i ; // name << "SLFcoefs" << i ;
SLFcoefs[i] = m_map.template addAttribute<typename PFP::VEC3>(VERTEX, name.str()) ; // SLFcoefs[i] = m_map.template addAttribute<typename PFP::VEC3>(VERTEX, name.str()) ;
attrNames.push_back(SLFcoefs[i].name()) ; // attrNames.push_back(SLFcoefs[i].name()) ;
} // }
//
AttributeHandler<typename PFP::REAL> *remainders = new AttributeHandler<typename PFP::REAL>[nbRemainders] ; // AttributeHandler<typename PFP::REAL> *remainders = new AttributeHandler<typename PFP::REAL>[nbRemainders] ;
for (unsigned int i = 0 ; i < nbRemainders ; ++i) // for (unsigned int i = 0 ; i < nbRemainders ; ++i)
{ // {
std::stringstream name ; // std::stringstream name ;
name << "remainderNo" << i ; // name << "remainderNo" << i ;
remainders[i] = m_map.template addAttribute<typename PFP::REAL>(VERTEX, name.str()) ; // remainders[i] = m_map.template addAttribute<typename PFP::REAL>(VERTEX, name.str()) ;
attrNames.push_back(remainders[i].name()) ; // attrNames.push_back(remainders[i].name()) ;
} // }
//
// Read vertices // // Read vertices
std::vector<unsigned int> verticesID ; // std::vector<unsigned int> verticesID ;
verticesID.reserve(nbVertices) ; // verticesID.reserve(nbVertices) ;
//
float* properties = new float[nbProps] ; // float* properties = new float[nbProps] ;
AttributeContainer& container = m_map.getAttributeContainer(VERTEX) ; // AttributeContainer& container = m_map.getAttributeContainer(VERTEX) ;
for (unsigned int i = 0 ; i < nbVertices ; ++i) // Read and store properties for current vertex // for (unsigned int i = 0 ; i < nbVertices ; ++i) // Read and store properties for current vertex
{ // {
unsigned int id = container.insertLine() ; // unsigned int id = container.insertLine() ;
verticesID.push_back(id) ; // verticesID.push_back(id) ;
//
for (unsigned int j = 0 ; j < nbProps ; ++j) // get all properties // for (unsigned int j = 0 ; j < nbProps ; ++j) // get all properties
fp >> properties[j] ; // fp >> properties[j] ;
//
positions[id] = VEC3(properties[0],properties[1],properties[2]) ; // position // positions[id] = VEC3(properties[0],properties[1],properties[2]) ; // position
for (unsigned int k = 0 ; k < 3 ; ++k) // frame // for (unsigned int k = 0 ; k < 3 ; ++k) // frame
for (unsigned int l = 0 ; l < 3 ; ++l) // for (unsigned int l = 0 ; l < 3 ; ++l)
frame[k][id][l] = properties[3+(3*k+l)] ; // frame[k][id][l] = properties[3+(3*k+l)] ;
for (unsigned int k = 0 ; k < 3 ; ++k) // coefficients // for (unsigned int k = 0 ; k < 3 ; ++k) // coefficients
for (unsigned int l = 0 ; l < nbCoefs ; ++l) // for (unsigned int l = 0 ; l < nbCoefs ; ++l)
SLFcoefs[l][id][k] = properties[12+(nbCoefs*k+l)] ; // SLFcoefs[l][id][k] = properties[12+(nbCoefs*k+l)] ;
unsigned int cur = 12+3*nbCoefs ; // unsigned int cur = 12+3*nbCoefs ;
for (unsigned int k = 0 ; k < nbRemainders ; ++k) // remaining data // for (unsigned int k = 0 ; k < nbRemainders ; ++k) // remaining data
remainders[k][id] = properties[cur + k] ; // remainders[k][id] = properties[cur + k] ;
} // }
m_nbVertices = verticesID.size() ; // m_nbVertices = verticesID.size() ;
delete[] properties ; // delete[] properties ;
//
// Read faces index // // Read faces index
m_nbEdges.reserve(m_nbFaces) ; // 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) // for (unsigned int i = 0 ; i < m_nbFaces ; ++i)
{ // {
// read the indices of vertices for current face // // read the indices of vertices for current face
unsigned int nbEdgesForFace ; // unsigned int nbEdgesForFace ;
fp >> nbEdgesForFace ; // fp >> nbEdgesForFace ;
m_nbEdges.push_back(nbEdgesForFace); // m_nbEdges.push_back(nbEdgesForFace);
//
unsigned int vertexID ; // unsigned int vertexID ;
for (unsigned int j=0 ; j < nbEdgesForFace ; ++j) // for (unsigned int j=0 ; j < nbEdgesForFace ; ++j)
{ // {
fp >> vertexID ; // fp >> vertexID ;
m_emb.push_back(verticesID[vertexID]); // m_emb.push_back(verticesID[vertexID]);
} // }
} // }
//
// Close file // // Close file
fp.close() ; // fp.close() ;
//
return true ; // return true ;
} //}
template <typename PFP> //template <typename PFP>
bool MeshTablesSurface<PFP>::importPlySLFgenericBin(const std::string& filename, std::vector<std::string>& attrNames) //bool MeshTablesSurface<PFP>::importPlySLFgenericBin(const std::string& filename, std::vector<std::string>& attrNames)
{ //{
// Open file // // Open file
std::ifstream fp(filename.c_str(), std::ios::in | std::ios::binary) ; // std::ifstream fp(filename.c_str(), std::ios::in | std::ios::binary) ;
if (!fp.good()) // if (!fp.good())
{ // {
CGoGNerr << "Unable to open file " << filename << CGoGNendl ; // CGoGNerr << "Unable to open file " << filename << CGoGNendl ;
return false ; // return false ;
} // }
//
// Read quantities : #vertices, #faces, #properties, degree of polynomials // // Read quantities : #vertices, #faces, #properties, degree of polynomials
std::string tag ; // std::string tag ;
//
fp >> tag; // fp >> tag;
if (tag != std::string("ply")) // verify file type // if (tag != std::string("ply")) // verify file type
{ // {
CGoGNerr << filename << " is not a ply file !" << CGoGNout ; // CGoGNerr << filename << " is not a ply file !" << CGoGNout ;
return false ; // return false ;
} // }
//
do // go to #vertices // do // go to #vertices
{ // {
fp >> tag ; // fp >> tag ;
} while (tag != std::string("vertex")) ; // } while (tag != std::string("vertex")) ;
unsigned int nbVertices ; // unsigned int nbVertices ;
fp >> nbVertices ; // Read #vertices // fp >> nbVertices ; // Read #vertices
//
bool position = false ; // bool position = false ;
bool tangent = false ; // bool tangent = false ;
bool binormal = false ; // bool binormal = false ;
bool normal = false ; // bool normal = false ;
unsigned int nbProps = 0 ; // # properties // unsigned int nbProps = 0 ; // # properties
unsigned int nbCoefs = 0 ; // # coefficients per polynomial // unsigned int nbCoefs = 0 ; // # coefficients per polynomial
do // go to #faces and count #properties // do // go to #faces and count #properties
{ // {
fp >> tag ; // fp >> tag ;
if (tag == std::string("property")) // if (tag == std::string("property"))
++nbProps ; // ++nbProps ;
//
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("FrameT_0") || tag == std::string("FrameT_1") || tag == std::string("FrameT_2")) // 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("FrameB_0") || tag == std::string("FrameB_1") || tag == std::string("FrameB_2")) // 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("FrameN_0") || tag == std::string("FrameN_1") || tag == std::string("FrameN_2")) // else if (tag == std::string("FrameN_0") || tag == std::string("FrameN_1") || tag == std::string("FrameN_2"))
normal = true ; // normal = true ;
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("_"))) // 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
nbRemainders -= nbCoefs + 3*(position==true) + 3*(tangent==true) + 3*(binormal==true) + 3*(normal==true) ; // nbRemainders -= nbCoefs + 3*(position==true) + 3*(tangent==true) + 3*(binormal==true) + 3*(normal==true) ;
nbCoefs /= 3 ; // nbCoefs /= 3 ;
//
fp >> m_nbFaces ; // Read #vertices // fp >> m_nbFaces ; // Read #vertices
//
do // go to end of header // do // go to end of header
{ // {
fp >> tag ; // fp >> tag ;
} while (tag != std::string("end_header")) ; // } while (tag != std::string("end_header")) ;
//
char* endline = new char[1] ; // char* endline = new char[1] ;
fp.read(endline, sizeof(char)) ; // fp.read(endline, sizeof(char)) ;
if (*endline == '\r') // for windows // if (*endline == '\r') // for windows
fp.read(endline, sizeof(char)) ; // fp.read(endline, sizeof(char)) ;
assert(*endline == '\n') ; // assert(*endline == '\n') ;
delete endline ; // delete endline ;
//
// Define containers // // Define containers
AttributeHandler<typename PFP::VEC3> positions = m_map.template getAttribute<typename PFP::VEC3>(VERTEX, "position") ; // AttributeHandler<typename PFP::VEC3> positions = m_map.template getAttribute<typename PFP::VEC3>(VERTEX, "position") ;
if (!positions.isValid()) // if (!positions.isValid())
positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX, "position") ; // positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX, "position") ;
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] ;
frame[0] = m_map.template addAttribute<typename PFP::VEC3>(VERTEX, "frameT") ; // Tangent // frame[0] = m_map.template addAttribute<typename PFP::VEC3>(VERTEX, "frameT") ; // Tangent
frame[1] = m_map.template addAttribute<typename PFP::VEC3>(VERTEX, "frameB") ; // Bitangent // frame[1] = m_map.template addAttribute<typename PFP::VEC3>(VERTEX, "frameB") ; // Bitangent
frame[2] = m_map.template addAttribute<typename PFP::VEC3>(VERTEX, "frameN") ; // Normal // frame[2] = m_map.template addAttribute<typename PFP::VEC3>(VERTEX, "frameN") ; // Normal
attrNames.push_back(frame[0].name()) ; // attrNames.push_back(frame[0].name()) ;
attrNames.push_back(frame[1].name()) ; // attrNames.push_back(frame[1].name()) ;
attrNames.push_back(frame[2].name()) ; // attrNames.push_back(frame[2].name()) ;
//
AttributeHandler<typename PFP::VEC3> *SLFcoefs = new AttributeHandler<typename PFP::VEC3>[nbCoefs] ; // AttributeHandler<typename PFP::VEC3> *SLFcoefs = new AttributeHandler<typename PFP::VEC3>[nbCoefs] ;
for (unsigned int i = 0 ; i < nbCoefs ; ++i) // for (unsigned int i = 0 ; i < nbCoefs ; ++i)
{ // {
std::stringstream name ; // std::stringstream name ;
name << "SLFcoefs" << i ; // name << "SLFcoefs" << i ;
SLFcoefs[i] = m_map.template addAttribute<typename PFP::VEC3>(VERTEX, name.str()) ; // SLFcoefs[i] = m_map.template addAttribute<typename PFP::VEC3>(VERTEX, name.str()) ;
attrNames.push_back(SLFcoefs[i].name()) ; // attrNames.push_back(SLFcoefs[i].name()) ;
} // }
//
AttributeHandler<typename PFP::REAL> *remainders = new AttributeHandler<typename PFP::REAL>[nbRemainders] ; // AttributeHandler<typename PFP::REAL> *remainders = new AttributeHandler<typename PFP::REAL>[nbRemainders] ;
for (unsigned int i = 0 ; i < nbRemainders ; ++i) // for (unsigned int i = 0 ; i < nbRemainders ; ++i)
{ // {
std::stringstream name ; // std::stringstream name ;
name << "remainderNo" << i ; // name << "remainderNo" << i ;
remainders[i] = m_map.template addAttribute<typename PFP::REAL>(VERTEX, name.str()) ; // remainders[i] = m_map.template addAttribute<typename PFP::REAL>(VERTEX, name.str()) ;
attrNames.push_back(remainders[i].name()) ; // attrNames.push_back(remainders[i].name()) ;
} // }
//
// Read vertices // // Read vertices
std::vector<unsigned int> verticesID ; // std::vector<unsigned int> verticesID ;
verticesID.reserve(nbVertices) ; // verticesID.reserve(nbVertices) ;
//
float* properties = new float[nbProps] ; // float* properties = new float[nbProps] ;
AttributeContainer& container = m_map.getAttributeContainer(VERTEX) ; // AttributeContainer& container = m_map.getAttributeContainer(VERTEX) ;
for (unsigned int i = 0 ; i < nbVertices ; ++i) // Read and store properties for current vertex // for (unsigned int i = 0 ; i < nbVertices ; ++i) // Read and store properties for current vertex
{ // {
unsigned int id = container.insertLine() ; // unsigned int id = container.insertLine() ;
verticesID.push_back(id) ; // verticesID.push_back(id) ;
//
// for (unsigned int j = 0 ; j < nbProps ; ++j) // get all properties // // for (unsigned int j = 0 ; j < nbProps ; ++j) // get all properties
fp.read((char*)properties,nbProps * sizeof(float)) ; // fp.read((char*)properties,nbProps * sizeof(float)) ;
//
positions[id] = VEC3(properties[0],properties[1],properties[2]) ; // position // positions[id] = VEC3(properties[0],properties[1],properties[2]) ; // position
for (unsigned int k = 0 ; k < 3 ; ++k) // frame // for (unsigned int k = 0 ; k < 3 ; ++k) // frame
for (unsigned int l = 0 ; l < 3 ; ++l) // for (unsigned int l = 0 ; l < 3 ; ++l)
frame[k][id][l] = (typename PFP::REAL)(properties[3+(3*k+l)]) ; // frame[k][id][l] = (typename PFP::REAL)(properties[3+(3*k+l)]) ;
for (unsigned int k = 0 ; k < 3 ; ++k) // coefficients // for (unsigned int k = 0 ; k < 3 ; ++k) // coefficients
for (unsigned int l = 0 ; l < nbCoefs ; ++l) // for (unsigned int l = 0 ; l < nbCoefs ; ++l)
SLFcoefs[l][id][k] = (typename PFP::REAL)(properties[12+(nbCoefs*k+l)]) ; // SLFcoefs[l][id][k] = (typename PFP::REAL)(properties[12+(nbCoefs*k+l)]) ;
unsigned int cur = 12+3*nbCoefs ; // unsigned int cur = 12+3*nbCoefs ;
for (unsigned int k = 0 ; k < nbRemainders ; ++k) // remaining data // for (unsigned int k = 0 ; k < nbRemainders ; ++k) // remaining data
remainders[k][id] = (typename PFP::REAL)(properties[cur + k]) ; // remainders[k][id] = (typename PFP::REAL)(properties[cur + k]) ;
} // }
m_nbVertices = verticesID.size() ; // m_nbVertices = verticesID.size() ;
delete[] properties ; // delete[] properties ;
//
// Read faces index // // Read faces index
m_nbEdges.reserve(m_nbFaces) ; // 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) // for (unsigned int i = 0 ; i < m_nbFaces ; ++i)
{ // {
// read the indices of vertices for current face // // read the indices of vertices for current face
unsigned int nbEdgesForFace ; // unsigned int nbEdgesForFace ;
fp.read((char*)&(nbEdgesForFace), sizeof(unsigned int)) ; // fp.read((char*)&(nbEdgesForFace), sizeof(unsigned int)) ;
m_nbEdges.push_back(nbEdgesForFace); // m_nbEdges.push_back(nbEdgesForFace);
//
unsigned int vertexID ; // unsigned int vertexID ;
for (unsigned int j=0 ; j < nbEdgesForFace ; ++j) // for (unsigned int j=0 ; j < nbEdgesForFace ; ++j)
{ // {
fp.read((char*)&vertexID, sizeof(unsigned int)) ; // fp.read((char*)&vertexID, sizeof(unsigned int)) ;
m_emb.push_back(verticesID[vertexID]); // m_emb.push_back(verticesID[vertexID]);
} // }
} // }
//
// Close file // // Close file
fp.close() ; // fp.close() ;
//
return true ; // return true ;
} //}
/** /**
* Import plyPTM (F Larue format). * Import plyPTM (F Larue format).
...@@ -974,133 +974,132 @@ bool MeshTablesSurface<PFP>::importPlySLFgenericBin(const std::string& filename, ...@@ -974,133 +974,132 @@ bool MeshTablesSurface<PFP>::importPlySLFgenericBin(const std::string& filename,
* - 3 attrNames for local frame (3xVEC3) : Tangent, Bitangent and Normal vector * - 3 attrNames for local frame (3xVEC3) : Tangent, Bitangent and Normal vector
* - 6 attrNames for the function coefficients (6xVEC3) : 6 RGB coefficients being successively the quadratic members, the linears and the constants (u then v) : a*u^2 + b*v^2 + c*uv + d*u + e*v +f. * - 6 attrNames for the function coefficients (6xVEC3) : 6 RGB coefficients being successively the quadratic members, the linears and the constants (u then v) : a*u^2 + b*v^2 + c*uv + d*u + e*v +f.
* @return bool : success. * @return bool : success.
* */
template <typename PFP> //template <typename PFP>
bool MeshTablesSurface<PFP>::importPlyPTM(const std::string& filename, std::vector<std::string>& attrNames) //bool MeshTablesSurface<PFP>::importPlyPTM(const std::string& filename, std::vector<std::string>& attrNames)
{ //{
AttributeHandler<typename PFP::VEC3> positions = m_map.template getAttribute<typename PFP::VEC3>(VERTEX, "position") ; // AttributeHandler<typename PFP::VEC3> positions = m_map.template getAttribute<typename PFP::VEC3>(VERTEX, "position") ;
//
if (!positions.isValid()) // if (!positions.isValid())
positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX, "position") ; // positions = m_map.template addAttribute<typename PFP::VEC3>(VERTEX, "position") ;
//
attrNames.push_back(positions.name()) ; // attrNames.push_back(positions.name()) ;
//
AttributeHandler<typename PFP::VEC3> frame[3] ; // AttributeHandler<typename PFP::VEC3> frame[3] ;
frame[0] = m_map.template addAttribute<typename PFP::VEC3>(VERTEX, "frame_T") ; // Tangent // frame[0] = m_map.template addAttribute<typename PFP::VEC3>(VERTEX, "frame_T") ; // Tangent
frame[1] = m_map.template addAttribute<typename PFP::VEC3>(VERTEX, "frame_B") ; // Bitangent // frame[1] = m_map.template addAttribute<typename PFP::VEC3>(VERTEX, "frame_B") ; // Bitangent
frame[2] = m_map.template addAttribute<typename PFP::VEC3>(VERTEX, "frame_N") ; // Normal // frame[2] = m_map.template addAttribute<typename PFP::VEC3>(VERTEX, "frame_N") ; // Normal
for (unsigned int i = 0 ; i < 3 ; ++i) // for (unsigned int i = 0 ; i < 3 ; ++i)