From f711a02a6209ef0774fc82f05a17872b494e8035 Mon Sep 17 00:00:00 2001 From: curt Date: Fri, 12 Dec 1997 19:52:47 +0000 Subject: [PATCH] Working on lightling and material properties. --- Scenery/astro.c | 12 +++++++++--- Scenery/moon.c | 13 ++++++++++--- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/Scenery/astro.c b/Scenery/astro.c index a9f10392..bf5cd5e3 100644 --- a/Scenery/astro.c +++ b/Scenery/astro.c @@ -89,6 +89,9 @@ void fgAstroRender() { /* Disable fog effects */ glDisable( GL_FOG ); + /* set the sun position */ + /* glLightfv( GL_LIGHT0, GL_POSITION, l->sun_vec_inv );*/ + glPushMatrix(); /* Translate to view position */ @@ -118,10 +121,13 @@ void fgAstroRender() { /* $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 {}" diff --git a/Scenery/moon.c b/Scenery/moon.c index d8c82cdd..f9ce58bb 100644 --- a/Scenery/moon.c +++ b/Scenery/moon.c @@ -225,10 +225,18 @@ struct CelestialCoord fgCalculateMoon(struct OrbElements params, 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); @@ -245,7 +253,6 @@ void fgMoonInit() { 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(); @@ -255,13 +262,13 @@ void fgMoonInit() { /* 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); -- 2.39.5