mirror of
https://github.com/ConjureETS/LOG750-LAB2.git
synced 2026-03-24 03:21:19 +00:00
Texture Mag/Min Options
This commit is contained in:
parent
d729f9aaaf
commit
b022c428d3
@ -174,8 +174,30 @@
|
||||
<addaction name="separator"/>
|
||||
<addaction name="menuInterpolation"/>
|
||||
</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="menuAffichage"/>
|
||||
<addaction name="menuFiltrage"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusBar">
|
||||
<property name="enabled">
|
||||
@ -220,6 +242,38 @@
|
||||
<string>Gouraud</string>
|
||||
</property>
|
||||
</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>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
|
||||
@ -756,6 +756,37 @@ void Viewer::setPhong(bool on) {
|
||||
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<Shape*> (activeCell->childAt(0));
|
||||
|
||||
@ -60,6 +60,8 @@ public slots:
|
||||
void cleanup();
|
||||
void changeColor(QColor);
|
||||
void setPhong(bool);
|
||||
void setMagLinear(bool);
|
||||
void setMinLinear(bool);
|
||||
|
||||
signals:
|
||||
int shapeSelected(int);
|
||||
|
||||
@ -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(){
|
||||
|
||||
@ -28,6 +28,8 @@ private:
|
||||
Ui::MainWindow *ui;
|
||||
QColorDialog *colordialog;
|
||||
QActionGroup *lightTypeGroup;
|
||||
QActionGroup *minFilterGroup;
|
||||
QActionGroup *magFilterGroup;
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user