mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
keep triangles facing outward
This commit is contained in:
parent
bb0f6b4d28
commit
3642e93b3f
1 changed files with 4 additions and 3 deletions
|
@ -51,13 +51,14 @@ bool writeOBJ(QString outFileName, QVector<QVector<VHACD::IVHACD::ConvexHull>>&
|
|||
out << "v ";
|
||||
out << formatFloat(hull.m_points[i*3]) << " ";
|
||||
// swap y and z because up is 3rd value in OBJ
|
||||
out << formatFloat(hull.m_points[i*3+2]) << "\n";
|
||||
out << formatFloat(hull.m_points[i*3+1]) << " ";
|
||||
out << formatFloat(hull.m_points[i*3+2]) << " ";
|
||||
out << formatFloat(hull.m_points[i*3+1]) << "\n";
|
||||
}
|
||||
for (unsigned int i = 0; i < hull.m_nTriangles; i++) {
|
||||
out << "f ";
|
||||
out << hull.m_triangles[i*3] + 1 + pointStartOffset << " ";
|
||||
// change order to flip normal (due to swapping y and z, above)
|
||||
out << hull.m_triangles[i*3+1] + 1 + pointStartOffset << " ";
|
||||
out << hull.m_triangles[i*3] + 1 + pointStartOffset << " ";
|
||||
out << hull.m_triangles[i*3+2] + 1 + pointStartOffset << "\n";
|
||||
}
|
||||
out << "\n";
|
||||
|
|
Loading…
Reference in a new issue