to unit length after transformation. See glNormal. */
glEnable( GL_NORMALIZE );
- glLightfv( GL_LIGHT0, GL_POSITION, l->sun_vec );
glEnable( GL_LIGHTING );
glEnable( GL_LIGHT0 );
+ glLightfv( GL_LIGHT0, GL_POSITION, l->sun_vec );
glShadeModel( GL_FLAT ); /* glShadeModel( GL_SMOOTH ); */
struct fgVIEW *v;
double x_2, x_4, x_8, x_10;
- double ambient, diffuse, sky_brightness;
+ double light, 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};
x_8 = x_4 * x_4;
x_10 = x_8 * x_2;
- ambient = 0.4 * pow(1.1, -x_10 / 30.0);
-
- /* diffuse = 0.4 * cos(0.3 * x_2);
- if ( t->sun_angle > FG_PI_2 + 0.05 ) {
- diffuse = 0.0;
- }
- */
-
- diffuse = ambient;
+ light = pow(1.1, -x_10 / 30.0);
+ ambient = 0.3 * light;
+ diffuse = 0.7 * light;
sky_brightness = 0.85 * pow(1.2, -x_8 / 20.0) + 0.15;
/* draw scenery */
fgSceneryRender();
+ /* draw astronomical objects */
+ fgAstroRender();
+
/* display HUD */
if( show_hud )
fgCockpitUpdate();
/* $Log$
-/* 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.30 1997/12/12 19:52:47 curt
+/* Working on lightling and material properties.
/*
+ * 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 {}"
/* 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_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_Runway_altitude = 8500.0;
FG_Altitude = FG_Runway_altitude + 3.758099;
printf("Initial position is: (%.4f, %.4f, %.2f)\n",
/* Initial Orientation */
FG_Phi = -2.658474E-06;
FG_Theta = 7.401790E-03;
- /* FG_Psi = 270.0 * DEG_TO_RAD; */
- FG_Psi = 258.0 * DEG_TO_RAD;
- /* FG_Psi = 0.0 * DEG_TO_RAD; */
+ FG_Psi = 270.0 * DEG_TO_RAD;
/* Initial Angular B rates */
FG_P_body = 7.206685E-05;
/* $Log$
-/* 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.16 1997/12/12 19:52:48 curt
+/* Working on lightling and material properties.
/*
+ * 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 {}"
/* Disable fog effects */
glDisable( GL_FOG );
+ /* set the sun position */
+ /* glLightfv( GL_LIGHT0, GL_POSITION, l->sun_vec_inv );*/
+
glPushMatrix();
/* Translate to view position */
/* $Log$
-/* 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.5 1997/12/12 19:52:54 curt
+/* Working on lightling and material properties.
/*
+ * 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 {}"
void fgMoonInit() {
+ struct fgLIGHT *l;
+ static GLfloat moon_color[4] = { 1.0, 1.0, 1.0, 1.0 };
// int i;
+
+ l = &cur_light_params;
+
moon = glGenLists(1);
glNewList(moon, GL_COMPILE );
+ /* glMaterialfv(GL_FRONT, GL_AMBIENT, l->scene_clear);
+ glMaterialfv(GL_FRONT, GL_DIFFUSE, moon_color); */
+
fgSolarSystemUpdate(&(pltOrbElements[1]), cur_time_params);
moonPos = fgCalculateMoon(pltOrbElements[1], pltOrbElements[0],
cur_time_params);
yMoon = 60000.0 * sin(moonPos.RightAscension) * cos(moonPos.Declination);
zMoon = 60000.0 * sin(moonPos.Declination);
- glColor3f(1.0, 1.0, 1.0);
glutSolidSphere(1.0, 10, 10);
glEndList();
/* Draw the moon */
void fgMoonRender() {
struct fgLIGHT *l;
- GLfloat color[4] = { 1.0, 1.0, 1.0, 1.0 };
+ GLfloat moon_color[4] = { 1.0, 1.0, 1.0, 1.0 };
l = &cur_light_params;
/* set lighting parameters */
glLightfv(GL_LIGHT0, GL_AMBIENT, l->scene_clear );
- glLightfv(GL_LIGHT0, GL_DIFFUSE, color );
+ glLightfv(GL_LIGHT0, GL_DIFFUSE, moon_color );
glPushMatrix();
glTranslatef(xMoon, yMoon, zMoon);
/* Load a .obj file and generate the GL call list */
GLint fgObjLoad(char *path) {
char line[256], winding[256];
- static GLfloat color[4] = { 0.5, 0.5, 0.25, 1.0 };
+ static GLfloat terrain_color[4] = { 0.6, 0.6, 0.25, 1.0 };
+ static GLfloat terrain_ambient[4];
+ static GLfloat terrain_diffuse[4];
double v1[3], v2[3], approx_normal[3], dot_prod, temp;
struct fgCartesianPoint ref;
GLint area;
area = glGenLists(1);
glNewList(area, GL_COMPILE);
- /* glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, color ); */
- glColor3fv(color);
+ for ( i = 0; i < 4; i++ ) {
+ terrain_ambient[i] = terrain_color[i];
+ terrain_diffuse[i] = terrain_color[i];
+ }
+
+ glMaterialfv(GL_FRONT, GL_AMBIENT, terrain_ambient);
+ glMaterialfv(GL_FRONT, GL_DIFFUSE, terrain_diffuse);
first = 1;
ncount = 1;
/* $Log$
-/* Revision 1.8 1997/12/10 01:19:51 curt
-/* Tweaks for verion 0.15 release.
+/* Revision 1.9 1997/12/12 19:52:57 curt
+/* Working on lightling and material properties.
/*
+ * Revision 1.8 1997/12/10 01:19:51 curt
+ * Tweaks for verion 0.15 release.
+ *
* Revision 1.7 1997/12/08 22:51:17 curt
* Enhanced to handle ccw and cw tri-stripe winding. This is a temporary
* admission of defeat. I will eventually go back and get all the stripes
/* Render out the current scene */
void fgSceneryRender() {
glCallList(area_terrain);
-
- fgAstroRender();
}
/* $Log$
-/* Revision 1.25 1997/12/10 22:37:51 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.26 1997/12/12 19:52:58 curt
+/* Working on lightling and material properties.
/*
+ * Revision 1.25 1997/12/10 22:37:51 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.24 1997/12/08 22:51:18 curt
* Enhanced to handle ccw and cw tri-stripe winding. This is a temporary
* admission of defeat. I will eventually go back and get all the stripes
sscanf(front, "%lf,%lf,%lf\n",
&right_ascension, &declination, &magnitude);
+ /*
if ( strcmp(name, "Betelgeuse") == 0 ) {
printf(" *** Marking %s\n", name);
ra_save = right_ascension;
decl_save = declination;
}
+ */
+ /*
if ( strcmp(name, "Alnilam") == 0 ) {
printf(" *** Marking %s\n", name);
ra_save1 = right_ascension;
decl_save1 = declination;
}
+ */
/* scale magnitudes to (0.0 - 1.0) */
magnitude = (0.0 - magnitude) / 5.0 + 1.0;
}
glEnd();
+ /*
glBegin(GL_LINE_LOOP);
glColor3f(1.0, 0.0, 0.0);
glVertex3f( 190000.0 * cos(ra_save-0.2) * cos(decl_save-0.2),
190000.0 * sin(ra_save-0.2) * cos(decl_save+0.2),
190000.0 * sin(decl_save+0.2) );
glEnd();
+ */
+ /*
glBegin(GL_LINE_LOOP);
glColor3f(0.0, 1.0, 0.0);
glVertex3f( 190000.0 * cos(ra_save1-0.2) * cos(decl_save1-0.2),
190000.0 * sin(ra_save1-0.2) * cos(decl_save1+0.2),
190000.0 * sin(decl_save1+0.2) );
glEnd();
+ */
glEndList();
/* $Log$
-/* Revision 1.18 1997/12/10 22:37:52 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.19 1997/12/12 19:53:00 curt
+/* Working on lightling and material properties.
/*
+ * Revision 1.18 1997/12/10 22:37:52 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.17 1997/12/09 04:25:33 curt
* Working on adding a global lighting params structure.
*
static long int warp = 0;
/* get current Unix calendar time (in seconds) */
- warp += 0;
+ warp += 240;
/* warp = 60; */
- t->cur_time = time(NULL) + (12) * 60 * 60;
+ t->cur_time = time(NULL) + (0) * 60 * 60;
t->cur_time += warp;
printf("Current Unix calendar time = %ld warp = %ld\n", t->cur_time, warp);
/* $Log$
-/* 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.17 1997/12/12 19:53:04 curt
+/* Working on lightling and material properties.
/*
+ * 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 {}"