Stellarium 0.13.2
Comet.hpp
1 /*
2  * Stellarium
3  * Copyright (C) 2010 Bogdan Marinov
4  * Copyright (C) 2014 Georg Zotti (orbit fix, tails, speedup)
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
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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  */
20 
21 #ifndef _COMET_HPP_
22 #define _COMET_HPP_
23 
24 #include "Planet.hpp"
25 
36 class Comet : public Planet
37 {
38 public:
39  friend class SolarSystem; // Solar System initializes static constants.
40  Comet(const QString& englishName,
41  int flagLighting,
42  double radius,
43  double oblateness,
44  Vec3f color,
45  float albedo,
46  const QString& texMapName,
47  posFuncType _coordFunc,
48  void* userDataPtr,
49  OsculatingFunctType *osculatingFunc,
50  bool closeOrbit,
51  bool hidden,
52  const QString &pTypeStr,
53  float dustTailWidthFact=1.5f,
54  float dustTailLengthFact=0.4f,
55  float dustTailBrightnessFact=1.5f
56  );
57 
58  virtual ~Comet();
59 
60  //Inherited from StelObject via Planet
69  // - Size <- Size of what?
73  virtual QString getInfoString(const StelCore *core, const InfoStringGroup &flags) const;
74  //The Comet class inherits the "Planet" type because the SolarSystem class
75  //was not designed to handle different types of objects.
76  //virtual QString getType() const {return "Comet";}
78  virtual float getVMagnitude(const StelCore* core) const;
79 
85  void setAbsoluteMagnitudeAndSlope(const double magnitude, const double slope);
86 
88  void setSemiMajorAxis(const double value);
89 
91  virtual double getSiderealPeriod() const;
92 
94  virtual void computePosition(const double date);
95 
97  virtual void draw(StelCore* core, float maxMagLabels, const QFont& planetNameFont);
98 
99 private:
102  Vec2f getComaDiameterAndTailLengthAU();
103  void drawTail(StelCore* core, StelProjector::ModelViewTranformP transfo, bool gas);
104  void drawComa(StelCore* core, StelProjector::ModelViewTranformP transfo);
105 
108  void computeComa(const float diameter);
109 
120  void computeParabola(const float parameter, const float topradius, const float zshift, QVector<double>& vertexArr, QVector<float>& texCoordArr, QVector<unsigned short>& indices, const float xOffset=0.0f);
121 
122  double absoluteMagnitude;
123  double slopeParameter;
124  double semiMajorAxis;
125  bool isCometFragment;
126  bool nameIsProvisionalDesignation;
127 
128  //GZ Tail additions
129  Vec2f tailFactors; // result of latest call to getComaDiameterAndTailLengthAU(); Results cached here for infostring. [0]=Coma diameter, [1] gas tail length.
130  bool tailActive;
131  double deltaJDtail;
132  double lastJDtail;
133  Mat4d gasTailRot;
134  Mat4d dustTailRot;
135  float dustTailWidthFactor;
136  float dustTailLengthFactor;
137  float dustTailBrightnessFactor;
138  QVector<double> comaVertexArr;
139  QVector<float> comaTexCoordArr; // --> 2014-08: could also be declared static, but it is filled by StelPainter...
140 
141  // These are to avoid having index arrays for each comet when all are equal.
142  static bool createTailIndices;
143  static bool createTailTextureCoords;
144 
145  QVector<double> gastailVertexArr; // computed frequently, describes parabolic shape (along z axis) of gas tail.
146  QVector<double> dusttailVertexArr; // computed frequently, describes parabolic shape (along z axis) of dust tail.
147  static QVector<float> tailTexCoordArr; // computed only once for all comets!
148  static QVector<unsigned short> tailIndices; // computed only once for all comets!
149  static StelTextureSP comaTexture;
150  static StelTextureSP tailTexture; // it seems not really necessary to have different textures. gas tail is just painted blue.
151 };
152 
153 #endif //_COMET_HPP_
virtual void computePosition(const double date)
GZ: override from Planet: extend with tail details.
virtual float getVMagnitude(const StelCore *core) const
virtual QString getInfoString(const StelCore *core, const InfoStringGroup &flags) const
Get a string with data about the Comet.
virtual void draw(StelCore *core, float maxMagLabels, const QFont &planetNameFont)
re-implementation of Planet's draw()
Main class for Stellarium core processing.
Definition: StelCore.hpp:46
This StelObjectModule derivative is used to model SolarSystem bodies.
Definition: SolarSystem.hpp:46
Definition: Comet.hpp:36
void setAbsoluteMagnitudeAndSlope(const double magnitude, const double slope)
sets absolute magnitude and slope parameter.
virtual double getSiderealPeriod() const
get sidereal period for comet, days, or returns 0 if not possible (paraboloid, hyperboloid orbit) ...
QSharedPointer< ModelViewTranform > ModelViewTranformP
Shared pointer on a ModelViewTranform instance (implement reference counting)
QSharedPointer< StelTexture > StelTextureSP
Use shared pointer to simplify memory managment.
void setSemiMajorAxis(const double value)
set value for semi-major axis in AU