diff --git a/viewer/windows/JFJochViewerReciprocalSpaceWindow.cpp b/viewer/windows/JFJochViewerReciprocalSpaceWindow.cpp index faf4302e..d3b62f45 100644 --- a/viewer/windows/JFJochViewerReciprocalSpaceWindow.cpp +++ b/viewer/windows/JFJochViewerReciprocalSpaceWindow.cpp @@ -101,8 +101,14 @@ void ReciprocalSpaceGLView::initializeGL() { } void ReciprocalSpaceGLView::resizeGL(int w, int h) { + const float aspect = float(w) / float(h ? h : 1); + const float halfHeight = zoom_; + const float halfWidth = halfHeight * aspect; + proj_.setToIdentity(); - proj_.perspective(45.0f, float(w) / float(h ? h : 1), 0.1f, 10000.0f); + proj_.ortho(-halfWidth, halfWidth, + -halfHeight, halfHeight, + -10000.0f, 10000.0f); } QMatrix4x4 ReciprocalSpaceGLView::currentViewMatrix() const { @@ -283,6 +289,7 @@ void ReciprocalSpaceGLView::mouseMoveEvent(QMouseEvent *e) { void ReciprocalSpaceGLView::wheelEvent(QWheelEvent *e) { zoom_ *= (e->angleDelta().y() > 0) ? 0.9f : 1.1f; zoom_ = qBound(1.0f, zoom_, 5000.0f); + resizeGL(width(), height()); update(); } @@ -631,16 +638,6 @@ void JFJochViewerReciprocalSpaceWindow::rebuildGL() { 0.0f, 0.0f, 0.0f }); - } else { - // Faint full reciprocal grid node. - spotVerts.push_back({ - node.x * scene_scale_, - node.y * scene_scale_, - node.z * scene_scale_, - pr, pg, pb, 0.5f, - 0.0f, 0.0f, - 0.0f - }); } } }