1) fixed token parsing : SplitToken() should take the original IO mask and not the clamped (with mesh attributes) one.
2) some indentation work.
This commit is contained in:
parent
302a7725fa
commit
8e9062b12b
|
@ -282,6 +282,7 @@ static int Open( OpenMeshType &m, const char * filename, Info &oi)
|
||||||
if (oi.mask == -1)
|
if (oi.mask == -1)
|
||||||
LoadMask(filename, oi);
|
LoadMask(filename, oi);
|
||||||
|
|
||||||
|
const int inputMask = oi.mask;
|
||||||
Mask::ClampMask<OpenMeshType>(m,oi.mask);
|
Mask::ClampMask<OpenMeshType>(m,oi.mask);
|
||||||
|
|
||||||
if (oi.numVertices == 0)
|
if (oi.numVertices == 0)
|
||||||
|
@ -395,7 +396,7 @@ static int Open( OpenMeshType &m, const char * filename, Info &oi)
|
||||||
std::string texcoord;
|
std::string texcoord;
|
||||||
std::string normal;
|
std::string normal;
|
||||||
for(int i=0;i<vertexesPerFace;++i) // remember index starts from 1 instead of 0
|
for(int i=0;i<vertexesPerFace;++i) // remember index starts from 1 instead of 0
|
||||||
SplitToken(tokens[i+1], ff.v[i], ff.n[i], ff.t[i], oi.mask);
|
SplitToken(tokens[i+1], ff.v[i], ff.n[i], ff.t[i], inputMask);
|
||||||
|
|
||||||
if ( oi.mask & vcg::tri::io::Mask::IOM_WEDGTEXCOORD )
|
if ( oi.mask & vcg::tri::io::Mask::IOM_WEDGTEXCOORD )
|
||||||
{
|
{
|
||||||
|
@ -453,7 +454,7 @@ static int Open( OpenMeshType &m, const char * filename, Info &oi)
|
||||||
std::string normal;
|
std::string normal;
|
||||||
for(int i=0;i<3;++i)
|
for(int i=0;i<3;++i)
|
||||||
{ // remember index starts from 1 instead of 0
|
{ // remember index starts from 1 instead of 0
|
||||||
SplitToken(tokens[i+1], ff.v[i], ff.n[i], ff.t[i], oi.mask);
|
SplitToken(tokens[i+1], ff.v[i], ff.n[i], ff.t[i], inputMask);
|
||||||
if(QuadFlag) { ff.v[i]+=1; }
|
if(QuadFlag) { ff.v[i]+=1; }
|
||||||
}
|
}
|
||||||
if ( oi.mask & vcg::tri::io::Mask::IOM_WEDGTEXCOORD )
|
if ( oi.mask & vcg::tri::io::Mask::IOM_WEDGTEXCOORD )
|
||||||
|
@ -481,7 +482,8 @@ static int Open( OpenMeshType &m, const char * filename, Info &oi)
|
||||||
// verifying validity of vertex normal indices
|
// verifying validity of vertex normal indices
|
||||||
// -------------------------------------------
|
// -------------------------------------------
|
||||||
for(int i=0;i<3;i++)
|
for(int i=0;i<3;i++)
|
||||||
if(!GoodObjIndex(ff.n[i],numVNormals)) return E_BAD_VERT_NORMAL_INDEX;
|
if(!GoodObjIndex(ff.n[i],numVNormals))
|
||||||
|
return E_BAD_VERT_NORMAL_INDEX;
|
||||||
}
|
}
|
||||||
|
|
||||||
// assigning face color
|
// assigning face color
|
||||||
|
@ -522,7 +524,7 @@ static int Open( OpenMeshType &m, const char * filename, Info &oi)
|
||||||
int vt4_index;
|
int vt4_index;
|
||||||
int vn4_index;
|
int vn4_index;
|
||||||
|
|
||||||
SplitToken(tokens[++iVertex], v4_index, vn4_index, vt4_index, oi.mask);
|
SplitToken(tokens[++iVertex], v4_index, vn4_index, vt4_index, inputMask);
|
||||||
if(QuadFlag) { v4_index+=1; }
|
if(QuadFlag) { v4_index+=1; }
|
||||||
if(!GoodObjIndex(v4_index, numVertices))
|
if(!GoodObjIndex(v4_index, numVertices))
|
||||||
return E_BAD_VERT_INDEX;
|
return E_BAD_VERT_INDEX;
|
||||||
|
@ -720,6 +722,7 @@ inline static const void SplitToken(std::string token, int &vId, int &nId, int &
|
||||||
std::string vertex;
|
std::string vertex;
|
||||||
std::string texcoord;
|
std::string texcoord;
|
||||||
std::string normal;
|
std::string normal;
|
||||||
|
|
||||||
if( ( mask & Mask::IOM_WEDGTEXCOORD ) && (mask & Mask::IOM_WEDGNORMAL) ) SplitVVTVNToken(token, vertex, texcoord, normal);
|
if( ( mask & Mask::IOM_WEDGTEXCOORD ) && (mask & Mask::IOM_WEDGNORMAL) ) SplitVVTVNToken(token, vertex, texcoord, normal);
|
||||||
if(!( mask & Mask::IOM_WEDGTEXCOORD ) && (mask & Mask::IOM_WEDGNORMAL) ) SplitVVNToken(token, vertex, normal);
|
if(!( mask & Mask::IOM_WEDGTEXCOORD ) && (mask & Mask::IOM_WEDGNORMAL) ) SplitVVNToken(token, vertex, normal);
|
||||||
if( ( mask & Mask::IOM_WEDGTEXCOORD ) &&!(mask & Mask::IOM_WEDGNORMAL) ) SplitVVTToken(token, vertex, texcoord);
|
if( ( mask & Mask::IOM_WEDGTEXCOORD ) &&!(mask & Mask::IOM_WEDGNORMAL) ) SplitVVTToken(token, vertex, texcoord);
|
||||||
|
|
Loading…
Reference in New Issue