mirror of
https://github.com/ConjureETS/LOG750-LAB2.git
synced 2026-03-24 11:31:20 +00:00
Texture Mag/Min Options
This commit is contained in:
parent
d729f9aaaf
commit
b022c428d3
@ -174,8 +174,30 @@
|
|||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="menuInterpolation"/>
|
<addaction name="menuInterpolation"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QMenu" name="menuFiltrage">
|
||||||
|
<property name="title">
|
||||||
|
<string>Filtrage</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QMenu" name="menuMag_Filter">
|
||||||
|
<property name="title">
|
||||||
|
<string>Mag Filter</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="actionMagNear"/>
|
||||||
|
<addaction name="actionMagLinear"/>
|
||||||
|
</widget>
|
||||||
|
<widget class="QMenu" name="menuMin_Filter">
|
||||||
|
<property name="title">
|
||||||
|
<string>Min Filter</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="actionMinLin"/>
|
||||||
|
<addaction name="actionMinNear"/>
|
||||||
|
</widget>
|
||||||
|
<addaction name="menuMag_Filter"/>
|
||||||
|
<addaction name="menuMin_Filter"/>
|
||||||
|
</widget>
|
||||||
<addaction name="menu_File"/>
|
<addaction name="menu_File"/>
|
||||||
<addaction name="menuAffichage"/>
|
<addaction name="menuAffichage"/>
|
||||||
|
<addaction name="menuFiltrage"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QStatusBar" name="statusBar">
|
<widget class="QStatusBar" name="statusBar">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
@ -220,6 +242,38 @@
|
|||||||
<string>Gouraud</string>
|
<string>Gouraud</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionMagNear">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Nearest</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionMagLinear">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Linear</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionMinLin">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Nearest</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionMinNear">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Linear MipMap Linear</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
|||||||
@ -749,13 +749,44 @@ void Viewer::visit(SceneGroup &s)
|
|||||||
|
|
||||||
|
|
||||||
void Viewer::setPhong(bool on) {
|
void Viewer::setPhong(bool on) {
|
||||||
m_program->bind();
|
m_program->bind();
|
||||||
m_program->setUniformValue(m_isPhongLoc, on);
|
m_program->setUniformValue(m_isPhongLoc, on);
|
||||||
if(on) std::cout << "Phong ON\n";
|
if(on) std::cout << "Phong ON\n";
|
||||||
else std::cout << "Phong OFF\n";
|
else std::cout << "Phong OFF\n";
|
||||||
this->update();
|
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){
|
void Viewer::changeColor(QColor c){
|
||||||
if(activeCell->getChildren()->size()){
|
if(activeCell->getChildren()->size()){
|
||||||
Shape* shape = dynamic_cast<Shape*> (activeCell->childAt(0));
|
Shape* shape = dynamic_cast<Shape*> (activeCell->childAt(0));
|
||||||
|
|||||||
@ -60,6 +60,8 @@ public slots:
|
|||||||
void cleanup();
|
void cleanup();
|
||||||
void changeColor(QColor);
|
void changeColor(QColor);
|
||||||
void setPhong(bool);
|
void setPhong(bool);
|
||||||
|
void setMagLinear(bool);
|
||||||
|
void setMinLinear(bool);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
int shapeSelected(int);
|
int shapeSelected(int);
|
||||||
|
|||||||
@ -19,6 +19,14 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
lightTypeGroup->addAction(ui->actionGouraud);
|
lightTypeGroup->addAction(ui->actionGouraud);
|
||||||
lightTypeGroup->addAction(ui->actionPhong);
|
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()));
|
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
|
// actionGouraud shouldn't need one, since they are mutual
|
||||||
connect(ui->actionPhong, SIGNAL(toggled(bool)), viewer, SLOT(setPhong(bool)));
|
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(){
|
void MainWindow::onColorPickerActivate(){
|
||||||
|
|||||||
@ -26,8 +26,10 @@ public slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
QColorDialog *colordialog;
|
QColorDialog *colordialog;
|
||||||
QActionGroup *lightTypeGroup;
|
QActionGroup *lightTypeGroup;
|
||||||
|
QActionGroup *minFilterGroup;
|
||||||
|
QActionGroup *magFilterGroup;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user