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
This commit is contained in:
Paolo Cignoni 2014-06-18 10:51:46 +00:00
parent 3808c3dbd4
commit f9fbb89854
1 changed files with 8 additions and 5 deletions

View File

@ -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<vcg::TexCoord2<ScalarType>,int> CoordIndexTexture;
std::map<TexCoordType,int> 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<TexCoord2<ScalarType>,int> &mapTexToInt, const vcg::TexCoord2<ScalarType> &wt)
inline static int GetIndexVertexTexture(typename std::map<TexCoordType,int> &mapTexToInt, const TexCoordType &wt)
{
typename std::map<vcg::TexCoord2<ScalarType>,int>::iterator iter= mapTexToInt.find(wt);
typename std::map<TexCoordType,int>::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<typename vcg::TexCoord2<ScalarType>,int> &m,
const typename vcg::TexCoord2<ScalarType> &wt,int value)
template <class TexScalarType>
inline static bool AddNewTextureCoord(std::map<typename vcg::TexCoord2<TexScalarType>,int> &m,
const typename vcg::TexCoord2<TexScalarType> &wt,int value)
{
int index = m[wt];
if(index==0){m[wt]=value;return true;}