Commit 7e9bfcb3 by Philipp Adolf

Make precomputeVertexTable use Input

parent 51432f8a
......@@ -172,7 +172,7 @@ Subdivision::Tables Subdivision::precomputeTables(Input input) {
qCDebug(log_timing) << "precomputeEdgeTable:" << formatTimeMeasurement(subTimer.elapsed());
subTimer.restart();
precomputeVertexTable(tables, vb, ib, ib_regular);
precomputeVertexTable(tables, input);
qCDebug(log_timing) << "precomputeVertexTable:" << formatTimeMeasurement(subTimer.elapsed());
//tables.patch_index_regular = getPatchIndexBuffer(ib, QVector<unsigned int>());//TODO pass regular and irregular index buffer?
......@@ -302,13 +302,13 @@ void Subdivision::precomputeEdgeTable(Subdivision::Tables &tables, QVector<Trian
}
}
void Subdivision::precomputeVertexTable(Subdivision::Tables &tables, QVector<Vertex> &vb, QVector<unsigned int> &ib, QVector<unsigned int> &ib_regular) {
void Subdivision::precomputeVertexTable(Subdivision::Tables &tables, Input &input) {
//compute vertex table
//Format: First entry: original vertex. Other entries: adjacent vertices.
QVector<QVector<unsigned int> > duplicates;//for debugging
QVector<unsigned int> ib_combined = ib + ib_regular;
QVector<unsigned int> ib_combined = input.index_irregular_buffer + input.index_regular_buffer;
unsigned int offset = 0;
for (int i = 0; i < vb.length(); i++){
for (int i = 0; i < input.vertex_buffer.length(); i++){
//hat evtl viel redundanz
QVector<Vertex> adj_v;//helfer
......@@ -316,14 +316,14 @@ void Subdivision::precomputeVertexTable(Subdivision::Tables &tables, QVector<Ver
tables.vertex_indices.push_back(i);
offset++;
Vertex originalVertex = vb[i];
Vertex originalVertex = input.vertex_buffer[i];
QVector<unsigned int> d;
for (int j = 0; j < ib_combined.length(); j++){
//suche verweise auf vertex im indexbuffer
if (vb[ib_combined[j]].samePos(originalVertex)){
if (input.vertex_buffer[ib_combined[j]].samePos(originalVertex)){
d.push_back(j);
unsigned int i1, i2; //indices for neighbour vertices
switch (j % 3) {
......@@ -342,8 +342,8 @@ void Subdivision::precomputeVertexTable(Subdivision::Tables &tables, QVector<Ver
}
Vertex v1,v2; //neighbour vertices;
v1 = vb[i1];
v2 = vb[i2];
v1 = input.vertex_buffer[i1];
v2 = input.vertex_buffer[i2];
//check if vertices where already used to influence this vertex
//Note: Can't use contain. Contain uses equal (would have to implement equal, but we're only interested in the position here.
bool found1 = false;
......
......@@ -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, QVector<Vertex> &vb, QVector<unsigned int> &ib, QVector<unsigned int> &ib_regular);
void precomputeVertexTable(Subdivision::Tables &tables, Input &input);
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