1
0
Fork 0

WE CAN NOW FLY!!!

Continuing work on the LaRCsim flight model integration.
Added some MSFS-like keyboard input handling.
This commit is contained in:
curt 1997-05-31 04:13:51 +00:00
parent 305c0fa027
commit 220ee54f33
7 changed files with 112 additions and 33 deletions

View 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.
*

View 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.

View file

@ -37,16 +37,23 @@
/* 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.
*

View 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.
*

View 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.
#

View 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.
*

View 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.