Commit 07352b7c by Kai Westerkamp

bounding Volume Button

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