mirror of
https://github.com/ConjureETS/LOG750-LAB2.git
synced 2026-03-24 03:21:19 +00:00
Cel Shade Toggle
This commit is contained in:
parent
63037d90c6
commit
545f78d0dc
120
mainwindow.ui
120
mainwindow.ui
@ -56,7 +56,6 @@
|
|||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<zorder>speedSlider</zorder>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="4">
|
<item row="0" column="4">
|
||||||
@ -64,7 +63,7 @@
|
|||||||
<property name="horizontalSpacing">
|
<property name="horizontalSpacing">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="3" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QPushButton" name="cw_x">
|
<widget class="QPushButton" name="cw_x">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -74,7 +73,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QPushButton" name="ccw_x">
|
<widget class="QPushButton" name="ccw_x">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -84,55 +83,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>Couleur</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="0" colspan="2">
|
|
||||||
<widget class="QPushButton" name="action_delete">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Delete Cube</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QComboBox" name="comboBox">
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Vide</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Triangle</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Carré</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Cercle</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Forme</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@ -145,7 +96,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="0" column="0">
|
||||||
<spacer name="verticalSpacer_2">
|
<spacer name="verticalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@ -158,40 +109,17 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="4" column="0" colspan="2">
|
||||||
<widget class="QPushButton" name="pushButton">
|
<widget class="QPushButton" name="action_delete">
|
||||||
<property name="text">
|
|
||||||
<string>Couleur</string>
|
|
||||||
</property>
|
|
||||||
<property name="default">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="flat">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0">
|
|
||||||
<widget class="QPushButton" name="ccw_y">
|
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>+Y</string>
|
<string>Delete Cube</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1">
|
<item row="3" column="0">
|
||||||
<widget class="QPushButton" name="cw_y">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>-Y</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="0">
|
|
||||||
<widget class="QPushButton" name="ccw_z">
|
<widget class="QPushButton" name="ccw_z">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -201,7 +129,17 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="1">
|
<item row="2" column="1">
|
||||||
|
<widget class="QPushButton" name="cw_y">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>-Y</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
<widget class="QPushButton" name="cw_z">
|
<widget class="QPushButton" name="cw_z">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -211,6 +149,16 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QPushButton" name="ccw_y">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>+Y</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
@ -282,6 +230,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
<addaction name="actionTextures"/>
|
<addaction name="actionTextures"/>
|
||||||
<addaction name="actionNormal_Maps"/>
|
<addaction name="actionNormal_Maps"/>
|
||||||
|
<addaction name="actionCel_Shading"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="menuInterpolation"/>
|
<addaction name="menuInterpolation"/>
|
||||||
</widget>
|
</widget>
|
||||||
@ -405,6 +354,17 @@
|
|||||||
<string>Normal Maps</string>
|
<string>Normal Maps</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionCel_Shading">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Cel Shading</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
|||||||
@ -1332,6 +1332,11 @@ void Viewer::rotateSelectedObjZCW() {
|
|||||||
rotateSelected(RotateDirection::Z_CW);
|
rotateSelected(RotateDirection::Z_CW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Viewer::toggleCelShading(bool on) {
|
||||||
|
m_program->bind();
|
||||||
|
m_program->setUniformValue(m_useToonShading, on);
|
||||||
|
}
|
||||||
|
|
||||||
void Viewer::animationSpeedChange(int val) {
|
void Viewer::animationSpeedChange(int val) {
|
||||||
frame_mult = fmax(double(val) / 10, 0.05);
|
frame_mult = fmax(double(val) / 10, 0.05);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -86,6 +86,7 @@ public slots:
|
|||||||
void rotateSelectedObjYCW();
|
void rotateSelectedObjYCW();
|
||||||
void rotateSelectedObjZCCW();
|
void rotateSelectedObjZCCW();
|
||||||
void rotateSelectedObjZCW();
|
void rotateSelectedObjZCW();
|
||||||
|
void toggleCelShading(bool);
|
||||||
void animationSpeedChange(int);
|
void animationSpeedChange(int);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|||||||
@ -36,9 +36,6 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
controlGroup->addButton(ui->cw_y);
|
controlGroup->addButton(ui->cw_y);
|
||||||
controlGroup->addButton(ui->ccw_z);
|
controlGroup->addButton(ui->ccw_z);
|
||||||
controlGroup->addButton(ui->cw_z);
|
controlGroup->addButton(ui->cw_z);
|
||||||
|
|
||||||
|
|
||||||
connect(ui->pushButton, SIGNAL(clicked(bool)), this, SLOT(onColorPickerActivate()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
@ -76,6 +73,8 @@ void MainWindow::addViewer(Viewer* viewer)
|
|||||||
connect(ui->ccw_z, SIGNAL(clicked(bool)), viewer, SLOT(rotateSelectedObjZCCW()));
|
connect(ui->ccw_z, SIGNAL(clicked(bool)), viewer, SLOT(rotateSelectedObjZCCW()));
|
||||||
connect(ui->cw_z, SIGNAL(clicked(bool)), viewer, SLOT(rotateSelectedObjZCW()));
|
connect(ui->cw_z, SIGNAL(clicked(bool)), viewer, SLOT(rotateSelectedObjZCW()));
|
||||||
|
|
||||||
|
connect(ui->actionCel_Shading, SIGNAL(toggled(bool)), viewer, SLOT(toggleCelShading(bool)));
|
||||||
|
|
||||||
connect(ui->speedSlider, SIGNAL(valueChanged(int)), viewer, SLOT(animationSpeedChange(int)));
|
connect(ui->speedSlider, SIGNAL(valueChanged(int)), viewer, SLOT(animationSpeedChange(int)));
|
||||||
connect(ui->play_button, SIGNAL(clicked(bool)), viewer, SLOT(toggleAnimation()));
|
connect(ui->play_button, SIGNAL(clicked(bool)), viewer, SLOT(toggleAnimation()));
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user