Stellarium 0.13.3
1 /*
2  * Stellarium
3  * Copyright (C) 2002 Fabien Chereau
4  * Copyright (C) 2014 Georg Zotti: ZodiacalLight
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
19  */
21 #ifndef _ZODIACALLIGHT_
22 #define _ZODIACALLIGHT_
24 #include <QVector>
25 #include "StelModule.hpp"
26 #include "VecMath.hpp"
27 #include "StelTextureTypes.hpp"
34 // GZ OCRed and hand-edited the table in Excel, first filling the missing data around the sun with values based on
35 // Leinert 1975: Zodiacal Light - A Measure of the Interplanetary Environment. Space Science Reviews 18, 281-339.
36 // From the combined table, I tried to create a texture. Image editing hides the numbers, so I finally exported the
37 // data (power 0.75) into a 3D surface which I edited in Sketchup: fill the data hole "mountain" with believeable values.
38 // Export to OBJ, extract and mirror vertices. Then, in ArcGIS10,
39 // 3D Analyst Toolbox -> From File -> ASCII 3D to Feature Class
40 // 3D Analyst Toolbox -> Raster Interpolation -> IDW: cell size: 1 (degree), power:2, var.dist., 12points.
41 // Spatial Analyst Tools -> Math -> Power: 1.3333 (to invert the 0.75 above)
42 // Spatial Analyst Tools -> Math -> Log2 (to provide better scaling, matches better with visual impression)
43 // This float32 texture was then exported to a regular 8bit grayscale PNG texture.
44 // It turned out that the original distribution had a quite boxy appearance around the data hole.
45 // I had to do more editing, finally also within the data values, but I think much of the error is in these published data values.
46 // The true values would massively concentrate further around the sun, but a single 8bit texture cannot deliver more dynamic range in brightness.
47 // The current solution matches my own observations in a very dark location in Namibia, May 2014, and photos taken in Libya in March 2006.
49 class ZodiacalLight : public StelModule
50 {
52  Q_PROPERTY(bool flagZodiacalLightDisplayed
53  READ getFlagShow
54  WRITE setFlagShow
55  NOTIFY zodiacalLightDisplayedChanged)
57 public:
58  ZodiacalLight();
59  virtual ~ZodiacalLight();
62  // Methods defined in the StelModule class
66  virtual void init();
69  virtual void draw(StelCore* core);
73  virtual void update(double deltaTime);
76  virtual double getCallOrder(StelModuleActionName actionName) const {Q_UNUSED(actionName); return 6.;}
79  // Setter and getters
80 public slots:
82  double getIntensity() const {return intensity;}
84  void setIntensity(double aintensity) {intensity = aintensity;}
87  Vec3f getColor() const {return color;}
89  void setColor(const Vec3f& c) {color=c;}
92  void setFlagShow(bool b);
94  bool getFlagShow(void) const;
96 signals:
97  void zodiacalLightDisplayedChanged(const bool displayed);
99 private:
100  StelTextureSP tex;
101  Vec3f color; // global color
102  float intensity;
103  class LinearFader* fader;
104  double lastJD; // keep date of last computation. Position will be updated only if far enough away from last computation.
106  struct StelVertexArray* vertexArray;
107  QVector<Vec3d> eclipticalVertices;
108 };
110 #endif // _ZODIACALLIGHT_HPP_
Vec3f getColor() const
Get the color used for rendering the Zodiacal Light.
Implementation of StelFader which implements a linear transition.
Definition: StelFader.hpp:77
Define the StelTextureSP type.
bool getFlagShow(void) const
Gets whether the Zodiacal Light is displayed.
Main class for Stellarium core processing.
Definition: StelCore.hpp:46
Manages the displaying of the Zodiacal Light.
virtual void init()
Initialize the class.
double getIntensity() const
Get Zodiacal Light intensity.
virtual double getCallOrder(StelModuleActionName actionName) const
Used to determine the order in which the various modules are drawn. MilkyWay=1, we use 6...
virtual void update(double deltaTime)
Update and time-dependent state.
Define the possible action for which an order is defined.
Definition: StelModule.hpp:117
void setFlagShow(bool b)
Sets whether to show the Zodiacal Light.
void setColor(const Vec3f &c)
Sets the color to use for rendering the Zodiacal Light.
QSharedPointer< StelTexture > StelTextureSP
Use shared pointer to simplify memory managment.
void setIntensity(double aintensity)
Set Zodiacal Light intensity.
virtual void draw(StelCore *core)
Draw the Zodiacal Light.
This is the common base class for all the main components of stellarium.
Definition: StelModule.hpp:49