1 /**************************************************************************
4 * Written by Durk Talsma. Started November 1997, for use with the flight
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 * (Log is kept at end of this file)
23 **************************************************************************/
40 #include "../constants.h"
41 #include "../general.h"
43 #include "../Main/views.h"
44 #include "../Aircraft/aircraft.h"
45 #include "../Time/fg_time.h"
47 static double prevUpdate = 0;
50 /* Initialize Astronomical Objects */
55 /* Initialize the orbital elements of sun, moon and mayor planets */
56 fgSolarSystemInit(*t);
58 /* Initialize the Stars subsystem */
61 /* Initialize the sun's position */
64 /* Intialize the moon's position */
69 /* Render Astronomical Objects */
70 void fgAstroRender() {
77 f = ¤t_aircraft.flight;
78 l = &cur_light_params;
82 /* a hack: Force sun and moon position to be updated on an hourly basis */
83 if (((t->gst - prevUpdate) > 1) || (t->gst < prevUpdate)) {
89 /* Disable fog effects */
92 /* set the sun position */
93 /* glLightfv( GL_LIGHT0, GL_POSITION, l->sun_vec_inv );*/
97 /* Translate to view position */
98 glTranslatef( v->view_pos.x, v->view_pos.y, v->view_pos.z );
100 /* Rotate based on gst (side real time) */
101 angle = t->gst * 15.041085; /* should be 15.041085, Curt thought it was 15*/
103 printf("Rotating astro objects by %.2f degrees\n",angle);
105 glRotatef( angle, 0.0, 0.0, -1.0 );
107 /* render the stars */
113 /* render the moon */
118 /* reenable fog effects */
124 /* Revision 1.6 1997/12/12 21:41:27 curt
125 /* More light/material property tweaking ... still a ways off.
127 * Revision 1.5 1997/12/12 19:52:54 curt
128 * Working on lightling and material properties.
130 * Revision 1.4 1997/12/11 04:43:56 curt
131 * Fixed sun vector and lighting problems. I thing the moon is now lit
134 * Revision 1.3 1997/12/10 22:37:49 curt
135 * Prepended "fg" on the name of all global structures that didn't have it yet.
136 * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
138 * Revision 1.2 1997/12/09 04:25:33 curt
139 * Working on adding a global lighting params structure.
141 * Revision 1.1 1997/11/25 23:20:22 curt