1 // oursun.hxx -- model earth's sun
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 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.
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.
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.
34 #include <simgear/misc/sg_path.hxx>
35 #include <simgear/props/props.hxx>
39 ssgTransform *sun_transform;
40 ssgSimpleState *sun_state;
41 ssgSimpleState *ihalo_state;
42 ssgSimpleState *ohalo_state;
44 ssgColourArray *sun_cl;
45 ssgColourArray *ihalo_cl;
46 ssgColourArray *ohalo_cl;
48 ssgVertexArray *sun_vl;
49 ssgVertexArray *ihalo_vl;
50 ssgVertexArray *ohalo_vl;
52 ssgTexCoordArray *sun_tl;
53 ssgTexCoordArray *ihalo_tl;
54 ssgTexCoordArray *ohalo_tl;
60 double prev_sun_angle;
61 // distance of light traveling through the atmosphere
64 SGPropertyNode *env_node;
74 // return the sun object
75 ssgBranch *build( SGPath path, double sun_size, SGPropertyNode *property_tree_Node );
77 // repaint the sun colors based on current value of sun_anglein
78 // degrees relative to verticle
79 // 0 degrees = high noon
80 // 90 degrees = sun rise/set
81 // 180 degrees = darkest midnight
82 bool repaint( double sun_angle, double new_visibility );
84 // reposition the sun at the specified right ascension and
85 // declination, offset by our current position (p) so that it
86 // appears fixed at a great distance from the viewer. Also add in
87 // an optional rotation (i.e. for the current time of day.)
88 bool reposition( sgVec3 p, double angle,
89 double rightAscension, double declination,
90 double sun_dist, double lat, double alt_asl, double sun_angle );
92 // retrun the current color of the sun
93 inline float *get_color() { return ohalo_cl->get( 0 ); }
95 // return the texture id of the sun halo texture
96 inline GLuint get_texture_id() { return ohalo_state->getTextureHandle(); }
100 #endif // _SG_SUN_HXX_