summaryrefslogtreecommitdiff
path: root/src/glview.cc
diff options
context:
space:
mode:
authorDon Bright <hugh.m.bright@gmail.com>2012-05-28 16:48:46 (GMT)
committerDon Bright <hugh.m.bright@gmail.com>2012-05-28 16:48:46 (GMT)
commitdd2002a81673b3875ce8c4e8a61cb10278c4eb03 (patch)
tree7aaadf1c9b12cd37a7a913d3e76256f6406fa939 /src/glview.cc
parent4381762f5aa2e6a56258618e585e1510ead88684 (diff)
parent67eb2ebe90447e966dc1e08b91c43d937c521583 (diff)
Tidy up code. Generate proper test png images. Merge branch 'master' into caliston1.
Conflicts: src/PolySetCGALEvaluator.cc
Diffstat (limited to 'src/glview.cc')
-rw-r--r--src/glview.cc27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/glview.cc b/src/glview.cc
index 0f9ec5b..aa2e746 100644
--- a/src/glview.cc
+++ b/src/glview.cc
@@ -393,8 +393,6 @@ void GLView::paintGL()
glRotated(object_rot_y, 0.0, 1.0, 0.0);
glRotated(object_rot_z, 0.0, 0.0, 1.0);
- glTranslated(object_trans_x, object_trans_y, object_trans_z);
-
// FIXME: Crosshairs and axes are lighted, this doesn't make sense and causes them
// to change color based on view orientation.
if (showcrosshairs)
@@ -412,6 +410,8 @@ void GLView::paintGL()
glEnd();
}
+ glTranslated(object_trans_x, object_trans_y, object_trans_z);
+
// Large gray axis cross inline with the model
// FIXME: This is always gray - adjust color to keep contrast with background
if (showaxes)
@@ -589,14 +589,24 @@ void GLView::mouseMoveEvent(QMouseEvent *event)
normalizeAngle(object_rot_y);
normalizeAngle(object_rot_z);
} else {
- // Right button pans
- // Shift-right zooms
+ // Right button pans in the xz plane
+ // Middle button pans in the xy plane
+ // Shift-right and Shift-middle zooms
if ((QApplication::keyboardModifiers() & Qt::ShiftModifier) != 0) {
viewer_distance += (GLdouble)dy;
} else {
double mx = +(dx) * viewer_distance/1000;
- double my = -(dy) * viewer_distance/1000;
+ double mz = -(dy) * viewer_distance/1000;
+
+ double my = 0;
+ if (event->buttons() & Qt::MiddleButton) {
+ my = mz;
+ mz = 0;
+ // actually lock the x-position
+ // (turns out to be easier to use than xy panning)
+ mx = 0;
+ }
Matrix3d aax, aay, aaz, tm3;
aax = Eigen::AngleAxisd(-(object_rot_x/180) * M_PI, Vector3d::UnitX());
@@ -612,15 +622,10 @@ void GLView::mouseMoveEvent(QMouseEvent *event)
Matrix4d vec;
vec <<
0, 0, 0, mx,
- 0, 0, 0, 0,
0, 0, 0, my,
+ 0, 0, 0, mz,
0, 0, 0, 1
;
- if ((QApplication::keyboardModifiers() & Qt::ShiftModifier) != 0) {
- vec(0,3) = 0;
- vec(1,3) = my;
- vec(2,3) = 0;
- }
tm = tm * vec;
object_trans_x += tm(0,3);
object_trans_y += tm(1,3);
contact: Jan Huwald // Impressum