Commit 9d5ca018 by Philipp Adolf

Add mesh logging category

parent fa6a6559
#include "logcategories.h"
#include "mesh.h"
Mesh::SubdivEntry::SubdivEntry()
......@@ -9,7 +10,7 @@ Mesh::SubdivEntry::SubdivEntry()
Mesh::SubdivEntry::~SubdivEntry()
{
qDebug() << "FIXME: Delete Called: num vertex:" << vertices.size();
qCDebug(log_mesh) << "FIXME: Delete Called: num vertex:" << vertices.size();
/*f->glDeleteBuffers(1, &VB_handle);
f->glDeleteBuffers(1, &IB_irregular_handle);
f->glDeleteBuffers(1, &IB_regular_handle);
......@@ -48,9 +49,9 @@ void Mesh::SubdivEntry::init(QOpenGLFunctions_4_3_Core *f, GLuint VB_handle, QVe
indices_irregular = Indices_irregular;
indices_regular = patches;
qDebug() << "Vertices" << vertices.length();
qDebug() << "Indices irregular" << indices_irregular.length();
qDebug() << "Indices patches" << patches.length();
qCDebug(log_mesh) << "Vertices" << vertices.length();
qCDebug(log_mesh) << "Indices irregular" << indices_irregular.length();
qCDebug(log_mesh) << "Indices patches" << patches.length();
f->glGenBuffers(1, &IB_irregular_handle);
f->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IB_irregular_handle);
......@@ -149,10 +150,10 @@ Mesh::Mesh(QOpenGLFunctions_4_3_Core *f,QString fileName)
aiProcess_Triangulate
);
qDebug() << "File Read";
qCDebug(log_mesh) << "File Read";
if( !scene)
{
qDebug() << importer.GetErrorString();
qCDebug(log_mesh) << importer.GetErrorString();
}else {
QString dir = QFileInfo(fileName).path();
......@@ -166,10 +167,10 @@ Mesh::Mesh(QOpenGLFunctions_4_3_Core *f,QString fileName)
material->Get(AI_MATKEY_NAME, mname);
initMaterial(dir, i, material);
qDebug() << "Loaded Material" << (i+1) << "/" << scene->mNumMaterials << ":" << mname.C_Str() << "Shininess" << materials[i].Shininess;
qCDebug(log_mesh) << "Loaded Material" << (i+1) << "/" << scene->mNumMaterials << ":" << mname.C_Str() << "Shininess" << materials[i].Shininess;
}
}
qDebug() << "Materials Read";
qCDebug(log_mesh) << "Materials Read";
//Init Mesh
if(scene->HasMeshes())
......@@ -185,7 +186,7 @@ Mesh::Mesh(QOpenGLFunctions_4_3_Core *f,QString fileName)
return;
}
qDebug() << "Mesh Read";
qCDebug(log_mesh) << "Mesh Read";
//init Nodes
if(scene->mRootNode != NULL)
......@@ -200,9 +201,9 @@ Mesh::Mesh(QOpenGLFunctions_4_3_Core *f,QString fileName)
{
rootNode.meshes[i] = i;
}
qDebug() << "No Root Node";
qCDebug(log_mesh) << "No Root Node";
}
qDebug() << "Nodes Read";
qCDebug(log_mesh) << "Nodes Read";
globalInverseTransform = rootNode.transformation.inverted();
......@@ -211,7 +212,7 @@ Mesh::Mesh(QOpenGLFunctions_4_3_Core *f,QString fileName)
QVector3D max = QVector3D(-amax,-amax,-amax);
findObjectDimension(rootNode,QMatrix4x4(),min,max);
qDebug() << "AABB" << min << max;
qCDebug(log_mesh) << "AABB" << min << max;
float dist = qMax(max.x() - min.x(), qMax(max.y()-min.y(), max.z() - min.z()));
float sc = 100.0/dist;
......@@ -256,7 +257,7 @@ Mesh::Mesh(QOpenGLFunctions_4_3_Core *f, Mesh *mesh, QVector<Vertex> &vertex_buf
QVector3D max = QVector3D(-amax,-amax,-amax);
findObjectDimension(rootNode,QMatrix4x4(),min,max);
qDebug() << "AABB" << min << max;
qCDebug(log_mesh) << "AABB" << min << max;
float dist = qMax(max.x() - min.x(), qMax(max.y()-min.y(), max.z() - min.z()));
float sc = 100.0/dist;
......@@ -290,16 +291,16 @@ void Mesh::initNode(const aiScene *scene, aiNode *node, Node &newNode,QString de
newNode.transformation = QMatrix4x4(node->mTransformation[0]);
newNode.meshes.resize(node->mNumMeshes);
if(debug) qDebug() << debugoffset.toStdString().c_str() << "NodeName" << newNode.name;
if(debug) qDebug() << debugoffset.toStdString().c_str() << " NumMeshes" << newNode.meshes.size();
if(debug) qCDebug(log_mesh) << debugoffset.toStdString().c_str() << "NodeName" << newNode.name;
if(debug) qCDebug(log_mesh) << debugoffset.toStdString().c_str() << " NumMeshes" << newNode.meshes.size();
for(uint i = 0; i < node->mNumMeshes; ++i)
{
newNode.meshes[i] = node->mMeshes[i];
if(debug) qDebug() << debugoffset.toStdString().c_str() << " MeshName" << entries[newNode.meshes[i]].name;
if(debug) qCDebug(log_mesh) << debugoffset.toStdString().c_str() << " MeshName" << entries[newNode.meshes[i]].name;
}
if(debug) qDebug() << debugoffset.toStdString().c_str() << " NumChildren" << node->mNumChildren;
if(debug) qCDebug(log_mesh) << debugoffset.toStdString().c_str() << " NumChildren" << node->mNumChildren;
QString newDebug = QString(debugoffset).append(" ");
for(uint i = 0; i < node->mNumChildren; ++i)
{
......@@ -381,7 +382,7 @@ void Mesh::initMeshEntry(int index, aiMesh * entry) {
entries[index].name = entry->mName.length != 0 ? entry->mName.C_Str() : "";
entries[index].materialIndex = entry->mMaterialIndex;
qDebug() << "Loaded Mesh:" << entries[index].name << "HasBones:" << entry->HasBones();
qCDebug(log_mesh) << "Loaded Mesh:" << entries[index].name << "HasBones:" << entry->HasBones();
entries[index].init(f,Vertices, Indices);
}
......@@ -429,7 +430,7 @@ void Mesh::renderMesh(QOpenGLShaderProgram *shader, int index, int subdivision,
{
int MaterialIndex = entries[index].materialIndex;
if (MaterialIndex < materials.size()) {
// qDebug() << materials[MaterialIndex].Diffuse << materials[MaterialIndex].Specular << materials[MaterialIndex].Shininess << materials[MaterialIndex].hasTexture;
// qCDebug(log_mesh) << materials[MaterialIndex].Diffuse << materials[MaterialIndex].Specular << materials[MaterialIndex].Shininess << materials[MaterialIndex].hasTexture;
if (regular) {
shader->setUniformValue("materialInfo.Diffuse", QVector3D(0.0f, 0.0f, 1.0f));
......
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