Commit e33b9c89 authored by Oliver Bock's avatar Oliver Bock

Changed camera position and "zoom"

* Reduces perspective effects (e.g. on pulse amplitude)
* Also: added upper zoom boundary and improved lower bound
parent 3cb92d89
...@@ -94,8 +94,9 @@ PulsarAnimationWidget::PulsarAnimationWidget(QWidget *parent) : ...@@ -94,8 +94,9 @@ PulsarAnimationWidget::PulsarAnimationWidget(QWidget *parent) :
// initial view settings // initial view settings
m_mouseAngleH = 90.0; m_mouseAngleH = 90.0;
m_mouseAngleV = 30.0; m_mouseAngleV = 30.0;
m_cameraZoom = 15.0; m_cameraZoom = 150.0;
m_cameraZoomLBound = 2.0; m_cameraZoomLBound = 10.0;
m_cameraZoomUBound = 4500.0;
m_mouseLastX = 0; m_mouseLastX = 0;
m_mouseLastY = 0; m_mouseLastY = 0;
...@@ -235,7 +236,7 @@ void PulsarAnimationWidget::resizeGL(int w, int h) ...@@ -235,7 +236,7 @@ void PulsarAnimationWidget::resizeGL(int w, int h)
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glLoadIdentity(); 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); glMatrixMode(GL_MODELVIEW);
glLoadIdentity(); glLoadIdentity();
...@@ -491,6 +492,7 @@ void PulsarAnimationWidget::mouseMoveEvent(QMouseEvent *event) ...@@ -491,6 +492,7 @@ void PulsarAnimationWidget::mouseMoveEvent(QMouseEvent *event)
if(m_mouseLastY != 0) { if(m_mouseLastY != 0) {
m_cameraZoom -= (m_mouseLastY - event->y()); m_cameraZoom -= (m_mouseLastY - event->y());
m_cameraZoom = m_cameraZoom >= m_cameraZoomLBound ? m_cameraZoom : m_cameraZoomLBound; m_cameraZoom = m_cameraZoom >= m_cameraZoomLBound ? m_cameraZoom : m_cameraZoomLBound;
m_cameraZoom = m_cameraZoom >= m_cameraZoomUBound ? m_cameraZoomUBound : m_cameraZoom;
} }
m_mouseLastY = event->y(); m_mouseLastY = event->y();
......
...@@ -118,6 +118,7 @@ private: ...@@ -118,6 +118,7 @@ private:
int m_mouseAngleV; int m_mouseAngleV;
double m_cameraZoom; double m_cameraZoom;
double m_cameraZoomLBound; double m_cameraZoomLBound;
double m_cameraZoomUBound;
double m_cameraPosX; double m_cameraPosX;
double m_cameraPosY; double m_cameraPosY;
double m_cameraPosZ; double m_cameraPosZ;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment