correctly.
/* sun direction */
/* static GLfloat sun_vec[4] = {1.0, 0.0, 0.0, 0.0 }; */
-/* if the 4th field is 0.0, this specifies a direction ... */
-/* clear color (sky) */
-GLfloat fgClearColor[4] = {0.60, 0.60, 0.90, 1.0};
/* fog color */
static GLfloat fgFogColor[4] = {0.65, 0.65, 0.85, 1.0};
/* glFogf (GL_FOG_DENSITY, w->visibility); */
/* glHint (GL_FOG_HINT, GL_FASTEST); */
- glClearColor(fgClearColor[0], fgClearColor[1], fgClearColor[2],
- fgClearColor[3]);
+ /* initial screen color */
+ glClearColor(0.0, 0.0, 0.0, 1.0);
}
struct fgVIEW *v;
double x_2, x_4, x_8, x_10;
- double ambient, diffuse, sky;
- GLfloat color[4] = { 1.0, 1.0, 0.50, 1.0 };
- /* GLfloat amb[3], diff[3], fog[4], clear[4]; */
+ double ambient, diffuse, sky_brightness;
+ /* if the 4th field is 0.0, this specifies a direction ... */
+ /* clear color (sky) */
+ GLfloat sky_color[4] = {0.60, 0.60, 0.90, 1.0};
+ GLfloat white[4] = { 1.0, 1.0, 1.0, 1.0 };
f = ¤t_aircraft.flight;
l = &cur_light_params;
/* Tell GL we are about to modify the projection parameters */
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- gluPerspective(60.0, 1.0/win_ratio, 1.0, 200000.0);
+ gluPerspective(55.0, 1.0/win_ratio, 1.0, 200000.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
diffuse = ambient;
- sky = 0.85 * pow(1.2, -x_8 / 20.0) + 0.15;
+ sky_brightness = 0.85 * pow(1.2, -x_8 / 20.0) + 0.15;
- /* sky = 0.15; */ /* to force a dark sky (for testing) */
+ /* sky_brightness = 0.15; */ /* to force a dark sky (for testing) */
if ( ambient < 0.1 ) { ambient = 0.1; }
if ( diffuse < 0.0 ) { diffuse = 0.0; }
- if ( sky < 0.0 ) { sky = 0.0; }
+ if ( sky_brightness < 0.0 ) { sky_brightness = 0.0; }
- l->scene_ambient[0] = color[0] * ambient;
- l->scene_ambient[1] = color[1] * ambient;
- l->scene_ambient[2] = color[2] * ambient;
+ l->scene_ambient[0] = white[0] * ambient;
+ l->scene_ambient[1] = white[1] * ambient;
+ l->scene_ambient[2] = white[2] * ambient;
- l->scene_diffuse[0] = color[0] * diffuse;
- l->scene_diffuse[1] = color[1] * diffuse;
- l->scene_diffuse[2] = color[2] * diffuse;
+ l->scene_diffuse[0] = white[0] * diffuse;
+ l->scene_diffuse[1] = white[1] * diffuse;
+ l->scene_diffuse[2] = white[2] * diffuse;
/* set lighting parameters */
glLightfv(GL_LIGHT0, GL_AMBIENT, l->scene_ambient );
glFogfv (GL_FOG_COLOR, l->scene_fog);
/* set sky color */
- l->scene_clear[0] = fgClearColor[0] * sky;
- l->scene_clear[1] = fgClearColor[1] * sky;
- l->scene_clear[2] = fgClearColor[2] * sky;
- l->scene_clear[3] = fgClearColor[3];
+ l->scene_clear[0] = sky_color[0] * sky_brightness;
+ l->scene_clear[1] = sky_color[1] * sky_brightness;
+ l->scene_clear[2] = sky_color[2] * sky_brightness;
+ l->scene_clear[3] = sky_color[3];
+
glClearColor(l->scene_clear[0], l->scene_clear[1],
l->scene_clear[2], l->scene_clear[3]);
}
/* $Log$
-/* Revision 1.28 1997/12/10 22:37:45 curt
-/* Prepended "fg" on the name of all global structures that didn't have it yet.
-/* i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+/* Revision 1.29 1997/12/11 04:43:54 curt
+/* Fixed sun vector and lighting problems. I thing the moon is now lit
+/* correctly.
/*
+ * Revision 1.28 1997/12/10 22:37:45 curt
+ * Prepended "fg" on the name of all global structures that didn't have it yet.
+ * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+ *
* Revision 1.27 1997/12/09 05:11:54 curt
* Working on tweaking lighting.
*
FG_Longitude = ( -398391.28 / 3600.0 ) * DEG_TO_RAD;
FG_Latitude = ( 120070.41 / 3600.0 ) * DEG_TO_RAD;
FG_Altitude = FG_Runway_altitude + 3.758099;
- FG_Altitude = 10000;
/* Initial Position north of the city of Globe */
/* FG_Longitude = ( -398673.28 / 3600.0 ) * DEG_TO_RAD; */
/* FG_Latitude = ( 120625.64 / 3600.0 ) * DEG_TO_RAD; */
+ FG_Longitude = ( -397867.44 / 3600.0 ) * DEG_TO_RAD;
+ FG_Latitude = ( 119548.21 / 3600.0 ) * DEG_TO_RAD;
/* FG_Altitude = 0.0 + 3.758099; */
/* Initial Position: 10125 Jewell St. NE */
/* A random test position */
/* FG_Longitude = ( 88128.00 / 3600.0 ) * DEG_TO_RAD; */
/* FG_Latitude = ( 93312.00 / 3600.0 ) * DEG_TO_RAD; */
+ FG_Runway_altitude = 4500.0;
+ FG_Altitude = FG_Runway_altitude + 3.758099;
printf("Initial position is: (%.4f, %.4f, %.2f)\n",
FG_Longitude * RAD_TO_DEG, FG_Latitude * RAD_TO_DEG,
/* Initial Orientation */
FG_Phi = -2.658474E-06;
FG_Theta = 7.401790E-03;
- FG_Psi = 270.0 * DEG_TO_RAD;
+ /* FG_Psi = 270.0 * DEG_TO_RAD; */
+ FG_Psi = 258.0 * DEG_TO_RAD;
/* FG_Psi = 0.0 * DEG_TO_RAD; */
/* Initial Angular B rates */
/* $Log$
-/* Revision 1.14 1997/12/10 22:37:47 curt
-/* Prepended "fg" on the name of all global structures that didn't have it yet.
-/* i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+/* Revision 1.15 1997/12/11 04:43:55 curt
+/* Fixed sun vector and lighting problems. I thing the moon is now lit
+/* correctly.
/*
+ * Revision 1.14 1997/12/10 22:37:47 curt
+ * Prepended "fg" on the name of all global structures that didn't have it yet.
+ * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+ *
* Revision 1.13 1997/11/25 19:25:32 curt
* Changes to integrate Durk's moon/sun code updates + clean up.
*
/* Disable fog effects */
glDisable( GL_FOG );
- /* reverse light direction so the moon is displayed properly */
- glLightfv( GL_LIGHT0, GL_POSITION, l->sun_vec_inv );
-
glPushMatrix();
/* Translate to view position */
/* $Log$
-/* Revision 1.3 1997/12/10 22:37:49 curt
-/* Prepended "fg" on the name of all global structures that didn't have it yet.
-/* i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+/* Revision 1.4 1997/12/11 04:43:56 curt
+/* Fixed sun vector and lighting problems. I thing the moon is now lit
+/* correctly.
/*
+ * Revision 1.3 1997/12/10 22:37:49 curt
+ * Prepended "fg" on the name of all global structures that didn't have it yet.
+ * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+ *
* Revision 1.2 1997/12/09 04:25:33 curt
* Working on adding a global lighting params structure.
*
extern float xMoon, yMoon, zMoon, xSun, ySun, zSun;
extern GLint moon, sun;
extern GLint stars[FG_STAR_LEVELS];
-extern GLfloat fgClearColor[4];
/* Initialize Astronomical Objects */
/* $Log$
-/* Revision 1.1 1997/11/25 23:20:23 curt
-/* Initial revision.
+/* Revision 1.2 1997/12/11 04:43:56 curt
+/* Fixed sun vector and lighting problems. I thing the moon is now lit
+/* correctly.
/*
+ * Revision 1.1 1997/11/25 23:20:23 curt
+ * Initial revision.
+ *
*/
struct fgTIME t);
extern struct OrbElements pltOrbElements[9];
-extern GLfloat fgClearColor[4];
#endif /* _MOON_H_ */
/* $Log$
-/* Revision 1.3 1997/11/25 19:25:35 curt
-/* Changes to integrate Durk's moon/sun code updates + clean up.
+/* Revision 1.4 1997/12/11 04:43:56 curt
+/* Fixed sun vector and lighting problems. I thing the moon is now lit
+/* correctly.
/*
+ * Revision 1.3 1997/11/25 19:25:35 curt
+ * Changes to integrate Durk's moon/sun code updates + clean up.
+ *
* Revision 1.2 1997/10/25 03:24:23 curt
* Incorporated sun, moon, and star positioning code contributed by Durk Talsma.
*
struct SunPos fgCalcSunPos(struct OrbElements sunParams);
extern struct OrbElements pltOrbElements[9];
-extern GLfloat fgClearColor[4];
/* Initialize the Sun */
void fgSunInit();
/* $Log$
-/* Revision 1.2 1997/11/25 19:25:39 curt
-/* Changes to integrate Durk's moon/sun code updates + clean up.
+/* Revision 1.3 1997/12/11 04:43:56 curt
+/* Fixed sun vector and lighting problems. I thing the moon is now lit
+/* correctly.
/*
+ * Revision 1.2 1997/11/25 19:25:39 curt
+ * Changes to integrate Durk's moon/sun code updates + clean up.
+ *
* Revision 1.1 1997/10/25 03:16:12 curt
* Initial revision of code contributed by Durk Talsma.
*
#---------------------------------------------------------------------------
VERSION_MAJOR = 0
-VERSION_MINOR = 16
+VERSION_MINOR = 17
VERSION = $(VERSION_MAJOR).$(VERSION_MINOR)
#---------------------------------------------------------------------------
# $Log$
+# Revision 1.22 1997/12/11 04:43:53 curt
+# Fixed sun vector and lighting problems. I thing the moon is now lit
+# correctly.
+#
# Revision 1.21 1997/12/10 01:19:42 curt
# Tweaks for verion 0.15 release.
#
static long int warp = 0;
/* get current Unix calendar time (in seconds) */
- warp += 60;
- /* warp = 0; */
- t->cur_time = time(NULL) + (0) * 60 * 60;
+ warp += 0;
+ /* warp = 60; */
+ t->cur_time = time(NULL) + (12) * 60 * 60;
t->cur_time += warp;
printf("Current Unix calendar time = %ld warp = %ld\n", t->cur_time, warp);
/* $Log$
-/* Revision 1.15 1997/12/10 22:37:54 curt
-/* Prepended "fg" on the name of all global structures that didn't have it yet.
-/* i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+/* Revision 1.16 1997/12/11 04:43:57 curt
+/* Fixed sun vector and lighting problems. I thing the moon is now lit
+/* correctly.
/*
+ * Revision 1.15 1997/12/10 22:37:54 curt
+ * Prepended "fg" on the name of all global structures that didn't have it yet.
+ * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+ *
* Revision 1.14 1997/12/10 01:19:52 curt
* Tweaks for verion 0.15 release.
*
/* printf("Geodetic lat = %.5f Geocentric lat = %.5f\n", sun_gd_lat,
t->sun_gc_lat); */
- /* the sun position has to be translated just like everything else */
- l->sun_vec_inv[0] = l->fg_sunpos.x - scenery_center.x;
- l->sun_vec_inv[1] = l->fg_sunpos.y - scenery_center.y;
- l->sun_vec_inv[2] = l->fg_sunpos.z - scenery_center.z;
- MAT3_SCALE_VEC(l->sun_vec, l->sun_vec_inv, -1.0);
+ /* FALSE! (?> the sun position has to be translated just like
+ * everything else */
+ /* l->sun_vec_inv[0] = l->fg_sunpos.x - scenery_center.x; */
+ /* l->sun_vec_inv[1] = l->fg_sunpos.y - scenery_center.y; */
+ /* l->sun_vec_inv[2] = l->fg_sunpos.z - scenery_center.z; */
+ /* MAT3_SCALE_VEC(l->sun_vec, l->sun_vec_inv, -1.0); */
+
+ /* I think this will work better for generating the sun light vector */
+ l->sun_vec[0] = l->fg_sunpos.x;
+ l->sun_vec[1] = l->fg_sunpos.y;
+ l->sun_vec[2] = l->fg_sunpos.z;
+ MAT3_NORMALIZE_VEC(l->sun_vec, temp);
+ MAT3_SCALE_VEC(l->sun_vec_inv, l->sun_vec, -1.0);
/* make these are directional light sources only */
l->sun_vec[3] = 0.0;
/* $Log$
-/* Revision 1.15 1997/12/10 22:37:55 curt
-/* Prepended "fg" on the name of all global structures that didn't have it yet.
-/* i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+/* Revision 1.16 1997/12/11 04:43:57 curt
+/* Fixed sun vector and lighting problems. I thing the moon is now lit
+/* correctly.
/*
+ * Revision 1.15 1997/12/10 22:37:55 curt
+ * Prepended "fg" on the name of all global structures that didn't have it yet.
+ * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+ *
* Revision 1.14 1997/12/09 04:25:39 curt
* Working on adding a global lighting params structure.
*
/* Configure some wind */
/* FG_V_north_airmass = 15; */ /* ft/s =~ 10mph */
- w->visibility = 60000.0; /* meters = 60km */
+ w->visibility = 45000.0; /* in meters */
}
/* $Log$
-/* Revision 1.7 1997/12/10 22:37:56 curt
-/* Prepended "fg" on the name of all global structures that didn't have it yet.
-/* i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+/* Revision 1.8 1997/12/11 04:43:58 curt
+/* Fixed sun vector and lighting problems. I thing the moon is now lit
+/* correctly.
/*
+ * Revision 1.7 1997/12/10 22:37:56 curt
+ * Prepended "fg" on the name of all global structures that didn't have it yet.
+ * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
+ *
* Revision 1.6 1997/08/27 03:30:38 curt
* Changed naming scheme of basic shared structures.
*