Commit 1884395d by Philipp Adolf

Pass edgeIndices from precomputeTables to runShader

parent be6417c0
...@@ -47,12 +47,13 @@ QOpenGLShaderProgram *Subdivision::initComputeShaderProgram(){ ...@@ -47,12 +47,13 @@ QOpenGLShaderProgram *Subdivision::initComputeShaderProgram(){
} }
Mesh *Subdivision::subdivide(Mesh *mesh) { Mesh *Subdivision::subdivide(Mesh *mesh) {
precomputeTables(mesh); QVector<QVector<unsigned int> > edgeIndices;
runShader(mesh); precomputeTables(mesh, edgeIndices);
runShader(mesh, edgeIndices);
return NULL; return NULL;
} }
void Subdivision::precomputeTables(Mesh *mesh) { void Subdivision::precomputeTables(Mesh *mesh, QVector<QVector<unsigned int> > &edgeIndices_base) {
Mesh::Node root = mesh->getRootNode(); Mesh::Node root = mesh->getRootNode();
int firstMeshEntryIndex = -1; int firstMeshEntryIndex = -1;
...@@ -73,7 +74,6 @@ void Subdivision::precomputeTables(Mesh *mesh) { ...@@ -73,7 +74,6 @@ void Subdivision::precomputeTables(Mesh *mesh) {
//compute edge table //compute edge table
//Format: first two entries: edge vertices. last two entries: distant vertices. //Format: first two entries: edge vertices. last two entries: distant vertices.
QVector<QVector<unsigned int> > edgeIndices_base;
for (int i = 0; i < ib.length(); i+=3){ for (int i = 0; i < ib.length(); i+=3){
//schaue alle dreiecke an //schaue alle dreiecke an
...@@ -265,7 +265,7 @@ void Subdivision::precomputeTables(Mesh *mesh) { ...@@ -265,7 +265,7 @@ void Subdivision::precomputeTables(Mesh *mesh) {
} }
void Subdivision::runShader(Mesh *mesh) { void Subdivision::runShader(Mesh *mesh, QVector<QVector<unsigned int> > &edgeIndices) {
/* /*
* This shader will set the output buffer to its global ID times hundred + the local id + offset. * This shader will set the output buffer to its global ID times hundred + the local id + offset.
* *
......
...@@ -20,8 +20,8 @@ private: ...@@ -20,8 +20,8 @@ private:
QOpenGLShaderProgram *shader; QOpenGLShaderProgram *shader;
QOpenGLShaderProgram *initComputeShaderProgram(); QOpenGLShaderProgram *initComputeShaderProgram();
void precomputeTables(Mesh *mesh); void precomputeTables(Mesh *mesh, QVector<QVector<unsigned int> > &edgeIndices_base);
void runShader(Mesh *mesh); void runShader(Mesh *mesh, QVector<QVector<unsigned int> > &edgeIndices);
QVector<unsigned int> fillVector(unsigned int a, unsigned int b, unsigned int c,unsigned int d); QVector<unsigned int> fillVector(unsigned int a, unsigned int b, unsigned int c,unsigned int d);
}; };
......
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