diff --git a/mainwindow.ui b/mainwindow.ui
index c7a20fe..d70d07a 100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -174,8 +174,30 @@
+
+
@@ -220,6 +242,38 @@
Gouraud
+
+
+ true
+
+
+ Nearest
+
+
+
+
+ true
+
+
+ Linear
+
+
+
+
+ true
+
+
+ Nearest
+
+
+
+
+ true
+
+
+ Linear MipMap Linear
+
+
diff --git a/src/viewer/simpleViewer.cpp b/src/viewer/simpleViewer.cpp
index b89d6f4..fed74df 100644
--- a/src/viewer/simpleViewer.cpp
+++ b/src/viewer/simpleViewer.cpp
@@ -749,13 +749,44 @@ void Viewer::visit(SceneGroup &s)
void Viewer::setPhong(bool on) {
- m_program->bind();
- m_program->setUniformValue(m_isPhongLoc, on);
- if(on) std::cout << "Phong ON\n";
- else std::cout << "Phong OFF\n";
- this->update();
+ m_program->bind();
+ m_program->setUniformValue(m_isPhongLoc, on);
+ if(on) std::cout << "Phong ON\n";
+ else std::cout << "Phong OFF\n";
+ this->update();
}
+void Viewer::setMagLinear(bool on) {
+ m_program->bind();
+ if(on) {
+ std::cout << "Linear ON" << endl;
+
+ s_texture->setMagnificationFilter(QOpenGLTexture::Linear);
+ } else {
+ std::cout << "Nearest ON" << endl;
+
+ s_texture->setMagnificationFilter(QOpenGLTexture::Nearest);
+ }
+
+ this->update();
+}
+
+void Viewer::setMinLinear(bool on) {
+ m_program->bind();
+ if(on) {
+ std::cout << "Linear MipMap Linear ON" << endl;
+
+ s_texture->setMinificationFilter(QOpenGLTexture::LinearMipMapLinear);
+ } else {
+ std::cout << "Nearest ON" << endl;
+
+ s_texture->setMinificationFilter(QOpenGLTexture::Nearest);
+ }
+
+ this->update();
+}
+
+
void Viewer::changeColor(QColor c){
if(activeCell->getChildren()->size()){
Shape* shape = dynamic_cast (activeCell->childAt(0));
diff --git a/src/viewer/simpleViewer.h b/src/viewer/simpleViewer.h
index d58a467..356d3b6 100644
--- a/src/viewer/simpleViewer.h
+++ b/src/viewer/simpleViewer.h
@@ -60,6 +60,8 @@ public slots:
void cleanup();
void changeColor(QColor);
void setPhong(bool);
+ void setMagLinear(bool);
+ void setMinLinear(bool);
signals:
int shapeSelected(int);
diff --git a/src/window/mainwindow.cpp b/src/window/mainwindow.cpp
index 43621b5..e8ccf5f 100644
--- a/src/window/mainwindow.cpp
+++ b/src/window/mainwindow.cpp
@@ -19,6 +19,14 @@ MainWindow::MainWindow(QWidget *parent) :
lightTypeGroup->addAction(ui->actionGouraud);
lightTypeGroup->addAction(ui->actionPhong);
+ minFilterGroup = new QActionGroup(this);
+ minFilterGroup->addAction(ui->actionMinLin);
+ minFilterGroup->addAction(ui->actionMinNear);
+
+ magFilterGroup = new QActionGroup(this);
+ magFilterGroup->addAction(ui->actionMagLinear);
+ magFilterGroup->addAction(ui->actionMagNear);
+
connect(ui->pushButton, SIGNAL(clicked(bool)), this, SLOT(onColorPickerActivate()));
}
@@ -35,6 +43,8 @@ void MainWindow::addViewer(Viewer* viewer)
// actionGouraud shouldn't need one, since they are mutual
connect(ui->actionPhong, SIGNAL(toggled(bool)), viewer, SLOT(setPhong(bool)));
+ connect(ui->actionMagLinear, SIGNAL(toggled(bool)), viewer, SLOT(setMagLinear(bool)));
+ connect(ui->actionMinLin, SIGNAL(toggled(bool)), viewer, SLOT(setMinLinear(bool)));
}
void MainWindow::onColorPickerActivate(){
diff --git a/src/window/mainwindow.h b/src/window/mainwindow.h
index 94c2cfd..8294784 100644
--- a/src/window/mainwindow.h
+++ b/src/window/mainwindow.h
@@ -26,8 +26,10 @@ public slots:
private:
Ui::MainWindow *ui;
- QColorDialog *colordialog;
+ QColorDialog *colordialog;
QActionGroup *lightTypeGroup;
+ QActionGroup *minFilterGroup;
+ QActionGroup *magFilterGroup;
};
#endif // MAINWINDOW_H