#include <Include/fg_constants.h>
#include <Aircraft/aircraft.h>
-#include <Scenery/mesh.h>
#include <Scenery/scenery.h>
#include <Math/mat3.h>
#include <Math/polar.h>
/* $Log$
-/* Revision 1.7 1998/01/27 00:47:51 curt
-/* Incorporated Paul Bleisch's <bleisch@chromatic.com> new debug message
-/* system and commandline/config file processing code.
+/* Revision 1.8 1998/01/31 00:43:03 curt
+/* Added MetroWorks patches from Carmen Volpe.
/*
+ * Revision 1.7 1998/01/27 00:47:51 curt
+ * Incorporated Paul Bleisch's <bleisch@chromatic.com> new debug message
+ * system and commandline/config file processing code.
+ *
* Revision 1.6 1998/01/19 19:27:01 curt
* Merged in make system changes from Bob Kuehne <rpk@sgi.com>
* This should simplify things tremendously.
cockpit.o: cockpit.c
-hud.o: hud.c hud.h ../Include/constants.h ../Aircraft/aircraft.h \
- ../Scenery/mesh.h ../Scenery/scenery.h ../Math/mat3.h ../Math/polar.h \
- ../Time/fg_timer.h ../Math/fg_random.h ../Weather/weather.h
-test.o: test.c test.h ../Aircraft/aircraft.h ../Flight/flight.h \
- ../Controls/controls.h ../Include/constants.h ../Scenery/mesh.h \
- ../Scenery/scenery.h ../Math/mat3.h ../Math/polar.h \
- ../Time/fg_timer.h ../Math/fg_random.h ../Weather/weather.h
+hud.o: hud.c hud.h
#include <Include/fg_constants.h>
#include <Aircraft/aircraft.h>
-#include <Scenery/mesh.h>
+/* #include <Scenery/mesh.h> */
#include <Scenery/scenery.h>
#include <Math/mat3.h>
#include <Math/polar.h>
}
/* strokeString - Stroke font string */
-
-static void strokeString(int x, int y, char *msg, void *font)
-{
- glPushMatrix();
- glTranslatef(x, y, 0);
- glScalef(.04, .04, .04);
- while (*msg) {
- glutStrokeCharacter(font, *msg);
- msg++;
- }
- glPopMatrix();
-}
+/* static void strokeString(int x, int y, char *msg, void *font) */
+/* { */
+/* glPushMatrix(); */
+/* glTranslatef(x, y, 0); */
+/* glScalef(.04, .04, .04); */
+/* while (*msg) { */
+/* glutStrokeCharacter(font, *msg); */
+/* msg++; */
+/* } */
+/* glPopMatrix(); */
+/* } */
/*
{
double vmin, vmax;
double roll_value, pitch_value;
- double cos_roll, sin_roll;
+ /* double cos_roll, sin_roll; */
int marker_x, marker_y;
int mid_scr;
int scr_min, scr_max;
new_x_ini = ladder.x_pos+(x_ini-ladder.x_pos)*cos(roll_value)-\
(y_ini-ladder.y_pos)*sin(roll_value);
new_y_ini = ladder.y_pos+(x_ini-ladder.x_pos)*sin(roll_value)+\
- (y_ini-ladder.y_pos)*cos(roll_value);
+ (y_ini-ladder.y_pos)*cos(roll_value);
new_x_end = ladder.x_pos+(x_end-ladder.x_pos)*cos(roll_value)-\
(y_end-ladder.y_pos)*sin(roll_value);
new_y_end = ladder.y_pos+(x_end-ladder.x_pos)*sin(roll_value)+\
{
int x_inc1, y_inc1;
int x_inc2, y_inc2;
- struct fgFLIGHT *f;
+ /* struct fgFLIGHT *f; */
double sin_bank, cos_bank;
double bank_angle;
- // f = ¤t_aircraft.flight;
+ /* f = ¤t_aircraft.flight; */
bank_angle = (*horizon.load_value)();
/* $Log$
-/* Revision 1.8 1998/01/27 00:47:51 curt
-/* Incorporated Paul Bleisch's <bleisch@chromatic.com> new debug message
-/* system and commandline/config file processing code.
+/* Revision 1.9 1998/01/31 00:43:04 curt
+/* Added MetroWorks patches from Carmen Volpe.
/*
+ * Revision 1.8 1998/01/27 00:47:51 curt
+ * Incorporated Paul Bleisch's <bleisch@chromatic.com> new debug message
+ * system and commandline/config file processing code.
+ *
* Revision 1.7 1998/01/19 18:40:20 curt
* Tons of little changes to clean up the code and to remove fatal errors
* when building with the c++ compiler.
TARGETS = $(ARLIBRARY)
LaRCsimFILES = atmos_62.c ls_accel.c ls_aux.c ls_geodesy.c ls_gravity.c \
- ls_step.c ls_model.c default_model_routines.c ls_init.c # ls_sync.c
+ ls_step.c ls_matrix.c ls_model.c default_model_routines.c ls_init.c \
+ ls_trim.c
NavionFILES = navion_aero.c navion_engine.c navion_gear.c navion_init.c
InterfaceFILES = ls_interface.c
CFILES = $(LaRCsimFILES) $(NavionFILES) $(InterfaceFILES)
ls_interface.o: ls_interface.c ls_types.h ls_constants.h ls_generic.h \
ls_sim_control.h ls_cockpit.h ls_interface.h ls_step.h ls_accel.h \
ls_aux.h ls_model.h ls_init.h
+ls_matrix.o: ls_matrix.c ls_matrix.h
ls_model.o: ls_model.c ls_types.h ls_model.h default_model_routines.h
ls_step.o: ls_step.c ls_types.h ls_constants.h ls_generic.h ls_accel.h \
ls_aux.h ls_model.h ls_step.h ls_geodesy.h ls_gravity.h
+ls_trim.o: ls_trim.c ls_constants.h ls_types.h ls_sym.h ls_matrix.h
mymain.o: mymain.c ls_types.h ls_cockpit.h ls_generic.h
navion_aero.o: navion_aero.c ls_types.h ls_generic.h ls_cockpit.h
navion_engine.o: navion_engine.c ls_types.h ls_constants.h \
#include <Math/fg_geodesy.h>
#include <Math/mat3.h>
#include <Math/polar.h>
-#include <Scenery/mesh.h>
#include <Scenery/scenery.h>
#include <Scenery/tilemgr.h>
#include <Time/event.h>
/* I'm just sticking this here for now, it should probably move
* eventually */
- cur_elev = mesh_altitude(FG_Longitude * RAD_TO_ARCSEC,
- FG_Latitude * RAD_TO_ARCSEC);
+ /* cur_elev = mesh_altitude(FG_Longitude * RAD_TO_ARCSEC,
+ FG_Latitude * RAD_TO_ARCSEC); */
+ /* there is no ground collision detection really, so for now I
+ * just hard code the ground elevation to be 0 */
+ cur_elev = 0;
+
/* printf("Ground elevation is %.2f meters here.\n", cur_elev); */
/* FG_Runway_altitude = cur_elev * METER_TO_FEET; */
/* $Log$
-/* Revision 1.53 1998/01/27 18:35:54 curt
-/* Minor tweaks.
+/* Revision 1.54 1998/01/31 00:43:10 curt
+/* Added MetroWorks patches from Carmen Volpe.
/*
+ * Revision 1.53 1998/01/27 18:35:54 curt
+ * Minor tweaks.
+ *
* Revision 1.52 1998/01/27 00:47:56 curt
* Incorporated Paul Bleisch's <bleisch@chromatic.com> new debug message
* system and commandline/config file processing code.
static fgDebugClass fg_DebugClass = FG_ALL;
static fgDebugPriority fg_DebugPriority = FG_INFO;
static fgDebugCallback fg_DebugCallback = NULL;
-static FILE *fg_DebugOutput = stderr;
+
+#ifndef __CYGWIN32__
+ static FILE *fg_DebugOutput = stderr;
+#else /* __CYGWIN32__ */
+ static FILE *fg_DebugOutput = NULL;
+#endif /* __CYGWIN32 */
/* TODO: Actually make this thing thread safe */
#ifdef USETHREADS
{
char *pszClass, *pszPrio;
+#ifdef __CYGWIN32__
+ fg_DebugOutput = stderr;
+#endif /* __CYGWIN32 */
+
FG_GRABDEBUGSEM;
fg_DebugSem=fg_DebugSem; /* shut up GCC */
#include <Cockpit/cockpit.h>
#include <Joystick/joystick.h>
#include <Math/fg_random.h>
-#include <Scenery/mesh.h>
#include <Scenery/scenery.h>
#include <Scenery/tilemgr.h>
#include <Time/event.h>
/* I'm just sticking this here for now, it should probably move
* eventually */
- cur_elev = mesh_altitude(FG_Longitude * RAD_TO_DEG * 3600.0,
- FG_Latitude * RAD_TO_DEG * 3600.0);
- fgPrintf( FG_GENERAL, FG_INFO, "True ground elevation is %.2f meters here.\n",
- cur_elev);
+ /* cur_elev = mesh_altitude(FG_Longitude * RAD_TO_DEG * 3600.0,
+ FG_Latitude * RAD_TO_DEG * 3600.0); */
+ /* fgPrintf( FG_GENERAL, FG_INFO,
+ "True ground elevation is %.2f meters here.\n",
+ cur_elev); */
+ cur_elev = FG_Runway_altitude * FEET_TO_METER;
if ( cur_elev > -9990.0 ) {
FG_Runway_altitude = cur_elev * METER_TO_FEET;
}
/* $Log$
-/* Revision 1.35 1998/01/27 00:47:57 curt
-/* Incorporated Paul Bleisch's <bleisch@chromatic.com> new debug message
-/* system and commandline/config file processing code.
+/* Revision 1.36 1998/01/31 00:43:13 curt
+/* Added MetroWorks patches from Carmen Volpe.
/*
+ * Revision 1.35 1998/01/27 00:47:57 curt
+ * Incorporated Paul Bleisch's <bleisch@chromatic.com> new debug message
+ * system and commandline/config file processing code.
+ *
* Revision 1.34 1998/01/22 02:59:37 curt
* Changed #ifdef FILE_H to #ifdef _FILE_H
*
ARLIBRARY = libScenery.a
TARGETS = $(ARLIBRARY)
-CFILES = bucketutils.c common.c geometry.c mesh.c obj.c scenery.c texload.c \
- tilecache.c tilemgr.c
+CFILES = bucketutils.c common.c obj.c scenery.c texload.c tilecache.c tilemgr.c
CXXFILES =
LDIRT = $(FG_ROOT_LIB)/$(ARLIBRARY)
+++ /dev/null
-/**************************************************************************
- * geometry.c -- data structures and routines for processing vrml geometry
- *
- * Written by Curtis Olson, started June 1997.
- *
- * Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Id$
- * (Log is kept at end of this file)
- **************************************************************************/
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <Scenery/geometry.h>
-#include <Scenery/mesh.h>
-
-
-static vrmlGeometryType;
-struct MESH eg;
-
-
-/* Begin a new vrml geometry statement */
-int vrmlInitGeometry(char *type) {
- printf("Beginning geometry item = %s\n", type);
-
- if ( strcmp(type, "ElevationGrid") == 0 ) {
- vrmlGeometryType = VRML_ELEV_GRID;
- mesh_init(&eg);
- } else {
- vrmlGeometryType = -1;
- printf("Unimplemented geometry type = %s\n", type);
- }
-
- return(vrmlGeometryType);
-}
-
-
-/* Set current vrml geometry option name */
-void vrmlGeomOptionName(char *name) {
- /* printf("Found vrml geometry option = %s\n", name); */
-
- switch(vrmlGeometryType) {
- case VRML_ELEV_GRID:
- if ( strcmp(name, "xOrigin") == 0 ) {
- mesh_set_option_name(&eg, "origin_lon");
- } else if ( strcmp(name, "zOrigin") == 0 ) {
- mesh_set_option_name(&eg, "origin_lat");
- } else if ( strcmp(name, "xDimension") == 0 ) {
- mesh_set_option_name(&eg, "rows");
- } else if ( strcmp(name, "zDimension") == 0 ) {
- mesh_set_option_name(&eg, "cols");
- } else if ( strcmp(name, "xSpacing") == 0 ) {
- mesh_set_option_name(&eg, "row_step");
- } else if ( strcmp(name, "zSpacing") == 0 ) {
- mesh_set_option_name(&eg, "col_step");
- } else if ( strcmp(name, "height") == 0 ) {
- eg.mesh_data = new_mesh_data(eg.rows, eg.cols);
- mesh_set_option_name(&eg, "do_data");
- } else {
- printf("Unknown ElevationGrid option = %s\n", name);
- }
- break;
- }
-}
-
-
-/* Set current vrml geometry value */
-void vrmlGeomOptionsValue(char *value) {
- /* printf("Found vrml geometry value = %s\n", value); */
-
- switch(vrmlGeometryType) {
- case VRML_ELEV_GRID:
- mesh_set_option_value(&eg, value);
- }
-}
-
-
-/* We've finished parsing the current geometry. Now do whatever needs
- * to be done with it (like generating the OpenGL call list for
- * instance */
-void vrmlHandleGeometry( void ) {
- switch(vrmlGeometryType) {
- case VRML_ELEV_GRID:
- mesh_do_it(&eg);
- }
-}
-
-
-/* Finish up the current vrml geometry statement */
-int vrmlFreeGeometry( void ) {
- printf("Freeing geometry type = %d\n", vrmlGeometryType);
-
- switch(vrmlGeometryType) {
- case VRML_ELEV_GRID:
- /* 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);
-}
-
-
-/* $Log$
-/* Revision 1.7 1998/01/19 19:27:15 curt
-/* Merged in make system changes from Bob Kuehne <rpk@sgi.com>
-/* This should simplify things tremendously.
-/*
- * Revision 1.6 1998/01/19 18:40:35 curt
- * Tons of little changes to clean up the code and to remove fatal errors
- * when building with the c++ compiler.
- *
- * Revision 1.5 1998/01/06 01:20:23 curt
- * Tweaks to help building with MSVC++
- *
- * Revision 1.4 1997/08/27 03:30:26 curt
- * Changed naming scheme of basic shared structures.
- *
- * Revision 1.3 1997/07/08 18:20:13 curt
- * Working on establishing a hard ground.
- *
- * 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
- * More twiddling with the Scenery Management system.
- *
- * Revision 1.1 1997/06/22 21:42:35 curt
- * Initial revision of VRML (subset) parser.
- *
- */
+++ /dev/null
-/**************************************************************************
- * geometry.h -- data structures and routines for handling vrml geometry
- *
- * Written by Curtis Olson, started June 1997.
- *
- * Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Id$
- * (Log is kept at end of this file)
- **************************************************************************/
-
-
-#ifndef _GEOMETRY_H
-#define _GEOMETRY_H
-
-
-#define VRML_BOX 0
-#define VRML_CYLINDER 1
-#define VRML_CONE 2
-#define VRML_ELEV_GRID 3
-
-
-/* Begin a new vrml geometry statement */
-int vrmlInitGeometry(char *type);
-
-/* Set current vrml geometry option name */
-void vrmlGeomOptionName(char *name);
-
-/* Set current vrml geometry value */
-void vrmlGeomOptionsValue(char *value);
-
-/* We've finished parsing the current geometry. Now do whatever needs
- * to be done with it (like generating the OpenGL call list for
- * instance */
-void vrmlHandleGeometry( void );
-
-/* Finish up the current vrml geometry statement */
-int vrmlFreeGeometry( void );
-
-
-#endif /* _GEOMETRY_H */
-
-
-/* $Log$
-/* Revision 1.4 1998/01/22 02:59:40 curt
-/* Changed #ifdef FILE_H to #ifdef _FILE_H
-/*
- * Revision 1.3 1998/01/19 18:40:36 curt
- * Tons of little changes to clean up the code and to remove fatal errors
- * when building with the c++ compiler.
- *
- * Revision 1.2 1997/07/23 21:52:25 curt
- * Put comments around the text after an #endif for increased portability.
- *
- * Revision 1.1 1997/06/29 21:16:48 curt
- * More twiddling with the Scenery Management system.
- *
- * Revision 1.1 1997/06/22 21:42:35 curt
- * Initial revision of VRML (subset) parser.
- *
- */
+++ /dev/null
-/**************************************************************************
- * mesh.c -- data structures and routines for processing terrain meshes
- *
- * Written by Curtis Olson, started May 1997.
- *
- * Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Id$
- * (Log is kept at end of this file)
- **************************************************************************/
-
-
-#ifndef __CYGWIN32__
-# include <malloc.h>
-#endif
-
-#ifdef WIN32
-# include <windows.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h> /* atof(), atoi() */
-#include <string.h>
-
-#include <GL/glut.h>
-
-#include <Include/fg_constants.h>
-#include <Include/fg_types.h>
-#include <Math/fg_geodesy.h>
-#include <Math/fg_random.h>
-#include <Math/mat3.h>
-#include <Math/polar.h>
-
-#include <Scenery/mesh.h>
-#include <Scenery/common.h>
-#include <Scenery/scenery.h>
-
-
-/* Temporary hack until we get the scenery management system running */
-extern GLint area_terrain;
-extern struct MESH eg;
-
-/* initialize the non-array mesh values */
-void mesh_init(struct MESH *m) {
- m->originx = 0.0;
- m->originy = 0.0;
-
- m->rows = 0;
- m->cols = 0;
-
- m->row_step = 0.0;
- m->col_step = 0.0;
-
- m->cur_row = 0;
- m->cur_col = 0;
- m->do_data = 0;
-}
-
-
-/* return a pointer to a new mesh structure (no data array allocated yet) */
-struct MESH *(new_mesh)( void ) {
- struct MESH *mesh_ptr;
-
- mesh_ptr = (struct MESH *)malloc(sizeof(struct MESH));
-
- if ( mesh_ptr == 0 ) {
- printf("Virtual memory exceeded\n");
- exit(-1);
- }
-
- mesh_ptr->cur_row = 0;
- mesh_ptr->cur_col = 0;
-
- return(mesh_ptr);
-}
-
-
-/* return a pointer to a dynamically allocated array */
-float *(new_mesh_data)(int nrows, int ncols) {
- float *mesh_data_ptr;
-
- mesh_data_ptr = (float *)malloc(nrows * ncols * sizeof(float));
-
- if ( mesh_data_ptr == 0 ) {
- printf("Virtual memory exceeded\n");
- exit(-1);
- }
-
- printf("Allocated float(%d, %d)\n", nrows, ncols);
-
- return(mesh_data_ptr);
-}
-
-
-/* set the option name in the mesh data structure */
-void mesh_set_option_name(struct MESH *m, char *name) {
- if ( strlen(name) < MAX_IDENT_LEN ) {
- strcpy(m->option_name, name);
- } else {
- strncpy(m->option_name, name, MAX_IDENT_LEN - 1);
- m->option_name[MAX_IDENT_LEN - 1] = '\0';
- }
- if ( strcmp(m->option_name, "do_data") == 0 ) {
- m->do_data = 1;
- } else {
- m->do_data = 0;
- }
-}
-
-
-/* set an option value in the mesh data structure */
-void mesh_set_option_value(struct MESH *m, char *value) {
- /* printf("Setting %s to %s\n", m->option_name, value); */
-
- if ( m->do_data ) {
- /* mesh data is a pseudo 2d array */
- /* printf("Setting mesh_data[%d][%d] to %s\n", m->cur_row, m->cur_col,
- value); */
- m->mesh_data[m->cur_row * m->cols + m->cur_col] = atof(value);
- m->cur_col++;
- if ( m->cur_col >= m->cols ) {
- m->cur_col = 0;
- m->cur_row++;
- if ( m->cur_row > m->rows ) {
- m->do_data = 0;
- }
- }
- } else if ( strcmp(m->option_name, "origin_lon") == 0 ) {
- m->originx = atof(value);
- } else if ( strcmp(m->option_name, "origin_lat") == 0 ) {
- m->originy = atof(value);
- } else if ( strcmp(m->option_name, "rows") == 0 ) {
- m->rows = atoi(value);
- } else if ( strcmp(m->option_name, "cols") == 0 ) {
- m->cols = atoi(value);
- } else if ( strcmp(m->option_name, "row_step") == 0 ) {
- m->row_step = atof(value);
- } else if ( strcmp(m->option_name, "col_step") == 0 ) {
- m->col_step = atof(value);
- } else {
- printf("Unknown option %s with value %s, ignoring ...\n",
- m->option_name, value);
- }
-}
-
-
-/* do whatever needs to be done with the mesh now that it's been
- loaded, such as generating the OpenGL call list. */
-void mesh_do_it(struct MESH *m) {
- area_terrain = mesh_to_OpenGL(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 incoming (lon,lat) to be in arcsec for now */
-
- double xlocal, ylocal, dx, dy, zA, zB, elev;
- int x1, y1, z1, x2, y2, z2, x3, y3, z3;
- int xindex, yindex;
- int skip;
-
- skip = scenery.terrain_skip;
- /* determine if we are in the lower triangle or the upper triangle
- ______
- | /|
- | / |
- | / |
- |/ |
- ------
-
- then calculate our end points
- */
-
- xlocal = (lon - eg.originx) / eg.col_step;
- ylocal = (lat - eg.originy) / eg.row_step;
-
- xindex = (int)(xlocal / skip) * skip;
- yindex = (int)(ylocal / skip) * skip;
-
- if ( (xindex < 0) || (xindex + skip >= eg.cols) ||
- (yindex < 0) || (yindex + skip >= eg.rows) ) {
- return(-9999);
- }
-
- dx = xlocal - xindex;
- dy = ylocal - yindex;
-
- if ( dx > dy ) {
- /* lower triangle */
- /* printf(" Lower triangle\n"); */
-
- x1 = xindex;
- y1 = yindex;
- z1 = eg.mesh_data[y1 * eg.cols + x1];
-
- x2 = xindex + skip;
- y2 = yindex;
- z2 = eg.mesh_data[y2 * eg.cols + x2];
-
- x3 = xindex + skip;
- y3 = yindex + skip;
- z3 = eg.mesh_data[y3 * eg.cols + x3];
-
- /* printf(" dx = %.2f dy = %.2f\n", dx, dy);
- printf(" (x1,y1,z1) = (%d,%d,%d)\n", x1, y1, z1);
- printf(" (x2,y2,z2) = (%d,%d,%d)\n", x2, y2, z2);
- printf(" (x3,y3,z3) = (%d,%d,%d)\n", x3, y3, z3); */
-
- zA = dx * (z2 - z1) / skip + z1;
- zB = dx * (z3 - z1) / skip + z1;
-
- /* printf(" zA = %.2f zB = %.2f\n", zA, zB); */
-
- if ( dx > FG_EPSILON ) {
- elev = dy * (zB - zA) / dx + zA;
- } else {
- elev = zA;
- }
- } else {
- /* upper triangle */
- /* printf(" Upper triangle\n"); */
-
- x1 = xindex;
- y1 = yindex;
- z1 = eg.mesh_data[y1 * eg.cols + x1];
-
- x2 = xindex;
- y2 = yindex + skip;
- z2 = eg.mesh_data[y2 * eg.cols + x2];
-
- x3 = xindex + skip;
- y3 = yindex + skip;
- z3 = eg.mesh_data[y3 * eg.cols + x3];
-
- /* printf(" dx = %.2f dy = %.2f\n", dx, dy);
- printf(" (x1,y1,z1) = (%d,%d,%d)\n", x1, y1, z1);
- printf(" (x2,y2,z2) = (%d,%d,%d)\n", x2, y2, z2);
- printf(" (x3,y3,z3) = (%d,%d,%d)\n", x3, y3, z3); */
-
- zA = dy * (z2 - z1) / skip + z1;
- zB = dy * (z3 - z1) / skip + z1;
-
- /* printf(" zA = %.2f zB = %.2f\n", zA, zB );
- printf(" xB - xA = %.2f\n", eg.col_step * dy / eg.row_step); */
-
- if ( dy > FG_EPSILON ) {
- elev = dx * (zB - zA) / dy + zA;
- } else {
- elev = zA;
- }
- }
-
- return(elev);
-}
-
-
-/* walk through mesh and make opengl calls */
-GLint mesh_to_OpenGL(struct MESH *m) {
- GLint mesh;
- /* 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 }; */
- static GLfloat color[4] = { 1.0, 0.0, 0.0, 1.0 };
- double centerx, centery;
- double randx, randy;
-
- float x1, y1, x2, y2, z11, z12, z21, z22;
- struct fgCartesianPoint p11, p12, p21, p22, c;
- double gc_lon, gc_lat, sl_radius;
-
- MAT3vec v1, v2, normal;
- int i, j, istep, jstep, iend, jend;
- float temp;
-
- printf("In mesh2GL(), generating GL call list.\n");
-
- /* Detail level. This is how big a step we take as we walk
- * through the DEM data set. This value is initialized in
- * .../Scenery/scenery.c:fgSceneryInit() */
- istep = jstep = scenery.terrain_skip ;
-
- centerx = m->originx + (m->rows * m->row_step) / 2.0;
- centery = m->originy + (m->cols * m->col_step) / 2.0;
- fgGeodToGeoc(centery*ARCSEC_TO_RAD, 0, &sl_radius, &gc_lat);
- c = fgPolarToCart(centerx*ARCSEC_TO_RAD, gc_lat, sl_radius);
- scenery.center = c;
-
- mesh = glGenLists(1);
- glNewList(mesh, GL_COMPILE);
-
- /* glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, color ); */
- glColor3fv(color);
-
- iend = m->cols - 1;
- jend = m->rows - 1;
-
- y1 = m->originy;
- y2 = y1 + (m->col_step * istep);
-
- for ( i = 0; i < iend; i += istep ) {
- x1 = m->originx;
- x2 = x1 + (m->row_step * jstep);
-
- glBegin(GL_TRIANGLE_STRIP);
-
- for ( j = 0; j < jend; j += jstep ) {
- z11 = m->mesh_data[i * m->cols + j ];
- z12 = m->mesh_data[(i+istep) * m->cols + j ];
- z21 = m->mesh_data[i * m->cols + (j+jstep)];
- z22 = m->mesh_data[(i+istep) * m->cols + (j+jstep)];
-
- /* printf("A geodetic point is (%.2f, %.2f, %.2f)\n",
- x1, y1, z11); */
- gc_lon = x1*ARCSEC_TO_RAD;
- fgGeodToGeoc(y1*ARCSEC_TO_RAD, z11, &sl_radius, &gc_lat);
- /* printf("A geocentric point is (%.2f, %.2f, %.2f)\n", gc_lon,
- gc_lat, sl_radius+z11); */
- p11 = fgPolarToCart(gc_lon, gc_lat, sl_radius+z11);
- /* printf("A cart point is (%.8f, %.8f, %.8f)\n",
- p11.x, p11.y, p11.z); */
-
- gc_lon = x1*ARCSEC_TO_RAD;
- fgGeodToGeoc(y2*ARCSEC_TO_RAD, z12, &sl_radius, &gc_lat);
- p12 = fgPolarToCart(gc_lon, gc_lat, sl_radius+z12);
-
- gc_lon = x2*ARCSEC_TO_RAD;
- fgGeodToGeoc(y1*ARCSEC_TO_RAD, z21, &sl_radius, &gc_lat);
- p21 = fgPolarToCart(gc_lon, gc_lat, sl_radius+z21);
-
- gc_lon = x2*ARCSEC_TO_RAD;
- fgGeodToGeoc(y2*ARCSEC_TO_RAD, z22, &sl_radius, &gc_lat);
- p22 = fgPolarToCart(gc_lon, gc_lat, sl_radius+z22);
-
- v1[0] = p22.y - p11.y; v1[1] = p22.z - p11.z; v1[2] = z22 - z11;
- v2[0] = p12.y - p11.y; v2[1] = p12.z - p11.z; v2[2] = z12 - z11;
- MAT3cross_product(normal, v1, v2);
- MAT3_NORMALIZE_VEC(normal,temp);
- glNormal3d(normal[0], normal[1], normal[2]);
- /* printf("normal 1 = (%.2f %.2f %.2f\n", normal[0], normal[1],
- normal[2]); */
-
- if ( j == 0 ) {
- /* first time through */
- glVertex3d(p12.x - c.x, p12.y - c.y, p12.z - c.z);
- glVertex3d(p11.x - c.x, p11.y - c.y, p11.z - c.z);
- }
-
- glVertex3d(p22.x - c.x, p22.y - c.y, p22.z - c.z);
-
- v2[0] = p21.y - p11.y; v2[1] = p21.z - p11.z; v2[2] = z21 - z11;
- MAT3cross_product(normal, v2, v1);
- MAT3_NORMALIZE_VEC(normal,temp);
- glNormal3d(normal[0], normal[1], normal[2]);
- /* printf("normal 2 = (%.2f %.2f %.2f\n", normal[0], normal[1],
- normal[2]); */
-
- glVertex3d(p21.x - c.x, p21.y - c.y, p21.z - c.z);
-
- x1 += m->row_step * jstep;
- x2 += m->row_step * jstep;
- }
- glEnd();
-
- y1 += m->col_step * istep;
- y2 += m->col_step * istep;
- }
-
- /* this will go, it's only here for testing/debugging */
-
- for ( i = 0; i < 200; i++ ) {
- randx = fg_random() * 3600.0;
- randy = fg_random() * 3600.0;
-
- /* mesh_make_test_object(m->originx + randx, m->originy + randy); */
- }
-
- glEndList();
-
- return(mesh);
-}
-
-
-/* $Log$
-/* Revision 1.28 1998/01/27 00:48:02 curt
-/* Incorporated Paul Bleisch's <bleisch@chromatic.com> new debug message
-/* system and commandline/config file processing code.
-/*
- * Revision 1.27 1998/01/19 19:27:15 curt
- * Merged in make system changes from Bob Kuehne <rpk@sgi.com>
- * This should simplify things tremendously.
- *
- * Revision 1.26 1998/01/19 18:40:36 curt
- * Tons of little changes to clean up the code and to remove fatal errors
- * when building with the c++ compiler.
- *
- * Revision 1.25 1998/01/07 03:31:27 curt
- * Miscellaneous tweaks.
- *
- * Revision 1.24 1997/12/15 23:54:59 curt
- * Add xgl wrappers for debugging.
- * Generate terrain normals on the fly.
- *
- * Revision 1.23 1997/10/30 12:38:44 curt
- * Working on new scenery subsystem.
- *
- * Revision 1.22 1997/10/28 21:00:21 curt
- * Changing to new terrain format.
- *
- * Revision 1.21 1997/08/27 03:30:27 curt
- * Changed naming scheme of basic shared structures.
- *
- * Revision 1.20 1997/08/19 23:55:08 curt
- * Worked on better simulating real lighting.
- *
- * Revision 1.19 1997/08/06 00:24:28 curt
- * Working on correct real time sun lighting.
- *
- * Revision 1.18 1997/08/02 19:10:14 curt
- * Incorporated mesh2GL.c into mesh.c
- *
- * Revision 1.17 1997/07/18 23:41:26 curt
- * Tweaks for building with Cygnus Win32 compiler.
- *
- * Revision 1.16 1997/07/16 20:04:51 curt
- * Minor tweaks to aid Win32 port.
- *
- * Revision 1.15 1997/07/14 16:26:04 curt
- * Testing/playing -- placed objects randomly across the entire terrain.
- *
- * Revision 1.14 1997/07/12 04:01:14 curt
- * Added #include <Windows32/Base.h> to help Win32 compiling.
- *
- * Revision 1.13 1997/07/12 02:27:11 curt
- * Looking at potential scenery transformation/coordinate system problems.
- *
- * Revision 1.12 1997/07/11 03:23:19 curt
- * Solved some scenery display/orientation problems. Still have a positioning
- * (or transformation?) problem.
- *
- * Revision 1.11 1997/07/11 01:30:02 curt
- * More tweaking of terrian floor.
- *
- * Revision 1.10 1997/07/10 04:26:38 curt
- * We now can interpolated ground elevation for any position in the grid. We
- * can use this to enforce a "hard" ground. We still need to enforce some
- * bounds checking so that we don't try to lookup data points outside the
- * grid data set.
- *
- * Revision 1.9 1997/07/10 02:22:10 curt
- * Working on terrain elevation interpolation routine.
- *
- * Revision 1.8 1997/07/09 21:31:15 curt
- * Working on making the ground "hard."
- *
- * Revision 1.7 1997/07/08 18:20:13 curt
- * 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
- * Working on intergrating the VRML (subset) parser.
- *
- * Revision 1.4 1997/05/30 19:30:17 curt
- * The LaRCsim flight model is starting to look like it is working.
- *
- * Revision 1.3 1997/05/23 15:40:41 curt
- * Added GNU copyright headers.
- *
- * Revision 1.2 1997/05/19 18:20:50 curt
- * Slight change to origin key words.
- *
- * Revision 1.1 1997/05/16 16:07:04 curt
- * Initial revision.
- *
- */
+++ /dev/null
-/**************************************************************************
- * mesh.h -- data structures and routines for processing terrain meshes
- *
- * Written by Curtis Olson, started May 1997.
- *
- * Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Id$
- * (Log is kept at end of this file)
- **************************************************************************/
-
-
-#ifndef _MESH_H
-#define _MESH_H
-
-
-#include <GL/glut.h>
-
-
-struct MESH {
- /* start coordinates (in arc seconds) */
- double originx, originy;
-
- /* number of rows and columns */
- int rows, cols;
-
- /* Distance between row and column data points (in arc seconds) */
- double row_step, col_step;
-
- /* pointer to the actual mesh data dynamically allocated */
- float *mesh_data;
-
- /* a temporary values for the parser to use */
- char option_name[32];
- int do_data;
- int cur_row, cur_col;
-};
-
-
-/* return a pointer to a new mesh structure (no data array allocated yet) */
-struct MESH *(new_mesh)( void );
-
-/* initialize the non-array mesh values */
-void mesh_init(struct MESH *m);
-
-/* return a pointer to a dynamically allocated array */
-float *(new_mesh_data)(int nrows, int ncols);
-
-/* set the option name in the mesh data structure */
-void mesh_set_option_name(struct MESH *m, char *name);
-
-/* set an option value in the mesh data structure */
-void mesh_set_option_value(struct MESH *m, char *value);
-
-/* do whatever needs to be done with the mesh now that it's been
- * loaded, such as generating the OpenGL call list. */
-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);
-
-/* walk through mesh and make opengl calls */
-GLint mesh_to_OpenGL(struct MESH *m);
-
-
-#endif /* _MESH_H */
-
-
-/* $Log$
-/* Revision 1.9 1998/01/22 02:59:41 curt
-/* Changed #ifdef FILE_H to #ifdef _FILE_H
-/*
- * Revision 1.8 1998/01/19 18:40:37 curt
- * Tons of little changes to clean up the code and to remove fatal errors
- * when building with the c++ compiler.
- *
- * Revision 1.7 1997/08/27 03:30:29 curt
- * Changed naming scheme of basic shared structures.
- *
- * Revision 1.6 1997/08/02 19:10:15 curt
- * Incorporated mesh2GL.c into mesh.c
- *
- * Revision 1.5 1997/07/23 21:52:25 curt
- * Put comments around the text after an #endif for increased portability.
- *
- * Revision 1.4 1997/07/08 18:20:14 curt
- * 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
- * Added GNU copyright headers.
- *
- * Revision 1.1 1997/05/16 16:07:05 curt
- * Initial revision.
- *
- */
#define MAXNODES 100000
-float nodes[MAXNODES][3];
-float normals[MAXNODES][3];
+double nodes[MAXNODES][3];
+double normals[MAXNODES][3];
/* given three points defining a triangle, calculate the normal */
-void calc_normal(float p1[3], float p2[3], float p3[3], double normal[3])
+void calc_normal(double p1[3], double p2[3], double p3[3], double normal[3])
{
double v1[3], v2[3];
- float temp;
+ double temp;
v1[0] = p2[0] - p1[0]; v1[1] = p2[1] - p1[1]; v1[2] = p2[2] - p1[2];
v2[0] = p3[0] - p1[0]; v2[1] = p3[1] - p1[1]; v2[2] = p3[2] - p1[2];
/* Load a .obj file and generate the GL call list */
-GLint fgObjLoad(char *path, struct fgCartesianPoint *ref) {
+GLint fgObjLoad(char *path, struct fgCartesianPoint *ref, double *radius) {
char line[256], winding_str[256];
double approx_normal[3], normal[3], scale;
- float x, y, z, xmax, xmin, ymax, ymin, zmax, zmin;
+ double x, y, z, xmax, xmin, ymax, ymin, zmax, zmin;
GLint tile;
FILE *f;
int first, ncount, vncount, n1, n2, n3, n4;
/* node (vertex) */
if ( ncount < MAXNODES ) {
/* fgPrintf( FG_TERRAIN, FG_DEBUG, "vertex = %s", line); */
- sscanf(line, "v %f %f %f\n", &x, &y, &z);
+ sscanf(line, "v %lf %lf %lf\n", &x, &y, &z);
nodes[ncount][0] = x;
nodes[ncount][1] = y;
nodes[ncount][2] = z;
/* vertex normal */
if ( vncount < MAXNODES ) {
/* fgPrintf( FG_TERRAIN, FG_DEBUG, "vertex normal = %s", line); */
- sscanf(line, "vn %f %f %f\n",
+ sscanf(line, "vn %lf %lf %lf\n",
&normals[vncount][0], &normals[vncount][1],
&normals[vncount][2]);
vncount++;
/* $Log$
-/* Revision 1.20 1998/01/29 00:51:39 curt
-/* First pass at tile cache, dynamic tile loading and tile unloading now works.
+/* Revision 1.21 1998/01/31 00:43:25 curt
+/* Added MetroWorks patches from Carmen Volpe.
/*
+ * Revision 1.20 1998/01/29 00:51:39 curt
+ * First pass at tile cache, dynamic tile loading and tile unloading now works.
+ *
* Revision 1.19 1998/01/27 03:26:42 curt
* Playing with new fgPrintf command.
*
/* Load a .obj file and generate the GL call list */
-GLint fgObjLoad(char *file, struct fgCartesianPoint *ref);
+GLint fgObjLoad(char *path, struct fgCartesianPoint *ref, double *radius);
#endif /* _OBJ_H */
/* $Log$
-/* Revision 1.5 1998/01/27 00:48:03 curt
-/* Incorporated Paul Bleisch's <bleisch@chromatic.com> new debug message
-/* system and commandline/config file processing code.
+/* Revision 1.6 1998/01/31 00:43:25 curt
+/* Added MetroWorks patches from Carmen Volpe.
/*
+ * Revision 1.5 1998/01/27 00:48:03 curt
+ * Incorporated Paul Bleisch's <bleisch@chromatic.com> new debug message
+ * system and commandline/config file processing code.
+ *
* Revision 1.4 1998/01/22 02:59:41 curt
* Changed #ifdef FILE_H to #ifdef _FILE_H
*
* build the proper structures. */
void fgSceneryUpdate(double lon, double lat, double elev) {
struct fgGENERAL *g;
+ double max_radius;
char path[1024];
g = &general;
fgPrintf(FG_TERRAIN, FG_DEBUG, " Loading Scenery: %s\n", path);
- area_terrain = fgObjLoad(path, &scenery.center);
+ area_terrain = fgObjLoad(path, &scenery.center, &max_radius);
}
/* $Log$
-/* Revision 1.34 1998/01/27 03:26:43 curt
-/* Playing with new fgPrintf command.
+/* Revision 1.35 1998/01/31 00:43:26 curt
+/* Added MetroWorks patches from Carmen Volpe.
/*
+ * Revision 1.34 1998/01/27 03:26:43 curt
+ * Playing with new fgPrintf command.
+ *
* Revision 1.33 1998/01/19 19:27:17 curt
* Merged in make system changes from Bob Kuehne <rpk@sgi.com>
* This should simplify things tremendously.
if ( tile_cache[i].tile_bucket.lat == p->lat ) {
if ( tile_cache[i].tile_bucket.x == p->x ) {
if ( tile_cache[i].tile_bucket.y == p->y ) {
- printf("TILE EXISTS in cache ... index = %d\n", i);
+ fgPrintf( FG_TERRAIN, FG_DEBUG,
+ "TILE EXISTS in cache ... index = %d\n", i );
return( i );
}
}
sprintf(file_name, "%s/Scenery/%s/%ld.obj", g->root_dir,
base_path, fgBucketGenIndex(p));
tile_cache[index].display_list =
- fgObjLoad(file_name, &tile_cache[index].local_ref);
+ fgObjLoad(file_name, &tile_cache[index].local_ref,
+ &tile_cache[index].bounding_radius);
}
tile_cache[index].used = 0;
/* Update the bucket */
- printf( "FREEING TILE = (%d %d %d %d)\n",
- tile_cache[index].tile_bucket.lon,
- tile_cache[index].tile_bucket.lat, tile_cache[index].tile_bucket.x,
- tile_cache[index].tile_bucket.y );
+ fgPrintf( FG_TERRAIN, FG_DEBUG,
+ "FREEING TILE = (%d %d %d %d)\n",
+ tile_cache[index].tile_bucket.lon,
+ tile_cache[index].tile_bucket.lat,
+ tile_cache[index].tile_bucket.x,
+ tile_cache[index].tile_bucket.y );
/* Load the appropriate area and get the display list pointer */
xglDeleteLists( tile_cache[index].display_list, 1 );
return(i);
} else {
/* calculate approximate distance from view point */
- printf( "DIST Abs view pos = %.4f, %.4f, %.4f\n",
- v->abs_view_pos.x, v->abs_view_pos.y, v->abs_view_pos.z);
- printf( " ref point = %.4f, %.4f, %.4f\n",
- tile_cache[i].local_ref.x, tile_cache[i].local_ref.y,
- tile_cache[i].local_ref.z);
+ fgPrintf( FG_TERRAIN, FG_DEBUG,
+ "DIST Abs view pos = %.4f, %.4f, %.4f\n",
+ v->abs_view_pos.x, v->abs_view_pos.y, v->abs_view_pos.z );
+ fgPrintf( FG_TERRAIN, FG_DEBUG,
+ " ref point = %.4f, %.4f, %.4f\n",
+ tile_cache[i].local_ref.x, tile_cache[i].local_ref.y,
+ tile_cache[i].local_ref.z);
dx = fabs(tile_cache[i].local_ref.x - v->abs_view_pos.x);
dy = fabs(tile_cache[i].local_ref.y - v->abs_view_pos.y);
}
dist = max + (med + min) / 4;
- printf(" distance = %.2f\n", dist);
+ fgPrintf( FG_TERRAIN, FG_DEBUG, " distance = %.2f\n", dist);
if ( dist > max_dist ) {
max_dist = dist;
/* $Log$
-/* Revision 1.5 1998/01/29 00:51:39 curt
-/* First pass at tile cache, dynamic tile loading and tile unloading now works.
+/* Revision 1.6 1998/01/31 00:43:26 curt
+/* Added MetroWorks patches from Carmen Volpe.
/*
+ * Revision 1.5 1998/01/29 00:51:39 curt
+ * First pass at tile cache, dynamic tile loading and tile unloading now works.
+ *
* Revision 1.4 1998/01/27 03:26:43 curt
* Playing with new fgPrintf command.
*
struct fgBUCKET tile_bucket;
GLint display_list;
struct fgCartesianPoint local_ref;
+ double bounding_radius;
int used;
int priority;
};
/* $Log$
-/* Revision 1.3 1998/01/29 00:51:40 curt
-/* First pass at tile cache, dynamic tile loading and tile unloading now works.
+/* Revision 1.4 1998/01/31 00:43:27 curt
+/* Added MetroWorks patches from Carmen Volpe.
/*
+ * Revision 1.3 1998/01/29 00:51:40 curt
+ * First pass at tile cache, dynamic tile loading and tile unloading now works.
+ *
* Revision 1.2 1998/01/27 00:48:04 curt
* Incorporated Paul Bleisch's <bleisch@chromatic.com> new debug message
* system and commandline/config file processing code.
/* Initialize the Tile Manager subsystem */
void fgTileMgrInit( void ) {
fgPrintf( FG_TERRAIN, FG_INFO, "Initializing Tile Manager subsystem.\n");
-
- fgTileCacheInit();
}
fgTileCacheEntryFillIn(*index, p);
}
- printf( "SELECTED cache index of %d\n", *index);
fgPrintf( FG_TERRAIN, FG_DEBUG, "Selected cache index of %d\n", *index);
-
}
/* $Log$
-/* Revision 1.10 1998/01/29 00:51:40 curt
-/* First pass at tile cache, dynamic tile loading and tile unloading now works.
+/* Revision 1.11 1998/01/31 00:43:27 curt
+/* Added MetroWorks patches from Carmen Volpe.
/*
+ * Revision 1.10 1998/01/29 00:51:40 curt
+ * First pass at tile cache, dynamic tile loading and tile unloading now works.
+ *
* Revision 1.9 1998/01/27 03:26:44 curt
* Playing with new fgPrintf command.
*
| Done
--------------------------------------------------------------------------
+1/30/98 - remove Scenery/geometry.c and Scenery/mesh.c
+
+1/28/98 - Dynamic unloading of scenery.
+
+1/26/98 - Debug message system.
+
+1/26/98 - Dynamic loading of scenery
+
+1/24/98 - Remove some of the unused files such as ls_sync.c
+
+1/23/98 - in all .h's change #ifdef FILE_H -> #ifdef _FILE_H
--------------------------------------------------------------------------
Provided geographic data used by this project
+Carmelo Volpe <carmelo.volpe@csb.ki.se>
+ Porting Flight Gear to the Metro Works development environment (PC/Mac)
+
+
Robert Allan Zeh <raz@cmg.FCNBD.COM>
Helped me tremendously in figuring out the Cygnus win32 compiler and
how to link with .dll's. With out him the first runable win32
| Todo
--------------------------------------------------------------------------
-1/17/98 - in all .h's change #ifdef FILE_H -> #ifdef _FILE_H
-
-1/21/98 - Fix warning when compiling with c++
-
-1/17/98 - Remove some of the unused files such as ls_sync.c
-
-12/29/97 - Scenery area manager
-
12/29/97 - View frustum culling
-1/17/98 - See about building with C++ compiler
+1/21/98 - Fix warning when compiling with c++ ... still can't build
+ with cygnus-g++
1/5/98 - Create a development "roadmap"
-1/5/98 - remove Scenery/geometry.c and Scenery/mesh.c
-
12/30/97 - fix winding problem with tri-strips in obj.c (invert normals)
12/29/97 - Unify sun position render code with existing sunpos
#---------------------------------------------------------------------------
FG_VERSION_MAJOR = 0
-FG_VERSION_MINOR = 27
+FG_VERSION_MINOR = 28
FG_VERSION = $(FG_VERSION_MAJOR).$(FG_VERSION_MINOR)
event.o: event.c
fg_time.o: fg_time.c
fg_timer.o: fg_timer.c
-old-sidereal.o: old-sidereal.c ../Include/constants.h
-scheduler.o: scheduler.c
sunpos.o: sunpos.c
test_event.o: test_event.c event.h
ttest.o: ttest.c
#ifdef USE_FTIME
# include <stdlib.h>
# include <sys/timeb.h> /* for ftime() and struct timeb */
+#elif defined(__MWERKS__)
+# include <windows.h> /* For Metrowerks environment */
+# include <winbase.h> /* There is no ANSI/MSL time function that */
+ /* contains milliseconds */
#else
# include <sys/time.h> /* for get/setitimer, gettimeofday, struct timeval */
#endif /* USE_FTIME */
struct timeb last_run; /* absolute time for last run */
struct timeb current; /* current time */
struct timeb next_run; /* absolute time for next run */
+#elif defined(__MWERKS__)
+ SYSTEMTIME last_run; /* A type defed structure that holds */
+ SYSTEMTIME current; /* the only structure that contains */
+ SYSTEMTIME next_run; /* millisecond timing */
#else
struct timeval last_run; /* absolute time for last run */
struct timeval current; /* current time */
/* record starting time */
#ifdef USE_FTIME
ftime(&e->last_run);
+#elif defined(__MWERKS__)
+ GetLocalTime(&e->last_run);
#else
gettimeofday(&e->last_run, &e->tz);
#endif /* USE_FTIME */
ftime(&e->current);
duration = 1000 * (e->current.time - e->last_run.time) +
(e->current.millitm - e->last_run.millitm);
+#elif defined(__MWERKS__)
+ GetLocalTime(&e->current);
+ duration = 1000 * (e->current.wSecond - e->last_run.wSecond) +
+ (e->current.wMilliseconds - e->last_run.wMilliseconds);
#else
gettimeofday(&e->current, &e->tz);
duration = 1000000 * (e->current.tv_sec - e->last_run.tv_sec) +
e->next_run.time = e->last_run.time +
(e->last_run.millitm + e->interval) / 1000;
e->next_run.millitm = (e->last_run.millitm + e->interval) % 1000;
+#elif defined(__MWERKS__)
+ e->next_run.wSecond = e->last_run.wSecond +
+ (e->last_run.wMilliseconds + e->interval) / 1000;
+ e->next_run.wMilliseconds =
+ (e->last_run.wMilliseconds + e->interval) % 1000;
#else
e->next_run.tv_sec = e->last_run.tv_sec +
(e->last_run.tv_usec + e->interval * 1000) / 1000000;
e->next_run.tv_usec = (e->last_run.tv_usec + e->interval * 1000) % 1000000;
#endif /* USE_FTIME */
-
}
void fgEventProcess( void ) {
#ifdef USE_FTIME
struct timeb current;
+#elif defined(__MWERKS__)
+ SYSTEMTIME current; /* current time */
#else
struct timeval current;
struct timezone tz;
/* get the current time */
#ifdef USE_FTIME
ftime(¤t);
+#elif defined(__MWERKS__)
+ GetLocalTime(¤t);
#else
gettimeofday(¤t, &tz);
#endif /* USE_FTIME */
(current.millitm >= events[i].next_run.millitm) ) {
addq(i);
}
+#elif defined(__MWERKS__)
+ if (current.wSecond > events[i].next_run.wSecond) {
+ addq(i);
+ }
+ else if ( (current.wSecond == events[i].next_run.wSecond) &&
+ (current.wMilliseconds >=
+ events[i].next_run.wMilliseconds)) {
+ addq(i);
+ }
#else
if ( current.tv_sec > events[i].next_run.tv_sec ) {
addq(i);
/* $Log$
-/* Revision 1.8 1998/01/27 00:48:05 curt
-/* Incorporated Paul Bleisch's <bleisch@chromatic.com> new debug message
-/* system and commandline/config file processing code.
+/* Revision 1.9 1998/01/31 00:43:44 curt
+/* Added MetroWorks patches from Carmen Volpe.
/*
+ * Revision 1.8 1998/01/27 00:48:05 curt
+ * Incorporated Paul Bleisch's <bleisch@chromatic.com> new debug message
+ * system and commandline/config file processing code.
+ *
* Revision 1.7 1998/01/19 19:27:19 curt
* Merged in make system changes from Bob Kuehne <rpk@sgi.com>
* This should simplify things tremendously.
#ifdef USE_FTIME
# include <sys/timeb.h> /* for ftime() and struct timeb */
+#elif defined(__MWERKS__)
+# include <windows.h> /* For Metrowerks environment */
+# include <winbase.h> /* There is no ANSI/MSL time function that */
+ /* contains milliseconds */
#else
# include <sys/time.h> /* for get/setitimer, gettimeofday, struct timeval */
#endif /* USE_FTIME */
#ifdef USE_FTIME
static struct timeb last;
static struct timeb current;
+#elif defined (__MWERKS__)
+ SYSTEMTIME last;
+ SYSTEMTIME current;
#else
static struct timeval last;
static struct timeval current;
#ifdef USE_FTIME
ftime(&last);
+#elif defined (__MWERKS__)
+ GetLocalTime(&last);
#else
gettimeofday(&last, &tz);
#endif /* USE_FTIME */
ftime(¤t);
interval = 1000 * (current.time - last.time) +
(current.millitm - last.millitm);
+#elif defined (__MWERKS__)
+ GetLocalTime(¤t);
+ interval = 1000 * (current.wSecond - last.wSecond) +
+ (current.wMilliseconds - last.wMilliseconds);
#else
gettimeofday(¤t, &tz);
interval = 1000000 * (current.tv_sec - last.tv_sec) +
/* $Log$
-/* Revision 1.9 1998/01/19 19:27:21 curt
-/* Merged in make system changes from Bob Kuehne <rpk@sgi.com>
-/* This should simplify things tremendously.
+/* Revision 1.10 1998/01/31 00:43:45 curt
+/* Added MetroWorks patches from Carmen Volpe.
/*
+ * Revision 1.9 1998/01/19 19:27:21 curt
+ * Merged in make system changes from Bob Kuehne <rpk@sgi.com>
+ * This should simplify things tremendously.
+ *
* Revision 1.8 1998/01/19 18:40:39 curt
* Tons of little changes to clean up the code and to remove fatal errors
* when building with the c++ compiler.