]> git.mxchange.org Git - simgear.git/blob - simgear/sky/skysun.hxx
Starting to work on an independent sky implimentation that can be used by
[simgear.git] / simgear / sky / skysun.hxx
1 // skysun.hxx -- draw a sun object
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 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.
15 //
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.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
24 //
25 // $Id$
26
27
28 #ifndef _SKYSUN_HXX_
29 #define _SKYSUN_HXX_
30
31
32 #include <plib/ssg.h>
33
34 class FGSkySun {
35
36     // scene graph root for the skysun
37     ssgRoot *skysun;
38
39     ssgSelector *sun_selector;
40     ssgTransform *sun_transform;
41     ssgSimpleState *sun_state;
42     ssgSimpleState *halo_state;
43
44 public:
45
46     // Constructor
47     FGSkySun( void );
48
49     // Destructor
50     ~FGSkySun( void );
51
52     // initialize the sun object and connect it into our scene graph
53     // root
54     bool initialize();
55
56     // repaint the sun colors based on current value of sun_anglein
57     // degrees relative to verticle
58     // 0 degrees = high noon
59     // 90 degrees = sun rise/set
60     // 180 degrees = darkest midnight
61     bool repaint( sgVec3 sky_color, sgVec3 fog_color, double sun_angle );
62
63     // reposition the sun at the specified right ascension and
64     // declination
65     bool reposition( double rightAscension, double declination );
66
67     // Draw the sun
68     bool draw();
69
70     // enable the sun in the scene graph (default)
71     void enable() { sun_selector->select( 1 ); }
72
73     // disable the sun in the scene graph.  The leaf node is still
74     // there, how ever it won't be traversed on the cullandrender
75     // phase.
76     void disable() { sun_selector->select( 0 ); }
77
78 };
79
80
81 #if 0
82 class Star : public CelestialBody
83 {
84 private:
85   //double longitude;  // the sun's true longitude - this is depreciated by
86                        // CelestialBody::lonEcl 
87   double xs, ys;     // the sun's rectangular geocentric coordinates
88   double distance;   // the sun's distance to the earth
89    GLUquadricObj *SunObject;
90   GLuint sun_texid;
91   GLubyte *sun_texbuf;
92
93   void setTexture();
94 public:
95   Star (FGTime *t);
96   ~Star();
97   void updatePosition(FGTime *t);
98   double getM();
99   double getw();
100   //double getLon();
101   double getxs();
102   double getys();
103   double getDistance();
104   void newImage();
105 };
106
107
108
109 inline double Star::getM()
110 {
111   return M;
112 }
113
114 inline double Star::getw()
115 {
116   return w;
117 }
118
119 inline double Star::getxs()
120 {
121   return xs;
122 }
123
124 inline double Star::getys()
125 {
126   return ys;
127 }
128
129 inline double Star::getDistance()
130 {
131   return distance;
132 }
133 #endif
134
135
136 #endif // _SKYSUN_HXX_
137
138
139
140
141
142
143
144
145
146
147
148
149
150