Commit 143894a1 by Philipp Adolf

Just reuse vertices and indices if all regular

parent 182c5e2e
...@@ -71,23 +71,25 @@ void Subdivision::subdivide(Mesh *mesh, int level) { ...@@ -71,23 +71,25 @@ void Subdivision::subdivide(Mesh *mesh, int level) {
input.vertex_buffer = entry->vertices; input.vertex_buffer = entry->vertices;
input.index_buffer = entry->indices; input.index_buffer = entry->indices;
Tables tables = precomputeTables(input); if (input.index_buffer.isEmpty()) {
Result result = runShader(input, tables); current_mesh->update(input.vb_handle, input.vertex_buffer, input.index_buffer, entry->indicesRegular);
} else {
Tables tables = precomputeTables(input);
Result result = runShader(input, tables);
QVector<unsigned int> regular; QVector<unsigned int> regular;
QVector<unsigned int> irregular; QVector<unsigned int> irregular;
findRegular(tables.index_buffer, result.vertex_buffer, regular, irregular); findRegular(tables.index_buffer, result.vertex_buffer, regular, irregular);
qDebug() << "Indices" << tables.index_buffer.length(); qDebug() << "Indices" << tables.index_buffer.length();
qDebug() << "regular" << regular.length(); qDebug() << "regular" << regular.length();
qDebug() << "irregular" << irregular.length(); qDebug() << "irregular" << irregular.length();
QVector<unsigned int> patches = getPatchIndexBuffer(regular); QVector<unsigned int> patches = getPatchIndexBuffer(regular);
qDebug() << "patches" << patches.length(); qDebug() << "patches" << patches.length();
current_mesh->update(result.vb_handle, result.vertex_buffer, irregular, patches); current_mesh->update(result.vb_handle, result.vertex_buffer, irregular, patches);
}
//return new Mesh(f, mesh, result.vertex_buffer, tables.index_buffer);
} }
/** /**
......
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