Stellarium 0.13.0
Comet.hpp
1 /*
2  * Stellarium
3  * Copyright (C) 2010 Bogdan Marinov
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 _COMET_HPP_
21 #define _COMET_HPP_
22 
23 #include "Planet.hpp"
24 
34 class Comet : public Planet
35 {
36 public:
37  Comet(const QString& englishName,
38  int flagLighting,
39  double radius,
40  double oblateness,
41  Vec3f color,
42  float albedo,
43  const QString& texMapName,
44  posFuncType _coordFunc,
45  void* userDataPtr,
46  OsculatingFunctType *osculatingFunc,
47  bool closeOrbit,
48  bool hidden,
49  const QString &pType,
50  float dustTailWidthFact=1.5f,
51  float dustTailLengthFact=0.4f,
52  float dustTailBrightnessFact=1.5f
53  );
54 
55  virtual ~Comet();
56 
57  //Inherited from StelObject via Planet
66  // - Size <- Size of what?
70  virtual QString getInfoString(const StelCore *core, const InfoStringGroup &flags) const;
71  //The Comet class inherits the "Planet" type because the SolarSystem class
72  //was not designed to handle different types of objects.
73  //virtual QString getType() const {return "Comet";}
75  virtual float getVMagnitude(const StelCore* core) const;
76 
82  void setAbsoluteMagnitudeAndSlope(const double magnitude, const double slope);
83 
85  void setSemiMajorAxis(const double value);
86 
88  virtual double getSiderealPeriod() const;
89 
91  virtual void draw(StelCore* core, float maxMagLabels, const QFont& planetNameFont);
92 
93 private:
96  Vec2f getComaDiameterAndTailLengthAU() const;
97  void drawTail(StelCore* core, StelProjector::ModelViewTranformP transfo, bool gas);
98  void drawComa(StelCore* core, StelProjector::ModelViewTranformP transfo);
99 
102  void computeComa(const float diameter);
103 
114  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);
115 
116  double absoluteMagnitude;
117  double slopeParameter;
118  double semiMajorAxis;
119  bool isCometFragment;
120  bool nameIsProvisionalDesignation;
121 
122  //GZ Tail additions
123  float dustTailWidthFactor;
124  float dustTailLengthFactor;
125  float dustTailBrightnessFactor;
126  QVector<double> gastailVertexArr; // computed frequently, describes parabolic shape (along z axis) of gas tail.
127  QVector<double> dusttailVertexArr; // computed frequently, describes parabolic shape (along z axis) of dust tail.
128  QVector<float> gastailTexCoordArr; // computed only once per comet!
129  //QVector<float> dusttailTexCoordArr; // currently identical to gastailVertexArr, has been taken out.
130  QVector<unsigned short> gastailIndices; // computed only once per comet!
131  //QVector<unsigned short> dusttailIndices; // actually no longer required. Re-use gas tail indices.
132  QVector<double> comaVertexArr;
133  QVector<float> comaTexCoordArr;
134  StelTextureSP comaTexture;
135  StelTextureSP gasTailTexture;
136  //StelTextureSP dusttailTexture; // it seems not really necessary to have different textures.
137 };
138 
139 #endif //_COMET_HPP_
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()
Definition: Planet.hpp:85
Main class for Stellarium core processing.
Definition: StelCore.hpp:46
Definition: Comet.hpp:34
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)
Definition: StelProjector.hpp:46
QSharedPointer< StelTexture > StelTextureSP
Use shared pointer to simplify memory managment.
Definition: StelTextureTypes.hpp:34
void setSemiMajorAxis(const double value)
set value for semi-major axis in AU