Fixed bug where hex digit in Face is assigned as a material

This commit is contained in:
2017-05-06 15:25:47 -07:00
parent 98c2ec2a20
commit 111cdc6339

View File

@ -125,27 +125,25 @@ vector<struct TFace> parse_face(ifstream &f) {
// then it qualifies as an illegal line.
} else if (4 < i && i < 8) {
x.m_Indices.push_back(stoi(fdata));
} else if (i == 8) {
// field #8 may either be the unidentified hex digit
// i.e there are 3 indices only,
// or it could be another index.
if (fdata.length() > 1 && SECONDCH(fdata) == 'x') {
} else if (8 <= i) {
if (!hex && fdata.length() > 1) {
if (SECONDCH(fdata) == 'x') {
// this is the unidentified hex digit.
// just it signify the texture at the end.
hex = true;
} else {
x.m_Indices.push_back(stoi(fdata));
}
} else if ((i == 9 && hex) || i == 10) {
// it is a texture if it is field #9
// and the hex digit is already encountered
// or it is field #10.
} else if (!hex) {
x.m_Indices.push_back(stoi(fdata));
} else if (hex) {
x.m_Material = fdata;
} else {
;
}
}
i++;
} // end, per field iteration
output.push_back(x);
}
} // end else case, if line did not contain other keywords
pos = f.tellg();
} // end, per line iteration
// the odd case when the map file ends with a face indent.