]> git.mxchange.org Git - flightgear.git/commitdiff
WE CAN NOW FLY!!!
authorcurt <curt>
Sat, 31 May 1997 04:13:51 +0000 (04:13 +0000)
committercurt <curt>
Sat, 31 May 1997 04:13:51 +0000 (04:13 +0000)
Continuing work on the LaRCsim flight model integration.
Added some MSFS-like keyboard input handling.

LaRCsim/ls_interface.c
Main/GLUTkey.c
Main/GLUTkey.h
Main/GLmain.c
Main/Makefile
Main/mesh2GL.c
Simulator/README

index 8a0b3400b2e1cea7dc98564487a0584ec6c77f6a..82017e5beeeaa62852cb58341c57851e5d2f1574 100644 (file)
@@ -497,14 +497,14 @@ int initialize;
 int ls_cockpit() {
     struct control_params *c;
 
+    sim_control_.paused = 0;
+
     c = &current_aircraft.controls;
 
     Lat_control = -c->aileron;
     Long_control = -c->elev;
-
-    sim_control_.paused = 0;
-
-    Throttle_pct = 0.95;
+    Rudder_pedal = c->rudder;
+    Throttle_pct = c->throttle[0];
 
     /* printf("Mach = %.2f  ", Mach_number);
     printf("%.4f,%.4f,%.2f  ", Latitude, Longitude, Altitude);
@@ -908,6 +908,12 @@ int fgLaRCsim_2_Flight (struct flight_params *f) {
 /* Flight Gear Modification Log
  *
  * $Log$
+ * Revision 1.6  1997/05/31 04:13:53  curt
+ * WE CAN NOW FLY!!!
+ *
+ * Continuing work on the LaRCsim flight model integration.
+ * Added some MSFS-like keyboard input handling.
+ *
  * Revision 1.5  1997/05/30 23:26:25  curt
  * Added elevator/aileron controls.
  *
index 19a9450ec251d192241d39d157ddf06e1ec8d3e7..2258253e5f47a27761a4b1c43f7d6bddd1bb425a 100644 (file)
@@ -42,30 +42,34 @@ void GLUTkey(unsigned char k, int x, int y) {
     printf("Key hit = %d\n", k);
 
     switch (k) {
-    case GLUT_KEY_UP:
-       c->elev -= 0.01;
-       return;
-    case GLUT_KEY_DOWN:
+    case 50: /* numeric keypad 2 */
        c->elev += 0.01;
        return;
-    case GLUT_KEY_LEFT:
+    case 56: /* numeric keypad 8 */
+       c->elev -= 0.01;
+       return;
+    case 52: /* numeric keypad 4 */
        c->aileron += 0.01;
        return;
-    case GLUT_KEY_RIGHT:
+    case 54: /* numeric keypad 6 */
        c->aileron -= 0.01;
        return;
-    case 1 /* TK_END */:
+    case 48: /* numeric keypad Ins */
        c->rudder -= 0.01;
        return;
-    case 2 /* TK_PGDWN */:
+    case 13: /* numeric keypad Enter */
        c->rudder += 0.01;
        return;
-    case 3:
-       c->throttle[0] -= 0.05;
-       return;
-    case 4:
+    case 53: /* numeric keypad 5 */
+       c->aileron = 0.0;
+       c->elev = 0.0;
+       c->rudder = 0.0;
+    case 57: /* numeric keypad 9 (Pg Up) */
        c->throttle[0] += 0.05;
        return;
+    case 51: /* numeric keypad 3 (Pg Dn) */
+       c->throttle[0] -= 0.05;
+       return;
     case 122:
        fogDensity *= 1.10;
        glFogf(GL_FOG_END, fogDensity);
@@ -83,10 +87,42 @@ void GLUTkey(unsigned char k, int x, int y) {
 }
 
 
+/* Handle "special" keyboard events */
+void GLUTspecialkey(unsigned char k, int x, int y) {
+    struct control_params *c;
+
+    c = &current_aircraft.controls;
+
+    printf("Special key hit = %d\n", k);
+
+    switch (k) {
+    case GLUT_KEY_UP:
+       c->elev -= 0.01;
+       return;
+    case GLUT_KEY_DOWN:
+       c->elev += 0.01;
+       return;
+    case GLUT_KEY_LEFT:
+       c->aileron += 0.01;
+       return;
+    case GLUT_KEY_RIGHT:
+       c->aileron -= 0.01;
+       return;
+    }
+
+}
+
+
 /* $Log$
-/* Revision 1.5  1997/05/30 23:26:19  curt
-/* Added elevator/aileron controls.
+/* Revision 1.6  1997/05/31 04:13:52  curt
+/* WE CAN NOW FLY!!!
 /*
+/* Continuing work on the LaRCsim flight model integration.
+/* Added some MSFS-like keyboard input handling.
+/*
+ * Revision 1.5  1997/05/30 23:26:19  curt
+ * Added elevator/aileron controls.
+ *
  * Revision 1.4  1997/05/27 17:44:31  curt
  * Renamed & rearranged variables and routines.   Added some initial simple
  * timer/alarm routines so the flight model can be updated on a regular interval.
index 8294048a3f9462229d2fd691af4aab4c8da57c06..0fa974cb4fccfb95c340ae5d714567b17060f602 100644 (file)
 
 /* Handle keyboard events */
 void GLUTkey(unsigned char k, int x, int y);
+void GLUTspecialkey(unsigned char k, int x, int y);
 
 
 #endif GLUTKEY_H
 
 
 /* $Log$
-/* Revision 1.2  1997/05/23 15:40:25  curt
-/* Added GNU copyright headers.
-/* Fog now works!
+/* Revision 1.3  1997/05/31 04:13:52  curt
+/* WE CAN NOW FLY!!!
 /*
+/* Continuing work on the LaRCsim flight model integration.
+/* Added some MSFS-like keyboard input handling.
+/*
+ * Revision 1.2  1997/05/23 15:40:25  curt
+ * Added GNU copyright headers.
+ * Fog now works!
+ *
  * Revision 1.1  1997/05/21 15:57:51  curt
  * Renamed due to added GLUT support.
  *
index 592825797e5d5531803c680866b2571d892dba81..68c19c6d4fdd2195c33c4ad0dc9bd814b46dd5a1 100644 (file)
@@ -59,6 +59,9 @@ struct aircraft_params current_aircraft;
 /* view parameters */
 static GLfloat win_ratio = 1.0;
 
+/* sun direction */
+static GLfloat sun_vec[4] = {-3.0, 1.0, 2.0, 0.0 };
+
 /* temporary hack */
 extern struct mesh *mesh_ptr;
 /* Function prototypes */
@@ -82,7 +85,6 @@ double Simtime;
 
 static void fgInitVisuals() {
     /* if the 4th field is 0.0, this specifies a direction ... */
-    static GLfloat sun_vec[4] = {3.0, 1.0, 3.0, 0.0 };
     static GLfloat color[4] = { 0.3, 0.7, 0.2, 1.0 };
     static GLfloat fogColor[4] = {0.65, 0.65, 0.85, 1.0};
     
@@ -122,6 +124,7 @@ static void fgUpdateViewParams() {
     struct flight_params *f;
     MAT3mat R, tmp;
     MAT3vec vec, forward, up;
+    MAT3hvec sun;
 
     f = &current_aircraft.flight;
 
@@ -170,6 +173,7 @@ static void fgUpdateViewParams() {
              pos_x + forward[0], pos_y + forward[1], pos_z + forward[2],
              up[0], up[1], up[2]);
 
+    glLightfv( GL_LIGHT0, GL_POSITION, sun_vec );
 }
 
 
@@ -210,6 +214,9 @@ void fgTimerCatch() {
     static double lastSimtime = -99.9;
     int Overrun;
 
+    /* ignore any SIGALRM's until we come back from our EOM iteration */
+    signal(SIGALRM, SIG_IGN);
+
     f = &current_aircraft.flight;
 
     /* printf("In fgTimerCatch()\n"); */
@@ -390,7 +397,7 @@ int main( int argc, char *argv[] ) {
     /* fgSlewInit(-335340,162540, 15, 4.38); */
     /* fgSlewInit(-398673.28,120625.64, 53, 4.38); */
 
-    fgFlightModelInit(FG_LARCSIM, f, 1.0 / DEFAULT_MODEL_HZ);
+    fgFlightModelInit(FG_LARCSIM, f, 1.0/(DEFAULT_MODEL_HZ*DEFAULT_MULTILOOP));
 
     /* build all objects */
     fgSceneryInit();
@@ -404,7 +411,7 @@ int main( int argc, char *argv[] ) {
 
       /* call key() on keyboard event */
       glutKeyboardFunc( GLUTkey );
-      glutSpecialFunc( GLUTkey );
+      glutSpecialFunc( GLUTspecialkey );
 
       /* call fgMainLoop() whenever there is nothing else to do */
       glutIdleFunc( fgMainLoop );
@@ -439,9 +446,15 @@ int main( int argc, char *argv[] ) {
 
 
 /* $Log$
-/* Revision 1.9  1997/05/30 19:27:01  curt
-/* The LaRCsim flight model is starting to look like it is working.
+/* Revision 1.10  1997/05/31 04:13:52  curt
+/* WE CAN NOW FLY!!!
 /*
+/* Continuing work on the LaRCsim flight model integration.
+/* Added some MSFS-like keyboard input handling.
+/*
+ * Revision 1.9  1997/05/30 19:27:01  curt
+ * The LaRCsim flight model is starting to look like it is working.
+ *
  * Revision 1.8  1997/05/30 03:54:10  curt
  * Made a bit more progress towards integrating the LaRCsim flight model.
  *
index cf435bc75e4810d5b107c5781023af05a1b56127..dba9064935d321fee87eb485c4884b8b1c096c7f 100644 (file)
@@ -53,12 +53,12 @@ INTERFACE_FILES = GLUTkey.c
 #---------------------------------------------------------------------------
 
 # For OpenGL
-GRAPHICS_LIBS = -lGLU -lGL -lXmu -lX11
+GRAPHICS_LIBS = -lGLU -lGL -lXmu -lX11
 
 # For Mesa
-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)
+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)
 
 
 CFLAGS = $(STD_CFLAGS) $(INTERFACE_FLAGS)
@@ -103,6 +103,12 @@ mesh2GL.o: mesh2GL.c ../scenery/mesh.h
 
 #---------------------------------------------------------------------------
 # $Log$
+# Revision 1.10  1997/05/31 04:13:53  curt
+# WE CAN NOW FLY!!!
+#
+# Continuing work on the LaRCsim flight model integration.
+# Added some MSFS-like keyboard input handling.
+#
 # Revision 1.9  1997/05/30 23:26:19  curt
 # Added elevator/aileron controls.
 #
index 2b312c01114893e0b7893b5e4c89e682926bc896..e00b5425cb07a303eb2f9852a335aa0ef953c0bc 100644 (file)
@@ -44,7 +44,7 @@ GLint mesh2GL(struct mesh *m) {
     int i, j, istep, jstep, iend, jend;
     float temp;
 
-    istep = jstep = 4;  /* Detail level 1 -- 1200 ... */
+    istep = jstep = 12;  /* Detail level 1 -- 1200 ... */
 
     mesh = glGenLists(1);
     glNewList(mesh, GL_COMPILE);
@@ -104,9 +104,15 @@ GLint mesh2GL(struct mesh *m) {
 
 
 /* $Log$
-/* Revision 1.12  1997/05/30 23:26:20  curt
-/* Added elevator/aileron controls.
+/* Revision 1.13  1997/05/31 04:13:53  curt
+/* WE CAN NOW FLY!!!
 /*
+/* Continuing work on the LaRCsim flight model integration.
+/* Added some MSFS-like keyboard input handling.
+/*
+ * Revision 1.12  1997/05/30 23:26:20  curt
+ * Added elevator/aileron controls.
+ *
  * Revision 1.11  1997/05/30 19:27:02  curt
  * The LaRCsim flight model is starting to look like it is working.
  *
index b633a6189d51311fa1e1f02c2783005b7a085faf..af84417d80f77df0273f3ce02952704d9a13fac9 100644 (file)
@@ -22,6 +22,11 @@ Strucures and code to implement various flight models.  Provides a
 standardized interface to all interesting flight model variabls.
 
 
+mat3/
+-----
+Contains miscellaneous matrix/vector routines.
+
+
 scenery/
 --------
 Scenery parsing/generating code.