Normal Map Toggle

This commit is contained in:
Riku Avelar 2016-11-30 16:00:16 -05:00
parent f9f86d3700
commit e3b690b42d
4 changed files with 20 additions and 0 deletions

View File

@ -181,6 +181,7 @@
<addaction name="actionGouraud"/> <addaction name="actionGouraud"/>
</widget> </widget>
<addaction name="actionTextures"/> <addaction name="actionTextures"/>
<addaction name="actionNormal_Maps"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="menuInterpolation"/> <addaction name="menuInterpolation"/>
</widget> </widget>
@ -293,6 +294,17 @@
<string>Linear MipMap Linear</string> <string>Linear MipMap Linear</string>
</property> </property>
</action> </action>
<action name="actionNormal_Maps">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>Normal Maps</string>
</property>
</action>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<resources/> <resources/>

View File

@ -841,6 +841,11 @@ void Viewer::setMinLinear(bool on) {
this->update(); this->update();
} }
void Viewer::toggleNormalMaps(bool state) {
m_program->bind();
m_program->setUniformValue(m_useNormalMap, state);
}
void Viewer::deleteSelected() { void Viewer::deleteSelected() {
// Remove Shape from its parent // Remove Shape from its parent
if(selectedObj.shape == nullptr) return; if(selectedObj.shape == nullptr) return;

View File

@ -63,6 +63,7 @@ public slots:
void setMagLinear(bool); void setMagLinear(bool);
void setMinLinear(bool); void setMinLinear(bool);
void deleteSelected(); void deleteSelected();
void toggleNormalMaps(bool);
signals: signals:
int shapeSelected(int); int shapeSelected(int);

View File

@ -46,6 +46,8 @@ void MainWindow::addViewer(Viewer* viewer)
connect(ui->actionMagLinear, SIGNAL(toggled(bool)), viewer, SLOT(setMagLinear(bool))); connect(ui->actionMagLinear, SIGNAL(toggled(bool)), viewer, SLOT(setMagLinear(bool)));
connect(ui->actionMinLin, SIGNAL(toggled(bool)), viewer, SLOT(setMinLinear(bool))); connect(ui->actionMinLin, SIGNAL(toggled(bool)), viewer, SLOT(setMinLinear(bool)));
connect(ui->actionNormal_Maps, SIGNAL(toggled(bool)), viewer, SLOT(toggleNormalMaps(bool)));
connect(ui->action_delete, SIGNAL(clicked(bool)), viewer, SLOT(deleteSelected())); connect(ui->action_delete, SIGNAL(clicked(bool)), viewer, SLOT(deleteSelected()));
connect(viewer, SIGNAL(cubeSelected(bool)), ui->action_delete, SLOT(setEnabled(bool))); connect(viewer, SIGNAL(cubeSelected(bool)), ui->action_delete, SLOT(setEnabled(bool)));
} }