adjust to for loop

This commit is contained in:
David Back 2018-01-04 16:53:35 -08:00
parent 6b9658f8cf
commit 307867a91f

View file

@ -468,19 +468,19 @@ bool OBJReader::parseOBJGroup(OBJTokenizer& tokenizer, const QVariantHash& mappi
assert(parts.count() <= 3); assert(parts.count() <= 3);
// If indices are negative relative indices then adjust them to absolute indices based on current vector sizes // If indices are negative relative indices then adjust them to absolute indices based on current vector sizes
// Also add 1 to each index as 1 will be subtracted later on from each index in OBJFace::add // Also add 1 to each index as 1 will be subtracted later on from each index in OBJFace::add
int part0 = parts[0].toInt(); for (int i = 0; i < parts.count(); ++i) {
if (part0 < 0) { int part = parts[i].toInt();
parts[0].setNum(vertices.size() - abs(part0) + 1); if (part < 0) {
} switch (i) {
if (parts.count() > 1) { case 0:
int part1 = parts[1].toInt(); parts[i].setNum(vertices.size() - abs(part) + 1);
if (part1 < 0) { break;
parts[1].setNum(textureUVs.size() - abs(part1) + 1); case 1:
} parts[i].setNum(textureUVs.size() - abs(part) + 1);
if (parts.count() > 2) { break;
int part2 = parts[2].toInt(); case 2:
if (part2 < 0) { parts[i].setNum(normals.size() - abs(part) + 1);
parts[2].setNum(normals.size() - abs(part2) + 1); break;
} }
} }
} }