]> git.mxchange.org Git - flightgear.git/blobdiff - Airports/genapt.cxx
Optimizations from Norman Vine.
[flightgear.git] / Airports / genapt.cxx
index dd604a93f5482cf64e7d353fe49a0ff2c6cb9795..22ad167367c8488c789a00b88581ce8f2fe7f5f0 100644 (file)
@@ -1,5 +1,5 @@
 //
-// getapt.cxx -- generate airport scenery from the given definition file
+// genapt.cxx -- generate airport scenery from the given definition file
 //
 // Written by Curtis Olson, started September 1998.
 //
 using namespace std;
 #endif
 
-#include <Debug/fg_debug.h>
+#ifdef __BORLANDC__
+#  define exception c_exception
+#endif
+#include <math.h>
+
+#include <Debug/logstream.hxx>
 // #include <Include/fg_types.h>
 #include <Math/fg_geodesy.hxx>
 #include <Math/mat3.h>
@@ -90,22 +95,25 @@ gen_base( const Point3D& average, const container& perimeter, fgTILE *t)
 
     max_dist = 0.0;
 
-    cout << "generating airport base for size = " << perimeter.size() << "\n";
+    FG_LOG( FG_TERRAIN, FG_INFO, 
+           "generating airport base for size = " << perimeter.size() );
 
     fragment.init();
     fragment.tile_ptr = t;
 
     // find airport base material in the properties list
     if ( ! material_mgr.find( APT_BASE_MATERIAL, fragment.material_ptr )) {
-       fgPrintf( FG_TERRAIN, FG_ALERT, 
-                 "Ack! unknown material name = %s in fgAptGenerat()\n",
-                 APT_BASE_MATERIAL );
+       FG_LOG( FG_TERRAIN, FG_ALERT, 
+               "Ack! unknown material name = " << APT_BASE_MATERIAL 
+               << " in fgAptGenerat()" );
     }
 
-    printf(" tile center = %.2f %.2f %.2f\n", 
-          t->center.x(), t->center.y(), t->center.z() );
-    printf(" airport center = %.2f %.2f %.2f\n", 
-          average.x(), average.y(), average.z());
+    FG_LOG( FG_TERRAIN, FG_INFO, 
+           " tile center = " 
+           << t->center.x() << " " << t->center.y() << " " << t->center.z() );
+    FG_LOG( FG_TERRAIN, FG_INFO, 
+           " airport center = "
+           << average.x() << " " << average.y() << " " << average.z() );
     fragment.center = average;
 
     normal[0] = average.x();
@@ -141,7 +149,7 @@ gen_base( const Point3D& average, const container& perimeter, fgTILE *t)
 
     i = 1;
     tex = calc_tex_coords( t->nodes[i], t->center );
-    dist = cart.distance3D(average);
+    dist = cart.distance3Dsquared(average);
     if ( dist > max_dist ) {
        max_dist = dist;
     }
@@ -161,7 +169,7 @@ gen_base( const Point3D& average, const container& perimeter, fgTILE *t)
        fragment.add_face(center_num, i - 1, i);
 
        tex = calc_tex_coords( t->nodes[i], t->center );
-       dist = cart.distance3D(average);
+       dist = cart.distance3Dsquared(average);
        if ( dist > max_dist ) {
            max_dist = dist;
        }
@@ -183,7 +191,7 @@ gen_base( const Point3D& average, const container& perimeter, fgTILE *t)
     xglEnd();
     xglEndList();
 
-    fragment.bounding_radius = max_dist;
+    fragment.bounding_radius = sqrt(max_dist);
     fragment.display_list = display_list;
 
     t->fragment_list.push_back(fragment);
@@ -233,7 +241,7 @@ fgAptGenerate(const string& path, fgTILE *tile)
                gen_base(average, perimeter, tile);
            }
 
-           cout << "Reading airport record\n";
+           FG_LOG( FG_TERRAIN, FG_INFO, "Reading airport record" );
            in >> apt_id;
            apt_name = "";
            i = 1;
@@ -243,7 +251,8 @@ fgAptGenerate(const string& path, fgTILE *tile)
            while ( in.get(c) && c != '\n' ) {
                apt_name += c;
            }
-           cout << "\tID = " + apt_id + "  Name = " + apt_name + "\n";
+           FG_LOG( FG_TERRAIN, FG_INFO, 
+                   "\tID = " << apt_id << "  Name = " << apt_name );
        } else if ( token == "p" ) {
            // airport area bounding polygon coordinate.  These
            // specify a convex hull that should already have been cut
@@ -281,6 +290,22 @@ fgAptGenerate(const string& path, fgTILE *tile)
 
 
 // $Log$
+// Revision 1.12  1999/02/01 21:08:33  curt
+// Optimizations from Norman Vine.
+//
+// Revision 1.11  1998/11/23 21:48:09  curt
+// Borland portability tweaks.
+//
+// Revision 1.10  1998/11/07 19:07:06  curt
+// Enable release builds using the --without-logging option to the configure
+// script.  Also a couple log message cleanups, plus some C to C++ comment
+// conversion.
+//
+// Revision 1.9  1998/11/06 21:17:32  curt
+// Converted to new logstream debugging facility.  This allows release
+// builds with no messages at all (and no performance impact) by using
+// the -DFG_NDEBUG flag.
+//
 // Revision 1.8  1998/11/06 14:46:59  curt
 // Changes to track Bernie's updates to fgstream.
 //
@@ -308,5 +333,3 @@ fgAptGenerate(const string& path, fgTILE *tile)
 // Revision 1.1  1998/09/14 02:14:01  curt
 // Initial revision of genapt.[ch]xx for generating airport scenery.
 //
-//
-