Commit 5de98145 by Philipp Adolf

Add new ibToTriangles

parent 163766c2
...@@ -208,6 +208,24 @@ Triangle::Edge::Name rotate_edge_name(Triangle::Edge::Name edge) { ...@@ -208,6 +208,24 @@ Triangle::Edge::Name rotate_edge_name(Triangle::Edge::Name edge) {
} }
} }
//Annahme: indices in sharpEdges in gleicher Reihenfolge wie im Indexbuffer
void ibToTriangles(const QVector<Vertex> *vb,
const QVector<unsigned int> &ib,
const QMap<Edge,unsigned int>& sharpEdges, QVector<Triangle> &triangles) {
for (int i = 0; i < ib.length(); i+=3) {
//sharpness
Edge uv = Edge(ib[i],ib[i+1]);
Edge vw = Edge(ib[i+1],ib[i+2]);
Edge wu = Edge(ib[i+2],ib[i]);
unsigned int shuv = sharpEdges.value(uv,0);
unsigned int shvw = sharpEdges.value(vw,0);
unsigned int shwu = sharpEdges.value(wu,0);
triangles.push_back(Triangle(vb, ib[i], ib[i+1], ib[i+2],shuv,shvw,shwu));
}
}
void Triangle::set_sharpness(Triangle::Edge::Name name, unsigned int value){ void Triangle::set_sharpness(Triangle::Edge::Name name, unsigned int value){
if (name == Edge::Name::uv){ if (name == Edge::Name::uv){
sharpness_uv = value; sharpness_uv = value;
......
...@@ -88,6 +88,7 @@ class Triangle { ...@@ -88,6 +88,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(const QVector<Vertex> *vb, const QVector<unsigned int> &ib, const QMap<Edge,unsigned int>& sharpEdges, QVector<Triangle> &triangles);
void regularIbToTriangles(const QVector<Vertex> *vb, const QVector<unsigned int> &ib, QVector<Triangle> &triangles); void regularIbToTriangles(const QVector<Vertex> *vb, const QVector<unsigned int> &ib, QVector<Triangle> &triangles);
void trianglesToIB(const QVector<Triangle> &triangles, QVector<unsigned int> &ib); void trianglesToIB(const QVector<Triangle> &triangles, QVector<unsigned int> &ib);
......
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