diff options
author | Don Bright <hugh.m.bright@gmail.com> | 2013-09-12 00:52:31 (GMT) |
---|---|---|
committer | Don Bright <hugh.m.bright@gmail.com> | 2013-09-12 00:52:31 (GMT) |
commit | ea92d9ce190adf34f48778c39ffaeca9b5a7da13 (patch) | |
tree | d90fc6690d1c15378c86ec8971e25041d09146ad /src | |
parent | b53dde04e2a13c066cfa0c552fe5bd0cdd1b8dbd (diff) |
fix issue #430
Diffstat (limited to 'src')
-rw-r--r-- | src/Camera.h | 13 | ||||
-rw-r--r-- | src/GLView.cc | 2 | ||||
-rw-r--r-- | src/QGLView.cc | 11 | ||||
-rw-r--r-- | src/openscad.cc | 4 |
4 files changed, 25 insertions, 5 deletions
diff --git a/src/Camera.h b/src/Camera.h index dfc71f8..6079672 100644 --- a/src/Camera.h +++ b/src/Camera.h @@ -47,7 +47,8 @@ public: projection = Camera::PERSPECTIVE; } - void setup( std::vector<double> params ) { + void setup( std::vector<double> params ) + { if ( params.size() == 7 ) { type = Camera::GIMBAL; object_trans << params[0], params[1], params[2]; @@ -62,6 +63,16 @@ public: } } + void gimbalDefaultTranslate() + { // match the GUI viewport numbers (historical reasons) + object_trans.x() *= -1; + object_trans.y() *= -1; + object_trans.z() *= -1; + object_rot.x() = fmodf(360 - object_rot.x() + 90, 360 ); + object_rot.y() = fmodf(360 - object_rot.y(), 360); + object_rot.z() = fmodf(360 - object_rot.z(), 360); + } + // Vectorcam Eigen::Vector3d eye; Eigen::Vector3d center; // (aka 'target') diff --git a/src/GLView.cc b/src/GLView.cc index 822a246..1cfe82c 100644 --- a/src/GLView.cc +++ b/src/GLView.cc @@ -460,7 +460,7 @@ void GLView::showAxes() void GLView::showCrosshairs() { - // FIXME: this might not work with Vector camera + // FIXME: this might not work with Vector camera // FIXME: Crosshairs and axes are lighted, this doesn't make sense and causes them // to change color based on view orientation. glLineWidth(3); diff --git a/src/QGLView.cc b/src/QGLView.cc index b23ba8e..8aaeaf2 100644 --- a/src/QGLView.cc +++ b/src/QGLView.cc @@ -147,13 +147,18 @@ void QGLView::resizeGL(int w, int h) void QGLView::paintGL() { - GLView::gimbalCamPaintGL(); + GLView::gimbalCamPaintGL(); if (statusLabel) { QString msg; + + Camera nc( cam ); + nc.gimbalDefaultTranslate(); msg.sprintf("Viewport: translate = [ %.2f %.2f %.2f ], rotate = [ %.2f %.2f %.2f ], distance = %.2f", - -cam.object_trans.x(), -cam.object_trans.y(), -cam.object_trans.z(), - fmodf(360 - cam.object_rot.x() + 90, 360), fmodf(360 - cam.object_rot.y(), 360), fmodf(360 - cam.object_rot.z(), 360), cam.viewer_distance); + nc.object_trans.x(), nc.object_trans.y(), nc.object_trans.z(), + nc.object_rot.x(), nc.object_rot.y(), nc.object_rot.z(), + nc.viewer_distance ); + statusLabel->setText(msg); } diff --git a/src/openscad.cc b/src/openscad.cc index e657cb0..2fe5cde 100644 --- a/src/openscad.cc +++ b/src/openscad.cc @@ -127,6 +127,10 @@ Camera get_camera( po::variables_map vm ) } } + if (camera.type == Camera::GIMBAL) { + camera.gimbalDefaultTranslate(); + } + if (vm.count("projection")) { string proj = vm["projection"].as<string>(); if (proj=="o" || proj=="ortho" || proj=="orthogonal") |