Skip to content
Snippets Groups Projects
Commit e33b9c89 authored by Oliver Bock's avatar Oliver Bock
Browse files

Changed camera position and "zoom"

* Reduces perspective effects (e.g. on pulse amplitude)
* Also: added upper zoom boundary and improved lower bound
parent 3cb92d89
No related branches found
No related tags found
No related merge requests found
......@@ -94,8 +94,9 @@ PulsarAnimationWidget::PulsarAnimationWidget(QWidget *parent) :
// initial view settings
m_mouseAngleH = 90.0;
m_mouseAngleV = 30.0;
m_cameraZoom = 15.0;
m_cameraZoomLBound = 2.0;
m_cameraZoom = 150.0;
m_cameraZoomLBound = 10.0;
m_cameraZoomUBound = 4500.0;
m_mouseLastX = 0;
m_mouseLastY = 0;
......@@ -235,7 +236,7 @@ void PulsarAnimationWidget::resizeGL(int w, int h)
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0, (GLfloat)w / (GLfloat)h, 0.1, 500.0);
gluPerspective(4.5, (GLfloat)w / (GLfloat)h, 0.1, 5000.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
......@@ -491,6 +492,7 @@ void PulsarAnimationWidget::mouseMoveEvent(QMouseEvent *event)
if(m_mouseLastY != 0) {
m_cameraZoom -= (m_mouseLastY - event->y());
m_cameraZoom = m_cameraZoom >= m_cameraZoomLBound ? m_cameraZoom : m_cameraZoomLBound;
m_cameraZoom = m_cameraZoom >= m_cameraZoomUBound ? m_cameraZoomUBound : m_cameraZoom;
}
m_mouseLastY = event->y();
......
......@@ -118,6 +118,7 @@ private:
int m_mouseAngleV;
double m_cameraZoom;
double m_cameraZoomLBound;
double m_cameraZoomUBound;
double m_cameraPosX;
double m_cameraPosY;
double m_cameraPosZ;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment