Stellarium 0.15.2
MilkyWay.hpp
1 /*
2  * Stellarium
3  * Copyright (C) 2002 Fabien Chereau
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
18  */
19 
20 #ifndef _MILKYWAY_HPP_
21 #define _MILKYWAY_HPP_
22 
23 #include "StelModule.hpp"
24 #include "VecMath.hpp"
25 #include "StelTextureTypes.hpp"
26 
29 class MilkyWay : public StelModule
30 {
31  Q_OBJECT
32  Q_PROPERTY(bool flagMilkyWayDisplayed
33  READ getFlagShow
34  WRITE setFlagShow
35  NOTIFY milkyWayDisplayedChanged)
36  Q_PROPERTY(double intensity
37  READ getIntensity
38  WRITE setIntensity
39  NOTIFY intensityChanged)
40  Q_PROPERTY(Vec3f color
41  READ getColor
42  WRITE setColor
43  NOTIFY colorChanged)
44 public:
45  MilkyWay();
46  virtual ~MilkyWay();
47 
49  // Methods defined in the StelModule class
53  virtual void init();
54 
56  virtual void draw(StelCore* core);
57 
60  virtual void update(double deltaTime);
61 
64  virtual double getCallOrder(StelModuleActionName actionName) const;
65 
67  // Setter and getters
68 public slots:
70  double getIntensity() const {return intensity;}
72  void setIntensity(double aintensity) {if(aintensity!=intensity){ intensity = aintensity; emit intensityChanged(intensity); }}
73 
75  Vec3f getColor() const {return color;}
82  void setColor(const Vec3f& c) {if (c!=color) { color=c; emit colorChanged(c);}}
83 
85  void setFlagShow(bool b);
87  bool getFlagShow(void) const;
88 
89 signals:
90  void milkyWayDisplayedChanged(const bool displayed);
91  void intensityChanged(double intensity);
92  void colorChanged(Vec3f color);
93 
94 private:
95  StelTextureSP tex;
96  Vec3f color; // global color
97  double intensity;
98  class LinearFader* fader;
99 
100  struct StelVertexArray* vertexArray;
101 };
102 
103 #endif // _MILKYWAY_HPP_
Vec3f getColor() const
Get the color used for rendering the Milky Way. It is modulated by intensity, light pollution and atm...
Definition: MilkyWay.hpp:75
bool getFlagShow(void) const
Gets whether the Milky Way is displayed.
Implementation of StelFader which implements a linear transition.
Definition: StelFader.hpp:77
Define the StelTextureSP type.
Main class for Stellarium core processing.
Definition: StelCore.hpp:48
void setColor(const Vec3f &c)
Sets the color to use for rendering the Milky Way.
Definition: MilkyWay.hpp:82
double getIntensity() const
Get Milky Way intensity.
Definition: MilkyWay.hpp:70
virtual void init()
Initialize the class.
void setFlagShow(bool b)
Sets whether to show the Milky Way.
StelModuleActionName
Define the possible action for which an order is defined.
Definition: StelModule.hpp:121
virtual double getCallOrder(StelModuleActionName actionName) const
actionDraw returns 1 (because this is background, very early drawing).
virtual void update(double deltaTime)
Update and time-dependent state.
Manages the displaying of the Milky Way.
Definition: MilkyWay.hpp:29
void setIntensity(double aintensity)
Set Milky Way intensity. Default value: 1.
Definition: MilkyWay.hpp:72
QSharedPointer< StelTexture > StelTextureSP
Use shared pointer to simplify memory managment.
This is the common base class for all the main components of stellarium.
Definition: StelModule.hpp:49
virtual void draw(StelCore *core)
Draw the Milky Way.