Commit 5eb26b35 by Kai Westerkamp

debug test

parent c6c99b52
...@@ -69,7 +69,7 @@ void Subdivision::subdivide(Mesh *mesh, int level) { ...@@ -69,7 +69,7 @@ void Subdivision::subdivide(Mesh *mesh, int level) {
input.index_regular_buffer = getTriangles(entry->indices_regular); input.index_regular_buffer = getTriangles(entry->indices_regular);
if (input.index_irregular_buffer.isEmpty()) { if (input.index_irregular_buffer.isEmpty()) {
// current_mesh->update(input.vb_handle, input.vertex_buffer, input.index_buffer, entry->indices_regular); // current_mesh->update(input.vb_handle, input.vertex_buffer, input.index_buffer, entry->indices_regular);
} else { } else {
Tables tables = precomputeTables(input); Tables tables = precomputeTables(input);
Result result = runShader(input, tables); Result result = runShader(input, tables);
...@@ -93,18 +93,18 @@ void insert_edge(QMap<Triangle, QVector<Triangle::Edge>> &opposite_edges, const ...@@ -93,18 +93,18 @@ void insert_edge(QMap<Triangle, QVector<Triangle::Edge>> &opposite_edges, const
QVector<Triangle::Edge> edges = opposite_edges.value(triangle, QVector<Triangle::Edge>()); QVector<Triangle::Edge> edges = opposite_edges.value(triangle, QVector<Triangle::Edge>());
edges.resize(3); edges.resize(3);
switch (edge_a.name) { switch (edge_a.name) {
case Triangle::Edge::Name::uv: case Triangle::Edge::Name::uv:
edges[0] = edge_b; edges[0] = edge_b;
break; break;
case Triangle::Edge::Name::vw: case Triangle::Edge::Name::vw:
edges[1] = edge_b; edges[1] = edge_b;
break; break;
case Triangle::Edge::Name::wu: case Triangle::Edge::Name::wu:
edges[2] = edge_b; edges[2] = edge_b;
break; break;
default: default:
qCWarning(log_subdiv) << "got" << edge_a.name << "as edge!"; qCWarning(log_subdiv) << "got" << edge_a.name << "as edge!";
break; break;
} }
opposite_edges.insert(triangle, edges); opposite_edges.insert(triangle, edges);
} }
...@@ -139,10 +139,10 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) { ...@@ -139,10 +139,10 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) {
Tables tables; Tables tables;
QVector<unsigned int> ib = input.index_irregular_buffer; QVector<unsigned int> ib = input.index_irregular_buffer;
qCDebug(log_subdiv_trace) << "Index Buffer Irregular: " << ib; qCDebug(log_subdiv_trace) << "Index Buffer Irregular: " << ib;
QVector<unsigned int> ib_regular = input.index_regular_buffer; QVector<unsigned int> ib_regular = input.index_regular_buffer;
qCDebug(log_subdiv_trace) << "Index Buffer Regular: " << ib_regular; qCDebug(log_subdiv_trace) << "Index Buffer Regular: " << ib_regular;
QVector<Vertex> vb = input.vertex_buffer; QVector<Vertex> vb = input.vertex_buffer;
qCDebug(log_subdiv_trace) << "Vertex Buffer: " << vb; qCDebug(log_subdiv_trace) << "Vertex Buffer: " << vb;
...@@ -431,19 +431,21 @@ QVector<unsigned int> Subdivision::getPatchIndexBuffer(QVector<unsigned int> ib_ ...@@ -431,19 +431,21 @@ QVector<unsigned int> Subdivision::getPatchIndexBuffer(QVector<unsigned int> ib_
int count3 = 0; //counts other triangles with this vertex int count3 = 0; //counts other triangles with this vertex
int count6 = 0; int count6 = 0;
int count7 = 0; int count7 = 0;
/*
for (int j = 0; j < ib_combined.length(); j++){ if(log_subdiv_trace().isDebugEnabled()){
if (j != i && j != i+1 && j != i+2){ for (int j = 0; j < ib_combined.length(); j++){
//for debugging // checking if patch is regular. if (j != i && j != i+1 && j != i+2){
if (vb[ib_combined[j]] == v3) count3++; //for debugging // checking if patch is regular.
if (vb[ib_combined[j]] == v6) count6++; if (vb[ib_combined[j]] == v3) count3++;
if (vb[ib_combined[j]] == v7) count7++; if (vb[ib_combined[j]] == v6) count6++;
if (vb[ib_combined[j]] == v7) count7++;
}
}
if (count3 != 5 || count6 != 5 || count7 != 5){
qCWarning(log_subdiv) << "Counts wrong! 3: "<< count3 <<", 6: " << count6 << ", 7: " << count7 << ".\nEither this patch is not regular, or you didn't pass all neighboring triangles.";
} }
} }
if (count3 != 5 || count6 != 5 || count7 != 5){
qCWarning(log_subdiv) << "Counts wrong! 3: "<< count3 <<", 6: " << count6 << ", 7: " << count7 << ".\nEither this patch is not regular, or you didn't pass all neighboring triangles.";
}
*/
//find triangles with shared edge. Fills i2, i4, i10. //find triangles with shared edge. Fills i2, i4, i10.
{ {
...@@ -531,7 +533,7 @@ QVector<unsigned int> Subdivision::getPatchIndexBuffer(QVector<unsigned int> ib_ ...@@ -531,7 +533,7 @@ QVector<unsigned int> Subdivision::getPatchIndexBuffer(QVector<unsigned int> ib_
pib.push_back(i9); pib.push_back(i9);
pib.push_back(i10); pib.push_back(i10);
pib.push_back(i11); pib.push_back(i11);
} }
} }
qCDebug(log_timing)<<"PatchIndexBuffer done:"<<totalTimer.elapsed()<<"ms"; qCDebug(log_timing)<<"PatchIndexBuffer done:"<<totalTimer.elapsed()<<"ms";
......
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