* (Log is kept at end of this file)
**************************************************************************/
+
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
/* Function prototypes */
GLint fgSceneryCompile();
static void fgSceneryDraw();
-/* pointer to terrain mesh structure */
-static GLint terrain, runway;
+
+/* pointer to scenery structure */
+static GLint scenery, runway;
/* Another hack */
double fogDensity = 2000.0;
glMatrixMode(GL_MODELVIEW);
/* glLoadIdentity(); */
- /* draw terrain mesh */
+ /* draw scenery */
fgSceneryDraw();
#ifdef GLUT
**************************************************************************/
static void fgSceneryInit() {
- /* make terrain mesh */
- terrain = fgSceneryCompile();
+ /* make scenery */
+ scenery = fgSceneryCompile();
runway = fgRunwayHack(0.69, 53.07);
}
-/* create the terrain mesh */
+/* create the scenery */
GLint fgSceneryCompile() {
- GLint terrain;
+ GLint scenery;
- terrain = mesh2GL(mesh_ptr);
+ scenery = mesh2GL(mesh_ptr);
- return(terrain);
+ return(scenery);
}
}
-/* draw the terrain mesh */
+/* draw the scenery */
static void fgSceneryDraw() {
static float z = 32.35;
glPushMatrix();
- glCallList(terrain);
+ glCallList(scenery);
printf("*** Drawing runway at %.2f\n", z);
f = ¤t_aircraft.flight;
- /* parse the scenery file */
- parse_scenery(argv[1]);
-
#ifdef GLUT
/* initialize GLUT */
glutInit(&argc, argv);
glutInitWindowSize(640, 480);
/* Initialize the main window */
- glutCreateWindow("Terrain Demo");
+ glutCreateWindow("Flight Gear");
#elif MESA_TK
/* Define initial window size */
tkInitPosition(0, 0, 640, 480);
tkInitDisplayMode( TK_RGB | TK_DEPTH | TK_DOUBLE | TK_DIRECT );
/* Initialize the main window */
- if (tkInitWindow("Terrain Demo") == GL_FALSE) {
+ if (tkInitWindow("Flight Gear") == GL_FALSE) {
tkQuit();
}
#endif
}
/* build all objects */
+
+ /* parse the scenery file, and build the OpenGL call list */
+ /* this function will eventually move to the scenery management system */
+ if ( strlen(argv[1]) ) {
+ parse_scenery(argv[1]);
+ }
+
+ /* initialize the scenery */
fgSceneryInit();
#ifdef GLUT
/* $Log$
-/* Revision 1.20 1997/06/21 17:12:53 curt
-/* Capitalized subdirectory names.
+/* Revision 1.21 1997/06/22 21:44:41 curt
+/* Working on intergrating the VRML (subset) parser.
/*
+ * Revision 1.20 1997/06/21 17:12:53 curt
+ * Capitalized subdirectory names.
+ *
* Revision 1.19 1997/06/18 04:10:31 curt
* A couple more runway tweaks ...
*
#include "common.h"
+/* 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)() {
struct mesh *mesh_ptr;
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 ( strcmp(m->option_name, "origin_lon") == 0 ) {
+ /* 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->rows + 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);
}
+/* 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) {
+ mesh2GL(m);
+}
+
+
/* $Log$
-/* Revision 1.4 1997/05/30 19:30:17 curt
-/* The LaRCsim flight model is starting to look like it is working.
+/* 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.
*
/* 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)();
+/* 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 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);
+
+
#endif MESH_H
/* $Log$
-/* Revision 1.2 1997/05/23 15:40:42 curt
-/* Added GNU copyright headers.
+/* 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.
*
CC = gcc
-SUBSUBDIRS = Flight/LaRCsim Flight/Slew Scenery/ParseScn
+SUBSUBDIRS = Flight/LaRCsim Flight/Slew Scenery/ParseScn Scenery/ParseVrml
SUBDIRS = Aircraft Controls Flight mat3 Scenery Timer
MAIN = OpenGL
#---------------------------------------------------------------------------
# $Log$
+# Revision 1.9 1997/06/22 21:44:40 curt
+# Working on intergrating the VRML (subset) parser.
+#
# Revision 1.8 1997/06/21 17:52:22 curt
# Continue directory shuffling ... everything should be compilable/runnable
# again.
"main" and OpenGL dependent mouse/keyboard/graphics code.
-aircraft/
+Aircraft/
---------
Structure and code to tie together all the pieces of an aircraft such
as flight model, engine model, panel, controls, etc.
-controls/
+Controls/
---------
Provide a standardized interface to all aircraft controls.
-flight/
+Flight/
-------
Strucures and code to implement various flight models. Provides a
standardized interface to all interesting flight model variabls.
Contains miscellaneous matrix/vector routines.
-scenery/
+Scenery/
--------
Scenery parsing/generating code.
-timer/
+Sound/
+------
+Sound management code
+
+
+Timer/
------
Code to handle time and timing of events.
+
+
+Weather/
+--------
+Weather management and modeling code.