Commit 07352b7c by Kai Westerkamp

bounding Volume Button

parent 81e35fd2
...@@ -6,6 +6,7 @@ MainWidget::MainWidget(Camera *cam) ...@@ -6,6 +6,7 @@ MainWidget::MainWidget(Camera *cam)
startTime = QTime::currentTime(); startTime = QTime::currentTime();
rotTime = QTime::currentTime(); rotTime = QTime::currentTime();
wireframe = true; wireframe = true;
boundingVolume = true;
rotation = false; rotation = false;
subdivision = new Subdivision(this); subdivision = new Subdivision(this);
subdivLevel = 0; subdivLevel = 0;
...@@ -189,6 +190,10 @@ void MainWidget::setWireframe(bool active){ ...@@ -189,6 +190,10 @@ void MainWidget::setWireframe(bool active){
this->wireframe = active; this->wireframe = active;
} }
void MainWidget::setBoundingVolume(bool active){
this->boundingVolume = active;
}
QOpenGLShaderProgram* MainWidget::initShaderProgram(QString vertSource, QString tesselationControlSource, QString tesselationEvaluationSource, QString geometrySource, QString fragSource ){ QOpenGLShaderProgram* MainWidget::initShaderProgram(QString vertSource, QString tesselationControlSource, QString tesselationEvaluationSource, QString geometrySource, QString fragSource ){
QOpenGLShader *vert = initGLShader(vertSource,QOpenGLShader::Vertex); QOpenGLShader *vert = initGLShader(vertSource,QOpenGLShader::Vertex);
...@@ -248,7 +253,7 @@ void MainWidget::paintGL(){ ...@@ -248,7 +253,7 @@ void MainWidget::paintGL(){
mesh->render(regularShader,view, m_projection,subdivLevel,true); mesh->render(regularShader,view, m_projection,subdivLevel,true);
if(subdivLevel>0){ if(subdivLevel>0 && boundingVolume){
glEnable (GL_BLEND); glEnable (GL_BLEND);
glDepthMask(GL_FALSE); glDepthMask(GL_FALSE);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
...@@ -268,7 +273,7 @@ void MainWidget::paintGL(){ ...@@ -268,7 +273,7 @@ void MainWidget::paintGL(){
mesh->render(subdivisionShader,view, m_projection,subdivLevel,false); mesh->render(subdivisionShader,view, m_projection,subdivLevel,false);
if(subdivLevel>0){ if(subdivLevel>0 && boundingVolume){
glEnable (GL_BLEND); glEnable (GL_BLEND);
glDepthMask(GL_FALSE); glDepthMask(GL_FALSE);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
......
...@@ -28,6 +28,7 @@ public: ...@@ -28,6 +28,7 @@ public:
bool rotation; bool rotation;
bool wireframe; bool wireframe;
bool boundingVolume;
int subdivLevel; int subdivLevel;
public slots: public slots:
...@@ -35,6 +36,7 @@ public slots: ...@@ -35,6 +36,7 @@ public slots:
void loadNewMesh(QString path); void loadNewMesh(QString path);
void setRotation(bool started); void setRotation(bool started);
void setWireframe(bool active); void setWireframe(bool active);
void setBoundingVolume(bool active);
void subdivide(int level); void subdivide(int level);
signals: signals:
......
...@@ -28,6 +28,13 @@ MainWindow::MainWindow(QWidget *parent) : ...@@ -28,6 +28,13 @@ MainWindow::MainWindow(QWidget *parent) :
connect(switchWireframe, SIGNAL(triggered(bool)), m_centralWidget, SLOT(setWireframe(bool))); connect(switchWireframe, SIGNAL(triggered(bool)), m_centralWidget, SLOT(setWireframe(bool)));
toolBar->addAction(switchWireframe); toolBar->addAction(switchWireframe);
switchBoundingVolume = new QAction("Bounding Volume",this);
switchBoundingVolume->setCheckable(true);
switchBoundingVolume->setChecked(m_centralWidget->boundingVolume);
connect(switchBoundingVolume, SIGNAL(triggered(bool)), m_centralWidget, SLOT(setBoundingVolume(bool)));
toolBar->addAction(switchBoundingVolume);
CamHome = new QAction("Cam",this); CamHome = new QAction("Cam",this);
CamHome->setCheckable(false); CamHome->setCheckable(false);
......
...@@ -31,6 +31,7 @@ private: ...@@ -31,6 +31,7 @@ private:
QAction *loadMesh; QAction *loadMesh;
QAction *switchRotation; QAction *switchRotation;
QAction *switchWireframe; QAction *switchWireframe;
QAction *switchBoundingVolume;
QAction *CamHome; QAction *CamHome;
QAction *debugOutput; QAction *debugOutput;
QSlider *subdivSlider; QSlider *subdivSlider;
......
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