Commit 36f9cdb3 by Philipp Adolf

Add trianglesToIB

parent 0fb2b6dd
...@@ -192,6 +192,17 @@ void ibToTriangles(QVector<Vertex> *vb, QVector<unsigned int> &ib, QVector<Trian ...@@ -192,6 +192,17 @@ void ibToTriangles(QVector<Vertex> *vb, QVector<unsigned int> &ib, QVector<Trian
} }
} }
void trianglesToIB(const QVector<Triangle> &triangles, QVector<unsigned int> &ib) {
ib.reserve(ib.length() + triangles.length() * 3);
QVectorIterator<Triangle> it(triangles);
while (it.hasNext()) {
Triangle triangle = it.next();
ib.push_back(triangle.u_idx());
ib.push_back(triangle.v_idx());
ib.push_back(triangle.w_idx());
}
}
Triangle::Neighbor Triangle::Neighbors::get_neighbor(Triangle::Edge::Name name) const { Triangle::Neighbor Triangle::Neighbors::get_neighbor(Triangle::Edge::Name name) const {
switch (name) { switch (name) {
case Triangle::Edge::Name::uv: case Triangle::Edge::Name::uv:
......
...@@ -73,6 +73,7 @@ class Triangle { ...@@ -73,6 +73,7 @@ class Triangle {
Triangle::Edge::Name rotate_edge_name(Triangle::Edge::Name edge); Triangle::Edge::Name rotate_edge_name(Triangle::Edge::Name edge);
void ibToTriangles(QVector<Vertex> *vb, QVector<unsigned int> &ib, QVector<Triangle> &triangles); void ibToTriangles(QVector<Vertex> *vb, QVector<unsigned int> &ib, QVector<Triangle> &triangles);
void trianglesToIB(const QVector<Triangle> &triangles, QVector<unsigned int> &ib);
QDebug operator<<(QDebug d, const Triangle &triangle); QDebug operator<<(QDebug d, const Triangle &triangle);
......
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