Integrated new event manager with subsystem initializations.

This commit is contained in:
curt
1997-12-30 20:47:34 +00:00
parent 9bd9645b3e
commit bf92d30877
5 changed files with 60 additions and 26 deletions
+7 -2
View File
@@ -260,6 +260,8 @@ void fgMoonInit() {
struct fgLIGHT *l; struct fgLIGHT *l;
static int dl_exists = 0; static int dl_exists = 0;
printf("Initializing the Moon\n");
l = &cur_light_params; l = &cur_light_params;
/* position the moon */ /* position the moon */
@@ -317,7 +319,10 @@ void fgMoonRender() {
/* $Log$ /* $Log$
/* Revision 1.13 1997/12/30 16:41:00 curt /* Revision 1.14 1997/12/30 20:47:50 curt
/* Added log at end of file. /* Integrated new event manager with subsystem initializations.
/* /*
* Revision 1.13 1997/12/30 16:41:00 curt
* Added log at end of file.
*
*/ */
+14 -8
View File
@@ -53,10 +53,11 @@ double fgCalcActTime(struct fgTIME t)
actTime += (UT / 24.0); actTime += (UT / 24.0);
#define DEBUG 1 #define DEBUG 1
#ifdef DEBUG #ifdef DEBUG
printf("Actual Time:\n"); /* printf(" Actual Time:\n"); */
printf("current day = %f\t", actTime); /* printf(" current day = %f\t", actTime); */
printf("GMT = %d, %d, %d, %d, %d, %d\n", year, t.gmt->tm_mon, t.gmt->tm_mday, /* printf(" GMT = %d, %d, %d, %d, %d, %d\n",
t.gmt->tm_hour, t.gmt->tm_min, t.gmt->tm_sec); year, t.gmt->tm_mon, t.gmt->tm_mday,
t.gmt->tm_hour, t.gmt->tm_min, t.gmt->tm_sec); */
#endif #endif
return actTime; return actTime;
} }
@@ -124,6 +125,8 @@ void fgSolarSystemInit(struct fgTIME t)
int i; int i;
FILE *data; FILE *data;
printf("Initializing solar system\n");
/* build the full path name to the orbital elements database file */ /* build the full path name to the orbital elements database file */
g = &general; g = &general;
path[0] = '\0'; path[0] = '\0';
@@ -137,7 +140,7 @@ void fgSolarSystemInit(struct fgTIME t)
return; return;
} }
#ifdef DEBUG #ifdef DEBUG
printf("reading datafile %s", path); printf(" reading datafile %s\n", path);
#endif #endif
/* for all the objects... */ /* for all the objects... */
@@ -170,10 +173,13 @@ void fgSolarSystemUpdate(struct OrbElements *planet, struct fgTIME t)
/* $Log$ /* $Log$
/* Revision 1.5 1997/12/15 23:55:02 curt /* Revision 1.6 1997/12/30 20:47:52 curt
/* Add xgl wrappers for debugging. /* Integrated new event manager with subsystem initializations.
/* Generate terrain normals on the fly.
/* /*
* Revision 1.5 1997/12/15 23:55:02 curt
* Add xgl wrappers for debugging.
* Generate terrain normals on the fly.
*
* Revision 1.4 1997/12/10 22:37:51 curt * Revision 1.4 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 {}"
+12 -7
View File
@@ -120,20 +120,25 @@ struct CelestialCoord fgCalculatePlanet(struct OrbElements planet,
default: default:
printf("index %d out of range !!!!\n", idx); printf("index %d out of range !!!!\n", idx);
} }
printf("Geocentric dist %f\n" printf(" Planet found at %f (ra), %f (dec)\n",
"Heliocentric dist %f\n" result.RightAscension, result.Declination);
"Distance to the sun %f\n" printf(" Geocentric dist %f\n"
"Phase angle %f\n" " Heliocentric dist %f\n"
"Brightness %f\n", R, r, s, FV, result.magnitude); " Distance to the sun %f\n"
" Phase angle %f\n"
" Brightness %f\n", R, r, s, FV, result.magnitude);
return result; return result;
} }
/* $Log$ /* $Log$
/* Revision 1.3 1997/12/30 16:36:52 curt /* Revision 1.4 1997/12/30 20:47:52 curt
/* Merged in Durk's changes ... /* Integrated new event manager with subsystem initializations.
/* /*
* Revision 1.3 1997/12/30 16:36:52 curt
* Merged in Durk's changes ...
*
* Revision 1.2 1997/12/12 21:41:29 curt * Revision 1.2 1997/12/12 21:41:29 curt
* More light/material property tweaking ... still a ways off. * More light/material property tweaking ... still a ways off.
* *
+20 -7
View File
@@ -40,6 +40,7 @@
#include "sky.h" #include "sky.h"
#include "../Time/event.h"
#include "../Time/fg_time.h" #include "../Time/fg_time.h"
#include "../Aircraft/aircraft.h" #include "../Aircraft/aircraft.h"
@@ -75,7 +76,7 @@ void fgSkyVerticesInit() {
float theta; float theta;
int i; int i;
printf("Generating the sky dome vertices.\n"); printf(" Generating the sky dome vertices.\n");
for ( i = 0; i < 12; i++ ) { for ( i = 0; i < 12; i++ ) {
theta = (i * 30.0) * DEG_TO_RAD; theta = (i * 30.0) * DEG_TO_RAD;
@@ -84,8 +85,8 @@ void fgSkyVerticesInit() {
inner_vertex[i][1] = sin(theta) * INNER_RADIUS; inner_vertex[i][1] = sin(theta) * INNER_RADIUS;
inner_vertex[i][2] = INNER_ELEV; inner_vertex[i][2] = INNER_ELEV;
printf(" %.2f %.2f\n", cos(theta) * INNER_RADIUS, /* printf(" %.2f %.2f\n", cos(theta) * INNER_RADIUS,
sin(theta) * INNER_RADIUS); sin(theta) * INNER_RADIUS); */
middle_vertex[i][0] = cos((double)theta) * MIDDLE_RADIUS; middle_vertex[i][0] = cos((double)theta) * MIDDLE_RADIUS;
middle_vertex[i][1] = sin((double)theta) * MIDDLE_RADIUS; middle_vertex[i][1] = sin((double)theta) * MIDDLE_RADIUS;
@@ -109,7 +110,7 @@ void fgSkyColorsInit() {
l = &cur_light_params; l = &cur_light_params;
printf("Generating the sky colors for each vertex.\n"); printf(" Generating the sky colors for each vertex.\n");
/* setup for the possibility of sunset effects */ /* setup for the possibility of sunset effects */
sun_angle = l->sun_angle * RAD_TO_DEG; sun_angle = l->sun_angle * RAD_TO_DEG;
@@ -169,6 +170,7 @@ void fgSkyColorsInit() {
middle_amt[j] -= middle_diff[j]; middle_amt[j] -= middle_diff[j];
} }
/*
printf("inner_color[%d] = %.2f %.2f %.2f %.2f\n", i, inner_color[i][0], printf("inner_color[%d] = %.2f %.2f %.2f %.2f\n", i, inner_color[i][0],
inner_color[i][1], inner_color[i][2], inner_color[i][3]); inner_color[i][1], inner_color[i][2], inner_color[i][3]);
printf("middle_color[%d] = %.2f %.2f %.2f %.2f\n", i, printf("middle_color[%d] = %.2f %.2f %.2f %.2f\n", i,
@@ -177,6 +179,7 @@ void fgSkyColorsInit() {
printf("outer_color[%d] = %.2f %.2f %.2f %.2f\n", i, printf("outer_color[%d] = %.2f %.2f %.2f %.2f\n", i,
outer_color[i][0], outer_color[i][1], outer_color[i][2], outer_color[i][0], outer_color[i][1], outer_color[i][2],
outer_color[i][3]); outer_color[i][3]);
*/
} }
for ( j = 0; j < 3; j++ ) { for ( j = 0; j < 3; j++ ) {
@@ -206,6 +209,7 @@ void fgSkyColorsInit() {
middle_amt[j] += middle_diff[j]; middle_amt[j] += middle_diff[j];
} }
/*
printf("inner_color[%d] = %.2f %.2f %.2f %.2f\n", i, inner_color[i][0], printf("inner_color[%d] = %.2f %.2f %.2f %.2f\n", i, inner_color[i][0],
inner_color[i][1], inner_color[i][2], inner_color[i][3]); inner_color[i][1], inner_color[i][2], inner_color[i][3]);
printf("middle_color[%d] = %.2f %.2f %.2f %.2f\n", i, printf("middle_color[%d] = %.2f %.2f %.2f %.2f\n", i,
@@ -214,14 +218,20 @@ void fgSkyColorsInit() {
printf("outer_color[%d] = %.2f %.2f %.2f %.2f\n", i, printf("outer_color[%d] = %.2f %.2f %.2f %.2f\n", i,
outer_color[i][0], outer_color[i][1], outer_color[i][2], outer_color[i][0], outer_color[i][1], outer_color[i][2],
outer_color[i][3]); outer_color[i][3]);
*/
} }
} }
/* Initialize the sky structure and colors */ /* Initialize the sky structure and colors */
void fgSkyInit() { void fgSkyInit() {
printf("Initializing the sky\n");
fgSkyVerticesInit(); fgSkyVerticesInit();
fgSkyColorsInit();
/* regester fgSkyColorsInit() as an event to be run periodically */
fgEventRegister("fgSkyColorsInit()", fgSkyColorsInit,
FG_EVENT_READY, 30000);
} }
@@ -319,9 +329,12 @@ void fgSkyRender() {
/* $Log$ /* $Log$
/* Revision 1.9 1997/12/30 13:06:57 curt /* Revision 1.10 1997/12/30 20:47:53 curt
/* A couple lighting tweaks ... /* Integrated new event manager with subsystem initializations.
/* /*
* Revision 1.9 1997/12/30 13:06:57 curt
* A couple lighting tweaks ...
*
* Revision 1.8 1997/12/23 04:58:38 curt * Revision 1.8 1997/12/23 04:58:38 curt
* Tweaked the sky coloring a bit to build in structures to allow finer rgb * Tweaked the sky coloring a bit to build in structures to allow finer rgb
* control. * control.
+7 -2
View File
@@ -97,6 +97,8 @@ struct CelestialCoord fgCalculateSun(struct OrbElements params, struct fgTIME t)
void fgSunInit() { void fgSunInit() {
static int dl_exists = 0; static int dl_exists = 0;
printf("Initializing the Sun\n");
fgSolarSystemUpdate(&(pltOrbElements[0]), cur_time_params); fgSolarSystemUpdate(&(pltOrbElements[0]), cur_time_params);
sunPos = fgCalculateSun(pltOrbElements[0], cur_time_params); sunPos = fgCalculateSun(pltOrbElements[0], cur_time_params);
#ifdef DEBUG #ifdef DEBUG
@@ -188,9 +190,12 @@ void fgSunRender() {
/* $Log$ /* $Log$
/* Revision 1.9 1997/12/30 16:36:54 curt /* Revision 1.10 1997/12/30 20:47:54 curt
/* Merged in Durk's changes ... /* Integrated new event manager with subsystem initializations.
/* /*
* Revision 1.9 1997/12/30 16:36:54 curt
* Merged in Durk's changes ...
*
* Revision 1.8 1997/12/19 23:35:00 curt * Revision 1.8 1997/12/19 23:35:00 curt
* Lot's of tweaking with sky rendering and lighting. * Lot's of tweaking with sky rendering and lighting.
* *