Commit d14dc5a6 by Philipp Adolf

Add buffer of regular triangles to Input

parent 5579c275
...@@ -66,6 +66,7 @@ void Subdivision::subdivide(Mesh *mesh, int level) { ...@@ -66,6 +66,7 @@ void Subdivision::subdivide(Mesh *mesh, int level) {
input.vb_handle = entry->VB_handle; input.vb_handle = entry->VB_handle;
input.vertex_buffer = entry->vertices; input.vertex_buffer = entry->vertices;
input.index_irregular_buffer = entry->indices_irregular; input.index_irregular_buffer = entry->indices_irregular;
input.index_regular_buffer = getTriangles(entry->indices_regular);
if (input.index_irregular_buffer.isEmpty()) { if (input.index_irregular_buffer.isEmpty()) {
// current_mesh->update(input.vb_handle, input.vertex_buffer, input.index_buffer, entry->indices_regular); // current_mesh->update(input.vb_handle, input.vertex_buffer, input.index_buffer, entry->indices_regular);
...@@ -138,7 +139,10 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) { ...@@ -138,7 +139,10 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) {
Tables tables; Tables tables;
QVector<unsigned int> ib = input.index_irregular_buffer; QVector<unsigned int> ib = input.index_irregular_buffer;
qCDebug(log_subdiv_trace) << "Index Buffer: " << ib; qCDebug(log_subdiv_trace) << "Index Buffer Irregular: " << ib;
QVector<unsigned int> ib_regular = input.index_regular_buffer;
qCDebug(log_subdiv_trace) << "Index Buffer Regular: " << ib_regular;
QVector<Vertex> vb = input.vertex_buffer; QVector<Vertex> vb = input.vertex_buffer;
qCDebug(log_subdiv_trace) << "Vertex Buffer: " << vb; qCDebug(log_subdiv_trace) << "Vertex Buffer: " << vb;
...@@ -147,6 +151,10 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) { ...@@ -147,6 +151,10 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) {
for (int i = 0; i < ib.length(); i+=3) { for (int i = 0; i < ib.length(); i+=3) {
triangles.push_back(Triangle(vb, ib[i], ib[i+1], ib[i+2])); triangles.push_back(Triangle(vb, ib[i], ib[i+1], ib[i+2]));
} }
QVector<Triangle> triangles_regular;
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]));
}
precomputeEdgeTable(tables, triangles, (unsigned int) vb.length()); precomputeEdgeTable(tables, triangles, (unsigned int) vb.length());
precomputeVertexTable(tables, vb, ib); precomputeVertexTable(tables, vb, ib);
......
...@@ -23,6 +23,7 @@ private: ...@@ -23,6 +23,7 @@ private:
{ {
GLuint vb_handle; GLuint vb_handle;
QVector<unsigned int> index_irregular_buffer; QVector<unsigned int> index_irregular_buffer;
QVector<unsigned int> index_regular_buffer;
QVector<Vertex> vertex_buffer; QVector<Vertex> vertex_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