Commit 9fe1af47 by Philipp Adolf

temp

parent 1e95e175
......@@ -145,7 +145,7 @@ void MainWidget::initializeGL(){
subdivision->init();
//loadNewMesh( "../Models/demon_head.3ds");
loadNewMesh( "../Models/torus.obj");
loadNewMesh( "../Models/box.obj");
}
void MainWidget::loadNewMesh(){
......
......@@ -550,11 +550,14 @@ void Subdivision::precomputeEdgeTable(Subdivision::Tables &tables, QVector<Trian
extra_it.next();
Triangle triangle = extra_it.key();
qDebug() << triangle;
unsigned int uv, vw, wu;
int uv = -1;
int vw = -1;
int wu = -1;
Edge edge;
Triangle::Neighbors ns = neighbors.value(triangle);
if (ns.uv.triangle != NULL) {
edge = { triangle.u_idx(), triangle.v_idx() };
if (edge_indices.contains(edge)) {
uv = edge_indices.value(edge);
......@@ -570,7 +573,9 @@ void Subdivision::precomputeEdgeTable(Subdivision::Tables &tables, QVector<Trian
tables.edge_indices.push_back(triangle.w_idx());
tables.edge_indices.push_back(ns.uv.edge.c);
}
}
if (ns.vw.triangle != NULL) {
edge = { triangle.v_idx(), triangle.w_idx() };
if (edge_indices.contains(edge)) {
vw = edge_indices.value(edge);
......@@ -586,7 +591,9 @@ void Subdivision::precomputeEdgeTable(Subdivision::Tables &tables, QVector<Trian
tables.edge_indices.push_back(triangle.u_idx());
tables.edge_indices.push_back(ns.vw.edge.c);
}
}
if (ns.wu.triangle != NULL) {
edge = { triangle.w_idx(), triangle.u_idx() };
if (edge_indices.contains(edge)) {
wu = edge_indices.value(edge);
......@@ -602,23 +609,32 @@ void Subdivision::precomputeEdgeTable(Subdivision::Tables &tables, QVector<Trian
tables.edge_indices.push_back(triangle.v_idx());
tables.edge_indices.push_back(ns.wu.edge.c);
}
}
if (uv >= 0 && wu >= 0) {
tables.extra_triangles.push_back(triangle.u_idx());
tables.extra_triangles.push_back(uv);
tables.extra_triangles.push_back(wu);
}
if (vw >= 0 && uv >= 0) {
tables.extra_triangles.push_back(triangle.v_idx());
tables.extra_triangles.push_back(vw);
tables.extra_triangles.push_back(uv);
}
if (wu >= 0 && vw >= 0) {
tables.extra_triangles.push_back(triangle.w_idx());
tables.extra_triangles.push_back(wu);
tables.extra_triangles.push_back(vw);
}
if (uv >= 0 && vw >= 0 && wu >= 0) {
tables.extra_triangles.push_back(uv);
tables.extra_triangles.push_back(vw);
tables.extra_triangles.push_back(wu);
}
}
qCDebug(log_subdiv) << "Done with edge table. " << tables.edge_indices.length();
if (log_subdiv_trace().isDebugEnabled()) {
......
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