]> git.mxchange.org Git - simgear.git/blob - simgear/scene/sky/stars.hxx
Modified Files:
[simgear.git] / simgear / scene / sky / stars.hxx
1 // stars.hxx -- model the stars
2 //
3 // Written by Durk Talsma. Originally started October 1997, for distribution  
4 // with the FlightGear project. Version 2 was written in August and 
5 // September 1998. This code is based upon algorithms and data kindly 
6 // provided by Mr. Paul Schlyter. (pausch@saaf.se). 
7 //
8 // Separated out rendering pieces and converted to ssg by Curt Olson,
9 // March 2000
10 //
11 // This library is free software; you can redistribute it and/or
12 // modify it under the terms of the GNU Library General Public
13 // License as published by the Free Software Foundation; either
14 // version 2 of the License, or (at your option) any later version.
15 //
16 // This library is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19 // Library General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program; if not, write to the Free Software
23 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
24 //
25 // $Id$
26
27
28 #ifndef _SG_STARS_HXX_
29 #define _SG_STARS_HXX_
30
31
32 #include <osg/Array>
33 #include <osg/Node>
34 #include <osg/MatrixTransform>
35
36 #include <simgear/math/SGMath.hxx>
37 #include <simgear/structure/SGReferenced.hxx>
38
39
40 class SGStars : public SGReferenced {
41
42     osg::ref_ptr<osg::MatrixTransform> stars_transform;
43     osg::ref_ptr<osg::Vec4Array> cl;
44
45     int old_phase;              // data for optimization
46
47 public:
48
49     // Constructor
50     SGStars( void );
51
52     // Destructor
53     ~SGStars( void );
54
55     // initialize the stars structure
56     osg::Node* build( int num, const SGVec3d star_data[], double star_dist );
57
58     // repaint the planet magnitudes based on current value of
59     // sun_angle in degrees relative to verticle (so we can make them
60     // relatively dimmer during dawn and dusk
61     // 0 degrees = high noon
62     // 90 degrees = sun rise/set
63     // 180 degrees = darkest midnight
64     bool repaint( double sun_angle, int num, const SGVec3d star_data[] );
65
66     // reposition the stars for the specified time (GST rotation),
67     // offset by our current position (p) so that it appears fixed at
68     // a great distance from the viewer.
69     bool reposition( const SGVec3f& p, double angle );
70 };
71
72
73 #endif // _SG_STARS_HXX_