From: curt Date: Fri, 18 Jul 1997 14:28:34 +0000 (+0000) Subject: Hacked in some support for wind/turbulence. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ff2636c4f844fcfe82b709b9217460ae7fd9f652;p=flightgear.git Hacked in some support for wind/turbulence. --- diff --git a/Main/GLmain.c b/Main/GLmain.c index fc985e230..43d22415b 100644 --- a/Main/GLmain.c +++ b/Main/GLmain.c @@ -416,6 +416,17 @@ static void fgMainLoop( void ) { printf("<*> resetting altitude to %.0f meters\n", FG_Altitude * FEET_TO_METER); } + +#ifdef USE_RAND + FG_U_gust = rand() * 3.0 / RAND_MAX - 1.0; + FG_V_gust = rand() * 3.0 / RAND_MAX - 1.0; + FG_W_gust = rand() * 3.0 / RAND_MAX - 1.0; +#else + FG_U_gust = random() * 3.0 / RAND_MAX - 1.0; + FG_V_gust = random() * 3.0 / RAND_MAX - 1.0; + FG_W_gust = random() * 3.0 / RAND_MAX - 1.0; +#endif + } @@ -537,6 +548,9 @@ 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); */ @@ -615,9 +629,12 @@ int main( int argc, char *argv[] ) { /* $Log$ -/* Revision 1.34 1997/07/16 20:04:48 curt -/* Minor tweaks to aid Win32 port. +/* Revision 1.35 1997/07/18 14:28:34 curt +/* Hacked in some support for wind/turbulence. /* + * Revision 1.34 1997/07/16 20:04:48 curt + * Minor tweaks to aid Win32 port. + * * Revision 1.33 1997/07/12 03:50:20 curt * Added an #include to help compiling for Win32 * diff --git a/Main/mesh2GL.c b/Main/mesh2GL.c index fd4d91f73..8f7c298cc 100644 --- a/Main/mesh2GL.c +++ b/Main/mesh2GL.c @@ -31,6 +31,7 @@ #include #include /* for random(), srandom() */ +#include /* for time() to seed srandom() */ #include "../constants.h" #include "../Scenery/mesh.h" @@ -86,6 +87,7 @@ GLint mesh2GL(struct mesh *m) { /* static GLfloat color[4] = { 0.5, 0.4, 0.25, 1.0 }; */ /* dark desert */ static GLfloat color[4] = { 0.5, 0.5, 0.25, 1.0 }; double randx, randy; + int t; float x1, y1, x2, y2, z11, z12, z21, z22; struct fgCartesianPoint p11, p12, p21, p22; @@ -186,6 +188,12 @@ GLint mesh2GL(struct mesh *m) { } */ +#ifdef USE_RAND + srand(time(&t)); +#else + srandom(time(&t)); +#endif + for ( i = 0; i < 200; i++ ) { #ifdef USE_RAND randx = rand() * 3600.0 / RAND_MAX; @@ -206,9 +214,12 @@ GLint mesh2GL(struct mesh *m) { /* $Log$ -/* Revision 1.34 1997/07/16 20:04:50 curt -/* Minor tweaks to aid Win32 port. +/* Revision 1.35 1997/07/18 14:28:35 curt +/* Hacked in some support for wind/turbulence. /* + * Revision 1.34 1997/07/16 20:04:50 curt + * Minor tweaks to aid Win32 port. + * * Revision 1.33 1997/07/14 16:26:04 curt * Testing/playing -- placed objects randomly across the entire terrain. * diff --git a/Simulator/make.inc b/Simulator/make.inc index a5695573c..cbc2bae1c 100644 --- a/Simulator/make.inc +++ b/Simulator/make.inc @@ -61,7 +61,7 @@ RANLIB = ranlib # #--------------------------------------------------------------------------- -FG_CFLAGS = -g -Wall -DUSE_RAND +FG_CFLAGS = -g -Wall #--------------------------------------------------------------------------- @@ -72,9 +72,9 @@ FG_CFLAGS = -g -Wall -DUSE_RAND #--------------------------------------------------------------------------- #--------------------------------------------------------------------------- -# SGI IRIX with the GLUT toolkit (surprisingly, this also works on our -# SunOS 4.x machine with the way we have -# Mesa & Glut installed.) +# SGI IRIX with the GLUT toolkit +# (Surprisingly, this also works on our SunOS 4.x machine with the +# way we have Mesa & Glut installed.) # # INTERFACE_FLAGS = -DGLUT # INTERFACE_LIBS = -lglut @@ -85,26 +85,29 @@ FG_CFLAGS = -g -Wall -DUSE_RAND #--------------------------------------------------------------------------- # Linux/Mesa with the GLUT toolkit # -# INTERFACE_FLAGS = -DGLUT -# INTERFACE_LIBS = -lglut -# INTERFACE_FILES = 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) +INTERFACE_FLAGS = -DGLUT +INTERFACE_LIBS = -lglut +INTERFACE_FILES = 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) #--------------------------------------------------------------------------- #--------------------------------------------------------------------------- # Cygnus Win32 (gcc based) with the GLUT toolkit # -INTERFACE_FLAGS = -DGLUT -INTERFACE_LIBS = -Wl,--subsystem,windows -L. -lglut -INTERFACE_FILES = GLUTkey.c -GRAPHICS_LIBS = -lglu32 -lopengl32 +# INTERFACE_FLAGS = -DGLUT +# INTERFACE_LIBS = -Wl,--subsystem,windows -L. -lglut +# INTERFACE_FILES = GLUTkey.c +# GRAPHICS_LIBS = -lglu32 -lopengl32 #--------------------------------------------------------------------------- #--------------------------------------------------------------------------- # $Log$ +# Revision 1.7 1997/07/18 14:28:34 curt +# Hacked in some support for wind/turbulence. +# # Revision 1.6 1997/07/16 20:04:42 curt # Minor tweaks to aid Win32 port. #