Stellarium  0.90.0
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
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 _COMET_HPP_
22 #define _COMET_HPP_
24 #include "Planet.hpp"
38 class Comet : public Planet
39 {
40 public:
41  friend class SolarSystem; // Solar System initializes static constants.
42  Comet(const QString& englishName,
43  double radius,
44  double oblateness,
45  Vec3f halocolor,
46  float albedo,
47  float roughness,
48  float outgas_intensity,
49  float outgas_falloff,
50  const QString& texMapName,
51  const QString& objModelName,
52  posFuncType _coordFunc,
53  void* orbitPtr,
54  OsculatingFunctType *osculatingFunc,
55  bool closeOrbit,
56  bool hidden,
57  const QString &pTypeStr,
58  float dustTailWidthFact=1.5f,
59  float dustTailLengthFact=0.4f,
60  float dustTailBrightnessFact=1.5f
61  );
63  virtual ~Comet();
65  //Inherited from StelObject via Planet
74  // - Size <- Size of what?
78  virtual QString getInfoString(const StelCore *core, const InfoStringGroup &flags) const;
83  virtual QVariantMap getInfoMap(const StelCore *core) const;
84  //The Comet class inherits the "Planet" type because the SolarSystem class
85  //was not designed to handle different types of objects.
86  //virtual QString getType() const {return "Comet";}
88  virtual float getVMagnitude(const StelCore* core) const;
91  virtual void translateName(const StelTranslator& trans);
92  virtual QString getEnglishName(void) const {return englishName;}
93  virtual QString getNameI18n(void) const {return nameI18;}
94  QString getCommonEnglishName(void) const {return englishName;}
95  QString getCommonNameI18n(void) const {return nameI18;}
102  void setAbsoluteMagnitudeAndSlope(const float magnitude, const float slope);
105  void setSemiMajorAxis(const double value);
108  virtual double getSiderealPeriod() const;
111  virtual void draw(StelCore* core, float maxMagLabels, const QFont& planetNameFont);
113  // re-implementation of Planet's update() to prepare tails (extinction etc). @param deltaTime: ms (since last call)
114  virtual void update(int deltaTime);
116 private:
119  Vec2f getComaDiameterAndTailLengthAU();
120  void drawTail(StelCore* core, StelProjector::ModelViewTranformP transfo, bool gas);
121  void drawComa(StelCore* core, StelProjector::ModelViewTranformP transfo);
125  void computeComa(const float diameter);
137  void computeParabola(const float parameter, const float topradius, const float zshift, QVector<Vec3d>& vertexArr, QVector<float>& texCoordArr, QVector<unsigned short>& indices, const float xOffset=0.0f);
139  float slopeParameter;
140  double semiMajorAxis;
141  bool isCometFragment;
142  bool nameIsProvisionalDesignation;
144  //GZ Tail additions
145  Vec2f tailFactors; // result of latest call to getComaDiameterAndTailLengthAU(); Results cached here for infostring. [0]=Coma diameter, [1] gas tail length.
146  bool tailActive;
147  bool tailBright;
148  double deltaJDEtail;
149  double lastJDEtail;
150  Mat4d gasTailRot;
151  Mat4d dustTailRot;
152  float dustTailWidthFactor;
153  float dustTailLengthFactor;
154  float dustTailBrightnessFactor;
155  QVector<double> comaVertexArr;
156  QVector<float> comaTexCoordArr; // --> 2014-08: could also be declared static, but it is filled by StelPainter...
158  float intensityFovScale; // like for constellations: reduce brightness when zooming in.
159  float intensityMinFov;
160  float intensityMaxFov;
163  // These are to avoid having index arrays for each comet when all are equal.
164  static bool createTailIndices;
165  static bool createTailTextureCoords;
167  QVector<Vec3d> gastailVertexArr; // computed frequently, describes parabolic shape (along z axis) of gas tail.
168  QVector<Vec3d> dusttailVertexArr; // computed frequently, describes parabolic shape (along z axis) of dust tail.
169  QVector<Vec3f> gastailColorArr; // NEW computed for every 5 mins, modulates gas tail brightness for extinction
170  QVector<Vec3f> dusttailColorArr; // NEW computed for every 5 mins, modulates dust tail brightness for extinction
171  static QVector<float> tailTexCoordArr; // computed only once for all comets!
172  static QVector<unsigned short> tailIndices; // computed only once for all comets!
173  static StelTextureSP comaTexture;
174  static StelTextureSP tailTexture; // it seems not really necessary to have different textures. gas tail is just painted blue.
175 };
177 #endif //_COMET_HPP_
virtual void update(double deltaTime)
Update time-varying components.
virtual float getVMagnitude(const StelCore *core) const
Class used to translate strings to any language.
virtual QString getInfoString(const StelCore *core, const InfoStringGroup &flags) const
Get a string with data about the Comet.
virtual QString getEnglishName(void) const
Return object&#39;s name in english.
Definition: Comet.hpp:92
virtual void draw(StelCore *core, float maxMagLabels, const QFont &planetNameFont)
re-implementation of Planet&#39;s draw()
Main class for Stellarium core processing.
Definition: StelCore.hpp:48
void setAbsoluteMagnitudeAndSlope(const float magnitude, const float slope)
sets absolute magnitude and slope parameter.
This StelObjectModule derivative is used to model SolarSystem bodies.
Definition: SolarSystem.hpp:47
Definition: Comet.hpp:38
virtual QVariantMap getInfoMap(const StelCore *core) const
In addition to Planet::getInfoMap(), Comets provides estimates for.
virtual QString getNameI18n(void) const
Return translated object&#39;s name.
Definition: Comet.hpp:93
virtual void translateName(const StelTranslator &trans)
sets the nameI18 property with the appropriate translation.
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