Commit 87d5c28e by Philipp Adolf

Add method for turning patches into triangles

parent 72a399a4
......@@ -489,6 +489,19 @@ QVector<unsigned int> Subdivision::getPatchIndexBuffer(QVector<unsigned int> ib)
}
/**
* Turns a patch index buffer into an index buffer of triangles.
*/
QVector<unsigned int> Subdivision::getTriangles(QVector<unsigned int> ib) {
QVector<unsigned int> new_ib;
for (int i = 0; i < ib.length(); i += 12) {
new_ib.push_back(ib[i+3]);
new_ib.push_back(ib[i+6]);
new_ib.push_back(ib[i+7]);
}
return new_ib;
}
/**
* Generates index buffers containing all regular and all irregular triangles in the input index buffer.
*
* @param index_buffer Index buffer describing triangles.
......
......@@ -62,6 +62,7 @@ private:
//Geht davon aus, dass jeder 3D-Punkt nur einmal im Vertex-Buffer vorkommt!
QVector<unsigned int> getPatchIndexBuffer(QVector<unsigned int> ib);
QVector<unsigned int> getTriangles(QVector<unsigned int> ib);
/**
* @brief matchAndCompleteTriangle if tx ty matches sxsy, sysz or szsy, fill tz with third source vertex index.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment