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:
parent
3808c3dbd4
commit
f9fbb89854
|
@ -47,6 +47,8 @@ public:
|
||||||
typedef typename SaveMeshType::VertexType VertexType;
|
typedef typename SaveMeshType::VertexType VertexType;
|
||||||
typedef typename SaveMeshType::ScalarType ScalarType;
|
typedef typename SaveMeshType::ScalarType ScalarType;
|
||||||
typedef typename SaveMeshType::CoordType CoordType;
|
typedef typename SaveMeshType::CoordType CoordType;
|
||||||
|
typedef typename SaveMeshType::FaceType::TexCoordType TexCoordType;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
enum of all the types of error
|
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()));
|
fprintf(fp,"# %d vertices, %d vertices normals\n\n",m.vn,int(NormalVertex.size()));
|
||||||
|
|
||||||
//faces + texture coords
|
//faces + texture coords
|
||||||
std::map<vcg::TexCoord2<ScalarType>,int> CoordIndexTexture;
|
std::map<TexCoordType,int> CoordIndexTexture;
|
||||||
unsigned int material_num = 0;
|
unsigned int material_num = 0;
|
||||||
int mem_index = 0; //var temporany
|
int mem_index = 0; //var temporany
|
||||||
int curTexCoordIndex = 1;
|
int curTexCoordIndex = 1;
|
||||||
|
@ -289,9 +291,9 @@ public:
|
||||||
/*
|
/*
|
||||||
returns index of the texture coord
|
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;
|
if(iter != mapTexToInt.end()) return (*iter).second;
|
||||||
else return -1;
|
else return -1;
|
||||||
// Old wrong version.
|
// Old wrong version.
|
||||||
|
@ -335,8 +337,9 @@ public:
|
||||||
adds a new index to the coordinate of Texture if it is the first time
|
adds a new index to the coordinate of Texture if it is the first time
|
||||||
which is otherwise met not execute anything
|
which is otherwise met not execute anything
|
||||||
*/
|
*/
|
||||||
inline static bool AddNewTextureCoord(std::map<typename vcg::TexCoord2<ScalarType>,int> &m,
|
template <class TexScalarType>
|
||||||
const typename vcg::TexCoord2<ScalarType> &wt,int value)
|
inline static bool AddNewTextureCoord(std::map<typename vcg::TexCoord2<TexScalarType>,int> &m,
|
||||||
|
const typename vcg::TexCoord2<TexScalarType> &wt,int value)
|
||||||
{
|
{
|
||||||
int index = m[wt];
|
int index = m[wt];
|
||||||
if(index==0){m[wt]=value;return true;}
|
if(index==0){m[wt]=value;return true;}
|
||||||
|
|
Loading…
Reference in New Issue