Shufflin' stuff.
This commit is contained in:
parent
a657dc248b
commit
b830d97782
16 changed files with 219 additions and 124 deletions
|
@ -1,6 +1,30 @@
|
||||||
hud.o: cockpit.c cockpit.h hud.c hud.h ../Aircraft/aircraft.h \
|
cockpit.o: cockpit.c cockpit.h hud.h ../Aircraft/aircraft.h \
|
||||||
../Aircraft/../Flight/flight.h ../Aircraft/../Flight/Slew/slew.h \
|
../Aircraft/../Flight/flight.h ../Aircraft/../Flight/Slew/slew.h \
|
||||||
../Aircraft/../Flight/LaRCsim/ls_interface.h \
|
../Aircraft/../Flight/LaRCsim/ls_interface.h \
|
||||||
../Aircraft/../Flight/LaRCsim/../flight.h \
|
../Aircraft/../Flight/LaRCsim/../flight.h \
|
||||||
../Aircraft/../Controls/controls.h \
|
../Aircraft/../Controls/controls.h \
|
||||||
../Aircraft/../Controls/../limits.h ../Math/fg_random.h
|
../Aircraft/../Controls/../limits.h ../Flight/flight.h \
|
||||||
|
../Controls/controls.h ../constants.h ../Scenery/mesh.h \
|
||||||
|
../Scenery/scenery.h ../Scenery/../types.h ../Math/mat3.h \
|
||||||
|
../Math/polar.h ../Math/../types.h ../Time/fg_timer.h \
|
||||||
|
../Math/fg_random.h ../Weather/weather.h
|
||||||
|
hud.o: hud.c hud.h ../Aircraft/aircraft.h \
|
||||||
|
../Aircraft/../Flight/flight.h ../Aircraft/../Flight/Slew/slew.h \
|
||||||
|
../Aircraft/../Flight/LaRCsim/ls_interface.h \
|
||||||
|
../Aircraft/../Flight/LaRCsim/../flight.h \
|
||||||
|
../Aircraft/../Controls/controls.h \
|
||||||
|
../Aircraft/../Controls/../limits.h ../Flight/flight.h \
|
||||||
|
../Controls/controls.h ../constants.h ../Scenery/mesh.h \
|
||||||
|
../Scenery/scenery.h ../Scenery/../types.h ../Math/mat3.h \
|
||||||
|
../Math/polar.h ../Math/../types.h ../Time/fg_timer.h \
|
||||||
|
../Math/fg_random.h ../Weather/weather.h
|
||||||
|
test.o: test.c test.h ../Aircraft/aircraft.h \
|
||||||
|
../Aircraft/../Flight/flight.h ../Aircraft/../Flight/Slew/slew.h \
|
||||||
|
../Aircraft/../Flight/LaRCsim/ls_interface.h \
|
||||||
|
../Aircraft/../Flight/LaRCsim/../flight.h \
|
||||||
|
../Aircraft/../Controls/controls.h \
|
||||||
|
../Aircraft/../Controls/../limits.h ../Flight/flight.h \
|
||||||
|
../Controls/controls.h ../constants.h ../Scenery/mesh.h \
|
||||||
|
../Scenery/scenery.h ../Scenery/../types.h ../Math/mat3.h \
|
||||||
|
../Math/polar.h ../Math/../types.h ../Time/fg_timer.h \
|
||||||
|
../Math/fg_random.h ../Weather/weather.h
|
||||||
|
|
|
@ -25,8 +25,10 @@
|
||||||
|
|
||||||
|
|
||||||
#include <GL/glut.h>
|
#include <GL/glut.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#ifndef WIN32
|
||||||
|
# include <values.h> /* for MAXINT */
|
||||||
|
#endif /* not WIN32 */
|
||||||
#include "hud.h"
|
#include "hud.h"
|
||||||
|
|
||||||
#include "../constants.h"
|
#include "../constants.h"
|
||||||
|
@ -392,10 +394,10 @@ static void drawhorizon( struct HUD_horizon horizon )
|
||||||
|
|
||||||
bank_angle = (*horizon.load_value)();
|
bank_angle = (*horizon.load_value)();
|
||||||
|
|
||||||
// sin_bank = sin( 2*PI-FG_Phi );
|
// sin_bank = sin( FG_2PI-FG_Phi );
|
||||||
// cos_bank = cos( 2*PI-FG_Phi );
|
// cos_bank = cos( FG_2PI-FG_Phi );
|
||||||
sin_bank = sin(2*PI-bank_angle);
|
sin_bank = sin(FG_2PI-bank_angle);
|
||||||
cos_bank = cos(2*PI-bank_angle);
|
cos_bank = cos(FG_2PI-bank_angle);
|
||||||
x_inc1 = (int)(horizon.scr_width*cos_bank);
|
x_inc1 = (int)(horizon.scr_width*cos_bank);
|
||||||
y_inc1 = (int)(horizon.scr_width*sin_bank);
|
y_inc1 = (int)(horizon.scr_width*sin_bank);
|
||||||
x_inc2 = (int)(horizon.scr_hole*cos_bank);
|
x_inc2 = (int)(horizon.scr_hole*cos_bank);
|
||||||
|
@ -531,13 +533,13 @@ Hptr fgHUDInit( struct AIRCRAFT current_aircraft, int color )
|
||||||
hud->code = 123;
|
hud->code = 123;
|
||||||
hud->status = 0;
|
hud->status = 0;
|
||||||
|
|
||||||
// For now let's just hardcode a hud here .
|
// For now lets just hardcode a hud here .
|
||||||
// In the future, hud information has to come from the same place
|
// In the future, hud information has to come from the same place
|
||||||
// aircraft information came
|
// aircraft information came
|
||||||
|
|
||||||
fgHUDAddHorizon( hud, 590, 50, 40, 20, get_roll );
|
fgHUDAddHorizon( hud, 590, 50, 40, 20, get_roll );
|
||||||
fgHUDAddScale( hud, VERTICAL, 220, 100, 280, 5, 10, LEFT, LEFT, 0, 100, get_speed );
|
fgHUDAddScale( hud, VERTICAL, 220, 100, 280, 5, 10, LEFT, LEFT, 0, 100, get_speed );
|
||||||
fgHUDAddScale( hud, VERTICAL, 440, 100, 280, 1, 5, RIGHT, RIGHT, -MAXINT, 25, get_aoa );
|
fgHUDAddScale( hud, VERTICAL, 440, 100, 280, 1, 5, RIGHT, RIGHT, -400, 25, get_aoa );
|
||||||
fgHUDAddScale( hud, HORIZONTAL, 280, 220, 440, 5, 10, TOP, TOP, 0, 50, get_heading );
|
fgHUDAddScale( hud, HORIZONTAL, 280, 220, 440, 5, 10, TOP, TOP, 0, 50, get_heading );
|
||||||
fgHUDAddLabel( hud, 180, 85, SMALL, NOBLINK, RIGHT_JUST, NULL, " Kts", "%5.0f", get_speed );
|
fgHUDAddLabel( hud, 180, 85, SMALL, NOBLINK, RIGHT_JUST, NULL, " Kts", "%5.0f", get_speed );
|
||||||
fgHUDAddLabel( hud, 180, 73, SMALL, NOBLINK, RIGHT_JUST, NULL, " m", "%5.0f", get_altitude );
|
fgHUDAddLabel( hud, 180, 73, SMALL, NOBLINK, RIGHT_JUST, NULL, " m", "%5.0f", get_altitude );
|
||||||
|
@ -546,7 +548,6 @@ Hptr fgHUDInit( struct AIRCRAFT current_aircraft, int color )
|
||||||
return( hud );
|
return( hud );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Hptr fgHUDAddHorizon( Hptr hud, int x_pos, int y_pos, int length, \
|
Hptr fgHUDAddHorizon( Hptr hud, int x_pos, int y_pos, int length, \
|
||||||
int hole_len, double (*load_value)() )
|
int hole_len, double (*load_value)() )
|
||||||
{
|
{
|
||||||
|
@ -702,7 +703,6 @@ Hptr fgHUDAddLadder( Hptr hud, int x_pos, int y_pos, int scr_width, int scr_heig
|
||||||
hud->instruments = instrument;
|
hud->instruments = instrument;
|
||||||
|
|
||||||
return( hud );
|
return( hud );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -799,7 +799,10 @@ void fgUpdateHUD( Hptr hud )
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.1 1997/08/29 18:03:22 curt
|
/* Revision 1.2 1997/09/04 02:17:30 curt
|
||||||
/* Initial revision.
|
/* Shufflin' stuff.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.1 1997/08/29 18:03:22 curt
|
||||||
|
* Initial revision.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
21
FDM/flight.h
21
FDM/flight.h
|
@ -44,20 +44,6 @@
|
||||||
#define FG_EXTERN_NET 8
|
#define FG_EXTERN_NET 8
|
||||||
|
|
||||||
|
|
||||||
/* Define a structure containing the shared flight model parameters */
|
|
||||||
/* struct flight_params {
|
|
||||||
double pos_x, pos_y, pos_z;
|
|
||||||
double vel_x, vel_y, vel_z;
|
|
||||||
|
|
||||||
double Phi;
|
|
||||||
double Theta;
|
|
||||||
double Psi;
|
|
||||||
double vel_Phi;
|
|
||||||
double vel_Theta;
|
|
||||||
double vel_Psi;
|
|
||||||
}; */
|
|
||||||
|
|
||||||
|
|
||||||
typedef double FG_VECTOR_3[3];
|
typedef double FG_VECTOR_3[3];
|
||||||
|
|
||||||
/* This is based heavily on LaRCsim/ls_generic.h */
|
/* This is based heavily on LaRCsim/ls_generic.h */
|
||||||
|
@ -410,9 +396,12 @@ int fgFlightModelUpdate(int model, struct FLIGHT *f, int multiloop);
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.8 1997/08/27 03:30:06 curt
|
/* Revision 1.9 1997/09/04 02:17:33 curt
|
||||||
/* Changed naming scheme of basic shared structures.
|
/* Shufflin' stuff.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.8 1997/08/27 03:30:06 curt
|
||||||
|
* Changed naming scheme of basic shared structures.
|
||||||
|
*
|
||||||
* Revision 1.7 1997/07/23 21:52:19 curt
|
* Revision 1.7 1997/07/23 21:52:19 curt
|
||||||
* Put comments around the text after an #endif for increased portability.
|
* Put comments around the text after an #endif for increased portability.
|
||||||
*
|
*
|
||||||
|
|
|
@ -69,7 +69,7 @@ struct VIEW current_view;
|
||||||
static GLfloat win_ratio = 1.0;
|
static GLfloat win_ratio = 1.0;
|
||||||
|
|
||||||
/* sun direction */
|
/* sun direction */
|
||||||
static GLfloat sun_vec[4] = {1.0, 0.0, 0.0, 0.0 };
|
/* static GLfloat sun_vec[4] = {1.0, 0.0, 0.0, 0.0 }; */
|
||||||
|
|
||||||
/* if the 4th field is 0.0, this specifies a direction ... */
|
/* if the 4th field is 0.0, this specifies a direction ... */
|
||||||
/* clear color (sky) */
|
/* clear color (sky) */
|
||||||
|
@ -86,10 +86,6 @@ static GLfloat fgFogColor[4] = {0.65, 0.65, 0.85, 1.0};
|
||||||
/* pointer to scenery structure */
|
/* pointer to scenery structure */
|
||||||
/* static GLint scenery, runway; */
|
/* static GLint scenery, runway; */
|
||||||
|
|
||||||
/* Another hack */
|
|
||||||
/* double view_offset = 0.0;
|
|
||||||
double goal_view_offset = 0.0; */
|
|
||||||
|
|
||||||
double Simtime;
|
double Simtime;
|
||||||
|
|
||||||
/* Another hack */
|
/* Another hack */
|
||||||
|
@ -104,8 +100,10 @@ int show_hud;
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
static void fgInitVisuals() {
|
static void fgInitVisuals() {
|
||||||
|
struct fgTIME *t;
|
||||||
struct WEATHER *w;
|
struct WEATHER *w;
|
||||||
|
|
||||||
|
t = &cur_time_params;
|
||||||
w = ¤t_weather;
|
w = ¤t_weather;
|
||||||
|
|
||||||
glEnable( GL_DEPTH_TEST );
|
glEnable( GL_DEPTH_TEST );
|
||||||
|
@ -116,7 +114,7 @@ static void fgInitVisuals() {
|
||||||
to unit length after transformation. See glNormal. */
|
to unit length after transformation. See glNormal. */
|
||||||
glEnable( GL_NORMALIZE );
|
glEnable( GL_NORMALIZE );
|
||||||
|
|
||||||
glLightfv( GL_LIGHT0, GL_POSITION, sun_vec );
|
glLightfv( GL_LIGHT0, GL_POSITION, t->sun_vec );
|
||||||
glEnable( GL_LIGHTING );
|
glEnable( GL_LIGHTING );
|
||||||
glEnable( GL_LIGHT0 );
|
glEnable( GL_LIGHT0 );
|
||||||
|
|
||||||
|
@ -143,8 +141,7 @@ static void fgUpdateViewParams() {
|
||||||
struct FLIGHT *f;
|
struct FLIGHT *f;
|
||||||
struct fgTIME *t;
|
struct fgTIME *t;
|
||||||
struct VIEW *v;
|
struct VIEW *v;
|
||||||
MAT3vec nup, nsun;
|
double ambient, diffuse, sky;
|
||||||
double sun_angle, temp, ambient, diffuse, sky;
|
|
||||||
GLfloat color[4] = { 1.0, 1.0, 0.50, 1.0 };
|
GLfloat color[4] = { 1.0, 1.0, 0.50, 1.0 };
|
||||||
GLfloat amb[3], diff[3], fog[4], clear[4];
|
GLfloat amb[3], diff[3], fog[4], clear[4];
|
||||||
|
|
||||||
|
@ -170,24 +167,17 @@ static void fgUpdateViewParams() {
|
||||||
v->view_up[0], v->view_up[1], v->view_up[2]);
|
v->view_up[0], v->view_up[1], v->view_up[2]);
|
||||||
|
|
||||||
/* set the sun position */
|
/* set the sun position */
|
||||||
glLightfv( GL_LIGHT0, GL_POSITION, sun_vec );
|
glLightfv( GL_LIGHT0, GL_POSITION, t->sun_vec );
|
||||||
|
|
||||||
/* calculate lighting parameters based on sun's relative angle to
|
/* calculate lighting parameters based on sun's relative angle to
|
||||||
* local up */
|
* local up */
|
||||||
MAT3_COPY_VEC(nup, v->local_up);
|
|
||||||
nsun[0] = t->fg_sunpos.x;
|
|
||||||
nsun[1] = t->fg_sunpos.y;
|
|
||||||
nsun[2] = t->fg_sunpos.z;
|
|
||||||
MAT3_NORMALIZE_VEC(nup, temp);
|
|
||||||
MAT3_NORMALIZE_VEC(nsun, temp);
|
|
||||||
|
|
||||||
sun_angle = acos(MAT3_DOT_PRODUCT(nup, nsun));
|
|
||||||
printf("SUN ANGLE relative to current location = %.3f rads.\n", sun_angle);
|
|
||||||
|
|
||||||
/* ya kind'a have to plot this to see the magic */
|
/* ya kind'a have to plot this to see the magic */
|
||||||
ambient = 0.4 * pow(2.4, -sun_angle*sun_angle*sun_angle*sun_angle/3.0);
|
ambient = 0.4 *
|
||||||
diffuse = 0.4 * cos(0.6*sun_angle*sun_angle);
|
pow(2.4, -t->sun_angle*t->sun_angle*t->sun_angle*t->sun_angle / 3.0);
|
||||||
sky = 0.85 * pow(1.6, -sun_angle*sun_angle*sun_angle*sun_angle/2.0) + 0.15;
|
diffuse = 0.4 * cos(0.6 * t->sun_angle * t->sun_angle);
|
||||||
|
sky = 0.85 *
|
||||||
|
pow(1.6, -t->sun_angle*t->sun_angle*t->sun_angle*t->sun_angle/2.0)
|
||||||
|
+ 0.15;
|
||||||
|
|
||||||
if ( ambient < 0.1 ) { ambient = 0.1; }
|
if ( ambient < 0.1 ) { ambient = 0.1; }
|
||||||
if ( diffuse < 0.0 ) { diffuse = 0.0; }
|
if ( diffuse < 0.0 ) { diffuse = 0.0; }
|
||||||
|
@ -240,10 +230,8 @@ static void fgUpdateVisuals( void ) {
|
||||||
fgSceneryRender();
|
fgSceneryRender();
|
||||||
|
|
||||||
/* display HUD */
|
/* display HUD */
|
||||||
if( show_hud ) {
|
if( show_hud )
|
||||||
fgCockpitUpdate();
|
fgCockpitUpdate();
|
||||||
/* fgUpdateHUD(); */
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef GLUT
|
#ifdef GLUT
|
||||||
glutSwapBuffers();
|
glutSwapBuffers();
|
||||||
|
@ -274,14 +262,7 @@ void fgUpdateTimeDepCalcs(int multi_loop) {
|
||||||
fgFlightModelUpdate(FG_LARCSIM, f, multi_loop);
|
fgFlightModelUpdate(FG_LARCSIM, f, multi_loop);
|
||||||
|
|
||||||
/* refresh shared sun position and sun_vec */
|
/* refresh shared sun position and sun_vec */
|
||||||
fgUpdateSunPos();
|
fgUpdateSunPos(scenery.center);
|
||||||
|
|
||||||
/* the sun position has to be translated just like everything else */
|
|
||||||
sun_vec[0] = t->fg_sunpos.x - scenery.center.x;
|
|
||||||
sun_vec[1] = t->fg_sunpos.y - scenery.center.y;
|
|
||||||
sun_vec[2] = t->fg_sunpos.z - scenery.center.z;
|
|
||||||
/* make this a directional light source only */
|
|
||||||
sun_vec[3] = 0.0;
|
|
||||||
|
|
||||||
/* update the view angle */
|
/* update the view angle */
|
||||||
for ( i = 0; i < multi_loop; i++ ) {
|
for ( i = 0; i < multi_loop; i++ ) {
|
||||||
|
@ -420,8 +401,8 @@ static void fgMainLoop( void ) {
|
||||||
f = ¤t_aircraft.flight;
|
f = ¤t_aircraft.flight;
|
||||||
|
|
||||||
/* Read joystick */
|
/* Read joystick */
|
||||||
/* fgJoystickRead( &joy_x, &joy_y, &joy_b1, &joy_b2 ); */
|
/* fgJoystickRead( &joy_x, &joy_y, &joy_b1, &joy_b2 );
|
||||||
/* printf( "Joystick X %f Y %f B1 %d B2 %d\n",
|
printf( "Joystick X %f Y %f B1 %d B2 %d\n",
|
||||||
joy_x, joy_y, joy_b1, joy_b2 );
|
joy_x, joy_y, joy_b1, joy_b2 );
|
||||||
fgElevSet( -joy_y );
|
fgElevSet( -joy_y );
|
||||||
fgAileronSet( joy_x ); */
|
fgAileronSet( joy_x ); */
|
||||||
|
@ -574,9 +555,12 @@ int main( int argc, char *argv[] ) {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.12 1997/08/27 21:32:24 curt
|
/* Revision 1.13 1997/09/04 02:17:34 curt
|
||||||
/* Restructured view calculation code. Added stars.
|
/* Shufflin' stuff.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.12 1997/08/27 21:32:24 curt
|
||||||
|
* Restructured view calculation code. Added stars.
|
||||||
|
*
|
||||||
* Revision 1.11 1997/08/27 03:30:16 curt
|
* Revision 1.11 1997/08/27 03:30:16 curt
|
||||||
* Changed naming scheme of basic shared structures.
|
* Changed naming scheme of basic shared structures.
|
||||||
*
|
*
|
||||||
|
|
|
@ -73,6 +73,9 @@ GLTKkey.o:
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# $Log$
|
# $Log$
|
||||||
|
# Revision 1.33 1997/09/04 02:17:35 curt
|
||||||
|
# Shufflin' stuff.
|
||||||
|
#
|
||||||
# Revision 1.32 1997/08/27 21:31:27 curt
|
# Revision 1.32 1997/08/27 21:31:27 curt
|
||||||
# Added views.[ch]
|
# Added views.[ch]
|
||||||
#
|
#
|
||||||
|
|
45
Main/depend
45
Main/depend
|
@ -1,33 +1,34 @@
|
||||||
GLUTkey.o: GLUTkey.c GLUTkey.h ../constants.h ../Aircraft/aircraft.h \
|
GLUTkey.o: GLUTkey.c GLUTkey.h views.h ../types.h ../Flight/flight.h \
|
||||||
../Aircraft/../Flight/flight.h ../Aircraft/../Flight/Slew/slew.h \
|
../Flight/Slew/slew.h ../Flight/LaRCsim/ls_interface.h \
|
||||||
../Aircraft/../Flight/LaRCsim/ls_interface.h \
|
../Flight/LaRCsim/../flight.h ../Math/mat3.h ../constants.h \
|
||||||
../Aircraft/../Flight/LaRCsim/../flight.h \
|
../Aircraft/aircraft.h ../Aircraft/../Flight/flight.h \
|
||||||
../Aircraft/../Controls/controls.h \
|
../Aircraft/../Controls/controls.h \
|
||||||
../Aircraft/../Controls/../limits.h ../Weather/weather.h
|
../Aircraft/../Controls/../limits.h ../Weather/weather.h
|
||||||
GLUTmain.o: GLUTmain.c fg_init.h ../constants.h ../general.h \
|
GLUTmain.o: GLUTmain.c GLUTkey.h fg_init.h views.h ../types.h \
|
||||||
../Aircraft/aircraft.h ../Aircraft/../Flight/flight.h \
|
../Flight/flight.h ../Flight/Slew/slew.h \
|
||||||
../Aircraft/../Flight/Slew/slew.h \
|
../Flight/LaRCsim/ls_interface.h ../Flight/LaRCsim/../flight.h \
|
||||||
../Aircraft/../Flight/LaRCsim/ls_interface.h \
|
../Math/mat3.h ../constants.h ../general.h ../Aircraft/aircraft.h \
|
||||||
../Aircraft/../Flight/LaRCsim/../flight.h \
|
../Aircraft/../Flight/flight.h ../Aircraft/../Controls/controls.h \
|
||||||
../Aircraft/../Controls/controls.h \
|
|
||||||
../Aircraft/../Controls/../limits.h ../Cockpit/cockpit.h \
|
../Aircraft/../Controls/../limits.h ../Cockpit/cockpit.h \
|
||||||
../Cockpit/hud.h ../Cockpit/../Aircraft/aircraft.h \
|
../Cockpit/hud.h ../Cockpit/../Aircraft/aircraft.h \
|
||||||
../Cockpit/../Flight/flight.h ../Cockpit/../Controls/controls.h \
|
../Cockpit/../Flight/flight.h ../Cockpit/../Controls/controls.h \
|
||||||
../Joystick/joystick.h ../Math/fg_geodesy.h ../Math/mat3.h \
|
../Joystick/joystick.h ../Math/fg_geodesy.h ../Math/polar.h \
|
||||||
../Math/polar.h ../Math/../types.h ../Scenery/mesh.h \
|
../Math/../types.h ../Scenery/mesh.h ../Scenery/scenery.h \
|
||||||
../Scenery/scenery.h ../Scenery/../types.h ../Time/fg_time.h \
|
../Scenery/../types.h ../Time/fg_time.h ../Time/../types.h \
|
||||||
../Time/../types.h ../Time/fg_timer.h ../Time/sunpos.h \
|
../Time/fg_timer.h ../Time/sunpos.h ../Weather/weather.h
|
||||||
../Weather/weather.h
|
fg_init.o: fg_init.c fg_init.h views.h ../types.h ../Flight/flight.h \
|
||||||
fg_init.o: fg_init.c fg_init.h ../constants.h ../general.h \
|
../Flight/Slew/slew.h ../Flight/LaRCsim/ls_interface.h \
|
||||||
../Aircraft/aircraft.h ../Aircraft/../Flight/flight.h \
|
../Flight/LaRCsim/../flight.h ../Math/mat3.h ../constants.h \
|
||||||
../Aircraft/../Flight/Slew/slew.h \
|
../general.h ../Aircraft/aircraft.h ../Aircraft/../Flight/flight.h \
|
||||||
../Aircraft/../Flight/LaRCsim/ls_interface.h \
|
|
||||||
../Aircraft/../Flight/LaRCsim/../flight.h \
|
|
||||||
../Aircraft/../Controls/controls.h \
|
../Aircraft/../Controls/controls.h \
|
||||||
../Aircraft/../Controls/../limits.h ../Cockpit/cockpit.h \
|
../Aircraft/../Controls/../limits.h ../Cockpit/cockpit.h \
|
||||||
../Cockpit/hud.h ../Cockpit/../Aircraft/aircraft.h \
|
../Cockpit/hud.h ../Cockpit/../Aircraft/aircraft.h \
|
||||||
../Cockpit/../Flight/flight.h ../Cockpit/../Controls/controls.h \
|
../Cockpit/../Flight/flight.h ../Cockpit/../Controls/controls.h \
|
||||||
../Joystick/joystick.h ../Math/fg_random.h ../Scenery/mesh.h \
|
../Joystick/joystick.h ../Math/fg_random.h ../Scenery/mesh.h \
|
||||||
../Scenery/scenery.h ../Scenery/../types.h ../Scenery/stars.h \
|
../Scenery/scenery.h ../Scenery/../types.h ../Scenery/stars.h \
|
||||||
../Time/sunpos.h ../Weather/weather.h
|
../Time/sunpos.h ../Time/../types.h ../Weather/weather.h
|
||||||
views.o: views.c views.h ../types.h
|
views.o: views.c views.h ../types.h ../Flight/flight.h \
|
||||||
|
../Flight/Slew/slew.h ../Flight/LaRCsim/ls_interface.h \
|
||||||
|
../Flight/LaRCsim/../flight.h ../Math/mat3.h ../constants.h \
|
||||||
|
../Math/polar.h ../Math/../types.h ../Scenery/scenery.h \
|
||||||
|
../Scenery/../types.h
|
||||||
|
|
|
@ -96,6 +96,7 @@ void fgInitSubsystems( void ) {
|
||||||
FG_Latitude = ( 120070.41 / 3600.0 ) * DEG_TO_RAD;
|
FG_Latitude = ( 120070.41 / 3600.0 ) * DEG_TO_RAD;
|
||||||
FG_Longitude = ( -398391.28 / 3600.0 ) * DEG_TO_RAD;
|
FG_Longitude = ( -398391.28 / 3600.0 ) * DEG_TO_RAD;
|
||||||
FG_Altitude = FG_Runway_altitude + 3.758099;
|
FG_Altitude = FG_Runway_altitude + 3.758099;
|
||||||
|
/* FG_Altitude = 20000; */
|
||||||
|
|
||||||
/* Initial Position north of the city of Globe */
|
/* Initial Position north of the city of Globe */
|
||||||
/* FG_Latitude = ( 120625.64 / 3600.0 ) * DEG_TO_RAD; */
|
/* FG_Latitude = ( 120625.64 / 3600.0 ) * DEG_TO_RAD; */
|
||||||
|
@ -142,7 +143,7 @@ void fgInitSubsystems( void ) {
|
||||||
/* fgSlewInit(-398673.28,120625.64, 53, 4.38); */
|
/* fgSlewInit(-398673.28,120625.64, 53, 4.38); */
|
||||||
|
|
||||||
/* Initialize shared sun position and sun_vec */
|
/* Initialize shared sun position and sun_vec */
|
||||||
fgUpdateSunPos();
|
fgUpdateSunPos(scenery.center);
|
||||||
|
|
||||||
/* Initialize view parameters */
|
/* Initialize view parameters */
|
||||||
fgViewInit(v);
|
fgViewInit(v);
|
||||||
|
@ -151,7 +152,11 @@ void fgInitSubsystems( void ) {
|
||||||
fgWeatherInit();
|
fgWeatherInit();
|
||||||
|
|
||||||
/* Initialize the Cockpit subsystem */
|
/* Initialize the Cockpit subsystem */
|
||||||
fgCockpitInit( current_aircraft );
|
if( fgCockpitInit( current_aircraft ) == NULL )
|
||||||
|
{
|
||||||
|
printf( "Error in Cockpit initialization!\n" );
|
||||||
|
exit( 1 );
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize the Stars subsystem */
|
/* Initialize the Stars subsystem */
|
||||||
fgStarsInit();
|
fgStarsInit();
|
||||||
|
@ -195,9 +200,12 @@ void fgInitSubsystems( void ) {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.4 1997/08/27 21:32:26 curt
|
/* Revision 1.5 1997/09/04 02:17:36 curt
|
||||||
/* Restructured view calculation code. Added stars.
|
/* Shufflin' stuff.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.4 1997/08/27 21:32:26 curt
|
||||||
|
* Restructured view calculation code. Added stars.
|
||||||
|
*
|
||||||
* Revision 1.3 1997/08/27 03:30:19 curt
|
* Revision 1.3 1997/08/27 03:30:19 curt
|
||||||
* Changed naming scheme of basic shared structures.
|
* Changed naming scheme of basic shared structures.
|
||||||
*
|
*
|
||||||
|
|
|
@ -7,5 +7,13 @@ mesh.o: mesh.c ../constants.h ../types.h ../Math/fg_geodesy.h \
|
||||||
parser.o: parser.c parsevrml.h geometry.h common.h mesh.h scenery.h \
|
parser.o: parser.c parsevrml.h geometry.h common.h mesh.h scenery.h \
|
||||||
../types.h
|
../types.h
|
||||||
scanner.o: scanner.c parser.h
|
scanner.o: scanner.c parser.h
|
||||||
scenery.o: scenery.c ../general.h scenery.h ../types.h parsevrml.h
|
scenery.o: scenery.c ../general.h scenery.h ../types.h parsevrml.h \
|
||||||
stars.o: stars.c stars.h ../general.h
|
stars.h
|
||||||
|
stars.o: stars.c stars.h ../constants.h ../general.h ../GLUT/views.h \
|
||||||
|
../GLUT/../types.h ../GLUT/../Flight/flight.h \
|
||||||
|
../GLUT/../Flight/Slew/slew.h \
|
||||||
|
../GLUT/../Flight/LaRCsim/ls_interface.h \
|
||||||
|
../GLUT/../Flight/LaRCsim/../flight.h ../GLUT/../Math/mat3.h \
|
||||||
|
../Aircraft/aircraft.h ../Aircraft/../Flight/flight.h \
|
||||||
|
../Aircraft/../Controls/controls.h \
|
||||||
|
../Aircraft/../Controls/../limits.h
|
||||||
|
|
|
@ -38,6 +38,9 @@ struct SCENERY {
|
||||||
|
|
||||||
/* center of current scenery chunk */
|
/* center of current scenery chunk */
|
||||||
struct fgCartesianPoint center;
|
struct fgCartesianPoint center;
|
||||||
|
|
||||||
|
/* angle of sun relative to current local horizontal */
|
||||||
|
double sun_angle;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct SCENERY scenery;
|
extern struct SCENERY scenery;
|
||||||
|
@ -60,9 +63,12 @@ void fgSceneryRender();
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.9 1997/08/27 03:30:33 curt
|
/* Revision 1.10 1997/09/04 02:17:37 curt
|
||||||
/* Changed naming scheme of basic shared structures.
|
/* Shufflin' stuff.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.9 1997/08/27 03:30:33 curt
|
||||||
|
* Changed naming scheme of basic shared structures.
|
||||||
|
*
|
||||||
* Revision 1.8 1997/08/06 00:24:30 curt
|
* Revision 1.8 1997/08/06 00:24:30 curt
|
||||||
* Working on correct real time sun lighting.
|
* Working on correct real time sun lighting.
|
||||||
*
|
*
|
||||||
|
|
|
@ -133,12 +133,6 @@ void fgStarsRender() {
|
||||||
glDisable( GL_LIGHTING );
|
glDisable( GL_LIGHTING );
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
|
||||||
/* set lighting parameters for stars */
|
|
||||||
/* amb[0] = amb[1] = amb[2] = 1.0;
|
|
||||||
diff[0] = diff[1] = diff[2] = 1.0;
|
|
||||||
glLightfv(GL_LIGHT0, GL_AMBIENT, amb );
|
|
||||||
glLightfv(GL_LIGHT0, GL_DIFFUSE, diff ); */
|
|
||||||
|
|
||||||
glTranslatef( v->view_pos.x, v->view_pos.y, v->view_pos.z );
|
glTranslatef( v->view_pos.x, v->view_pos.y, v->view_pos.z );
|
||||||
|
|
||||||
angle = FG_2PI * fmod(DaysSinceEpoch(time(NULL)), 1.0);
|
angle = FG_2PI * fmod(DaysSinceEpoch(time(NULL)), 1.0);
|
||||||
|
@ -154,9 +148,12 @@ void fgStarsRender() {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.3 1997/08/29 17:55:28 curt
|
/* Revision 1.4 1997/09/04 02:17:38 curt
|
||||||
/* Worked on properly aligning the stars.
|
/* Shufflin' stuff.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.3 1997/08/29 17:55:28 curt
|
||||||
|
* Worked on properly aligning the stars.
|
||||||
|
*
|
||||||
* Revision 1.2 1997/08/27 21:32:30 curt
|
* Revision 1.2 1997/08/27 21:32:30 curt
|
||||||
* Restructured view calculation code. Added stars.
|
* Restructured view calculation code. Added stars.
|
||||||
*
|
*
|
||||||
|
|
|
@ -58,19 +58,43 @@ clean:
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
tar: clean
|
source-tar: clean
|
||||||
(cd ../..; \
|
(cd ../..; \
|
||||||
tar cvf source-$(VERSION).tar FlightGear/COPYING FlightGear/Docs \
|
tar cvzf source-$(VERSION).tar.gz FlightGear/fgtop FlightGear/COPYING \
|
||||||
FlightGear/Src FlightGear/Thanks)
|
FlightGear/Docs FlightGear/Src FlightGear/Thanks)
|
||||||
|
|
||||||
zip: clean
|
source-zip: clean
|
||||||
(cd ../..; \
|
(cd ../..; \
|
||||||
zip -r source-$(VERSION).zip FlightGear/COPYING FlightGear/Docs \
|
zip -r source-$(VERSION).zip FlightGear/fgtop FlightGear/COPYING \
|
||||||
FlightGear/Src FlightGear/Thanks)
|
FlightGear/Docs FlightGear/Src FlightGear/Thanks)
|
||||||
|
|
||||||
|
scenery-tar:
|
||||||
|
(cd ../..; \
|
||||||
|
tar cvzf scenery-$(VERSION).tar.gz FlightGear/Scenery)
|
||||||
|
|
||||||
|
scenery-zip:
|
||||||
|
(cd ../..; \
|
||||||
|
zip -r scenery-$(VERSION).zip FlightGear/Scenery)
|
||||||
|
|
||||||
|
bin-tar: all
|
||||||
|
cp GLUT/fg0 GLUT/runfg ..
|
||||||
|
(cd ../..; \
|
||||||
|
tar cvzf bin-$(VERSION).tar.gz FlightGear/fgtop FlightGear/fg0 \
|
||||||
|
FlightGear/runfg FlightGear/COPYING FlightGear/Docs FlightGear/Thanks)
|
||||||
|
|
||||||
|
bin-zip: all
|
||||||
|
cp GLUT/fg0.exe GLUT/runfg.bat GLUT/cygwin.dll ..
|
||||||
|
(cd ../..; \
|
||||||
|
zip -r bin-$(VERSION).zip FlightGear/fgtop FlightGear/fg0.exe \
|
||||||
|
FlightGear/runfg.bat FlightGear/cygwin.dll FlightGear/COPYING \
|
||||||
|
FlightGear/Docs FlightGear/Thanks)
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# $Log$
|
# $Log$
|
||||||
|
# Revision 1.26 1997/09/04 02:17:18 curt
|
||||||
|
# Shufflin' stuff.
|
||||||
|
#
|
||||||
# Revision 1.25 1997/08/25 20:27:21 curt
|
# Revision 1.25 1997/08/25 20:27:21 curt
|
||||||
# Merged in initial HUD and Joystick code.
|
# Merged in initial HUD and Joystick code.
|
||||||
#
|
#
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
VERSION = 0.10
|
VERSION = 0.11
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Choose your weapons
|
# Choose your weapons
|
||||||
|
@ -120,6 +120,9 @@ FG_CFLAGS = $(GLOBAL_CFLAGS)
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# $Log$
|
# $Log$
|
||||||
|
# Revision 1.13 1997/09/04 02:17:19 curt
|
||||||
|
# Shufflin' stuff.
|
||||||
|
#
|
||||||
# Revision 1.12 1997/08/25 20:27:21 curt
|
# Revision 1.12 1997/08/25 20:27:21 curt
|
||||||
# Merged in initial HUD and Joystick code.
|
# Merged in initial HUD and Joystick code.
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
fg_time.o: fg_time.c fg_time.h ../types.h
|
fg_time.o: fg_time.c fg_time.h ../types.h
|
||||||
fg_timer.o: fg_timer.c fg_timer.h
|
fg_timer.o: fg_timer.c fg_timer.h
|
||||||
sunpos.o: sunpos.c sunpos.h fg_time.h ../types.h ../constants.h \
|
sunpos.o: sunpos.c sunpos.h ../types.h fg_time.h ../constants.h \
|
||||||
../Math/fg_geodesy.h ../Math/polar.h ../Math/../types.h
|
../GLUT/views.h ../GLUT/../types.h ../GLUT/../Flight/flight.h \
|
||||||
|
../GLUT/../Flight/Slew/slew.h \
|
||||||
|
../GLUT/../Flight/LaRCsim/ls_interface.h \
|
||||||
|
../GLUT/../Flight/LaRCsim/../flight.h ../GLUT/../Math/mat3.h \
|
||||||
|
../Math/fg_geodesy.h ../Math/mat3.h ../Math/polar.h \
|
||||||
|
../Math/../types.h
|
||||||
|
|
|
@ -28,6 +28,12 @@
|
||||||
#define FG_TIME_H
|
#define FG_TIME_H
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
# include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <GL/glut.h>
|
||||||
|
|
||||||
#include "../types.h"
|
#include "../types.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,8 +41,11 @@
|
||||||
struct fgTIME {
|
struct fgTIME {
|
||||||
/* the point on the earth's surface above which the sun is directly
|
/* the point on the earth's surface above which the sun is directly
|
||||||
* overhead */
|
* overhead */
|
||||||
struct fgCartesianPoint fg_sunpos; /* in cartesian coordiantes */
|
|
||||||
double sun_lon, sun_gc_lat; /* in geocentric coordinates */
|
double sun_lon, sun_gc_lat; /* in geocentric coordinates */
|
||||||
|
struct fgCartesianPoint fg_sunpos; /* in cartesian coordiantes */
|
||||||
|
GLfloat sun_vec[4]; /* in view coordinates */
|
||||||
|
double sun_angle; /* the angle between the sun and the
|
||||||
|
local horizontal */
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct fgTIME cur_time_params;
|
extern struct fgTIME cur_time_params;
|
||||||
|
@ -46,9 +55,12 @@ extern struct fgTIME cur_time_params;
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.2 1997/08/27 03:30:36 curt
|
/* Revision 1.3 1997/09/04 02:17:39 curt
|
||||||
/* Changed naming scheme of basic shared structures.
|
/* Shufflin' stuff.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.2 1997/08/27 03:30:36 curt
|
||||||
|
* Changed naming scheme of basic shared structures.
|
||||||
|
*
|
||||||
* Revision 1.1 1997/08/13 21:56:00 curt
|
* Revision 1.1 1997/08/13 21:56:00 curt
|
||||||
* Initial revision.
|
* Initial revision.
|
||||||
*
|
*
|
||||||
|
|
|
@ -46,7 +46,9 @@
|
||||||
#include "sunpos.h"
|
#include "sunpos.h"
|
||||||
#include "fg_time.h"
|
#include "fg_time.h"
|
||||||
#include "../constants.h"
|
#include "../constants.h"
|
||||||
|
#include "../GLUT/views.h"
|
||||||
#include "../Math/fg_geodesy.h"
|
#include "../Math/fg_geodesy.h"
|
||||||
|
#include "../Math/mat3.h"
|
||||||
#include "../Math/polar.h"
|
#include "../Math/polar.h"
|
||||||
|
|
||||||
#undef E
|
#undef E
|
||||||
|
@ -258,12 +260,15 @@ void fgSunPosition(time_t ssue, double *lon, double *lat) {
|
||||||
|
|
||||||
|
|
||||||
/* update the cur_time_params structure with the current sun position */
|
/* update the cur_time_params structure with the current sun position */
|
||||||
void fgUpdateSunPos() {
|
void fgUpdateSunPos(struct fgCartesianPoint scenery_center) {
|
||||||
struct fgTIME *t;
|
struct fgTIME *t;
|
||||||
double sun_gd_lat, sl_radius;
|
struct VIEW *v;
|
||||||
|
MAT3vec nup, nsun;
|
||||||
|
double sun_gd_lat, sl_radius, temp;
|
||||||
static int time_warp = 0;
|
static int time_warp = 0;
|
||||||
|
|
||||||
t = &cur_time_params;
|
t = &cur_time_params;
|
||||||
|
v = ¤t_view;
|
||||||
|
|
||||||
time_warp += 200; /* increase this to make the world spin real fast */
|
time_warp += 200; /* increase this to make the world spin real fast */
|
||||||
|
|
||||||
|
@ -275,13 +280,35 @@ void fgUpdateSunPos() {
|
||||||
|
|
||||||
/* printf("Geodetic lat = %.5f Geocentric lat = %.5f\n", sun_gd_lat,
|
/* printf("Geodetic lat = %.5f Geocentric lat = %.5f\n", sun_gd_lat,
|
||||||
t->sun_gc_lat); */
|
t->sun_gc_lat); */
|
||||||
|
|
||||||
|
/* the sun position has to be translated just like everything else */
|
||||||
|
t->sun_vec[0] = t->fg_sunpos.x - scenery_center.x;
|
||||||
|
t->sun_vec[1] = t->fg_sunpos.y - scenery_center.y;
|
||||||
|
t->sun_vec[2] = t->fg_sunpos.z - scenery_center.z;
|
||||||
|
/* make this a directional light source only */
|
||||||
|
t->sun_vec[3] = 0.0;
|
||||||
|
|
||||||
|
/* calculate thesun's relative angle to local up */
|
||||||
|
MAT3_COPY_VEC(nup, v->local_up);
|
||||||
|
nsun[0] = t->fg_sunpos.x;
|
||||||
|
nsun[1] = t->fg_sunpos.y;
|
||||||
|
nsun[2] = t->fg_sunpos.z;
|
||||||
|
MAT3_NORMALIZE_VEC(nup, temp);
|
||||||
|
MAT3_NORMALIZE_VEC(nsun, temp);
|
||||||
|
|
||||||
|
t->sun_angle = acos(MAT3_DOT_PRODUCT(nup, nsun));
|
||||||
|
printf("SUN ANGLE relative to current location = %.3f rads.\n",
|
||||||
|
t->sun_angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.6 1997/08/27 03:30:37 curt
|
/* Revision 1.7 1997/09/04 02:17:40 curt
|
||||||
/* Changed naming scheme of basic shared structures.
|
/* Shufflin' stuff.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.6 1997/08/27 03:30:37 curt
|
||||||
|
* Changed naming scheme of basic shared structures.
|
||||||
|
*
|
||||||
* Revision 1.5 1997/08/22 21:34:41 curt
|
* Revision 1.5 1997/08/22 21:34:41 curt
|
||||||
* Doing a bit of reorganizing and house cleaning.
|
* Doing a bit of reorganizing and house cleaning.
|
||||||
*
|
*
|
||||||
|
|
|
@ -42,9 +42,10 @@
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#include "../types.h"
|
||||||
|
|
||||||
/* update the cur_time_params structure with the current sun position */
|
/* update the cur_time_params structure with the current sun position */
|
||||||
void fgUpdateSunPos();
|
void fgUpdateSunPos(struct fgCartesianPoint scenery_center);
|
||||||
|
|
||||||
void fgSunPosition(time_t ssue, double *lon, double *lat);
|
void fgSunPosition(time_t ssue, double *lon, double *lat);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue