diff --git a/hw03/oglwidget.cpp b/hw03/oglwidget.cpp
index d7c5f71..b225032 100644
--- a/hw03/oglwidget.cpp
+++ b/hw03/oglwidget.cpp
@@ -270,11 +270,11 @@
for (auto vert : points) {
if (vert.isNext) {
glEnd();
- glLineWidth(2*abs(vert._z));
+// glLineWidth(2*abs(vert._z));
glColor3f(1.0f, 0.0f, 0.0f);
glBegin( GL_LINE_STRIP);
}
- glVertex3f(vert._x, vert._y, vert._z);
+ glVertex3f(vert._x, vert._y + vert._z, 0);
}
glEnd();
}
@@ -383,10 +383,10 @@
// draw the scene
glMatrixMode( GL_MODELVIEW);
glLoadIdentity(); // Reset The Current Modelview Matrix
- glTranslated( 0 ,0 ,-10.0); // Move 10 units backwards in z, since camera is at origin
- glScaled( 2.0, 2.0, 2.0); // scale objects
- glRotated( alpha, 0, 3, 1); // continuous rotation
- alpha += 2;
+// glTranslated( 0 ,0 ,-10.0); // Move 10 units backwards in z, since camera is at origin
+ glScaled( 2.5, 1.8, 2.0); // scale objects
+// glRotated( alpha, 0, 3, 1); // continuous rotation
+// alpha += 2;
// define color: 1=front, 2=back, 3=both, followed by r, g, and b
SetMaterialColor( 1, 0, .2, .2); // front color is red
diff --git a/hw03/oglwidget.cpp b/hw03/oglwidget.cpp
index d7c5f71..b225032 100644
--- a/hw03/oglwidget.cpp
+++ b/hw03/oglwidget.cpp
@@ -270,11 +270,11 @@
for (auto vert : points) {
if (vert.isNext) {
glEnd();
- glLineWidth(2*abs(vert._z));
+// glLineWidth(2*abs(vert._z));
glColor3f(1.0f, 0.0f, 0.0f);
glBegin( GL_LINE_STRIP);
}
- glVertex3f(vert._x, vert._y, vert._z);
+ glVertex3f(vert._x, vert._y + vert._z, 0);
}
glEnd();
}
@@ -383,10 +383,10 @@
// draw the scene
glMatrixMode( GL_MODELVIEW);
glLoadIdentity(); // Reset The Current Modelview Matrix
- glTranslated( 0 ,0 ,-10.0); // Move 10 units backwards in z, since camera is at origin
- glScaled( 2.0, 2.0, 2.0); // scale objects
- glRotated( alpha, 0, 3, 1); // continuous rotation
- alpha += 2;
+// glTranslated( 0 ,0 ,-10.0); // Move 10 units backwards in z, since camera is at origin
+ glScaled( 2.5, 1.8, 2.0); // scale objects
+// glRotated( alpha, 0, 3, 1); // continuous rotation
+// alpha += 2;
// define color: 1=front, 2=back, 3=both, followed by r, g, and b
SetMaterialColor( 1, 0, .2, .2); // front color is red
diff --git a/hw04/CMakeLists.txt b/hw04/CMakeLists.txt
index 4d596e0..4c6060f 100644
--- a/hw04/CMakeLists.txt
+++ b/hw04/CMakeLists.txt
@@ -18,7 +18,7 @@
mainwindow.cpp
mainwindow.h
oglwidget.cpp
- oglwidget.h)
+ oglwidget.h src/Vertex.cpp src/Vertex.h src/Tri.cpp src/Tri.h src/Mesh.cpp src/Mesh.h src/Util.cpp src/Util.h)
if (NOT CMAKE_PREFIX_PATH)
message(WARNING "CMAKE_PREFIX_PATH is not defined, you may need to set it "
diff --git a/hw03/oglwidget.cpp b/hw03/oglwidget.cpp
index d7c5f71..b225032 100644
--- a/hw03/oglwidget.cpp
+++ b/hw03/oglwidget.cpp
@@ -270,11 +270,11 @@
for (auto vert : points) {
if (vert.isNext) {
glEnd();
- glLineWidth(2*abs(vert._z));
+// glLineWidth(2*abs(vert._z));
glColor3f(1.0f, 0.0f, 0.0f);
glBegin( GL_LINE_STRIP);
}
- glVertex3f(vert._x, vert._y, vert._z);
+ glVertex3f(vert._x, vert._y + vert._z, 0);
}
glEnd();
}
@@ -383,10 +383,10 @@
// draw the scene
glMatrixMode( GL_MODELVIEW);
glLoadIdentity(); // Reset The Current Modelview Matrix
- glTranslated( 0 ,0 ,-10.0); // Move 10 units backwards in z, since camera is at origin
- glScaled( 2.0, 2.0, 2.0); // scale objects
- glRotated( alpha, 0, 3, 1); // continuous rotation
- alpha += 2;
+// glTranslated( 0 ,0 ,-10.0); // Move 10 units backwards in z, since camera is at origin
+ glScaled( 2.5, 1.8, 2.0); // scale objects
+// glRotated( alpha, 0, 3, 1); // continuous rotation
+// alpha += 2;
// define color: 1=front, 2=back, 3=both, followed by r, g, and b
SetMaterialColor( 1, 0, .2, .2); // front color is red
diff --git a/hw04/CMakeLists.txt b/hw04/CMakeLists.txt
index 4d596e0..4c6060f 100644
--- a/hw04/CMakeLists.txt
+++ b/hw04/CMakeLists.txt
@@ -18,7 +18,7 @@
mainwindow.cpp
mainwindow.h
oglwidget.cpp
- oglwidget.h)
+ oglwidget.h src/Vertex.cpp src/Vertex.h src/Tri.cpp src/Tri.h src/Mesh.cpp src/Mesh.h src/Util.cpp src/Util.h)
if (NOT CMAKE_PREFIX_PATH)
message(WARNING "CMAKE_PREFIX_PATH is not defined, you may need to set it "
diff --git a/hw04/mainwindow.cpp b/hw04/mainwindow.cpp
index ff258c4..43656fd 100644
--- a/hw04/mainwindow.cpp
+++ b/hw04/mainwindow.cpp
@@ -9,6 +9,13 @@
ui(new Ui::MainWindow)
{
ui->setupUi(this);
+
+ connect(ui->parentSpinBox, SIGNAL(valueChanged(int)), ui->glwidget, SLOT(parentSubdiv(int)));
+ connect(ui->childSpinBox, SIGNAL(valueChanged(int)), ui->glwidget, SLOT(childSubdiv(int)));
+ connect(ui->drawWireframe, SIGNAL(stateChanged(int)), ui->glwidget, SLOT(drawWireframe(int)));
+ connect(ui->drawOutline, SIGNAL(stateChanged(int)), ui->glwidget, SLOT(drawOutline(int)));
+
+ connect(ui->scale, SIGNAL(valueChanged(int)), ui->glwidget, SLOT(setScale(int)));
}
MainWindow::~MainWindow()
diff --git a/hw03/oglwidget.cpp b/hw03/oglwidget.cpp
index d7c5f71..b225032 100644
--- a/hw03/oglwidget.cpp
+++ b/hw03/oglwidget.cpp
@@ -270,11 +270,11 @@
for (auto vert : points) {
if (vert.isNext) {
glEnd();
- glLineWidth(2*abs(vert._z));
+// glLineWidth(2*abs(vert._z));
glColor3f(1.0f, 0.0f, 0.0f);
glBegin( GL_LINE_STRIP);
}
- glVertex3f(vert._x, vert._y, vert._z);
+ glVertex3f(vert._x, vert._y + vert._z, 0);
}
glEnd();
}
@@ -383,10 +383,10 @@
// draw the scene
glMatrixMode( GL_MODELVIEW);
glLoadIdentity(); // Reset The Current Modelview Matrix
- glTranslated( 0 ,0 ,-10.0); // Move 10 units backwards in z, since camera is at origin
- glScaled( 2.0, 2.0, 2.0); // scale objects
- glRotated( alpha, 0, 3, 1); // continuous rotation
- alpha += 2;
+// glTranslated( 0 ,0 ,-10.0); // Move 10 units backwards in z, since camera is at origin
+ glScaled( 2.5, 1.8, 2.0); // scale objects
+// glRotated( alpha, 0, 3, 1); // continuous rotation
+// alpha += 2;
// define color: 1=front, 2=back, 3=both, followed by r, g, and b
SetMaterialColor( 1, 0, .2, .2); // front color is red
diff --git a/hw04/CMakeLists.txt b/hw04/CMakeLists.txt
index 4d596e0..4c6060f 100644
--- a/hw04/CMakeLists.txt
+++ b/hw04/CMakeLists.txt
@@ -18,7 +18,7 @@
mainwindow.cpp
mainwindow.h
oglwidget.cpp
- oglwidget.h)
+ oglwidget.h src/Vertex.cpp src/Vertex.h src/Tri.cpp src/Tri.h src/Mesh.cpp src/Mesh.h src/Util.cpp src/Util.h)
if (NOT CMAKE_PREFIX_PATH)
message(WARNING "CMAKE_PREFIX_PATH is not defined, you may need to set it "
diff --git a/hw04/mainwindow.cpp b/hw04/mainwindow.cpp
index ff258c4..43656fd 100644
--- a/hw04/mainwindow.cpp
+++ b/hw04/mainwindow.cpp
@@ -9,6 +9,13 @@
ui(new Ui::MainWindow)
{
ui->setupUi(this);
+
+ connect(ui->parentSpinBox, SIGNAL(valueChanged(int)), ui->glwidget, SLOT(parentSubdiv(int)));
+ connect(ui->childSpinBox, SIGNAL(valueChanged(int)), ui->glwidget, SLOT(childSubdiv(int)));
+ connect(ui->drawWireframe, SIGNAL(stateChanged(int)), ui->glwidget, SLOT(drawWireframe(int)));
+ connect(ui->drawOutline, SIGNAL(stateChanged(int)), ui->glwidget, SLOT(drawOutline(int)));
+
+ connect(ui->scale, SIGNAL(valueChanged(int)), ui->glwidget, SLOT(setScale(int)));
}
MainWindow::~MainWindow()
diff --git a/hw04/mainwindow.ui b/hw04/mainwindow.ui
index 5e1745e..9f9248a 100644
--- a/hw04/mainwindow.ui
+++ b/hw04/mainwindow.ui
@@ -6,8 +6,8 @@
0
0
- 548
- 415
+ 1044
+ 718
@@ -25,6 +25,107 @@
+ -
+
+
-
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Parent Subdivisons
+
+
+
+ -
+
+
+ 10
+
+
+
+ -
+
+
+ Draw Parent
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Child Subdivisons
+
+
+
+ -
+
+
+ 1
+
+
+ 10
+
+
+
+ -
+
+
+ Draw Wireframe
+
+
+
+
+
+
+
+ -
+
+
+ Scale
+
+
+
+ -
+
+
+ 10
+
+
+ 100
+
+
+ 20
+
+
+ 20
+
+
+ Qt::Horizontal
+
+
+ QSlider::TicksBelow
+
+
+ 10
+
+
+
+ -
+
+
-
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Parent Subdivisons
+
+
+
+ -
+
+
+ 10
+
+
+
+ -
+
+
+ Draw Parent
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Child Subdivisons
+
+
+
+ -
+
+
+ 1
+
+
+ 10
+
+
+
+ -
+
+
+ Draw Wireframe
+
+
+
+
+
+
+
+ -
+
+
+ Scale
+
+
+
+ -
+
+
+ 10
+
+
+ 100
+
+
+ 20
+
+
+ 20
+
+
+ Qt::Horizontal
+
+
+ QSlider::TicksBelow
+
+
+ 10
+
+
+
+ -
+
+
-
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Parent Subdivisons
+
+
+
+ -
+
+
+ 10
+
+
+
+ -
+
+
+ Draw Parent
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Child Subdivisons
+
+
+
+ -
+
+
+ 1
+
+
+ 10
+
+
+
+ -
+
+
+ Draw Wireframe
+
+
+
+
+
+
+
+ -
+
+
+ Scale
+
+
+
+ -
+
+
+ 10
+
+
+ 100
+
+
+ 20
+
+
+ 20
+
+
+ Qt::Horizontal
+
+
+ QSlider::TicksBelow
+
+
+ 10
+
+
+
+ -
+
+
-
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Parent Subdivisons
+
+
+
+ -
+
+
+ 10
+
+
+
+ -
+
+
+ Draw Parent
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Child Subdivisons
+
+
+
+ -
+
+
+ 1
+
+
+ 10
+
+
+
+ -
+
+
+ Draw Wireframe
+
+
+
+
+
+
+
+ -
+
+
+ Scale
+
+
+
+ -
+
+
+ 10
+
+
+ 100
+
+
+ 20
+
+
+ 20
+
+
+ Qt::Horizontal
+
+
+ QSlider::TicksBelow
+
+
+ 10
+
+
+
+ -
+
+
-
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Parent Subdivisons
+
+
+
+ -
+
+
+ 10
+
+
+
+ -
+
+
+ Draw Parent
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Child Subdivisons
+
+
+
+ -
+
+
+ 1
+
+
+ 10
+
+
+
+ -
+
+
+ Draw Wireframe
+
+
+
+
+
+
+
+ -
+
+
+ Scale
+
+
+
+ -
+
+
+ 10
+
+
+ 100
+
+
+ 20
+
+
+ 20
+
+
+ Qt::Horizontal
+
+
+ QSlider::TicksBelow
+
+
+ 10
+
+
+
+ -
+
+
-
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Parent Subdivisons
+
+
+
+ -
+
+
+ 10
+
+
+
+ -
+
+
+ Draw Parent
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Child Subdivisons
+
+
+
+ -
+
+
+ 1
+
+
+ 10
+
+
+
+ -
+
+
+ Draw Wireframe
+
+
+
+
+
+
+
+ -
+
+
+ Scale
+
+
+
+ -
+
+
+ 10
+
+
+ 100
+
+
+ 20
+
+
+ 20
+
+
+ Qt::Horizontal
+
+
+ QSlider::TicksBelow
+
+
+ 10
+
+
+
+ -
+
+
-
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Parent Subdivisons
+
+
+
+ -
+
+
+ 10
+
+
+
+ -
+
+
+ Draw Parent
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Child Subdivisons
+
+
+
+ -
+
+
+ 1
+
+
+ 10
+
+
+
+ -
+
+
+ Draw Wireframe
+
+
+
+
+
+
+
+ -
+
+
+ Scale
+
+
+
+ -
+
+
+ 10
+
+
+ 100
+
+
+ 20
+
+
+ 20
+
+
+ Qt::Horizontal
+
+
+ QSlider::TicksBelow
+
+
+ 10
+
+
+
+ -
+
+
-
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Parent Subdivisons
+
+
+
+ -
+
+
+ 10
+
+
+
+ -
+
+
+ Draw Parent
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Child Subdivisons
+
+
+
+ -
+
+
+ 1
+
+
+ 10
+
+
+
+ -
+
+
+ Draw Wireframe
+
+
+
+
+
+
+
+ -
+
+
+ Scale
+
+
+
+ -
+
+
+ 10
+
+
+ 100
+
+
+ 20
+
+
+ 20
+
+
+ Qt::Horizontal
+
+
+ QSlider::TicksBelow
+
+
+ 10
+
+
+
+ -
+
+
-
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Parent Subdivisons
+
+
+
+ -
+
+
+ 10
+
+
+
+ -
+
+
+ Draw Parent
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Child Subdivisons
+
+
+
+ -
+
+
+ 1
+
+
+ 10
+
+
+
+ -
+
+
+ Draw Wireframe
+
+
+
+
+
+
+
+ -
+
+
+ Scale
+
+
+
+ -
+
+
+ 10
+
+
+ 100
+
+
+ 20
+
+
+ 20
+
+
+ Qt::Horizontal
+
+
+ QSlider::TicksBelow
+
+
+ 10
+
+
+
+ -
+
+
-
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Parent Subdivisons
+
+
+
+ -
+
+
+ 10
+
+
+
+ -
+
+
+ Draw Parent
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Child Subdivisons
+
+
+
+ -
+
+
+ 1
+
+
+ 10
+
+
+
+ -
+
+
+ Draw Wireframe
+
+
+
+
+
+
+
+ -
+
+
+ Scale
+
+
+
+ -
+
+
+ 10
+
+
+ 100
+
+
+ 20
+
+
+ 20
+
+
+ Qt::Horizontal
+
+
+ QSlider::TicksBelow
+
+
+ 10
+
+
+
+ -
+
+
-
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Parent Subdivisons
+
+
+
+ -
+
+
+ 10
+
+
+
+ -
+
+
+ Draw Parent
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ Child Subdivisons
+
+
+
+ -
+
+
+ 1
+
+
+ 10
+
+
+
+ -
+
+
+ Draw Wireframe
+
+
+
+
+
+
+
+ -
+
+
+ Scale
+
+
+
+ -
+
+
+ 10
+
+
+ 100
+
+
+ 20
+
+
+ 20
+
+
+ Qt::Horizontal
+
+
+ QSlider::TicksBelow
+
+
+ 10
+
+
+