Stellarium 0.12.3
Meteor.hpp
1 /*
2  * Stellarium
3  * This file Copyright (C) 2004 Robert Spearman
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 _METEOR_HPP_
21 #define _METEOR_HPP_
22 
23 #include "renderer/StelVertexAttribute.hpp"
24 #include "renderer/StelVertexBuffer.hpp"
25 #include "StelProjector.hpp"
26 #include "VecMath.hpp"
27 class StelCore;
28 
29 // all in km - altitudes make up meteor range
30 #define EARTH_RADIUS 6369.f
31 #define HIGH_ALTITUDE 115.f
32 #define LOW_ALTITUDE 70.f
33 #define VISIBLE_RADIUS 457.8f
34 
41 class Meteor
42 {
43 public:
46  Meteor(const StelCore*, double v);
47  virtual ~Meteor();
48 
51  bool update(double deltaTime);
52 
54  void draw(const StelCore* core, StelProjectorP projector, class StelRenderer* renderer);
55 
58  bool isAlive(void);
59 
60 private:
62  struct Vertex
63  {
64  Vec3f position;
65  Vec4f color;
66  Vertex(const Vec3d& pos, const Vec4f& color)
67  : position(Vec3f(pos[0], pos[1], pos[2])), color(color) {}
68  VERTEX_ATTRIBUTES(Vec3f Position, Vec4f Color);
69  };
70 
72  StelVertexBuffer<Vertex>* vertexBuffer;
73 
74  Mat4d mmat; // tranformation matrix to align radiant with earth direction of travel
75  Vec3d obs; // observer position in meteor coord. system
76  Vec3d position; // equatorial coordinate position
77  Vec3d posInternal; // middle of train
78  Vec3d posTrain; // end of train
79  bool train; // point or train visible?
80  double startH; // start height above center of earth
81  double endH; // end height
82  double velocity; // km/s
83  bool alive; // is it still visible?
84  float mag; // Apparent magnitude at head, 0-1
85  float maxMag; // 0-1
86  float absMag; // absolute magnitude
87  float visMag; // visual magnitude at observer
88  double xydistance; // distance in XY plane (orthogonal to meteor path) from observer to meteor
89  double initDist; // initial distance from observer
90  double minDist; // nearest point to observer along path
91  double distMultiplier; // scale magnitude due to changes in distance
92 };
93 
94 
95 #endif // _METEOR_HPP_