From: curt Date: Sat, 19 Jul 1997 23:04:46 +0000 (+0000) Subject: Added an initial weather section. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d6327ac839231eca6c45fff8ce887021b6908c18;p=flightgear.git Added an initial weather section. --- diff --git a/Main/GLmain.c b/Main/GLmain.c index aa664d9e0..e146e0c5f 100644 --- a/Main/GLmain.c +++ b/Main/GLmain.c @@ -48,6 +48,7 @@ #include "../Math/polar.h" #include "../Timer/fg_timer.h" #include "../Utils/fg_random.h" +#include "../Weather/weather.h" /* This is a record containing all the info for the aircraft currently @@ -387,8 +388,8 @@ static void fgMainLoop( void ) { /* I'm just sticking this here for now, it should probably move * eventually */ - rough_elev = mesh_altitude(FG_Longitude * RAD_TO_DEG * 3600.0, - FG_Latitude * RAD_TO_DEG * 3600.0); + rough_elev = mesh_altitude(FG_Longitude * RAD_TO_ARCSEC, + FG_Latitude * RAD_TO_ARCSEC); printf("Ground elevation is about %.2f meters here.\n", rough_elev); /* FG_Runway_altitude = rough_elev * METER_TO_FEET; */ @@ -403,9 +404,10 @@ static void fgMainLoop( void ) { FG_Altitude * FEET_TO_METER); } - FG_U_gust = fg_random() * 1.0 - 0.5; - FG_V_gust = fg_random() * 1.0 - 0.5; - FG_W_gust = fg_random() * 1.0 - 0.5; + /* update the weather for our current position */ + fgWeatherUpdate(FG_Longitude * RAD_TO_ARCSEC, + FG_Latitude * RAD_TO_ARCSEC, + FG_Altitude * FEET_TO_METER); } @@ -439,9 +441,6 @@ int main( int argc, char *argv[] ) { f = ¤t_aircraft.flight; - /* might as well do this first thing ... seed the random number generater */ - fg_srandom(); - printf("Flight Gear: prototype code to test OpenGL, LaRCsim, and VRML\n\n"); @@ -474,6 +473,9 @@ int main( int argc, char *argv[] ) { } #endif + /* seed the random number generater */ + fg_srandom(); + /* setup view parameters, only makes GL calls */ fgInitVisuals(); @@ -530,9 +532,6 @@ int main( int argc, char *argv[] ) { FG_Dy_cg = 0.000000E+00; FG_Dz_cg = 0.000000E+00; - /* Configure some wind & turbulance */ - FG_V_north_airmass = 15; /* ft/s =~ 10mph */ - /* Set initial position and slew parameters */ /* fgSlewInit(-398391.3, 120070.41, 244, 3.1415); */ /* GLOBE Airport */ /* fgSlewInit(-335340,162540, 15, 4.38); */ @@ -566,6 +565,9 @@ int main( int argc, char *argv[] ) { fgInitTimeDepCalcs(); } + /* Initialize the weather modeling subsystem */ + fgWeatherInit(); + /********************************************************************** * Initialize the Event Handlers. **********************************************************************/ @@ -619,10 +621,13 @@ int printf (const char *format, ...) { /* $Log$ -/* Revision 1.37 1997/07/19 22:34:02 curt -/* Moved PI definitions to ../constants.h -/* Moved random() stuff to ../Utils/ and renamed fg_random() +/* Revision 1.38 1997/07/19 23:04:47 curt +/* Added an initial weather section. /* + * Revision 1.37 1997/07/19 22:34:02 curt + * Moved PI definitions to ../constants.h + * Moved random() stuff to ../Utils/ and renamed fg_random() + * * Revision 1.36 1997/07/18 23:41:25 curt * Tweaks for building with Cygnus Win32 compiler. * diff --git a/Main/Makefile b/Main/Makefile index 1073ef29c..0760bc877 100644 --- a/Main/Makefile +++ b/Main/Makefile @@ -32,7 +32,7 @@ AFILES = ../Aircraft/libAircraft.a ../Controls/libControls.a \ ../Flight/libFlight.a ../Flight/LaRCsim/libLaRCsim.a \ ../Flight/Slew/libSlew.a ../Math/libMath.a \ ../Scenery/libScenery.a \ - ../Timer/libTimer.a ../Utils/libUtils.a + ../Timer/libTimer.a ../Utils/libUtils.a ../Weather/libWeather.a include ../make.inc @@ -76,6 +76,9 @@ mesh2GL.o: #--------------------------------------------------------------------------- # $Log$ +# Revision 1.24 1997/07/19 23:04:47 curt +# Added an initial weather section. +# # Revision 1.23 1997/07/19 22:34:03 curt # Moved PI definitions to ../constants.h # Moved random() stuff to ../Utils/ and renamed fg_random() diff --git a/Main/depend b/Main/depend index 788371740..4f8139b34 100644 --- a/Main/depend +++ b/Main/depend @@ -18,7 +18,8 @@ GLmain.o: GLmain.c ../constants.h ../Aircraft/aircraft.h \ ../Aircraft/../Controls/controls.h \ ../Aircraft/../Controls/../limits.h ../Scenery/mesh.h \ ../Scenery/scenery.h ../Math/mat3.h ../Math/polar.h \ - ../Math/../types.h ../Timer/fg_timer.h ../Utils/fg_random.h + ../Math/../types.h ../Timer/fg_timer.h ../Utils/fg_random.h \ + ../Weather/weather.h mesh2GL.o: mesh2GL.c ../constants.h ../Scenery/mesh.h \ ../Scenery/scenery.h ../Math/mat3.h ../Math/polar.h \ ../Math/../types.h ../Utils/fg_random.h diff --git a/Simulator/Makefile b/Simulator/Makefile index 93c9f6345..da1ed831d 100644 --- a/Simulator/Makefile +++ b/Simulator/Makefile @@ -28,7 +28,7 @@ include make.inc SUBSUBDIRS = Flight/LaRCsim Flight/Slew -SUBDIRS = Aircraft Controls Flight Math Scenery Timer Utils +SUBDIRS = Aircraft Controls Flight Math Scenery Timer Utils Weather MAIN = OpenGL @@ -63,6 +63,9 @@ zip: clean #--------------------------------------------------------------------------- # $Log$ +# Revision 1.19 1997/07/19 23:04:46 curt +# Added an initial weather section. +# # Revision 1.18 1997/07/19 22:36:28 curt # Added Utils/ subdirectory # diff --git a/Simulator/constants.h b/Simulator/constants.h index 114827a97..f1f8f1c2c 100644 --- a/Simulator/constants.h +++ b/Simulator/constants.h @@ -61,6 +61,9 @@ /* Arc seconds to radians */ /* (arcsec*pi)/(3600*180) = rad */ #define ARCSEC_TO_RAD 4.84813681109535993589e-06 +/* Radians to arc seconds */ /* (rad*3600*180)/pi = arcsec */ +#define RAD_TO_ARCSEC 2035752.03952618601852 + /* Feet to Meters */ #define FEET_TO_METER 0.3048 @@ -76,9 +79,12 @@ /* $Log$ -/* Revision 1.4 1997/07/19 22:37:03 curt -/* Added various PI definitions. +/* Revision 1.5 1997/07/19 23:04:46 curt +/* Added an initial weather section. /* + * Revision 1.4 1997/07/19 22:37:03 curt + * Added various PI definitions. + * * Revision 1.3 1997/07/14 16:26:03 curt * Testing/playing -- placed objects randomly across the entire terrain. *