Commit a4a69f68 authored by Basile Sauvage's avatar Basile Sauvage

Merge cgogn.u-strasbg.fr:~vanhoey/CGoGN

parents 6299c0fe 717310f1
...@@ -62,7 +62,7 @@ void decimate( ...@@ -62,7 +62,7 @@ void decimate(
std::vector<VertexAttribute<typename PFP::VEC3> *>& position, std::vector<VertexAttribute<typename PFP::VEC3> *>& position,
unsigned int nbWantedVertices, unsigned int nbWantedVertices,
const FunctorSelect& selected = allDarts, const FunctorSelect& selected = allDarts,
VertexAttribute<typename PFP::VEC3> *edgeErrors = NULL, EdgeAttribute<typename PFP::VEC3> *edgeErrors = NULL,
void (*callback_wrapper)(void*, const void*) = NULL, void *callback_object = NULL void (*callback_wrapper)(void*, const void*) = NULL, void *callback_object = NULL
) ; ) ;
......
...@@ -1010,12 +1010,21 @@ bool MeshTablesSurface<PFP>::importPlySLFgenericBin(const std::string& filename, ...@@ -1010,12 +1010,21 @@ bool MeshTablesSurface<PFP>::importPlySLFgenericBin(const std::string& filename,
attrNames.push_back(positions.name()) ; attrNames.push_back(positions.name()) ;
VertexAttribute<typename PFP::VEC3> *frame = new VertexAttribute<typename PFP::VEC3>[3] ; VertexAttribute<typename PFP::VEC3> *frame = new VertexAttribute<typename PFP::VEC3>[3] ;
frame[0] = m_map.template addAttribute<typename PFP::VEC3, VERTEX>("frameT") ; // Tangent if (tangent)
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[0] = m_map.template addAttribute<typename PFP::VEC3, VERTEX>("frameT") ; // Tangent
attrNames.push_back(frame[0].name()) ; attrNames.push_back(frame[0].name()) ;
attrNames.push_back(frame[1].name()) ; }
attrNames.push_back(frame[2].name()) ; if (binormal)
{
frame[1] = m_map.template addAttribute<typename PFP::VEC3, VERTEX>("frameB") ; // Bitangent
attrNames.push_back(frame[0].name()) ;
}
if (normal)
{
frame[2] = m_map.template addAttribute<typename PFP::VEC3, VERTEX>("frameN") ; // Normal
attrNames.push_back(frame[0].name()) ;
}
VertexAttribute<typename PFP::VEC3> *PBcoefs = NULL, *SHcoefs = NULL ; VertexAttribute<typename PFP::VEC3> *PBcoefs = NULL, *SHcoefs = NULL ;
if (PTM) if (PTM)
...@@ -1064,14 +1073,15 @@ bool MeshTablesSurface<PFP>::importPlySLFgenericBin(const std::string& filename, ...@@ -1064,14 +1073,15 @@ bool MeshTablesSurface<PFP>::importPlySLFgenericBin(const std::string& filename,
fp.read((char*)properties,nbProps * propSize) ; fp.read((char*)properties,nbProps * propSize) ;
positions[id] = VEC3(properties[0],properties[1],properties[2]) ; // position // positions
for (unsigned int k = 0 ; k < 3 ; ++k) // frame if (nbProps > 2)
for (unsigned int l = 0 ; l < 3 ; ++l) positions[id] = VEC3(properties[0],properties[1],properties[2]) ; // position
frame[k][id][l] = (typename PFP::REAL)(properties[3+(3*k+l)]) ;
/* if (tangent && binormal && normal) // == if (nbprops > 11)
for (unsigned int k = 0 ; k < 3 ; ++k) // coefficients for (unsigned int k = 0 ; k < 3 ; ++k) // frame
for (unsigned int l = 0 ; l < nbCoefs ; ++l) for (unsigned int l = 0 ; l < 3 ; ++l)
*/ frame[k][id][l] = (typename PFP::REAL)(properties[3+(3*k+l)]) ;
for (unsigned int l = 0 ; l < nbCoefs ; ++l) // coefficients for (unsigned int l = 0 ; l < nbCoefs ; ++l) // coefficients
for (unsigned int k = 0 ; k < 3 ; ++k) for (unsigned int k = 0 ; k < 3 ; ++k)
{ {
...@@ -1080,6 +1090,7 @@ bool MeshTablesSurface<PFP>::importPlySLFgenericBin(const std::string& filename, ...@@ -1080,6 +1090,7 @@ bool MeshTablesSurface<PFP>::importPlySLFgenericBin(const std::string& filename,
else /* if SH */ else /* if SH */
SHcoefs[l][id][k] = (typename PFP::REAL)(properties[12+(3*l+k)]) ; SHcoefs[l][id][k] = (typename PFP::REAL)(properties[12+(3*l+k)]) ;
} }
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]) ;
......
...@@ -65,7 +65,7 @@ private: ...@@ -65,7 +65,7 @@ private:
std::vector<VSplit<PFP>*> m_splits ; std::vector<VSplit<PFP>*> m_splits ;
unsigned int m_cur ; unsigned int m_cur ;
Algo::Decimation::HalfEdgeApproximator<PFP, VEC3, EDGE>* m_positionApproximator ; Algo::Decimation::Approximator<PFP, VEC3, EDGE>* m_positionApproximator ;
bool m_initOk ; bool m_initOk ;
......
...@@ -108,7 +108,7 @@ ProgressiveMesh<PFP>::ProgressiveMesh( ...@@ -108,7 +108,7 @@ ProgressiveMesh<PFP>::ProgressiveMesh(
if(! (*it)->init()) if(! (*it)->init())
m_initOk = false ; m_initOk = false ;
if((*it)->getApproximatedAttributeName() == "position") if((*it)->getApproximatedAttributeName() == "position")
m_positionApproximator = reinterpret_cast<Algo::Decimation::HalfEdgeApproximator<PFP, VEC3, EDGE>*>(*it) ; m_positionApproximator = reinterpret_cast<Algo::Decimation::Approximator<PFP, VEC3, EDGE>*>(*it) ;
} }
CGoGNout << "..done" << CGoGNendl ; CGoGNout << "..done" << CGoGNendl ;
......
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