Skip to content
Snippets Groups Projects
Select Git revision
  • a48d08b7cd7875974186fde7b68fd0a25403ed03
  • master default
  • mingw_gcc44
  • release_ABP1_012
  • release_ABP1_008
  • release_ABP1_006
  • release_ABP1_007
  • release_ABP1_005
  • release_ABP1_004
  • release_ABP1_003
  • pre_release_0.15
  • release_ABP1_001
  • release_ABP1_002
  • pre_release_0.13
  • pre_release_0.14
  • pre_release_0.11
  • pre_release_0.12
  • pre_release_0.10
  • pre_release_0.09
  • pre_release_0.08
20 results

build.sh

Blame
  • Forked from einsteinathome / graphicsframework
    Source project has a limited visibility.
    pulsaranimationwidget.h 2.97 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>
    
    #define PI 3.14159265
    
    class PulsarAnimationWidget : public QGLWidget
    {
    	Q_OBJECT
    
    public:
    	PulsarAnimationWidget(QWidget *parent);
    	virtual ~PulsarAnimationWidget();
    
    	void setFramePerSecond(const unsigned int fps);
    	void setPulsarSpinFrequency(const float frequency);
    	void setOrbitRadius(const float radius);
    	void setOrbitFrequency(const float frequency);
    
    public slots:
    	void runAnimation();
    	void pauseAnimation();
    	void stopAnimation();
    
    	void updateFrame();
    	void updatePulsarSpin();
    	void updateOrbit();
    
    protected:
        void initializeGL();
        void resizeGL(int w, int h);
        void paintGL();
    
        void mouseMoveEvent(QMouseEvent *event);
        void mouseReleaseEvent(QMouseEvent *event);
    
        void updateCameraPosition(const int angleH, const int angleV, const float zoom);
    
        QTimer m_frameTimer;
        QTimer m_pulsarSpinTimer;
        QTimer m_orbitTimer;
    
    	GLUquadricObj *m_quadricPulsar;
    	GLUquadricObj *m_quadricPulsarCone1;
    	GLUquadricObj *m_quadricPulsarCone2;
    
    	int m_framesPerSecond;
    
    	float m_pulsarSpinFrequency;
    	float m_pulsarRotationAngle;
    
    	float m_orbitRadius;
    	float m_orbitFrequency;
    	float m_orbitRotationAngle;
    
    	int m_mouseLastX;
    	int m_mouseLastY;
    	int m_mouseAngleH;
    	int m_mouseAngleV;
    	float m_cameraZoom;
    	float m_cameraZoomLBound;
    	float m_cameraPosX;
    	float m_cameraPosY;
    	float m_cameraPosZ;
    };
    
    #endif /* PULSARANIMATIONWIDGET_H_ */