Commit 97ea391e by Philipp Adolf

Make compute shader loading more generic

parent 27ca1b90
...@@ -11,7 +11,8 @@ Subdivision::~Subdivision() ...@@ -11,7 +11,8 @@ Subdivision::~Subdivision()
} }
void Subdivision::init() { void Subdivision::init() {
edgeShader = initEdgeComputeShaderProgram(); QString source = QLatin1String(":/subdivision-edge.compute");
edgeShader = initComputeShaderProgram(source);
} }
QVector<unsigned int> Subdivision::fillVector(unsigned int a, unsigned int b, unsigned int c,unsigned int d){ QVector<unsigned int> Subdivision::fillVector(unsigned int a, unsigned int b, unsigned int c,unsigned int d){
...@@ -23,9 +24,7 @@ QVector<unsigned int> Subdivision::fillVector(unsigned int a, unsigned int b, un ...@@ -23,9 +24,7 @@ QVector<unsigned int> Subdivision::fillVector(unsigned int a, unsigned int b, un
return x; return x;
} }
QOpenGLShaderProgram *Subdivision::initEdgeComputeShaderProgram(){ QOpenGLShaderProgram *Subdivision::initComputeShaderProgram(QString &source){
QString source = QLatin1String(":/subdivision-edge.compute");
qDebug()<<"Compiling compute shader ..."; qDebug()<<"Compiling compute shader ...";
QOpenGLShader *computeShader = new QOpenGLShader(QOpenGLShader::Compute); QOpenGLShader *computeShader = new QOpenGLShader(QOpenGLShader::Compute);
if(!computeShader->compileSourceFile(source)){ if(!computeShader->compileSourceFile(source)){
......
...@@ -19,7 +19,7 @@ private: ...@@ -19,7 +19,7 @@ private:
QOpenGLFunctions_4_3_Core *f; QOpenGLFunctions_4_3_Core *f;
QOpenGLShaderProgram *edgeShader; QOpenGLShaderProgram *edgeShader;
QOpenGLShaderProgram *initEdgeComputeShaderProgram(); QOpenGLShaderProgram *initComputeShaderProgram(QString &source);
void precomputeTables(Mesh *mesh, QVector<QVector<unsigned int> > &edgeIndices_base, void precomputeTables(Mesh *mesh, QVector<QVector<unsigned int> > &edgeIndices_base,
QVector<unsigned int> &vertexIndices, QVector<unsigned int> &vertexIndicesOffsets); QVector<unsigned int> &vertexIndices, QVector<unsigned int> &vertexIndicesOffsets);
void runShader(Mesh *mesh, QVector<QVector<unsigned int> > &edgeIndices); void runShader(Mesh *mesh, QVector<QVector<unsigned int> > &edgeIndices);
......
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