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);
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;
@ -570,9 +570,12 @@ int main( int argc, char *argv[] ) {
/* $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.

View file

@ -40,7 +40,7 @@ CFLAGS = $(FG_CFLAGS) $(INTERFACE_FLAGS)
LIBS = $(INTERFACE_LIBS) $(GRAPHICS_LIBS) -lm -lfl
TARGET=fg-$(VERSION)
TARGET=fg-$(FG_VERSION)
#---------------------------------------------------------------------------
@ -49,13 +49,14 @@ TARGET=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
#---------------------------------------------------------------------------
@ -82,6 +83,9 @@ views.o:
#---------------------------------------------------------------------------
# $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.
#

View file

@ -55,14 +55,14 @@ void fgAstroInit() {
/* 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();
}
@ -107,12 +107,12 @@ void fgAstroRender() {
/* render the stars */
fgStarsRender();
/* render the moon */
fgMoonRender();
/* render the sun */
fgSunRender();
/* render the moon */
fgMoonRender();
glPopMatrix();
/* reenable fog effects */
@ -121,9 +121,12 @@ void fgAstroRender() {
/* $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.

View file

@ -226,7 +226,6 @@ 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;
@ -262,6 +261,7 @@ void fgMoonInit() {
/* 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;
@ -270,11 +270,14 @@ void fgMoonRender() {
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);

View file

@ -48,9 +48,6 @@ float normals[MAXNODES][3];
/* 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;
@ -66,14 +63,6 @@ GLint fgObjLoad(char *path) {
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;
@ -259,9 +248,12 @@ GLint fgObjLoad(char *path) {
/* $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.
*

View file

@ -30,7 +30,7 @@
struct CelestialCoord fgCalculatePlanet(struct OrbElements planet,
struct OrbElements sun,
struct OrbElements theSun,
struct fgTIME t)
{
struct CelestialCoord
@ -70,7 +70,7 @@ struct CelestialCoord fgCalculatePlanet(struct OrbElements planet,
*/
/* calculate the solar position */
SolarPosition = fgCalcSunPos(sun);
SolarPosition = fgCalcSunPos(theSun);
xg = xh + SolarPosition.xs;
yg = yh + SolarPosition.ys;
zg = zh;
@ -85,7 +85,10 @@ struct CelestialCoord fgCalculatePlanet(struct OrbElements planet,
/* $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.
*
*/

View file

@ -28,14 +28,17 @@
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.
*
*/

View file

@ -80,14 +80,30 @@ void fgSceneryUpdate(double lon, double lat, double elev) {
/* 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 {}"

View file

@ -28,7 +28,7 @@
#include "orbits.h"
#include "sun.h"
GLint sun;
GLint sun_obj;
static struct CelestialCoord sunPos;
@ -95,8 +95,8 @@ void fgSunInit()
{
// int i;
sun = glGenLists(1);
glNewList(sun, GL_COMPILE );
sun_obj = glGenLists(1);
glNewList(sun_obj, GL_COMPILE );
// glBegin( GL_POINTS );
@ -136,7 +136,6 @@ void fgSunInit()
// glEnd();
//glPopMatrix();
glColor3f(0.85, 0.65, 0.05);
glutSolidSphere(1.0, 10, 10);
glEndList();
@ -190,9 +189,11 @@ void fgSunRender() {
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();
@ -201,10 +202,13 @@ void fgSunRender() {
/* $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.
*

View file

@ -93,6 +93,18 @@ GLOBAL_CFLAGS = -g -Wall -DVERSION=\"$(FG_VERSION)\"
# 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
@ -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_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
#
@ -142,6 +142,9 @@ FG_CFLAGS = $(GLOBAL_CFLAGS)
#---------------------------------------------------------------------------
# $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.
#

View file

@ -231,9 +231,9 @@ void fgTimeUpdate(struct fgFLIGHT *f, struct fgTIME *t) {
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);
@ -285,9 +285,12 @@ void fgTimeUpdate(struct fgFLIGHT *f, struct fgTIME *t) {
/* $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.