Commit 197f85be by Philipp Adolf

Rename nib_offset to edge_index

parent d117e237
......@@ -146,7 +146,8 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) {
// for each triangle the edges of the neighbor triangles are stored.
// First the edge shared with the triangles uv edge, then vw and wu.
QMap<Triangle, QVector<Triangle::Edge>> opposite_edges;
unsigned int nib_offset = vb.length();//offset in new index buffer for edge vertices
unsigned int edge_index = vb.length();//offset in new index buffer for edge vertices
for (int i = 0; i < triangles.length(); i++){
//schaue alle dreiecke an
Triangle triangle = triangles[i];
......@@ -170,6 +171,14 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) {
}
QVector<Triangle::Edge> opposite = opposite_edges.value(triangle);
// indices of the three vertices added to the edges of this triangle
unsigned int uv, vw, wu;
uv = edge_index++;
vw = edge_index++;
wu = edge_index++;
tables.edge_indices.push_back(triangle.u_idx());
tables.edge_indices.push_back(triangle.v_idx());
tables.edge_indices.push_back(triangle.w_idx());
......@@ -187,22 +196,20 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) {
//add indices to new index buffer
tables.index_buffer.push_back(triangle.u_idx());
tables.index_buffer.push_back(nib_offset);
tables.index_buffer.push_back(nib_offset + 2);
tables.index_buffer.push_back(uv);
tables.index_buffer.push_back(wu);
tables.index_buffer.push_back(triangle.v_idx());
tables.index_buffer.push_back(nib_offset + 1);
tables.index_buffer.push_back(nib_offset);
tables.index_buffer.push_back(vw);
tables.index_buffer.push_back(uv);
tables.index_buffer.push_back(triangle.w_idx());
tables.index_buffer.push_back(nib_offset + 2);
tables.index_buffer.push_back(nib_offset + 1);
tables.index_buffer.push_back(nib_offset);
tables.index_buffer.push_back(nib_offset + 1);
tables.index_buffer.push_back(nib_offset + 2);
tables.index_buffer.push_back(wu);
tables.index_buffer.push_back(vw);
nib_offset += 3;
tables.index_buffer.push_back(uv);
tables.index_buffer.push_back(vw);
tables.index_buffer.push_back(wu);
}
qDebug()<<"Done with edge table. "<<tables.edge_indices.length();
......
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