pulsaranimationwidget.h 2.35 KB
Newer Older
Oliver Bock's avatar
Oliver Bock committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/******************************************************************************
 *   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 <QGLWidget>
Oliver Bock's avatar
Oliver Bock committed
25
#include <QTimer>
Oliver Bock's avatar
Oliver Bock committed
26
27
28
29
30
31
32
33
34

class PulsarAnimationWidget : public QGLWidget
{
	Q_OBJECT

public:
	PulsarAnimationWidget(QWidget *parent);
	virtual ~PulsarAnimationWidget();

Oliver Bock's avatar
Oliver Bock committed
35
36
37
38
39
40
41
42
43
44
45
	void setFramePerSecond(const unsigned int fps);
	void setPulsarSpinFrequency(const float frequency);

public slots:
	void runAnimation();
	void pauseAnimation();
	void stopAnimation();

	void updateFrame();
	void updatePulsarSpin();

Oliver Bock's avatar
Oliver Bock committed
46
47
48
49
50
51
52
protected:

    void initializeGL();

    void resizeGL(int w, int h);

    void paintGL();
Oliver Bock's avatar
Oliver Bock committed
53
54
55
56
57
58
59
60
61
62
63
64

private:
    QTimer m_frameTimer;
    QTimer m_pulsarSpinTimer;

	GLUquadricObj *m_quadricPulsar;
	GLUquadricObj *m_quadricPulsarCone1;
	GLUquadricObj *m_quadricPulsarCone2;

	int m_framesPerSecond;
	float m_pulsarSpinFrequency;
	float m_pulsarRotationAngle;
Oliver Bock's avatar
Oliver Bock committed
65
66
67
};

#endif /* PULSARANIMATIONWIDGET_H_ */