Commit 13440614 by Philipp Adolf

Build neighbors map in precomputeTables

parent 86b7a460
......@@ -149,7 +149,13 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) {
qCDebug(log_timing) << "building Triangles:" << formatTimeMeasurement(subTimer.elapsed());
subTimer.restart();
precomputeEdgeTable(tables, triangles, triangles_regular, (unsigned int) vb.length());
QMap<Triangle, Triangle::Neighbors> neighbors;
QVector<Triangle> all_triangles = triangles + triangles_regular;
buildNeighborsMap(all_triangles, neighbors);
qCDebug(log_timing) << "building neighbors map:" << formatTimeMeasurement(subTimer.elapsed());
subTimer.restart();
precomputeEdgeTable(tables, triangles, neighbors, (unsigned int) vb.length());
qCDebug(log_timing) << "precomputeEdgeTable:" << formatTimeMeasurement(subTimer.elapsed());
QMap<unsigned int, unsigned int> modified_vertices;
......@@ -165,14 +171,10 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) {
return tables;
}
void Subdivision::precomputeEdgeTable(Subdivision::Tables &tables, QVector<Triangle> &triangles, QVector<Triangle> &triangles_regular, unsigned int offset) {
void Subdivision::precomputeEdgeTable(Subdivision::Tables &tables, QVector<Triangle> &triangles, QMap<Triangle, Triangle::Neighbors> &neighbors, unsigned int offset) {
//compute edge table
//Format: first two entries: edge vertices. last two entries: distant vertices.
QMap<Triangle, Triangle::Neighbors> neighbors;
QVector<Triangle> all_triangles = triangles + triangles_regular;
buildNeighborsMap(all_triangles, neighbors);
// Maps edges to the index of the new vertex added on that edge. The keys are the indices of the two vertices defining the edge and must be in the order uv, vw or uw.
QMap<Edge, unsigned int> edge_indices;
......
......@@ -57,7 +57,7 @@ private:
QOpenGLShaderProgram *initComputeShaderProgram(QString &source);
Tables precomputeTables(Input input);
void precomputeEdgeTable(Subdivision::Tables &tables, QVector<Triangle> &triangles, QVector<Triangle> &triangles_regular, unsigned int offset);
void precomputeEdgeTable(Subdivision::Tables &tables, QVector<Triangle> &triangles, QMap<Triangle, Triangle::Neighbors> &neighbors, unsigned int offset);
void precomputeVertexTable(Subdivision::Tables &tables, Input &input, QMap<unsigned int, unsigned int> &modified_vertices);
void updateIndexBuffer(QVector<unsigned int> &index_buffer, QMap<unsigned int, unsigned int> map);
void findRegular(QVector<unsigned int> index_buffer, QVector<Vertex> vertex_buffer, QVector<unsigned int> &regular, QVector<unsigned int> &irregular);
......
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