Commit 396763e5 by Philipp Adolf

Generate map from old vertex index to new one

parent b8573a72
......@@ -172,8 +172,9 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) {
precomputeEdgeTable(tables, triangles, triangles_regular, (unsigned int) vb.length());
qCDebug(log_timing) << "precomputeEdgeTable:" << formatTimeMeasurement(subTimer.elapsed());
QMap<unsigned int, unsigned int> modified_vertices;
subTimer.restart();
precomputeVertexTable(tables, input);
precomputeVertexTable(tables, input, modified_vertices);
qCDebug(log_timing) << "precomputeVertexTable:" << formatTimeMeasurement(subTimer.elapsed());
//tables.patch_index_regular = getPatchIndexBuffer(ib, QVector<unsigned int>());//TODO pass regular and irregular index buffer?
......@@ -303,7 +304,7 @@ void Subdivision::precomputeEdgeTable(Subdivision::Tables &tables, QVector<Trian
}
}
void Subdivision::precomputeVertexTable(Subdivision::Tables &tables, Input &input) {
void Subdivision::precomputeVertexTable(Subdivision::Tables &tables, Input &input, QMap<unsigned int, unsigned int> &modified_vertices) {
//compute vertex table
//Format: First entry: original vertex. Other entries: adjacent vertices.
QVector<QVector<unsigned int> > duplicates;//for debugging
......@@ -315,6 +316,7 @@ void Subdivision::precomputeVertexTable(Subdivision::Tables &tables, Input &inpu
QVector<Vertex> adj_v;//helfer
tables.vertex_offsets.push_back(offset);
tables.vertex_indices.push_back(i);
modified_vertices.insert(i, i);
offset++;
Vertex originalVertex = input.vertex_buffer[i];
......
......@@ -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 precomputeVertexTable(Subdivision::Tables &tables, Input &input);
void precomputeVertexTable(Subdivision::Tables &tables, Input &input, QMap<unsigned int, unsigned int> &modified_vertices);
void findRegular(QVector<unsigned int> index_buffer, QVector<Vertex> vertex_buffer, QVector<unsigned int> &regular, QVector<unsigned int> &irregular);
Result runShader(Input input, Tables &tables);
void runVertexShader(GLuint size, GLuint vb_handle, GLuint vertex_indices_handle, GLuint vertex_offsets_handle, GLuint output_handle);
......
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