Select Git revision
pulsaranimationwidget.h
-
Oliver Bock authoredOliver Bock authored
pulsaranimationwidget.h 3.77 KiB
/******************************************************************************
* Copyright (C) 2008 by Oliver Bock *
* oliver.bock[AT]aei.mpg.de *
* *
* This file is part of PulsatingScience. *
* *
* PulsatingScience is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published *
* by the Free Software Foundation, version 3 of the License. *
* *
* PulsatingScience is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with PulsatingScience. If not, see <http://www.gnu.org/licenses/>. *
* *
******************************************************************************/
#ifndef PULSARANIMATIONWIDGET_H_
#define PULSARANIMATIONWIDGET_H_
#include <cmath>
#include <QGLWidget>
#include <QTimer>
#include <QMouseEvent>
#include <QDebug>
#ifdef __APPLE__
#include <OpenGL/glu.h>
#else
#include <GL/glu.h>
#endif
#include "common.h"
#include "plotdata.h"
#define PI 3.14159265
class PulsarAnimationWidget : public QGLWidget
{
Q_OBJECT
public:
PulsarAnimationWidget(QWidget *parent);
virtual ~PulsarAnimationWidget();
void setLHOAngle(const double degrees);
void setLLOAngle(const double degrees);
void setVirgoAngle(const int degrees);
void setSourceIota(const int degrees);
void setSourceInclination(const double length);
void getCameraPosition(double& cameraAngleH, double& cameraAngleV, double& cameraZoom);
void resetCameraPosition(const double angleH, const double angleV, const double zoom);
signals:
void pulseProfileUpdated(const PlotData& data);
private:
void initializeGL();
void resizeGL(int w, int h);
void paintGL();
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void showEvent(QShowEvent *event);
void updateCameraPosition(const double angleH, const double angleV, const double zoom);
void updatePulseProfile();
GLUquadricObj *m_quadricVirgoh;
GLUquadricObj *m_quadricVirgov;
GLUquadricObj *m_quadricSourcePlane;
GLUquadricObj *m_quadricEarth;
GLUquadricObj *m_quadricLLOh;
GLUquadricObj *m_quadricLLOv;
GLUquadricObj *m_quadricSourcePlaneNormal;
GLUquadricObj *m_quadricSourcePlaneNormalCap;
GLUquadricObj *m_quadricSourcePlaneNormalCenter;
GLUquadricObj *m_quadricLHOv;
GLUquadricObj *m_quadricLHOh;
GLuint m_beamTexture;
double m_earthRadius;
double m_LHOAngle;
double m_LLOAngle;
double m_VirgoAngle;
double m_sourceIota;
double m_sourceInclination;
PlotData m_plotData;
bool m_cameraInteraction;
int m_mouseLastX;
int m_mouseLastY;
double m_mouseAngleH;
double m_mouseAngleV;
double m_cameraZoom;
double m_cameraZoomLBound;
double m_cameraZoomUBound;
double m_cameraPosX;
double m_cameraPosY;
double m_cameraPosZ;
static const double deg2rad;
};
#endif /* PULSARANIMATIONWIDGET_H_ */