light = pow(1.1, -x_10 / 30.0);
ambient = 0.3 * light;
- diffuse = 0.7 * light;
+ diffuse = 0.9 * light;
sky_brightness = 0.85 * pow(1.2, -x_8 / 20.0) + 0.15;
/* $Log$
-/* Revision 1.30 1997/12/12 19:52:47 curt
-/* Working on lightling and material properties.
+/* Revision 1.31 1997/12/12 21:41:25 curt
+/* More light/material property tweaking ... still a ways off.
/*
+ * 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.
LIBS = $(INTERFACE_LIBS) $(GRAPHICS_LIBS) -lm -lfl
-TARGET=fg-$(VERSION)
+TARGET=fg-$(FG_VERSION)
#---------------------------------------------------------------------------
$(TARGET): $(OFILES) $(AFILES)
$(CC) -o $(TARGET) $(OFILES) $(AFILES) $(LIBS)
- $(LN) $(TARGET) fg$(VERSION_MAJOR)
+ $(LN) $(TARGET) fg$(FG_VERSION_MAJOR)
all: $(TARGET)
clean:
rm -f *.o $(TARGET) $(TARGET).exe \
- fg$(VERSION_MAJOR) fg$(VERSION_MAJOR).exe lib*.a *.os2 *~ core
+ fg$(FG_VERSION_MAJOR) fg$(FG_VERSION_MAJOR).exe \
+ lib*.a *.os2 *~ core
#---------------------------------------------------------------------------
#---------------------------------------------------------------------------
# $Log$
+# Revision 1.37 1997/12/12 21:41:26 curt
+# More light/material property tweaking ... still a ways off.
+#
# Revision 1.36 1997/12/10 01:19:47 curt
# Tweaks for verion 0.15 release.
#
/* Initialize the orbital elements of sun, moon and mayor planets */
fgSolarSystemInit(*t);
- /* Intialize the moon's position */
- fgMoonInit();
+ /* Initialize the Stars subsystem */
+ fgStarsInit();
/* Initialize the sun's position */
fgSunInit();
- /* Initialize the Stars subsystem */
- fgStarsInit();
+ /* Intialize the moon's position */
+ fgMoonInit();
}
/* render the stars */
fgStarsRender();
- /* render the moon */
- fgMoonRender();
-
/* render the sun */
fgSunRender();
+ /* render the moon */
+ fgMoonRender();
+
glPopMatrix();
/* reenable fog effects */
/* $Log$
-/* Revision 1.5 1997/12/12 19:52:54 curt
-/* Working on lightling and material properties.
+/* Revision 1.6 1997/12/12 21:41:27 curt
+/* More light/material property tweaking ... still a ways off.
/*
+ * 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.
struct OrbElements sunParams,
struct fgTIME t)
{
- struct CelestialCoord
- result;
-
+ struct CelestialCoord
+ result;
+
double
- eccAnom, ecl, lonecl, latecl, actTime,
+ eccAnom, ecl, lonecl, latecl, actTime,
xv, yv, v, r, xh, yh, zh, xg, yg, zg, xe, ye, ze,
Ls, Lm, D, F;
void fgMoonInit() {
struct fgLIGHT *l;
- static GLfloat moon_color[4] = { 1.0, 1.0, 1.0, 1.0 };
// int i;
l = &cur_light_params;
/* Draw the moon */
void fgMoonRender() {
struct fgLIGHT *l;
+ GLfloat black[4] = { 0.0, 0.0, 0.0, 1.0 };
GLfloat moon_color[4] = { 1.0, 1.0, 1.0, 1.0 };
l = &cur_light_params;
glLightfv(GL_LIGHT0, GL_AMBIENT, l->scene_clear );
glLightfv(GL_LIGHT0, GL_DIFFUSE, moon_color );
+ glMaterialfv(GL_FRONT, GL_AMBIENT, black);
+ glMaterialfv(GL_FRONT, GL_DIFFUSE, moon_color);
+
glPushMatrix();
glTranslatef(xMoon, yMoon, zMoon);
glScalef(1400, 1400, 1400);
- /* glColor3fv(color); */
+ glColor3fv(moon_color);
/* glutSolidSphere(1.0, 25, 25); */
glCallList(moon);
/* Load a .obj file and generate the GL call list */
GLint fgObjLoad(char *path) {
char line[256], winding[256];
- 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);
- 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;
vncount = 1;
/* $Log$
-/* Revision 1.9 1997/12/12 19:52:57 curt
-/* Working on lightling and material properties.
+/* Revision 1.10 1997/12/12 21:41:28 curt
+/* More light/material property tweaking ... still a ways off.
/*
+ * 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.
*
struct CelestialCoord fgCalculatePlanet(struct OrbElements planet,
- struct OrbElements sun,
+ struct OrbElements theSun,
struct fgTIME t)
{
struct CelestialCoord
*/
/* calculate the solar position */
- SolarPosition = fgCalcSunPos(sun);
+ SolarPosition = fgCalcSunPos(theSun);
xg = xh + SolarPosition.xs;
yg = yh + SolarPosition.ys;
zg = zh;
/* $Log$
-/* Revision 1.1 1997/10/25 03:16:10 curt
-/* Initial revision of code contributed by Durk Talsma.
+/* Revision 1.2 1997/12/12 21:41:29 curt
+/* More light/material property tweaking ... still a ways off.
/*
+ * Revision 1.1 1997/10/25 03:16:10 curt
+ * Initial revision of code contributed by Durk Talsma.
+ *
*/
struct CelestialCoord fgCalculatePlanet(struct OrbElements planet,
- struct OrbElements sun,
+ struct OrbElements theSun,
struct fgTIME t);
#endif /* PLANETS_H */
/* $Log$
-/* Revision 1.1 1997/10/25 03:16:11 curt
-/* Initial revision of code contributed by Durk Talsma.
+/* Revision 1.2 1997/12/12 21:41:30 curt
+/* More light/material property tweaking ... still a ways off.
/*
+ * Revision 1.1 1997/10/25 03:16:11 curt
+ * Initial revision of code contributed by Durk Talsma.
+ *
*/
/* Render out the current scene */
void fgSceneryRender() {
+ static GLfloat terrain_color[4] = { 0.4, 0.8, 0.3, 1.0 };
+ static GLfloat terrain_ambient[4];
+ static GLfloat terrain_diffuse[4];
+ int i;
+
+ 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);
+
glCallList(area_terrain);
}
/* $Log$
-/* Revision 1.26 1997/12/12 19:52:58 curt
-/* Working on lightling and material properties.
+/* Revision 1.27 1997/12/12 21:41:30 curt
+/* More light/material property tweaking ... still a ways off.
/*
+ * 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 {}"
#include "orbits.h"
#include "sun.h"
-GLint sun;
+GLint sun_obj;
static struct CelestialCoord sunPos;
{
// int i;
- sun = glGenLists(1);
- glNewList(sun, GL_COMPILE );
+ sun_obj = glGenLists(1);
+ glNewList(sun_obj, GL_COMPILE );
// glBegin( GL_POINTS );
// glEnd();
//glPopMatrix();
- glColor3f(0.85, 0.65, 0.05);
glutSolidSphere(1.0, 10, 10);
glEndList();
glTranslatef(xSun, ySun, zSun);
glScalef(1400, 1400, 1400);
+ glColor3f(0.85, 0.65, 0.05);
+
/* glColor3fv( color ); */
/* glutSolidSphere(1.0, 25, 25); */
- glCallList(sun);
+ glCallList(sun_obj);
glPopMatrix();
/* $Log$
-/* Revision 1.4 1997/12/10 22:37:53 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.5 1997/12/12 21:41:31 curt
+/* More light/material property tweaking ... still a ways off.
/*
+ * Revision 1.4 1997/12/10 22:37:53 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.3 1997/12/09 05:11:56 curt
* Working on tweaking lighting.
*
# on your environment:
#---------------------------------------------------------------------------
+#---------------------------------------------------------------------------
+# Linux/Mesa with the GLUT toolkit
+#
+INTERFACE_FLAGS = -DGLUT
+INTERFACE_LIBS = -lglut
+INTERFACE_FILES = GLUTmain.c GLUTkey.c
+MESA_LIBS = -L/usr/lib/mesa -lMesatk -lMesaaux -lMesaGLU -lMesaGL
+X11_LIBS = -L/usr/X11R6/lib -lXext -lXmu -lXi -lX11
+GRAPHICS_LIBS = $(MESA_LIBS) $(X11_LIBS)
+FG_CFLAGS = $(GLOBAL_CFLAGS)
+#---------------------------------------------------------------------------
+
#---------------------------------------------------------------------------
# SGI IRIX with the GLUT toolkit
# (Surprisingly, this also works on our SunOS 4.x machine with the
#---------------------------------------------------------------------------
#---------------------------------------------------------------------------
-# Linux/Mesa with the GLUT toolkit
+# Sun/Solaris with the GLUT toolkit
#
+# VERSION=\"$(VERSION)\"
# INTERFACE_FLAGS = -DGLUT
# INTERFACE_LIBS = -lglut
# INTERFACE_FILES = GLUTmain.c GLUTkey.c
-# MESA_LIBS = -L/usr/lib/mesa -lMesatk -lMesaaux -lMesaGLU -lMesaGL
-# X11_LIBS = -L/usr/X11R6/lib -lXext -lXmu -lXi -lX11
-# GRAPHICS_LIBS = $(MESA_LIBS) $(X11_LIBS)
+# GRAPHICS_LIBS = -lGLU -lGL -lXext -lXmu -lXi -lX11
# FG_CFLAGS = $(GLOBAL_CFLAGS)
#---------------------------------------------------------------------------
-#---------------------------------------------------------------------------
-# Sun/Solaris with the GLUT toolkit
-#
-VERSION=\"$(VERSION)\"
-INTERFACE_FLAGS = -DGLUT
-INTERFACE_LIBS = -lglut
-INTERFACE_FILES = GLUTmain.c GLUTkey.c
-GRAPHICS_LIBS = -lGLU -lGL -lXext -lXmu -lXi -lX11
-FG_CFLAGS = $(GLOBAL_CFLAGS)
-#---------------------------------------------------------------------------
-
#---------------------------------------------------------------------------
# Cygnus Win32 (gcc based) with a static version of the GLUT toolkit
#
#---------------------------------------------------------------------------
# $Log$
+# Revision 1.24 1997/12/12 21:41:24 curt
+# More light/material property tweaking ... still a ways off.
+#
# Revision 1.23 1997/12/12 19:52:32 curt
# Solaris tweaks.
#
static long int warp = 0;
/* get current Unix calendar time (in seconds) */
- warp += 240;
/* warp = 60; */
- t->cur_time = time(NULL) + (0) * 60 * 60;
+ warp += 0;
+ t->cur_time = time(NULL) + (3) * 60 * 60;
t->cur_time += warp;
printf("Current Unix calendar time = %ld warp = %ld\n", t->cur_time, warp);
/* $Log$
-/* Revision 1.17 1997/12/12 19:53:04 curt
-/* Working on lightling and material properties.
+/* Revision 1.18 1997/12/12 21:41:31 curt
+/* More light/material property tweaking ... still a ways off.
/*
+ * 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.