1
0
Fork 0

More light/material property tweaking ... still a ways off.

This commit is contained in:
curt 1997-12-12 21:41:24 +00:00
parent 40f0747fac
commit f92f2a5c29
11 changed files with 107 additions and 70 deletions

View file

@ -176,7 +176,7 @@ static void fgUpdateViewParams() {
light = pow(1.1, -x_10 / 30.0); light = pow(1.1, -x_10 / 30.0);
ambient = 0.3 * light; 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; sky_brightness = 0.85 * pow(1.2, -x_8 / 20.0) + 0.15;
@ -570,9 +570,12 @@ int main( int argc, char *argv[] ) {
/* $Log$ /* $Log$
/* Revision 1.30 1997/12/12 19:52:47 curt /* Revision 1.31 1997/12/12 21:41:25 curt
/* Working on lightling and material properties. /* 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 * Revision 1.29 1997/12/11 04:43:54 curt
* Fixed sun vector and lighting problems. I thing the moon is now lit * Fixed sun vector and lighting problems. I thing the moon is now lit
* correctly. * correctly.

View file

@ -40,7 +40,7 @@ CFLAGS = $(FG_CFLAGS) $(INTERFACE_FLAGS)
LIBS = $(INTERFACE_LIBS) $(GRAPHICS_LIBS) -lm -lfl LIBS = $(INTERFACE_LIBS) $(GRAPHICS_LIBS) -lm -lfl
TARGET=fg-$(VERSION) TARGET=fg-$(FG_VERSION)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@ -49,13 +49,14 @@ TARGET=fg-$(VERSION)
$(TARGET): $(OFILES) $(AFILES) $(TARGET): $(OFILES) $(AFILES)
$(CC) -o $(TARGET) $(OFILES) $(AFILES) $(LIBS) $(CC) -o $(TARGET) $(OFILES) $(AFILES) $(LIBS)
$(LN) $(TARGET) fg$(VERSION_MAJOR) $(LN) $(TARGET) fg$(FG_VERSION_MAJOR)
all: $(TARGET) all: $(TARGET)
clean: clean:
rm -f *.o $(TARGET) $(TARGET).exe \ 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
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
@ -82,6 +83,9 @@ views.o:
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# $Log$ # $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 # Revision 1.36 1997/12/10 01:19:47 curt
# Tweaks for verion 0.15 release. # Tweaks for verion 0.15 release.
# #

View file

@ -55,14 +55,14 @@ void fgAstroInit() {
/* Initialize the orbital elements of sun, moon and mayor planets */ /* Initialize the orbital elements of sun, moon and mayor planets */
fgSolarSystemInit(*t); fgSolarSystemInit(*t);
/* Intialize the moon's position */ /* Initialize the Stars subsystem */
fgMoonInit(); fgStarsInit();
/* Initialize the sun's position */ /* Initialize the sun's position */
fgSunInit(); fgSunInit();
/* Initialize the Stars subsystem */ /* Intialize the moon's position */
fgStarsInit(); fgMoonInit();
} }
@ -107,12 +107,12 @@ void fgAstroRender() {
/* render the stars */ /* render the stars */
fgStarsRender(); fgStarsRender();
/* render the moon */
fgMoonRender();
/* render the sun */ /* render the sun */
fgSunRender(); fgSunRender();
/* render the moon */
fgMoonRender();
glPopMatrix(); glPopMatrix();
/* reenable fog effects */ /* reenable fog effects */
@ -121,9 +121,12 @@ void fgAstroRender() {
/* $Log$ /* $Log$
/* Revision 1.5 1997/12/12 19:52:54 curt /* Revision 1.6 1997/12/12 21:41:27 curt
/* Working on lightling and material properties. /* 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 * Revision 1.4 1997/12/11 04:43:56 curt
* Fixed sun vector and lighting problems. I thing the moon is now lit * Fixed sun vector and lighting problems. I thing the moon is now lit
* correctly. * correctly.

View file

@ -226,7 +226,6 @@ struct CelestialCoord fgCalculateMoon(struct OrbElements params,
void fgMoonInit() { void fgMoonInit() {
struct fgLIGHT *l; struct fgLIGHT *l;
static GLfloat moon_color[4] = { 1.0, 1.0, 1.0, 1.0 };
// int i; // int i;
l = &cur_light_params; l = &cur_light_params;
@ -262,6 +261,7 @@ void fgMoonInit() {
/* Draw the moon */ /* Draw the moon */
void fgMoonRender() { void fgMoonRender() {
struct fgLIGHT *l; 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 }; GLfloat moon_color[4] = { 1.0, 1.0, 1.0, 1.0 };
l = &cur_light_params; l = &cur_light_params;
@ -270,11 +270,14 @@ void fgMoonRender() {
glLightfv(GL_LIGHT0, GL_AMBIENT, l->scene_clear ); glLightfv(GL_LIGHT0, GL_AMBIENT, l->scene_clear );
glLightfv(GL_LIGHT0, GL_DIFFUSE, moon_color ); glLightfv(GL_LIGHT0, GL_DIFFUSE, moon_color );
glMaterialfv(GL_FRONT, GL_AMBIENT, black);
glMaterialfv(GL_FRONT, GL_DIFFUSE, moon_color);
glPushMatrix(); glPushMatrix();
glTranslatef(xMoon, yMoon, zMoon); glTranslatef(xMoon, yMoon, zMoon);
glScalef(1400, 1400, 1400); glScalef(1400, 1400, 1400);
/* glColor3fv(color); */ glColor3fv(moon_color);
/* glutSolidSphere(1.0, 25, 25); */ /* glutSolidSphere(1.0, 25, 25); */
glCallList(moon); glCallList(moon);

View file

@ -48,9 +48,6 @@ float normals[MAXNODES][3];
/* Load a .obj file and generate the GL call list */ /* Load a .obj file and generate the GL call list */
GLint fgObjLoad(char *path) { GLint fgObjLoad(char *path) {
char line[256], winding[256]; 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; double v1[3], v2[3], approx_normal[3], dot_prod, temp;
struct fgCartesianPoint ref; struct fgCartesianPoint ref;
GLint area; GLint area;
@ -66,14 +63,6 @@ GLint fgObjLoad(char *path) {
area = glGenLists(1); area = glGenLists(1);
glNewList(area, GL_COMPILE); 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; first = 1;
ncount = 1; ncount = 1;
vncount = 1; vncount = 1;
@ -259,9 +248,12 @@ GLint fgObjLoad(char *path) {
/* $Log$ /* $Log$
/* Revision 1.9 1997/12/12 19:52:57 curt /* Revision 1.10 1997/12/12 21:41:28 curt
/* Working on lightling and material properties. /* 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 * Revision 1.8 1997/12/10 01:19:51 curt
* Tweaks for verion 0.15 release. * Tweaks for verion 0.15 release.
* *

View file

@ -30,7 +30,7 @@
struct CelestialCoord fgCalculatePlanet(struct OrbElements planet, struct CelestialCoord fgCalculatePlanet(struct OrbElements planet,
struct OrbElements sun, struct OrbElements theSun,
struct fgTIME t) struct fgTIME t)
{ {
struct CelestialCoord struct CelestialCoord
@ -70,7 +70,7 @@ struct CelestialCoord fgCalculatePlanet(struct OrbElements planet,
*/ */
/* calculate the solar position */ /* calculate the solar position */
SolarPosition = fgCalcSunPos(sun); SolarPosition = fgCalcSunPos(theSun);
xg = xh + SolarPosition.xs; xg = xh + SolarPosition.xs;
yg = yh + SolarPosition.ys; yg = yh + SolarPosition.ys;
zg = zh; zg = zh;
@ -85,7 +85,10 @@ struct CelestialCoord fgCalculatePlanet(struct OrbElements planet,
/* $Log$ /* $Log$
/* Revision 1.1 1997/10/25 03:16:10 curt /* Revision 1.2 1997/12/12 21:41:29 curt
/* Initial revision of code contributed by Durk Talsma. /* 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.
*
*/ */

View file

@ -28,14 +28,17 @@
struct CelestialCoord fgCalculatePlanet(struct OrbElements planet, struct CelestialCoord fgCalculatePlanet(struct OrbElements planet,
struct OrbElements sun, struct OrbElements theSun,
struct fgTIME t); struct fgTIME t);
#endif /* PLANETS_H */ #endif /* PLANETS_H */
/* $Log$ /* $Log$
/* Revision 1.1 1997/10/25 03:16:11 curt /* Revision 1.2 1997/12/12 21:41:30 curt
/* Initial revision of code contributed by Durk Talsma. /* 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.
*
*/ */

View file

@ -80,14 +80,30 @@ void fgSceneryUpdate(double lon, double lat, double elev) {
/* Render out the current scene */ /* Render out the current scene */
void fgSceneryRender() { 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); glCallList(area_terrain);
} }
/* $Log$ /* $Log$
/* Revision 1.26 1997/12/12 19:52:58 curt /* Revision 1.27 1997/12/12 21:41:30 curt
/* Working on lightling and material properties. /* 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 * 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. * Prepended "fg" on the name of all global structures that didn't have it yet.
* i.e. "struct WEATHER {}" became "struct fgWEATHER {}" * i.e. "struct WEATHER {}" became "struct fgWEATHER {}"

View file

@ -28,7 +28,7 @@
#include "orbits.h" #include "orbits.h"
#include "sun.h" #include "sun.h"
GLint sun; GLint sun_obj;
static struct CelestialCoord sunPos; static struct CelestialCoord sunPos;
@ -95,8 +95,8 @@ void fgSunInit()
{ {
// int i; // int i;
sun = glGenLists(1); sun_obj = glGenLists(1);
glNewList(sun, GL_COMPILE ); glNewList(sun_obj, GL_COMPILE );
// glBegin( GL_POINTS ); // glBegin( GL_POINTS );
@ -136,7 +136,6 @@ void fgSunInit()
// glEnd(); // glEnd();
//glPopMatrix(); //glPopMatrix();
glColor3f(0.85, 0.65, 0.05);
glutSolidSphere(1.0, 10, 10); glutSolidSphere(1.0, 10, 10);
glEndList(); glEndList();
@ -190,9 +189,11 @@ void fgSunRender() {
glTranslatef(xSun, ySun, zSun); glTranslatef(xSun, ySun, zSun);
glScalef(1400, 1400, 1400); glScalef(1400, 1400, 1400);
glColor3f(0.85, 0.65, 0.05);
/* glColor3fv( color ); */ /* glColor3fv( color ); */
/* glutSolidSphere(1.0, 25, 25); */ /* glutSolidSphere(1.0, 25, 25); */
glCallList(sun); glCallList(sun_obj);
glPopMatrix(); glPopMatrix();
@ -201,10 +202,13 @@ void fgSunRender() {
/* $Log$ /* $Log$
/* Revision 1.4 1997/12/10 22:37:53 curt /* Revision 1.5 1997/12/12 21:41:31 curt
/* Prepended "fg" on the name of all global structures that didn't have it yet. /* More light/material property tweaking ... still a ways off.
/* i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
/* /*
* 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 * Revision 1.3 1997/12/09 05:11:56 curt
* Working on tweaking lighting. * Working on tweaking lighting.
* *

View file

@ -93,6 +93,18 @@ GLOBAL_CFLAGS = -g -Wall -DVERSION=\"$(FG_VERSION)\"
# on your environment: # 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 # SGI IRIX with the GLUT toolkit
# (Surprisingly, this also works on our SunOS 4.x machine with the # (Surprisingly, this also works on our SunOS 4.x machine with the
@ -106,28 +118,16 @@ GLOBAL_CFLAGS = -g -Wall -DVERSION=\"$(FG_VERSION)\"
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Linux/Mesa with the GLUT toolkit # Sun/Solaris with the GLUT toolkit
# #
# VERSION=\"$(VERSION)\"
# INTERFACE_FLAGS = -DGLUT # INTERFACE_FLAGS = -DGLUT
# INTERFACE_LIBS = -lglut # INTERFACE_LIBS = -lglut
# INTERFACE_FILES = GLUTmain.c GLUTkey.c # INTERFACE_FILES = GLUTmain.c GLUTkey.c
# MESA_LIBS = -L/usr/lib/mesa -lMesatk -lMesaaux -lMesaGLU -lMesaGL # GRAPHICS_LIBS = -lGLU -lGL -lXext -lXmu -lXi -lX11
# X11_LIBS = -L/usr/X11R6/lib -lXext -lXmu -lXi -lX11
# GRAPHICS_LIBS = $(MESA_LIBS) $(X11_LIBS)
# FG_CFLAGS = $(GLOBAL_CFLAGS) # 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 # Cygnus Win32 (gcc based) with a static version of the GLUT toolkit
# #
@ -142,6 +142,9 @@ FG_CFLAGS = $(GLOBAL_CFLAGS)
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# $Log$ # $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 # Revision 1.23 1997/12/12 19:52:32 curt
# Solaris tweaks. # Solaris tweaks.
# #

View file

@ -231,9 +231,9 @@ void fgTimeUpdate(struct fgFLIGHT *f, struct fgTIME *t) {
static long int warp = 0; static long int warp = 0;
/* get current Unix calendar time (in seconds) */ /* get current Unix calendar time (in seconds) */
warp += 240;
/* warp = 60; */ /* warp = 60; */
t->cur_time = time(NULL) + (0) * 60 * 60; warp += 0;
t->cur_time = time(NULL) + (3) * 60 * 60;
t->cur_time += warp; t->cur_time += warp;
printf("Current Unix calendar time = %ld warp = %ld\n", t->cur_time, warp); printf("Current Unix calendar time = %ld warp = %ld\n", t->cur_time, warp);
@ -285,9 +285,12 @@ void fgTimeUpdate(struct fgFLIGHT *f, struct fgTIME *t) {
/* $Log$ /* $Log$
/* Revision 1.17 1997/12/12 19:53:04 curt /* Revision 1.18 1997/12/12 21:41:31 curt
/* Working on lightling and material properties. /* 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 * Revision 1.16 1997/12/11 04:43:57 curt
* Fixed sun vector and lighting problems. I thing the moon is now lit * Fixed sun vector and lighting problems. I thing the moon is now lit
* correctly. * correctly.