Commit 351c36b2 authored by CGoGN's avatar CGoGN

Merge /home/vanhoey/CGoGN

Conflicts:
	include/Algo/Modelisation/polyhedron.hpp
parents b9fb2856 9d4aacc3
......@@ -102,8 +102,6 @@ private:
bool importPlySLFgeneric(const std::string& filename, std::vector<std::string>& attrNames);
bool importPlySLFgenericBin(const std::string& filename, std::vector<std::string>& attrNames);
#ifdef WITH_ASSIMP
bool importASSIMP(const std::string& filename, std::vector<std::string>& attrNames);
#endif
......@@ -131,6 +129,8 @@ public:
bool importVoxellisation(Algo::Surface::Modelisation::Voxellisation& voxellisation, std::vector<std::string>& attrNames);
bool importPlySLFgenericBin(const std::string& filename, std::vector<std::string>& attrNames);
MeshTablesSurface(typename PFP::MAP& map):
m_map(map)
{ }
......
......@@ -506,66 +506,53 @@ void explodPolyhedron(typename PFP::MAP& map, Dart d, VertexAttribute<typename
}
}
// template <typename PFP>
// void quads2TrianglesCC(typename PFP::MAP& the_map, Dart primd)
// {
// DartMarker m(the_map);
// // list of faces to process and processed(before pos iterator)
// std::list<Dart> ld;
// ld.push_back(primd);
// // current position in list
// typename std::list<Dart>::iterator pos = ld.begin();
// do
// {
// Dart d = *pos;
// // cut the face of first dart of list
// Dart d1 = the_map.phi1(d);
// Dart e = the_map.phi1(d1);
// Dart e1 = the_map.phi1(e);
// Dart f = the_map.phi1(e1);
// if (f==d) // quad
// {
// the_map.splitFace(d,e);
// // mark the face
// m.markOrbit<FACE>(d);
// m.markOrbit<FACE>(e);
// }
// else m.markOrbit<FACE>(d);
// // and store neighbours faces in the list
// d = the_map.phi2(d);
// e = the_map.phi2(e);
// d1 = the_map.phi1(the_map.phi2(d1));
// e1 = the_map.phi1(the_map.phi2(e1));
// if (!m.isMarked(d))
// ld.push_back(d);
// if (!m.isMarked(e))
// ld.push_back(e);
// if (!m.isMarked(d1))
// ld.push_back(d1);
// if ((f==d) && (!m.isMarked(e1)))
// ld.push_back(e1);
// pos++;
// }while (pos!=ld.end()); // stop when no more face to process
// }
// template <typename PFP>
// Dart triangleFan_topo(typename PFP::MAP& the_map, int n)
// {
// Dart d = the_map.newFace(3,false);
// Dart e = the_map.phi1(d);
// for(int i=1;i<n;++i)
// {
// Dart f = the_map.newFace(3,false);
// the_map.sewFaces(the_map.phi_1(f),e);
// e = the_map.phi1(f);
// }
// the_map.sewFaces(the_map.phi_1(d),e);
// return d;
// }
template <typename PFP>
void quads2TrianglesCC(typename PFP::MAP& the_map, Dart primd)
{
DartMarker m(the_map);
// list of faces to process and processed(before pos iterator)
std::list<Dart> ld;
ld.push_back(primd);
// current position in list
typename std::list<Dart>::iterator pos = ld.begin();
do
{
Dart d = *pos;
// cut the face of first dart of list
Dart d1 = the_map.phi1(d);
Dart e = the_map.phi1(d1);
Dart e1 = the_map.phi1(e);
Dart f = the_map.phi1(e1);
if (f==d) // quad
{
the_map.splitFace(d,e);
// mark the face
m.markOrbit<FACE>(d);
m.markOrbit<FACE>(e);
}
else m.markOrbit<FACE>(d);
// and store neighbours faces in the list
d = the_map.phi2(d);
e = the_map.phi2(e);
d1 = the_map.phi1(the_map.phi2(d1));
e1 = the_map.phi1(the_map.phi2(e1));
if (!m.isMarked(d))
ld.push_back(d);
if (!m.isMarked(e))
ld.push_back(e);
if (!m.isMarked(d1))
ld.push_back(d1);
if ((f==d) && (!m.isMarked(e1)))
ld.push_back(e1);
pos++;
}while (pos!=ld.end()); // stop when no more face to process
}
} // namespace Modelisation
......
......@@ -60,9 +60,8 @@ private:
VertexAttribute<typename PFP::VEC3>& positionsTable ;
DartMarker& inactiveMarker ;
SelectorUnmarked dartSelect ;
Algo::Surface::Decimation::EdgeSelector<PFP>* m_selector ;
Algo::Surface::Decimation::Selector<PFP>* m_selector ;
std::vector<Algo::Surface::Decimation::ApproximatorGen<PFP>*> m_approximators ;
std::vector<Algo::Surface::Decimation::PredictorGen<PFP>*> m_predictors ;
std::vector<VSplit<PFP>*> m_splits ;
......@@ -85,6 +84,10 @@ public:
Algo::Surface::Decimation::SelectorType s, Algo::Surface::Decimation::ApproximatorType a,
VertexAttribute<typename PFP::VEC3>& position
) ;
ProgressiveMesh(
MAP& map, DartMarker& inactive,
Algo::Surface::Decimation::Selector<PFP>* selector, std::vector<Algo::Surface::Decimation::ApproximatorGen<PFP>*>& approximators,
VertexAttribute<typename PFP::VEC3>& position) ;
~ProgressiveMesh() ;
bool initOk() { return m_initOk ; }
......@@ -92,7 +95,7 @@ public:
void createPM(unsigned int percentWantedVertices) ;
std::vector<VSplit<PFP>*>& splits() { return m_splits ; }
Algo::Surface::Decimation::EdgeSelector<PFP>* selector() { return m_selector ; }
Algo::Surface::Decimation::Selector<PFP>* selector() { return m_selector ; }
std::vector<Algo::Surface::Decimation::ApproximatorGen<PFP>*>& approximators() { return m_approximators ; }
std::vector<Algo::Surface::Decimation::PredictorGen<PFP>*>& predictors() { return m_predictors ; }
......
......@@ -42,7 +42,7 @@ ProgressiveMesh<PFP>::ProgressiveMesh(
Algo::Surface::Decimation::SelectorType s, Algo::Surface::Decimation::ApproximatorType a,
VertexAttribute<typename PFP::VEC3>& position
) :
m_map(map), positionsTable(position), inactiveMarker(inactive), dartSelect(inactiveMarker)
m_map(map), positionsTable(position), inactiveMarker(inactive)
{
CGoGNout << " creating approximator and predictor.." << CGoGNflush ;
......@@ -83,22 +83,22 @@ ProgressiveMesh<PFP>::ProgressiveMesh(
switch(s)
{
case Algo::Surface::Decimation::S_MapOrder : {
m_selector = new Algo::Surface::Decimation::EdgeSelector_MapOrder<PFP>(m_map, positionsTable, m_approximators, dartSelect) ;
m_selector = new Algo::Surface::Decimation::EdgeSelector_MapOrder<PFP>(m_map, positionsTable, m_approximators) ;
break ; }
case Algo::Surface::Decimation::S_Random : {
m_selector = new Algo::Surface::Decimation::EdgeSelector_Random<PFP>(m_map, positionsTable, m_approximators, dartSelect) ;
m_selector = new Algo::Surface::Decimation::EdgeSelector_Random<PFP>(m_map, positionsTable, m_approximators) ;
break ; }
case Algo::Surface::Decimation::S_EdgeLength : {
m_selector = new Algo::Surface::Decimation::EdgeSelector_Length<PFP>(m_map, positionsTable, m_approximators, dartSelect) ;
m_selector = new Algo::Surface::Decimation::EdgeSelector_Length<PFP>(m_map, positionsTable, m_approximators) ;
break ; }
case Algo::Surface::Decimation::S_QEM : {
m_selector = new Algo::Surface::Decimation::EdgeSelector_QEM<PFP>(m_map, positionsTable, m_approximators, dartSelect) ;
m_selector = new Algo::Surface::Decimation::EdgeSelector_QEM<PFP>(m_map, positionsTable, m_approximators) ;
break ; }
case Algo::Surface::Decimation::S_MinDetail : {
m_selector = new Algo::Surface::Decimation::EdgeSelector_MinDetail<PFP>(m_map, positionsTable, m_approximators, dartSelect) ;
m_selector = new Algo::Surface::Decimation::EdgeSelector_MinDetail<PFP>(m_map, positionsTable, m_approximators) ;
break ; }
case Algo::Surface::Decimation::S_Curvature : {
m_selector = new Algo::Surface::Decimation::EdgeSelector_Curvature<PFP>(m_map, positionsTable, m_approximators, dartSelect) ;
m_selector = new Algo::Surface::Decimation::EdgeSelector_Curvature<PFP>(m_map, positionsTable, m_approximators) ;
break ; }
}
CGoGNout << "..done" << CGoGNendl ;
......@@ -131,6 +131,40 @@ ProgressiveMesh<PFP>::ProgressiveMesh(
quantizationApplied = false ;
}
template <typename PFP>
ProgressiveMesh<PFP>::ProgressiveMesh(
MAP& map, DartMarker& inactive,
Algo::Surface::Decimation::Selector<PFP>* selector, std::vector<Algo::Surface::Decimation::ApproximatorGen<PFP>*>& approximators,
VertexAttribute<typename PFP::VEC3>& position
) :
m_map(map), m_selector(selector), m_approximators(approximators), positionsTable(position), inactiveMarker(inactive)
{
CGoGNout << " initializing approximators.." << CGoGNflush ;
for(typename std::vector<Algo::Surface::Decimation::ApproximatorGen<PFP>*>::iterator it = m_approximators.begin(); it != m_approximators.end(); ++it)
{
if(! (*it)->init())
m_initOk = false ;
if((*it)->getApproximatedAttributeName() == "position")
m_positionApproximator = reinterpret_cast<Algo::Surface::Decimation::Approximator<PFP, VEC3, EDGE>*>(*it) ;
}
CGoGNout << "..done" << CGoGNendl ;
CGoGNout << " initializing predictors.." << CGoGNflush ;
for(typename std::vector<Algo::Surface::Decimation::PredictorGen<PFP>*>::iterator it = m_predictors.begin(); it != m_predictors.end(); ++it)
if(! (*it)->init())
m_initOk = false ;
CGoGNout << "..done" << CGoGNendl ;
CGoGNout << " initializing selector.." << CGoGNflush ;
m_initOk = m_selector->init() ;
CGoGNout << "..done" << CGoGNendl ;
m_detailAmount = REAL(1) ;
m_localFrameDetailVectors = false ;
quantizationInitialized = false ;
quantizationApplied = false ;
}
template <typename PFP>
ProgressiveMesh<PFP>::~ProgressiveMesh()
{
......
......@@ -131,9 +131,9 @@ void ColorPerFaceRender::updateVBO(Utils::VBO& vboPosition, Utils::VBO& vboNorma
bufferNormals.push_back(PFP::toVec3f(normals[d]));
bufferColors.push_back(PFP::toVec3f(colorPerXXX[d]));
buffer.push_back(PFP::toVec3f(positions[b]));
bufferNormals.push_back(PFP::toVec3f(normals[b]);
bufferNormals.push_back(PFP::toVec3f(normals[b]));
bufferColors.push_back(PFP::toVec3f(colorPerXXX[b]));
buffer.push_back(PFP::toVec3f(positions[c]);
buffer.push_back(PFP::toVec3f(positions[c]));
bufferNormals.push_back(PFP::toVec3f(normals[c]));
bufferColors.push_back(PFP::toVec3f(colorPerXXX[c]));
b = c;
......
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