Commit bb1cedb8 by Philipp Adolf

Rename method

parent 6cf6fd52
...@@ -13,7 +13,7 @@ Subdivision::~Subdivision() ...@@ -13,7 +13,7 @@ Subdivision::~Subdivision()
delete edgeShader; delete edgeShader;
} }
QString Subdivision::getTimeSting(int time){ QString Subdivision::formatTimeMeasurement(int time){
return QString("%1m %2s %3ms").arg( time / 60000 , 2, 10, QChar('0')) return QString("%1m %2s %3ms").arg( time / 60000 , 2, 10, QChar('0'))
.arg((time % 60000) / 1000, 2, 10, QChar('0')) .arg((time % 60000) / 1000, 2, 10, QChar('0'))
.arg((time % 1000) , 3, 10, QChar('0')); .arg((time % 1000) , 3, 10, QChar('0'));
...@@ -163,17 +163,17 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) { ...@@ -163,17 +163,17 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) {
for (int i = 0; i < ib_regular.length(); i+=3) { for (int i = 0; i < ib_regular.length(); i+=3) {
triangles.push_back(Triangle(&vb, ib_regular[i], ib_regular[i+1], ib_regular[i+2])); triangles.push_back(Triangle(&vb, ib_regular[i], ib_regular[i+1], ib_regular[i+2]));
} }
qCDebug(log_timing) << "building Triangles:" << getTimeSting(trianglesTimer.elapsed()); qCDebug(log_timing) << "building Triangles:" << formatTimeMeasurement(trianglesTimer.elapsed());
QTime subTimer; QTime subTimer;
subTimer.start(); subTimer.start();
precomputeEdgeTable(tables, triangles, triangles_regular, (unsigned int) vb.length()); precomputeEdgeTable(tables, triangles, triangles_regular, (unsigned int) vb.length());
qCDebug(log_timing) << "precomputeEdgeTable:" << getTimeSting(subTimer.elapsed()); qCDebug(log_timing) << "precomputeEdgeTable:" << formatTimeMeasurement(subTimer.elapsed());
subTimer.restart(); subTimer.restart();
precomputeVertexTable(tables, vb, ib, ib_regular); precomputeVertexTable(tables, vb, ib, ib_regular);
qCDebug(log_timing) << "precomputeVertexTable:" << getTimeSting(subTimer.elapsed()); qCDebug(log_timing) << "precomputeVertexTable:" << formatTimeMeasurement(subTimer.elapsed());
//tables.patch_index_regular = getPatchIndexBuffer(ib, QVector<unsigned int>());//TODO pass regular and irregular index buffer? //tables.patch_index_regular = getPatchIndexBuffer(ib, QVector<unsigned int>());//TODO pass regular and irregular index buffer?
qCDebug(log_subdiv) << "Precompute Tables Done"; qCDebug(log_subdiv) << "Precompute Tables Done";
...@@ -399,7 +399,7 @@ void Subdivision::splitRegular(Mesh *mesh) { ...@@ -399,7 +399,7 @@ void Subdivision::splitRegular(Mesh *mesh) {
current_mesh->buffers[0]->updateIndices(); current_mesh->buffers[0]->updateIndices();
qCDebug(log_timing) << "splitRegular(mesh): time: " <<getTimeSting(totalTimer.elapsed()); qCDebug(log_timing) << "splitRegular(mesh): time: " <<formatTimeMeasurement(totalTimer.elapsed());
qCDebug(log_subdiv) << "splitRegular(mesh): regular: " << regular.length(); qCDebug(log_subdiv) << "splitRegular(mesh): regular: " << regular.length();
qCDebug(log_subdiv) << "splitRegular(mesh): irregular: " << irregular.length(); qCDebug(log_subdiv) << "splitRegular(mesh): irregular: " << irregular.length();
} }
...@@ -431,7 +431,10 @@ QVector<unsigned int> Subdivision::getPatchIndexBuffer(QVector<unsigned int> ib_ ...@@ -431,7 +431,10 @@ QVector<unsigned int> Subdivision::getPatchIndexBuffer(QVector<unsigned int> ib_
qCDebug(log_timing)<<"PatchIndexBuffer started"; qCDebug(log_timing)<<"PatchIndexBuffer started";
QVector<unsigned int> pib; QVector<unsigned int> pib;
if (ib_regular.size() == 0) return pib; if (ib_regular.size() == 0) return pib;
QTime tempTimer;
tempTimer.start();
QVector<unsigned int> ib_combined = ib_regular + ib_irregular; //DO NOT swap regular and irregular! iteration over ib_combined starting from index in ib_regular QVector<unsigned int> ib_combined = ib_regular + ib_irregular; //DO NOT swap regular and irregular! iteration over ib_combined starting from index in ib_regular
qCDebug(log_timing) << "ib_combined:" << formatTimeMeasurement(tempTimer.elapsed());
QMap<Triangle,QVector<Triangle>> adj; QMap<Triangle,QVector<Triangle>> adj;
// qDebug()<<"combined lenght"<<ib_combined.length(); // qDebug()<<"combined lenght"<<ib_combined.length();
for (int i = 0; i < ib_combined.length() - 2; i+=3){ for (int i = 0; i < ib_combined.length() - 2; i+=3){
...@@ -581,7 +584,7 @@ QVector<unsigned int> Subdivision::getPatchIndexBuffer(QVector<unsigned int> ib_ ...@@ -581,7 +584,7 @@ QVector<unsigned int> Subdivision::getPatchIndexBuffer(QVector<unsigned int> ib_
pib.push_back(i11); pib.push_back(i11);
} }
qCDebug(log_timing)<<"PatchIndexBuffer done:"<<getTimeSting(totalTimer.elapsed()); qCDebug(log_timing)<<"PatchIndexBuffer done:"<<formatTimeMeasurement(totalTimer.elapsed());
return pib; return pib;
} }
...@@ -641,7 +644,7 @@ void Subdivision::findRegular(QVector<unsigned int> index_buffer, QVector<Vertex ...@@ -641,7 +644,7 @@ void Subdivision::findRegular(QVector<unsigned int> index_buffer, QVector<Vertex
irregular.push_back(index_buffer[i+2]); irregular.push_back(index_buffer[i+2]);
} }
} }
qCDebug(log_timing)<<"Find Regular done:"<<getTimeSting(totalTimer.elapsed()); qCDebug(log_timing)<<"Find Regular done:"<<formatTimeMeasurement(totalTimer.elapsed());
} }
bool Subdivision::matchAndCompleteTriangleIndices(unsigned int sx, unsigned int sy, unsigned int sz, unsigned int tx, unsigned int ty, unsigned int &tz){ bool Subdivision::matchAndCompleteTriangleIndices(unsigned int sx, unsigned int sy, unsigned int sz, unsigned int tx, unsigned int ty, unsigned int &tz){
......
...@@ -48,7 +48,7 @@ private: ...@@ -48,7 +48,7 @@ private:
bool is_regular; bool is_regular;
}; };
QString getTimeSting(int time); QString formatTimeMeasurement(int time);
QOpenGLFunctions_4_3_Core *f; QOpenGLFunctions_4_3_Core *f;
QOpenGLShaderProgram *edgeShader; QOpenGLShaderProgram *edgeShader;
......
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