From f9fbb89854eb2c99fde4e7a696fa22c2191b2b4f Mon Sep 17 00:00:00 2001 From: cignoni Date: Wed, 18 Jun 2014 10:51:46 +0000 Subject: [PATCH] Small changes in the long long way to making meshlab and the vcglib really float/double independent TexCoordScalarType can be different from the mesh scalar type --- wrap/io_trimesh/export_obj.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/wrap/io_trimesh/export_obj.h b/wrap/io_trimesh/export_obj.h index 6ddb8ff7..3c44c537 100644 --- a/wrap/io_trimesh/export_obj.h +++ b/wrap/io_trimesh/export_obj.h @@ -47,6 +47,8 @@ public: typedef typename SaveMeshType::VertexType VertexType; typedef typename SaveMeshType::ScalarType ScalarType; typedef typename SaveMeshType::CoordType CoordType; + typedef typename SaveMeshType::FaceType::TexCoordType TexCoordType; + /* enum of all the types of error */ @@ -195,7 +197,7 @@ public: fprintf(fp,"# %d vertices, %d vertices normals\n\n",m.vn,int(NormalVertex.size())); //faces + texture coords - std::map,int> CoordIndexTexture; + std::map CoordIndexTexture; unsigned int material_num = 0; int mem_index = 0; //var temporany int curTexCoordIndex = 1; @@ -289,9 +291,9 @@ public: /* returns index of the texture coord */ - inline static int GetIndexVertexTexture(typename std::map,int> &mapTexToInt, const vcg::TexCoord2 &wt) + inline static int GetIndexVertexTexture(typename std::map &mapTexToInt, const TexCoordType &wt) { - typename std::map,int>::iterator iter= mapTexToInt.find(wt); + typename std::map::iterator iter= mapTexToInt.find(wt); if(iter != mapTexToInt.end()) return (*iter).second; else return -1; // Old wrong version. @@ -335,8 +337,9 @@ public: adds a new index to the coordinate of Texture if it is the first time which is otherwise met not execute anything */ - inline static bool AddNewTextureCoord(std::map,int> &m, - const typename vcg::TexCoord2 &wt,int value) + template + inline static bool AddNewTextureCoord(std::map,int> &m, + const typename vcg::TexCoord2 &wt,int value) { int index = m[wt]; if(index==0){m[wt]=value;return true;}