- fixed "if there is color both vertex/face colors are enabled even if there is just one of them" bug
This commit is contained in:
parent
8b90ba72a3
commit
20fa52181f
|
@ -111,7 +111,7 @@ static void WedgeTexFromVertexTex(ComputeMeshType &m)
|
||||||
{
|
{
|
||||||
(*fi).WT(i).U() = (*fi).V(i)->T().U();
|
(*fi).WT(i).U() = (*fi).V(i)->T().U();
|
||||||
(*fi).WT(i).V() = (*fi).V(i)->T().V();
|
(*fi).WT(i).V() = (*fi).V(i)->T().V();
|
||||||
//(*fi).WT(i).N() = 0;
|
(*fi).WT(i).N() = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,9 +53,11 @@ public:
|
||||||
typedef typename MESH_TYPE::ScalarType ScalarType;
|
typedef typename MESH_TYPE::ScalarType ScalarType;
|
||||||
|
|
||||||
// OFF codes
|
// OFF codes
|
||||||
enum OFFCodes {NoError=0, CantOpen, InvalidFile,
|
enum OFFCodes {
|
||||||
|
NoError = 0, CantOpen, InvalidFile,
|
||||||
InvalidFile_MissingOFF,
|
InvalidFile_MissingOFF,
|
||||||
UnsupportedFormat, ErrorNotTriangularFace,ErrorHighDimension,ErrorDegenerateFace};
|
UnsupportedFormat, ErrorNotTriangularFace, ErrorHighDimension, ErrorDegenerateFace
|
||||||
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Standard call for knowing the meaning of an error code
|
* Standard call for knowing the meaning of an error code
|
||||||
|
@ -166,11 +168,16 @@ public:
|
||||||
{ // the OFF string is in the header go on parsing it.
|
{ // the OFF string is in the header go on parsing it.
|
||||||
for (int u = static_cast<int>(header.rfind("OFF") - 1); u >= 0; u--)
|
for (int u = static_cast<int>(header.rfind("OFF") - 1); u >= 0; u--)
|
||||||
{
|
{
|
||||||
if (header[u] == 'C') isColorDefined = true;
|
if (header[u] == 'C')
|
||||||
else if (header[u] == 'N') isNormalDefined = true;
|
isColorDefined = true;
|
||||||
else if (u>0 && header[u-1] == 'S' && header[u] == 'T') isTexCoordDefined = true;
|
else if (header[u] == 'N')
|
||||||
else if (header[u] == '4') homogeneousComponents = true;
|
isNormalDefined = true;
|
||||||
else if (header[u] == 'n') return ErrorHighDimension;
|
else if (u > 0 && header[u - 1] == 'S' && header[u] == 'T')
|
||||||
|
isTexCoordDefined = true;
|
||||||
|
else if (header[u] == '4')
|
||||||
|
homogeneousComponents = true;
|
||||||
|
else if (header[u] == 'n')
|
||||||
|
return ErrorHighDimension;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else return InvalidFile_MissingOFF;
|
else return InvalidFile_MissingOFF;
|
||||||
|
@ -187,7 +194,7 @@ public:
|
||||||
|
|
||||||
if (isNormalDefined) loadmask |= Mask::IOM_VERTNORMAL;
|
if (isNormalDefined) loadmask |= Mask::IOM_VERTNORMAL;
|
||||||
if (isTexCoordDefined) loadmask |= Mask::IOM_VERTTEXCOORD;
|
if (isTexCoordDefined) loadmask |= Mask::IOM_VERTTEXCOORD;
|
||||||
if (isColorDefined) { loadmask |= Mask::IOM_VERTCOLOR;loadmask |= Mask::IOM_FACECOLOR;}
|
//if (isColorDefined) { loadmask |= Mask::IOM_VERTCOLOR;loadmask |= Mask::IOM_FACECOLOR;}
|
||||||
|
|
||||||
|
|
||||||
//if(onlyMaskFlag) return NoError;
|
//if(onlyMaskFlag) return NoError;
|
||||||
|
@ -521,17 +528,15 @@ public:
|
||||||
// (otherwise it is impossible to parse color information since
|
// (otherwise it is impossible to parse color information since
|
||||||
// color components can vary)
|
// color components can vary)
|
||||||
size_t color_elements = tokens.size() - vert_per_face - 1;
|
size_t color_elements = tokens.size() - vert_per_face - 1;
|
||||||
isColorDefined |= (color_elements>0);
|
//isColorDefined |= (color_elements>0);
|
||||||
if(isColorDefined) loadmask |= Mask::IOM_FACECOLOR;
|
//if(isColorDefined) loadmask |= Mask::IOM_FACECOLOR;
|
||||||
|
|
||||||
if( (color_elements>0) && tri::HasPerFaceColor(mesh) )
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
// set per-face color attribute
|
|
||||||
if (color_elements > 0)
|
if (color_elements > 0)
|
||||||
|
{
|
||||||
loadmask |= Mask::IOM_FACECOLOR;
|
loadmask |= Mask::IOM_FACECOLOR;
|
||||||
|
|
||||||
|
if (tri::HasPerFaceColor(mesh))
|
||||||
|
{
|
||||||
switch (color_elements)
|
switch (color_elements)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -593,6 +598,7 @@ public:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} //end switch
|
} //end switch
|
||||||
|
}
|
||||||
} // end if (isColorDefined)
|
} // end if (isColorDefined)
|
||||||
} // end of for f=...
|
} // end of for f=...
|
||||||
}
|
}
|
||||||
|
@ -630,8 +636,7 @@ protected:
|
||||||
tokens.push_back(line.substr(from, to - from).c_str());
|
tokens.push_back(line.substr(from, to - from).c_str());
|
||||||
from = to;
|
from = to;
|
||||||
}
|
}
|
||||||
}
|
} while (from < length);
|
||||||
while (from<length);
|
|
||||||
} // end Tokenize
|
} // end Tokenize
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
Loading…
Reference in New Issue