Commit e9112574 authored by Pierre Kraemer's avatar Pierre Kraemer

Merge cgogn:~thery/CGoGN

Conflicts:
	include/Algo/Export/export.h
	include/Algo/Export/export.hpp
parents 2a15a591 64d1573c
......@@ -63,15 +63,6 @@ bool exportOFF(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons
template <typename PFP>
bool exportTrian(typename PFP::MAP& map, const typename PFP::TVEC3& position, char* filename, const FunctorSelect& good = allDarts) ;
/**
* export the map into a Trian file
* @param the_map map to be exported
* @param filename filename of ply file
* @return true
*/
template <typename PFP>
bool exportCTM(typename PFP::MAP& map, const typename PFP::TVEC3& position, const std::string& filename, const FunctorSelect& good = allDarts) ;
/**
* export the map into a PLYPTMgeneric file (K. Vanhoey generic format).
*
......
......@@ -179,63 +179,6 @@ bool exportOFF(typename PFP::MAP& map, const typename PFP::TVEC3& position, cons
return true ;
}
template <typename PFP>
bool exportCTM(typename PFP::MAP& map, const typename PFP::TVEC3& position, const std::string& filename, const FunctorSelect& good)
{
typedef typename PFP::MAP MAP;
typedef typename PFP::VEC3 VEC3;
AutoAttributeHandler<unsigned int> tableVertLab(map, VERTEX);
unsigned int nbDarts = map.getNbDarts() ;
std::vector<CTMfloat> verticesBuffer;
std::vector<CTMuint> indicesBuffer;
verticesBuffer.reserve(nbDarts/5); // TODO non optimal reservation
indicesBuffer.reserve(nbDarts/3);
CellMarker markV(map, VERTEX);
TraversorF<MAP> t(map, good) ;
unsigned int lab = 0;
for(Dart d = t.begin(); d != t.end(); d = t.next())
{
Traversor2FV<typename PFP::MAP> tfv(map, d) ;
for(Dart it = tfv.begin(); it != tfv.end(); it = tfv.next())
{
if (!markV.isMarked(it))
{
markV.mark(it);
tableVertLab[it] = lab++;
const VEC3& vert = position[it];
verticesBuffer.push_back(vert[0]);
verticesBuffer.push_back(vert[1]);
verticesBuffer.push_back(vert[2]);
}
indicesBuffer.push_back(tableVertLab[it]);
}
}
// Save the file using the OpenCTM API
CTMexporter ctm;
// Define mesh
ctm.DefineMesh(&(verticesBuffer[0]) , verticesBuffer.size()/3,
&(indicesBuffer[0]) , indicesBuffer.size()/3, NULL);
ctm.VertexPrecisionRel(0.0001f);
// Set compression method and level
ctm.CompressionMethod(CTM_METHOD_MG2);
ctm.CompressionLevel(9);
// Export file
ctm.Save(filename.c_str());
return true ;
}
template <typename PFP>
bool exportPlyPTMgeneric(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& position, const FunctorSelect& good)
{
......
......@@ -52,7 +52,7 @@ namespace Import
namespace ImportSurfacique
{
enum ImportType { UNKNOWNSURFACE, TRIAN, TRIANBGZ, PLY, PLYPTM, PLYPTMgeneric, OFF, OBJ, CTM, VRML, AHEM };
enum ImportType { UNKNOWNSURFACE, TRIAN, TRIANBGZ, PLY, PLYPTM, PLYPTMgeneric, OFF, OBJ, VRML, AHEM };
}
namespace ImportVolumique
......
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