Commit 5212054f by Philipp Adolf

Update index buffer after precomputeVertexTable

parent 396763e5
...@@ -177,7 +177,10 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) { ...@@ -177,7 +177,10 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) {
precomputeVertexTable(tables, input, modified_vertices); precomputeVertexTable(tables, input, modified_vertices);
qCDebug(log_timing) << "precomputeVertexTable:" << formatTimeMeasurement(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? subTimer.restart();
updateIndexBuffer(tables.index_buffer, modified_vertices);
qCDebug(log_timing) << "updateIndexBuffer:" << formatTimeMeasurement(subTimer.elapsed());
qCDebug(log_subdiv) << "Precompute Tables Done"; qCDebug(log_subdiv) << "Precompute Tables Done";
return tables; return tables;
} }
...@@ -380,6 +383,13 @@ void Subdivision::precomputeVertexTable(Subdivision::Tables &tables, Input &inpu ...@@ -380,6 +383,13 @@ void Subdivision::precomputeVertexTable(Subdivision::Tables &tables, Input &inpu
} }
} }
void Subdivision::updateIndexBuffer(QVector<unsigned int> &index_buffer, QMap<unsigned int, unsigned int> map) {
for (int i = 0; i < index_buffer.length(); i++) {
unsigned int old = index_buffer[i];
index_buffer[i] = map.value(old, old);
}
}
void Subdivision::splitRegular(Mesh *mesh) { void Subdivision::splitRegular(Mesh *mesh) {
QTime totalTimer; QTime totalTimer;
totalTimer.start(); totalTimer.start();
......
...@@ -58,6 +58,7 @@ private: ...@@ -58,6 +58,7 @@ private:
Tables precomputeTables(Input input); 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, QVector<Triangle> &triangles_regular, unsigned int offset);
void precomputeVertexTable(Subdivision::Tables &tables, Input &input, QMap<unsigned int, unsigned int> &modified_vertices); 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); 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); Result runShader(Input input, Tables &tables);
void runVertexShader(GLuint size, GLuint vb_handle, GLuint vertex_indices_handle, GLuint vertex_offsets_handle, GLuint output_handle); 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