1
0
Fork 0

Working on establishing a hard ground.

This commit is contained in:
curt 1997-07-08 18:20:11 +00:00
parent c350e0bdca
commit 134081456f
7 changed files with 110 additions and 38 deletions

View file

@ -41,6 +41,7 @@
#include "../constants.h" #include "../constants.h"
#include "../Aircraft/aircraft.h" #include "../Aircraft/aircraft.h"
#include "../Scenery/mesh.h"
#include "../Scenery/scenery.h" #include "../Scenery/scenery.h"
#include "../Math/mat3.h" #include "../Math/mat3.h"
#include "../Math/polar.h" #include "../Math/polar.h"
@ -372,6 +373,10 @@ void fgInitTimeDepCalcs() {
static void fgMainLoop( void ) { static void fgMainLoop( void ) {
static int remainder = 0; static int remainder = 0;
int elapsed, multi_loop; int elapsed, multi_loop;
double rough_elev;
struct flight_params *f;
f = &current_aircraft.flight;
elapsed = fgGetTimeInterval(); elapsed = fgGetTimeInterval();
printf("Time interval is = %d, previous remainder is = %d\n", elapsed, printf("Time interval is = %d, previous remainder is = %d\n", elapsed,
@ -390,6 +395,17 @@ static void fgMainLoop( void ) {
if ( ! use_signals ) { if ( ! use_signals ) {
fgUpdateTimeDepCalcs(multi_loop); fgUpdateTimeDepCalcs(multi_loop);
} }
/* 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);
printf("Ground elevation is about %.2f meters here.\n", rough_elev);
/* FG_Runway_altitude = rough_elev * METER_TO_FEET; */
if ( FG_Altitude < FG_Runway_altitude ) {
FG_Altitude = FG_Runway_altitude + 3.758099;
}
} }
@ -419,6 +435,7 @@ static void fgReshape( int width, int height ) {
int main( int argc, char *argv[] ) { int main( int argc, char *argv[] ) {
struct flight_params *f; struct flight_params *f;
double rough_elev;
f = &current_aircraft.flight; f = &current_aircraft.flight;
@ -513,6 +530,25 @@ int main( int argc, char *argv[] ) {
/* fgSlewInit(-335340,162540, 15, 4.38); */ /* fgSlewInit(-335340,162540, 15, 4.38); */
/* fgSlewInit(-398673.28,120625.64, 53, 4.38); */ /* fgSlewInit(-398673.28,120625.64, 53, 4.38); */
/* Initialize the Scenery Management system */
fgSceneryInit();
/* Tell the Scenery Management system where we are so it can load
* the correct scenery data */
fgSceneryUpdate(FG_Latitude, FG_Longitude, FG_Altitude);
/* 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);
printf("Ground elevation is about %.2f meters here.\n", rough_elev);
FG_Runway_altitude = rough_elev * METER_TO_FEET;
if ( FG_Altitude < FG_Runway_altitude ) {
FG_Altitude = FG_Runway_altitude + 3.758099;
}
/* end of thing that I just stuck in that I should probably move */
/* Initialize the flight model data structures base on above values */ /* Initialize the flight model data structures base on above values */
fgFlightModelInit( FG_LARCSIM, f, 1.0 / DEFAULT_MODEL_HZ ); fgFlightModelInit( FG_LARCSIM, f, 1.0 / DEFAULT_MODEL_HZ );
@ -522,21 +558,6 @@ int main( int argc, char *argv[] ) {
fgInitTimeDepCalcs(); fgInitTimeDepCalcs();
} }
/**********************************************************************
* The following section (and the functions elsewhere in this file)
* set up the scenery management system. This part is a big hack,
* and needs to be moved to it's own area.
**********************************************************************/
/* Initialize the Scenery Management system */
fgSceneryInit();
/* Tell the Scenery Management system where we are so it can load
* the correct scenery data */
fgSceneryUpdate(FG_Latitude, FG_Longitude, FG_Altitude);
/********************************************************************** /**********************************************************************
* Initialize the Event Handlers. * Initialize the Event Handlers.
**********************************************************************/ **********************************************************************/
@ -582,10 +603,13 @@ int main( int argc, char *argv[] ) {
/* $Log$ /* $Log$
/* Revision 1.27 1997/07/07 20:59:49 curt /* Revision 1.28 1997/07/08 18:20:12 curt
/* Working on scenery transformations to enable us to fly fluidly over the /* Working on establishing a hard ground.
/* poles with no discontinuity/distortion in scenery.
/* /*
* Revision 1.27 1997/07/07 20:59:49 curt
* Working on scenery transformations to enable us to fly fluidly over the
* poles with no discontinuity/distortion in scenery.
*
* Revision 1.26 1997/07/05 20:43:34 curt * Revision 1.26 1997/07/05 20:43:34 curt
* renamed mat3 directory to Math so we could add other math related routines. * renamed mat3 directory to Math so we could add other math related routines.
* *

View file

@ -16,7 +16,8 @@ GLmain.o: GLmain.c ../constants.h ../Aircraft/aircraft.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 ../Scenery/scenery.h \ ../Aircraft/../Controls/../limits.h ../Scenery/mesh.h \
../Math/mat3.h ../Math/polar.h ../Math/../types.h ../Timer/fg_timer.h ../Scenery/scenery.h ../Math/mat3.h ../Math/polar.h \
../Math/../types.h ../Timer/fg_timer.h
mesh2GL.o: mesh2GL.c ../constants.h ../Scenery/mesh.h ../Math/mat3.h \ mesh2GL.o: mesh2GL.c ../constants.h ../Scenery/mesh.h ../Math/mat3.h \
../Math/polar.h ../Math/../types.h ../Math/polar.h ../Math/../types.h

View file

@ -47,7 +47,7 @@ GLint mesh2GL(struct mesh *m) {
printf("In mesh2GL(), generating GL call list.\n"); printf("In mesh2GL(), generating GL call list.\n");
istep = jstep = 25; /* Detail level 1 -- 1200 ... */ istep = jstep = 4; /* Detail level 1 -- 1200 ... */
/* setup the batch transformation */ /* setup the batch transformation */
fgRotateBatchInit(-m->originx * ARCSEC_TO_RAD, -m->originy * ARCSEC_TO_RAD); fgRotateBatchInit(-m->originx * ARCSEC_TO_RAD, -m->originy * ARCSEC_TO_RAD);
@ -133,10 +133,13 @@ GLint mesh2GL(struct mesh *m) {
/* $Log$ /* $Log$
/* Revision 1.25 1997/07/07 20:59:50 curt /* Revision 1.26 1997/07/08 18:20:13 curt
/* Working on scenery transformations to enable us to fly fluidly over the /* Working on establishing a hard ground.
/* poles with no discontinuity/distortion in scenery.
/* /*
* Revision 1.25 1997/07/07 20:59:50 curt
* Working on scenery transformations to enable us to fly fluidly over the
* poles with no discontinuity/distortion in scenery.
*
* Revision 1.24 1997/07/05 20:43:35 curt * Revision 1.24 1997/07/05 20:43:35 curt
* renamed mat3 directory to Math so we could add other math related routines. * renamed mat3 directory to Math so we could add other math related routines.
* *

View file

@ -33,7 +33,7 @@
static vrmlGeometryType; static vrmlGeometryType;
static struct mesh eg; struct mesh eg;
/* Begin a new vrml geometry statement */ /* Begin a new vrml geometry statement */
@ -109,17 +109,23 @@ int vrmlFreeGeometry() {
switch(vrmlGeometryType) { switch(vrmlGeometryType) {
case VRML_ELEV_GRID: case VRML_ELEV_GRID:
free(eg.mesh_data); /* We need to rethink this here, we can't just free the data,
* because we need it to calculate current ground elevation
* ... */
/* free(eg.mesh_data); */
} }
return(vrmlGeometryType); return(vrmlGeometryType);
} }
/* $Log$ /* $Log$
/* Revision 1.2 1997/07/07 20:59:51 curt /* Revision 1.3 1997/07/08 18:20:13 curt
/* Working on scenery transformations to enable us to fly fluidly over the /* Working on establishing a hard ground.
/* poles with no discontinuity/distortion in scenery.
/* /*
* Revision 1.2 1997/07/07 20:59:51 curt
* Working on scenery transformations to enable us to fly fluidly over the
* poles with no discontinuity/distortion in scenery.
*
* Revision 1.1 1997/06/29 21:16:48 curt * Revision 1.1 1997/06/29 21:16:48 curt
* More twiddling with the Scenery Management system. * More twiddling with the Scenery Management system.
* *

View file

@ -37,7 +37,7 @@
/* Temporary hack until we get the scenery management system running */ /* Temporary hack until we get the scenery management system running */
extern GLint mesh_hack; extern GLint mesh_hack;
extern struct mesh eg;
/* initialize the non-array mesh values */ /* initialize the non-array mesh values */
void mesh_init(struct mesh *m) { void mesh_init(struct mesh *m) {
@ -150,10 +150,35 @@ void mesh_do_it(struct mesh *m) {
} }
/* return the current altitude based on mesh data. We should rewrite
* this to interpolate exact values, but for now this is good enough */
double mesh_altitude(double lon, double lat) {
/* we expect things in arcsec for now */
double xoffset, yoffset;
int xindex, yindex;
xoffset = lon - eg.originx;
yoffset = lat - eg.originy;
xindex = xoffset / eg.col_step;
yindex = yoffset / eg.row_step;
if ( (xindex >= 0) && (xindex < eg.cols) ) {
if ( (yindex >= 0) && (yindex < eg.rows) ) {
return( eg.mesh_data[xindex * eg.rows + yindex] );
}
}
}
/* $Log$ /* $Log$
/* Revision 1.6 1997/06/29 21:16:49 curt /* Revision 1.7 1997/07/08 18:20:13 curt
/* More twiddling with the Scenery Management system. /* Working on establishing a hard ground.
/* /*
* Revision 1.6 1997/06/29 21:16:49 curt
* More twiddling with the Scenery Management system.
*
* Revision 1.5 1997/06/22 21:44:41 curt * Revision 1.5 1997/06/22 21:44:41 curt
* Working on intergrating the VRML (subset) parser. * Working on intergrating the VRML (subset) parser.
* *

View file

@ -64,17 +64,24 @@ void mesh_set_option_name(struct mesh *m, char *name);
void mesh_set_option_value(struct mesh *m, char *value); void mesh_set_option_value(struct mesh *m, char *value);
/* do whatever needs to be done with the mesh now that it's been /* do whatever needs to be done with the mesh now that it's been
loaded, such as generating the OpenGL call list. */ * loaded, such as generating the OpenGL call list. */
void mesh_do_it(struct mesh *m); void mesh_do_it(struct mesh *m);
/* return the current altitude based on mesh data. We should rewrite
* this to interpolate exact values, but for now this is good enough */
double mesh_altitude(double lon, double lat);
#endif MESH_H #endif MESH_H
/* $Log$ /* $Log$
/* Revision 1.3 1997/06/22 21:44:41 curt /* Revision 1.4 1997/07/08 18:20:14 curt
/* Working on intergrating the VRML (subset) parser. /* Working on establishing a hard ground.
/* /*
* Revision 1.3 1997/06/22 21:44:41 curt
* Working on intergrating the VRML (subset) parser.
*
* Revision 1.2 1997/05/23 15:40:42 curt * Revision 1.2 1997/05/23 15:40:42 curt
* Added GNU copyright headers. * Added GNU copyright headers.
* *

View file

@ -45,11 +45,17 @@
/* Feet to Meters */ /* Feet to Meters */
#define FEET_TO_METER 0.3048 #define FEET_TO_METER 0.3048
/* Meters to Feet */
#define METER_TO_FEET 3.28083989501312335958
#endif CONSTANTS_H #endif CONSTANTS_H
/* $Log$ /* $Log$
/* Revision 1.1 1997/07/07 21:02:36 curt /* Revision 1.2 1997/07/08 18:20:11 curt
/* Initial revision. /* Working on establishing a hard ground.
/* */ /*
* Revision 1.1 1997/07/07 21:02:36 curt
* Initial revision.
* */