]> git.mxchange.org Git - flightgear.git/blobdiff - Main/GLmain.c
Restructuring make, adding automatic "make dep" support.
[flightgear.git] / Main / GLmain.c
index f0e8008e6f0f0bb450a4310e4d7278cc7155a2c3..02cbcb70850d654f503c8908dd120d3e4676e8e7 100644 (file)
@@ -23,6 +23,7 @@
  * (Log is kept at end of this file)
  **************************************************************************/
 
+
 #include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
 #define DEG_TO_RAD       0.017453292
 #define RAD_TO_DEG       57.29577951
 
+#ifndef M_PI
+#define M_PI        3.14159265358979323846     /* pi */
+#endif
+
 #ifndef PI2                                     
 #define PI2  (M_PI + M_PI)
 #endif                                                           
 
+
+#ifndef M_PI_2
+#define M_PI_2      1.57079632679489661923     /* pi/2 */
+#endif
+
 /* This is a record containing all the info for the aircraft currently
    being operated */
 struct aircraft_params current_aircraft;
@@ -65,8 +75,9 @@ extern struct mesh *mesh_ptr;
 /* 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;
@@ -202,7 +213,7 @@ static void fgUpdateVisuals( void ) {
     glMatrixMode(GL_MODELVIEW);
     /* glLoadIdentity(); */
 
-    /* draw terrain mesh */
+    /* draw scenery */
     fgSceneryDraw();
 
     #ifdef GLUT
@@ -262,7 +273,11 @@ void fgUpdateTimeDepCalcs(int multi_loop) {
 
 void fgInitTimeDepCalcs() {
     /* initialize timer */
+
+#ifdef USE_ITIMER
     fgTimerInit( 1.0 / DEFAULT_TIMER_HZ, fgUpdateTimeDepCalcs );
+#endif USE_ITIMER
+
 }
 
 
@@ -271,19 +286,19 @@ void fgInitTimeDepCalcs() {
  **************************************************************************/
 
 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);
 }
 
 
@@ -332,13 +347,13 @@ GLint fgRunwayHack(double width, double length) {
 }
 
 
-/* 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);
 
@@ -405,8 +420,7 @@ int main( int argc, char *argv[] ) {
 
     f = &current_aircraft.flight;
 
-    /* parse the scenery file */
-    parse_scenery(argv[1]);
+    printf("Flight Gear:  prototype code to test OpenGL, LaRCsim, and VRML\n\n");
 
     #ifdef GLUT
       /* initialize GLUT */
@@ -419,7 +433,7 @@ int main( int argc, char *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);
@@ -428,7 +442,7 @@ int main( int argc, char *argv[] ) {
       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
@@ -494,6 +508,14 @@ int main( int argc, char *argv[] ) {
     }
 
     /* 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
@@ -537,9 +559,18 @@ int main( int argc, char *argv[] ) {
 
 
 /* $Log$
-/* Revision 1.20  1997/06/21 17:12:53  curt
-/* Capitalized subdirectory names.
+/* Revision 1.23  1997/06/26 19:08:33  curt
+/* Restructuring make, adding automatic "make dep" support.
 /*
+ * Revision 1.22  1997/06/25 15:39:47  curt
+ * Minor changes to compile with rsxnt/win32.
+ *
+ * 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 ...
  *