Commit 94cddb13 authored by Pierre Kraemer's avatar Pierre Kraemer

miniTest compile..

parent 498e5870
......@@ -627,8 +627,6 @@ int main(int argc, char** argv)
{
MyGlutWin* mgw = new MyGlutWin(&argc, argv, 1200, 800) ;
mgw->position = myMap.addAttribute<PFP::VEC3>(VERTEX_ORBIT, "position") ;
if(argc < 2)
{
Dart d1 = myMap.newFace(3) ;
......@@ -641,12 +639,13 @@ int main(int argc, char** argv)
char* filename = argv[1] ;
GLint t1 = glutGet(GLUT_ELAPSED_TIME) ;
bool success = Algo::Import::importMesh<PFP>(myMap, filename, mgw->position, Algo::Import::ImportSurfacique::UNKNOWNSURFACE) ;
if(!success)
std::vector<std::string> attrNames ;
if(!Algo::Import::importMesh<PFP>(myMap, filename, attrNames))
{
std::cerr << "could not import "<< filename << std::endl ;
return 1 ;
}
mgw->position = myMap.getAttribute<PFP::VEC3>(VERTEX_ORBIT, attrNames[0]) ;
GLint t2 = glutGet(GLUT_ELAPSED_TIME) ;
GLfloat seconds = (t2 - t1) / 1000.0f ;
std::cout << "import: " << seconds << " sec" << std::endl ;
......
......@@ -47,7 +47,7 @@ namespace Import
* @return a boolean indicating if import was successfull
*/
template <typename PFP>
bool importMesh(typename PFP::MAP& map, const std::string& filename, typename PFP::TVEC3& positions, ImportSurfacique::ImportType kind = ImportSurfacique::UNKNOWNSURFACE);
bool importMesh(typename PFP::MAP& map, const std::string& filename, std::vector<std::string>& attrNames, ImportSurfacique::ImportType kind = ImportSurfacique::UNKNOWNSURFACE);
template <typename PFP>
bool importPLYPTM(typename PFP::MAP& map, const std::string& filename, typename PFP::TVEC3& positions, ImportSurfacique::ImportType kind,
......@@ -57,7 +57,7 @@ bool importPLYPTM(typename PFP::MAP& map, const std::string& filename, typename
* import a volumic mesh
*/
template <typename PFP>
bool importMesh(typename PFP::MAP& map, const std::string& filename, typename PFP::TVEC3& positions, ImportVolumique::ImportType kind= ImportVolumique::UNKNOWNVOLUME);
bool importMesh(typename PFP::MAP& map, const std::string& filename, typename PFP::TVEC3& positions, ImportVolumique::ImportType kind = ImportVolumique::UNKNOWNVOLUME);
//template <typename PFP>
//bool importObjWithTex(typename PFP::MAP& map, const std::string& filename);
......
......@@ -63,11 +63,14 @@ template <typename PFP>
class MeshTablesSurface
{
protected:
typename PFP::MAP& m_map;
unsigned m_nbVertices;
unsigned m_nbFaces;
unsigned int m_lab;
/**
* number of edges per face
*/
......@@ -78,65 +81,49 @@ protected:
*/
std::vector<unsigned int> m_emb;
/**
* we need direct access to container itself to insert new lines while reading points
*/
AttribContainer& m_container;
/**
* table of positions
*/
typename PFP::TVEC3& m_positions;
static ImportSurfacique::ImportType getFileType(const std::string& filename);
void extractMeshRec(const struct aiScene* scene, const struct aiNode* nd, struct aiMatrix4x4* trafo);
void extractMeshRec(AttribContainer& container, AttributeHandler<typename PFP::VEC3>& positions, const struct aiScene* scene, const struct aiNode* nd, struct aiMatrix4x4* trafo);
public:
typedef typename PFP::VEC3 VEC3 ;
typedef typename VEC3::DATA_TYPE DATA_TYPE ;
inline unsigned getNbFaces() const { return m_nbFaces;}
inline unsigned getNbFaces() const { return m_nbFaces; }
inline unsigned getNbVertices() const { return m_nbVertices;}
inline unsigned getNbVertices() const { return m_nbVertices; }
inline short getNbEdgesFace(int i) const { return m_nbEdges[i];}
inline short getNbEdgesFace(int i) const { return m_nbEdges[i]; }
inline unsigned int getEmbIdx(int i) { return m_emb[i];}
inline unsigned int getEmbIdx(int i) { return m_emb[i]; }
bool importTrian(const std::string& filename);
bool importMesh(const std::string& filename, std::vector<std::string>& attrNames, ImportSurfacique::ImportType kind);
bool importTrianBinGz(const std::string& filename);
bool importTrian(const std::string& filename, std::vector<std::string>& attrNames);
bool importOff(const std::string& filename);
bool importTrianBinGz(const std::string& filename, std::vector<std::string>& attrNames);
bool importObj(const std::string& filename);
bool importOff(const std::string& filename, std::vector<std::string>& attrNames);
bool importPly(const std::string& filename);
bool importObj(const std::string& filename, std::vector<std::string>& attrNames);
bool importMesh(const std::string& filename, ImportSurfacique::ImportType kind);
bool importPly(const std::string& filename, std::vector<std::string>& attrNames);
bool importPlyPTM(const std::string& filename, typename PFP::TFRAME& Frame, typename PFP::TRGBFUNCS& RGBfunctions);
bool importPlyPTM(const std::string& filename, std::vector<std::string>& attrNames);
bool importCTM(const std::string& filename);
bool importCTM(const std::string& filename, std::vector<std::string>& attrNames);
bool importASSIMP(const std::string& filename);
bool importASSIMP(const std::string& filename, std::vector<std::string>& attrNames);
/**
* @param container container of vertex orbite
* @param idPositions id of position attribute in the container
* @param idLabels id of label attribute in the container
*/
MeshTablesSurface(AttribContainer& container, typename PFP::TVEC3& positions):
m_container(container), m_positions(positions)
MeshTablesSurface(typename PFP::MAP& map):
m_map(map)
{
}
MeshTablesSurface(AttribContainer& container, typename PFP::TVEC3& positions, const std::string& filename):
m_container(container), m_positions(positions)
{
importMesh(filename);
}
};
......
......@@ -428,13 +428,13 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv)
}
template <typename PFP>
bool importMesh(typename PFP::MAP& map, const std::string& filename, typename PFP::TVEC3& positions, ImportSurfacique::ImportType kind)
bool importMesh(typename PFP::MAP& map, const std::string& filename, std::vector<std::string>& attrNames, ImportSurfacique::ImportType kind)
{
AttribContainer& vertexContainer = map.getAttributeContainer(VERTEX_ORBIT);
// AttribContainer& vertexContainer = map.getAttributeContainer(VERTEX_ORBIT);
MeshTablesSurface<PFP> mts(vertexContainer, positions);
MeshTablesSurface<PFP> mts(map);
if(!mts.importMesh(filename, kind))
if(!mts.importMesh(filename, attrNames, kind))
return false;
return importMesh<PFP>(map, mts);
......
......@@ -246,7 +246,7 @@ public:
* @param strings (OUT) tableau des noms d'attributs
* @return le nombre d'attributs
*/
unsigned int getAttributesStrings(std::vector< std::string>& strings);
unsigned int getAttributesStrings(std::vector<std::string>& strings);
/**
* get the name of an attribute, given its index in the container
......
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