Commit 59566e61 by Philipp Adolf

Add subdiv logging category

parent 9d5ca018
#include <memory>
#include "logcategories.h"
#include "subdivision.h"
#include "triangle.h"
......@@ -34,15 +35,15 @@ QOpenGLShaderProgram *Subdivision::initComputeShaderProgram(QString &source){
exit(5);
}
qDebug() << "Adding compute shader ...";
qCDebug(log_subdiv) << "Adding compute shader ...";
QOpenGLShaderProgram *shader = new QOpenGLShaderProgram();
shader->addShader(computeShader);
qDebug() << "Linking compute shader ...";
qCDebug(log_subdiv) << "Linking compute shader ...";
if(!shader->link()){
qCritical() << "Linking compute shader failed:" << shader->log();
exit(5);
}
qDebug() << "Linking compute shader done";
qCDebug(log_subdiv) << "Linking compute shader done";
return shader;
}
......@@ -82,12 +83,12 @@ void Subdivision::subdivide(Mesh *mesh, int level) {
QVector<unsigned int> irregular;
findRegular(tables.index_buffer, result.vertex_buffer, regular, irregular);
qDebug() << "Indices" << tables.index_buffer.length();
qDebug() << "regular" << regular.length();
qDebug() << "irregular" << irregular.length();
qCDebug(log_subdiv) << "Indices" << tables.index_buffer.length();
qCDebug(log_subdiv) << "regular" << regular.length();
qCDebug(log_subdiv) << "irregular" << irregular.length();
QVector<unsigned int> patches = getPatchIndexBuffer(regular);
qDebug() << "patches" << patches.length();
qCDebug(log_subdiv) << "patches" << patches.length();
current_mesh->update(result.vb_handle, result.vertex_buffer, irregular, patches);
}
......@@ -144,11 +145,11 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) {
QVector<unsigned int> ib = input.index_buffer;
if(debugOutput)
qDebug() << "Index Buffer: " << ib;
qCDebug(log_subdiv) << "Index Buffer: " << ib;
QVector<Vertex> vb = input.vertex_buffer;
if(debugOutput)
qDebug() << "Vertex Buffer: " << vb;
qCDebug(log_subdiv) << "Vertex Buffer: " << vb;
QVector<Triangle> triangles;
for (int i = 0; i < ib.length(); i+=3) {
......@@ -261,12 +262,12 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) {
tables.index_buffer.push_back(wu);
}
qDebug() << "Done with edge table. " << tables.edge_indices.length();
qCDebug(log_subdiv) << "Done with edge table. " << tables.edge_indices.length();
if (debugOutput){
qDebug() << "Eedges found. Table: " << tables.edge_indices;
qDebug() << "Table (long version):";
qCDebug(log_subdiv) << "Eedges found. Table: " << tables.edge_indices;
qCDebug(log_subdiv) << "Table (long version):";
for (int i = 0; i < tables.edge_indices.length(); i++){
qDebug() << "blub:" << tables.edge_indices[i];
qCDebug(log_subdiv) << "blub:" << tables.edge_indices[i];
}
}
......@@ -334,11 +335,11 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) {
tables.vertex_offsets.push_back(offset);
qDebug() << "Done with vertex index table. ";
qCDebug(log_subdiv) << "Done with vertex index table. ";
if(debugOutput){
qDebug() << "Duplicates: ";
qCDebug(log_subdiv) << "Duplicates: ";
for (int i = 0; i < duplicates.length(); i++){
qDebug() << duplicates[i];
qCDebug(log_subdiv) << duplicates[i];
}
}
tables.index_regular = getPatchIndexBuffer(ib);
......@@ -367,8 +368,8 @@ void Subdivision::splitRegular(Mesh *mesh) {
current_mesh->buffers[0]->indices_irregular = irregular;
current_mesh->buffers[0]->updateIndices();
qDebug() << "regular: " << regular.length();
qDebug() << "irregular: " << irregular.length();
qCDebug(log_subdiv) << "regular: " << regular.length();
qCDebug(log_subdiv) << "irregular: " << irregular.length();
}
/**
......@@ -592,18 +593,18 @@ Subdivision::Result Subdivision::runShader(Input input, Tables &tables) {
ptr = (Vertex *) f->glMapBuffer(GL_SHADER_STORAGE_BUFFER, GL_WRITE_ONLY);
if(debugOutput)
qDebug() << "New vertices:";
qCDebug(log_subdiv) << "New vertices:";
for (int i = 0; i < input.vertex_buffer.size(); i++) {
if(debugOutput)
qDebug() << ptr[i].pos;
qCDebug(log_subdiv) << ptr[i].pos;
result.vertex_buffer.push_back(ptr[i]);
}
if(debugOutput)
qDebug() << "New edge points:";
qCDebug(log_subdiv) << "New edge points:";
for (int i = 0; i < tables.edge_indices.size() / 4; i++) {
if(debugOutput)
qDebug() << ptr[edgeOffset + i].pos;
qCDebug(log_subdiv) << ptr[edgeOffset + i].pos;
result.vertex_buffer.push_back(ptr[edgeOffset + i]);
}
......
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