1 // skysun.hxx -- draw a sun object
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).
8 // Separated out rendering pieces and converted to ssg by Curt Olson,
11 // This program is free software; you can redistribute it and/or
12 // modify it under the terms of the GNU General Public License as
13 // published by the Free Software Foundation; either version 2 of the
14 // License, or (at your option) any later version.
16 // This program is distributed in the hope that it will be useful, but
17 // WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 // General Public License for more details.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
36 // scene graph root for the skysun
39 ssgSelector *sun_selector;
40 ssgTransform *sun_transform;
41 ssgSimpleState *orb_state;
42 ssgSimpleState *halo_state;
46 ssgVertexArray *halo_vl;
47 ssgTexCoordArray *halo_tl;
60 // initialize the sun object and connect it into our scene graph
64 // repaint the sun colors based on current value of sun_anglein
65 // degrees relative to verticle
66 // 0 degrees = high noon
67 // 90 degrees = sun rise/set
68 // 180 degrees = darkest midnight
69 bool repaint( double sun_angle );
71 // reposition the sun at the specified right ascension and
72 // declination, offset by our current position (p) so that it
73 // appears fixed at a great distance from the viewer. Also add in
74 // an optional rotation (i.e. for the current time of day.)
75 bool reposition( sgVec3 p, double angle,
76 double rightAscension, double declination );
81 // enable the sun in the scene graph (default)
82 void enable() { sun_selector->select( 1 ); }
84 // disable the sun in the scene graph. The leaf node is still
85 // there, how ever it won't be traversed on the cullandrender
87 void disable() { sun_selector->select( 0 ); }
93 class Star : public CelestialBody
96 //double longitude; // the sun's true longitude - this is depreciated by
97 // CelestialBody::lonEcl
98 double xs, ys; // the sun's rectangular geocentric coordinates
99 double distance; // the sun's distance to the earth
100 GLUquadricObj *SunObject;
108 void updatePosition(FGTime *t);
114 double getDistance();
120 inline double Star::getM()
125 inline double Star::getw()
130 inline double Star::getxs()
135 inline double Star::getys()
140 inline double Star::getDistance()
147 #endif // _SKYSUN_HXX_