]> git.mxchange.org Git - flightgear.git/commitdiff
Playing with new fgPrintf command.
authorcurt <curt>
Tue, 27 Jan 1998 03:26:41 +0000 (03:26 +0000)
committercurt <curt>
Tue, 27 Jan 1998 03:26:41 +0000 (03:26 +0000)
Scenery/bucketutils.c
Scenery/obj.c
Scenery/scenery.c
Scenery/tilecache.c
Scenery/tilemgr.c

index af03c934829a7f9294b4a1f02fd62d29df55ae62..2453d256f858bc95575b5284bb457d8995b41412 100644 (file)
@@ -27,8 +27,9 @@
 #include <math.h>
 #include <stdio.h>
 
-#include <Scenery/bucketutils.h>
 #include <Include/fg_constants.h>
+#include <Main/fg_debug.h>
+#include <Scenery/bucketutils.h>
 
 
 /* Generate the unique scenery tile index containing the specified
@@ -199,8 +200,9 @@ void fgBucketFind(double lon, double lat, struct fgBUCKET *p) {
 
     p->x = (lon - p->lon) * 8;
     p->y = (lat - p->lat) * 8;
-    printf("Bucket = lon,lat = %d,%d  x,y index = %d,%d\n", 
-          p->lon, p->lat, p->x, p->y);
+    fgPrintf( FG_TERRAIN, FG_DEBUG, 
+             "Bucket = lon,lat = %d,%d  x,y index = %d,%d\n", 
+             p->lon, p->lat, p->x, p->y);
 }
 
 
@@ -216,9 +218,10 @@ void fgBucketGenIdxArray(struct fgBUCKET *p1, struct fgBUCKET *tiles,
        for ( i = 0; i < width; i++ ) {
            fgBucketOffset(p1, &tiles[(j*width)+i], i - dw, j - dh);
            p2 = &tiles[(j*width)+i];
-           printf("  bucket = %d %d %d %d  index = %ld\n", 
-                  p2->lon, p2->lat, p2->x, p2->y, 
-                  fgBucketGenIndex(&tiles[(j*width)+i]));
+           fgPrintf( FG_TERRAIN, FG_DEBUG, 
+                     "  bucket = %d %d %d %d  index = %ld\n", 
+                     p2->lon, p2->lat, p2->x, p2->y, 
+                     fgBucketGenIndex(&tiles[(j*width)+i]));
        }
     }
 }
@@ -266,10 +269,13 @@ int main() {
 
 
 /* $Log$
-/* Revision 1.3  1998/01/27 00:48:01  curt
-/* Incorporated Paul Bleisch's <bleisch@chromatic.com> new debug message
-/* system and commandline/config file processing code.
+/* Revision 1.4  1998/01/27 03:26:41  curt
+/* Playing with new fgPrintf command.
 /*
+ * Revision 1.3  1998/01/27 00:48:01  curt
+ * Incorporated Paul Bleisch's <bleisch@chromatic.com> new debug message
+ * system and commandline/config file processing code.
+ *
  * Revision 1.2  1998/01/24 00:03:28  curt
  * Initial revision.
  *
index c480a6f03042b281d1be48d30c85d36139511540..61e7195cbb80fb4136565fc5c338a2d6c5c629ca 100644 (file)
 #include <GL/glut.h>
 #include <XGL/xgl.h>
 
+#include <Main/fg_debug.h>
+#include <Math/mat3.h>
 #include <Scenery/obj.h>
 #include <Scenery/scenery.h>
 
-#include <Math/mat3.h>
-
 
 
 #define MAXNODES 100000
@@ -58,23 +58,24 @@ void calc_normal(float p1[3], float p2[3], float p3[3], double normal[3])
     MAT3cross_product(normal, v1, v2);
     MAT3_NORMALIZE_VEC(normal,temp);
 
-    /* printf("  Normal = %.2f %.2f %.2f\n", normal[0], normal[1], normal[2]);*/
+    /* fgPrintf( FG_TERRAIN, FG_DEBUG, "  Normal = %.2f %.2f %.2f\n", 
+                 normal[0], normal[1], normal[2]);*/
 }
 
 
 /* Load a .obj file and generate the GL call list */
 GLint fgObjLoad(char *path, struct fgCartesianPoint *ref) {
     char line[256], winding_str[256];
-    double v1[3], v2[3], approx_normal[3], normal[3], dot_prod, scale, temp;
+    double approx_normal[3], normal[3], scale;
     GLint area;
     FILE *f;
     int first, ncount, vncount, n1, n2, n3, n4;
     static int use_vertex_norms = 1;
-    int i, winding;
+    int winding;
     int last1, last2, odd;
 
     if ( (f = fopen(path, "r")) == NULL ) {
-       printf("Cannot open file: %s\n", path);
+       fgPrintf(FG_TERRAIN, FG_ALERT, "Cannot open file: %s\n", path);
        /* exit(-1); */
        return(0);
     }
@@ -94,7 +95,7 @@ GLint fgObjLoad(char *path, struct fgCartesianPoint *ref) {
        } else if ( strncmp(line, "v ", 2) == 0 ) {
            /* node (vertex) */
            if ( ncount < MAXNODES ) {
-               /* printf("vertex = %s", line); */
+               /* fgPrintf( FG_TERRAIN, FG_DEBUG, "vertex = %s", line); */
                sscanf(line, "v %f %f %f\n", 
                       &nodes[ncount][0], &nodes[ncount][1], &nodes[ncount][2]);
                if ( ncount == 1 ) {
@@ -106,24 +107,24 @@ GLint fgObjLoad(char *path, struct fgCartesianPoint *ref) {
                }
                ncount++;
            } else {
-               printf("Read too many nodes ... dying :-(\n");
-               exit(-1);
+               fgPrintf( FG_TERRAIN, FG_EXIT, 
+                         "Read too many nodes ... dying :-(\n");
            }
        } else if ( strncmp(line, "vn ", 3) == 0 ) {
            /* vertex normal */
            if ( vncount < MAXNODES ) {
-               /* printf("vertex normal = %s", line); */
+               /* fgPrintf( FG_TERRAIN, FG_DEBUG, "vertex normal = %s", line); */
                sscanf(line, "vn %f %f %f\n", 
                       &normals[vncount][0], &normals[vncount][1], 
                       &normals[vncount][2]);
                vncount++;
            } else {
-               printf("Read too many vertex normals ... dying :-(\n");
-               exit(-1);
+               fgPrintf( FG_TERRAIN, FG_EXIT, 
+                         "Read too many vertex normals ... dying :-(\n");
            }
        } else if ( strncmp(line, "winding ", 8) == 0 ) {
            sscanf(line+8, "%s", winding_str);
-           printf("    WINDING = %s\n", winding_str);
+           fgPrintf( FG_TERRAIN, FG_DEBUG, "    WINDING = %s\n", winding_str);
 
            /* can't call xglFrontFace() between xglBegin() & xglEnd() */
            xglEnd();
@@ -148,10 +149,11 @@ GLint fgObjLoad(char *path, struct fgCartesianPoint *ref) {
                first = 0;
            }
 
-           /* printf("    new tri strip = %s", line); */
+           /* fgPrintf( FG_TERRAIN, FG_DEBUG, "    new tri strip = %s", 
+              line); */
            sscanf(line, "t %d %d %d %d\n", &n1, &n2, &n3, &n4);
 
-           /* printf("(t) = "); */
+           /* fgPrintf( FG_TERRAIN, FG_DEBUG, "(t) = "); */
 
            xglBegin(GL_TRIANGLE_STRIP);
 
@@ -226,7 +228,7 @@ GLint fgObjLoad(char *path, struct fgCartesianPoint *ref) {
 
            xglBegin(GL_TRIANGLES);
 
-           /* printf("new triangle = %s", line);*/
+           /* fgPrintf( FG_TERRAIN, FG_DEBUG, "new triangle = %s", line);*/
            sscanf(line, "f %d %d %d\n", &n1, &n2, &n3);
 
             xglNormal3d(normals[n1][0], normals[n1][1], normals[n1][2]);
@@ -244,9 +246,10 @@ GLint fgObjLoad(char *path, struct fgCartesianPoint *ref) {
            /* continue a triangle strip */
            n1 = n2 = 0;
 
-           /* printf("continued tri strip = %s ", line); */
+           /* fgPrintf( FG_TERRAIN, FG_DEBUG, "continued tri strip = %s ", 
+              line); */
            sscanf(line, "q %d %d\n", &n1, &n2);
-           /* printf("read %d %d\n", n1, n2); */
+           /* fgPrintf( FG_TERRAIN, FG_DEBUG, "read %d %d\n", n1, n2); */
 
            if ( use_vertex_norms ) {
                MAT3_SCALE_VEC(normal, normals[n1], scale);
@@ -271,7 +274,7 @@ GLint fgObjLoad(char *path, struct fgCartesianPoint *ref) {
            last2 = n1;
 
            if ( n2 > 0 ) {
-               /* printf(" (cont)\n"); */
+               /* fgPrintf( FG_TERRAIN, FG_DEBUG, " (cont)\n"); */
 
                if ( use_vertex_norms ) {
                    MAT3_SCALE_VEC(normal, normals[n2], scale);
@@ -296,7 +299,8 @@ GLint fgObjLoad(char *path, struct fgCartesianPoint *ref) {
                last2 = n2;
            }
        } else {
-           printf("Unknown line in %s = %s\n", path, line);
+           fgPrintf( FG_TERRAIN, FG_WARN, "Unknown line in %s = %s\n", 
+                     path, line);
        }
     }
 
@@ -328,10 +332,13 @@ GLint fgObjLoad(char *path, struct fgCartesianPoint *ref) {
 
 
 /* $Log$
-/* Revision 1.18  1998/01/19 19:27:16  curt
-/* Merged in make system changes from Bob Kuehne <rpk@sgi.com>
-/* This should simplify things tremendously.
+/* Revision 1.19  1998/01/27 03:26:42  curt
+/* Playing with new fgPrintf command.
 /*
+ * Revision 1.18  1998/01/19 19:27:16  curt
+ * Merged in make system changes from Bob Kuehne <rpk@sgi.com>
+ * This should simplify things tremendously.
+ *
  * Revision 1.17  1998/01/13 00:23:10  curt
  * Initial changes to support loading and management of scenery tiles.  Note,
  * there's still a fair amount of work left to be done.
index 3e3ebda098d72f31e3bcf15639547ef831d71a12..23dc0f8619fb1867e98ebb9b18da0b9690619196 100644 (file)
@@ -35,7 +35,7 @@
 #include <string.h>
 
 #include <Include/general.h>
-
+#include <Main/fg_debug.h>
 #include <Scenery/obj.h>
 #include <Scenery/scenery.h>
 
@@ -50,7 +50,7 @@ struct fgSCENERY scenery;
 
 /* Initialize the Scenery Management system */
 void fgSceneryInit( void ) {
-    printf("Initializing scenery subsystem\n");
+    fgPrintf(FG_TERRAIN, FG_INFO, "Initializing scenery subsystem\n");
 
     /* set the default terrain detail level */
     scenery.terrain_skip = 6;
@@ -74,7 +74,7 @@ void fgSceneryUpdate(double lon, double lat, double elev) {
     strcat(path, "/Scenery/");
     strcat(path, "mesa-e.obj");
 
-    printf("  Loading Scenery: %s\n", path);
+    fgPrintf(FG_TERRAIN, FG_DEBUG, "  Loading Scenery: %s\n", path);
 
     area_terrain = fgObjLoad(path, &scenery.center);
 }
@@ -100,10 +100,13 @@ void fgSceneryRender( void ) {
 
 
 /* $Log$
-/* 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.
+/* 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.
+ *
  * Revision 1.32  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.
index e85e71149a98468f2f25d270bf1f795c6c455bb3..0adb150f97fe947be2d1ea394caf11878c6cc736 100644 (file)
 #include <GL/glut.h>
 #include <XGL/xgl.h>
 
+#include <Include/general.h>
 #include <Scenery/bucketutils.h>
 #include <Scenery/obj.h>
 #include <Scenery/tilecache.h>
+#include <Main/fg_debug.h>
 
-#include <Include/general.h>
 
 /* tile cache */
 struct fgTILE tile_cache[FG_TILE_CACHE_SIZE];
@@ -45,7 +46,7 @@ struct fgTILE tile_cache[FG_TILE_CACHE_SIZE];
 void fgTileCacheInit( void ) {
     int i;
 
-    printf("Initializing the tile cache.\n");
+    fgPrintf(FG_TERRAIN, FG_INFO, "Initializing the tile cache.\n");
 
     for ( i = 0; i < FG_TILE_CACHE_SIZE; i++ ) {
        tile_cache[i].used = 0;
@@ -97,7 +98,7 @@ void fgTileCacheEntryFillIn( int index, struct fgBUCKET *p ) {
 void fgTileCacheEntryInfo( int index, GLint *display_list, 
                           struct fgCartesianPoint *local_ref ) {
     *display_list = tile_cache[index].display_list;
-    /* printf("Display list = %d\n", *display_list); */
+    /* fgPrintf(FG_TERRAIN, FG_DEBUG, "Display list = %d\n", *display_list); */
 
     local_ref->x = tile_cache[index].local_ref.x;
     local_ref->y = tile_cache[index].local_ref.y;
@@ -112,10 +113,13 @@ void fgTileCacheEntryFree( in index ) {
 
 
 /* $Log$
-/* Revision 1.3  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/27 03:26:43  curt
+/* Playing with new fgPrintf command.
 /*
+ * Revision 1.3  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.2  1998/01/26 15:55:24  curt
  * Progressing on building dynamic scenery system.
  *
index 6cef1bbb8d727df67964ff496774a038ed16d13c..4ab70954386d2b3789f0dc518c1e99cf6c2f6d16 100644 (file)
@@ -39,6 +39,7 @@
 #include <Aircraft/aircraft.h>
 #include <Include/fg_constants.h>
 #include <Include/fg_types.h>
+#include <Main/fg_debug.h>
 
 
 #define FG_LOCAL_X           3   /* should be odd */
@@ -58,7 +59,7 @@ struct fgTILE tile_cache[FG_TILE_CACHE_SIZE];
 
 /* Initialize the Tile Manager subsystem */
 void fgTileMgrInit( void ) {
-    printf("Initializing Tile Manager subsystem.\n");
+    fgPrintf( FG_TERRAIN, FG_INFO, "Initializing Tile Manager subsystem.\n");
 
     fgTileCacheInit();
 }
@@ -66,11 +67,11 @@ void fgTileMgrInit( void ) {
 
 /* load a tile */
 void fgTileMgrLoadTile( struct fgBUCKET *p, int *index) {
-    printf("Updating for bucket %d %d %d %d\n", 
+    fgPrintf( FG_TERRAIN, FG_DEBUG, "Updating for bucket %d %d %d %d\n", 
           p->lon, p->lat, p->x, p->y);
     
     *index = fgTileCacheNextAvail();
-    printf("Selected cache index of %d\n", *index);
+    fgPrintf( FG_TERRAIN, FG_DEBUG, "Selected cache index of %d\n", *index);
     
     fgTileCacheEntryFillIn(*index, p);
 }
@@ -93,13 +94,13 @@ void fgTileMgrUpdate( void ) {
     if ( (p1.lon == p_last.lon) && (p1.lat == p_last.lat) && 
         (p1.x == p_last.x) && (p1.y == p_last.y) ) {
        /* same bucket as last time */
-       printf("Same bucket as last time\n");
+       fgPrintf( FG_TERRAIN, FG_DEBUG, "Same bucket as last time\n");
     } else if ( p_last.lon == -1000 ) {
        /* First time through, initialize the system and load all
          * relavant tiles */
 
-       printf("First time through ... \n");
-       printf("Updating Tile list for %d,%d %d,%d\n", 
+       fgPrintf( FG_TERRAIN, FG_DEBUG, "First time through ... \n");
+       fgPrintf( FG_TERRAIN, FG_DEBUG, "Updating Tile list for %d,%d %d,%d\n", 
               p1.lon, p1.lat, p1.x, p1.y);
 
        /* wipe tile cache */
@@ -198,7 +199,7 @@ void fgTileMgrRender( void ) {
 
     for ( i = 0; i < FG_LOCAL_X_Y; i++ ) {
        index = tiles[i];
-       /* printf("Index = %d\n", index); */
+       /* fgPrintf( FG_TERRAIN, FG_DEBUG, "Index = %d\n", index); */
        fgTileCacheEntryInfo(index, &display_list, &local_ref );
 
        xglPushMatrix();
@@ -212,10 +213,13 @@ void fgTileMgrRender( void ) {
 
 
 /* $Log$
-/* Revision 1.8  1998/01/27 00:48:04  curt
-/* Incorporated Paul Bleisch's <bleisch@chromatic.com> new debug message
-/* system and commandline/config file processing code.
+/* Revision 1.9  1998/01/27 03:26:44  curt
+/* Playing with new fgPrintf command.
 /*
+ * Revision 1.8  1998/01/27 00:48:04  curt
+ * Incorporated Paul Bleisch's <bleisch@chromatic.com> new debug message
+ * system and commandline/config file processing code.
+ *
  * Revision 1.7  1998/01/26 15:55:25  curt
  * Progressing on building dynamic scenery system.
  *