-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdialog.cpp
executable file
·164 lines (136 loc) · 3.07 KB
/
dialog.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#include "dialog.h"
#include "ui_dialog.h"
#include <QTimer>
// **************************
// Defines for movement_keys
// **************************
#define W_PRESSED 0x0008
#define A_PRESSED 0x0004
#define S_PRESSED 0x0002
#define D_PRESSED 0x0001
#define SB_PRESSED 0x0020
#define SH_PRESSED 0x0010
#define W_RELEASED 0x00F7
#define A_RELEASED 0x00FB
#define S_RELEASED 0x00FD
#define D_RELEASED 0x00FE
#define SB_RELEASED 0x00DF
#define SH_RELEASED 0x00EF
Dialog::Dialog(QWidget *parent)
: QDialog(parent)
, ui(new Ui::Dialog)
{
ui->setupUi(this);
setFocusPolicy(Qt::ClickFocus);
setFocus();
timer60fps = new QTimer();
if (timer60fps != nullptr) {
timer60fps->setInterval(1000.0 / 60.0);
connect(timer60fps, &QTimer::timeout, this, &Dialog::refresh);
timer60fps->start();
}
}
Dialog::~Dialog()
{
delete ui;
}
void Dialog::on_clearButton_clicked()
{
ui->openGLWidget->clearObjects();
ui->label->setText("Objects cleared!");
}
void Dialog::on_newObjectButton_clicked()
{
ui->openGLWidget->newNode();
ui->label->setText("New node generated");
}
void Dialog::on_selectObjectButton_clicked()
{
// TODO: redo this function
ui->label->setText("Click an object to select it");
}
void Dialog::on_selectNextButton_clicked()
{
ui->openGLWidget->selectNext();
}
void Dialog::on_selectPreviousButton_clicked()
{
ui->openGLWidget->selectPrevious();
}
void Dialog::on_translateObjectButton_clicked()
{
// TODO: redo this function
}
void Dialog::on_parentButton_clicked()
{
ui->openGLWidget->selectParent();
}
void Dialog::on_rotateButton_clicked()
{
// TODO: redo this function
}
void Dialog::on_scaleButton_clicked()
{
// TODO: redo this function
}
void Dialog::on_xAxisRadioButton_toggled(bool checked)
{
if (checked)
{
ui->openGLWidget->setAxis(0);
}
}
void Dialog::on_yAxisRadioButton_toggled(bool checked)
{
if (checked)
{
ui->openGLWidget->setAxis(1);
}
}
void Dialog::on_zAxisRadioButton_toggled(bool checked)
{
if (checked)
{
ui->openGLWidget->setAxis(2);
}
}
void Dialog::on_swapXformButton_clicked()
{
ui->openGLWidget->swapTransformOrder(0);
}
void Dialog::on_swapAxisButton_clicked()
{
ui->openGLWidget->swapAxisOrder(0);
}
void Dialog::on_translateCameraButton_clicked()
{
// TODO: redo this function
}
void Dialog::on_translateTargetButton_clicked()
{
// TODO: redo this function
}
void Dialog::on_rotateCameraZButton_clicked()
{
// TODO: redo this function
}
void Dialog::on_nearPlaneButton_clicked()
{
// TODO: redo this function
}
void Dialog::on_farPlaneButton_clicked()
{
// TODO: redo this function
}
void Dialog::on_resetCameraButton_clicked()
{
ui->openGLWidget->resetCamera();
}
void Dialog::on_addTriangle_clicked()
{
ui->openGLWidget->genericTriangle();
}
void Dialog::refresh()
{
ui->openGLWidget->refresh();
}