]> git.mxchange.org Git - flightgear.git/commitdiff
The next round of MacOS changes contributed by Darrell Walisser.
authorcurt <curt>
Sat, 5 Jun 1999 12:45:40 +0000 (12:45 +0000)
committercurt <curt>
Sat, 5 Jun 1999 12:45:40 +0000 (12:45 +0000)
Starting work on fixing tringle slivers in scenery generation tools.

14 files changed:
Lib/Bucket/newbucket.hxx
Lib/Debug/logstream.hxx
Lib/Math/fg_geodesy.cxx
Lib/Math/point3d.hxx
Lib/Misc/fgstream.cxx
Simulator/Airports/genapt.cxx
Simulator/Astro/sky.cxx
Simulator/GUI/gui.cxx
Simulator/Joystick/joystick.cxx
Simulator/Main/options.cxx
Simulator/Scenery/tilecache.cxx
Thanks
Tools/Construct/Triangulate/polygon.cxx
Tools/Construct/Triangulate/polygon.hxx

index c037f9dc0ddf5998b108baf5c428b643c687ddaf..c4f32e54991169e1cfdbad21c2af5c7c783f48a5 100644 (file)
 #  include <iostream.h>
 #endif
 
+// I don't understand ... <math.h> or <cmath> should be included
+// already depending on how you defined FG_HAVE_STD_INCLUDES, but I
+// can go ahead and add this -- CLO
+#ifdef __MWERKS__
+#  include <math.h> // needed fabs()
+#endif
+
 #include STL_STRING
 
 FG_USING_STD(string);
index 5d3983f52f32b869cc6a801101d3d61933128750..c49e1ebaaf99c0e013fcc1a8014c945ad5acc0d4 100644 (file)
@@ -48,6 +48,8 @@ FG_USING_STD(endl);
 #endif
 
 #ifdef __MWERKS__
+#  define cerr std::cerr and
+#  define endl std::endl
 FG_USING_STD(iostream);
 #endif
 
index 53d94ebfc97a74b45ddf0325e3fd7ab096714e98..2b426502c80911d1760b9ad27efa0ab2316f111a 100644 (file)
@@ -16,6 +16,7 @@
 # include <errno.h>
 #endif
 
+#include <Debug/logstream.hxx>
 #include <Include/fg_constants.h>
 #include <Math/fg_geodesy.hxx>
 #include <Math/point3d.hxx>
@@ -67,7 +68,7 @@ void fgGeocToGeod( double lat_geoc, double radius, double
 
        // check for domain error
        if ( errno == EDOM ) {
-           cout << "Domain ERROR in fgGeocToGeod!!!!\n";
+           FG_LOG( FG_GENERAL, FG_ALERT, "Domain ERROR in fgGeocToGeod!!!!" );
            *alt = 0.0;
        }
 
@@ -83,7 +84,7 @@ void fgGeocToGeod( double lat_geoc, double radius, double
 
        // check for domain error
        if ( errno == EDOM ) {
-           cout << "Domain ERROR in fgGeocToGeod!!!!\n";
+           FG_LOG( FG_GENERAL, FG_ALERT, "Domain ERROR in fgGeocToGeod!!!!" );
            *sea_level_r = 0.0;
        }
     }
index 5e419a8033f63a9299b9941bc0d7eabaa5e57925..d92638026126efdd5a844c99cb1bfd10bd205bc3 100644 (file)
 # include <math.h>
 #endif
 
+// I don't understand ... <math.h> or <cmath> should be included
+// already depending on how you defined FG_HAVE_STD_INCLUDES, but I
+// can go ahead and add this -- CLO
+#ifdef __MWERKS__
+#  include <math.h> // needed fabs()
+#endif
+
 #ifndef FG_HAVE_NATIVE_SGI_COMPILERS
 FG_USING_STD(ostream);
 FG_USING_STD(istream);
index 01b2c230b21ec4b5b1e91311b5720afe5e1669ae..3d5a09339e84108bc52e84c0455808205429262c 100644 (file)
@@ -99,6 +99,14 @@ skipeol( istream& in )
        if ( (c == '\n') || (c == '\r') ) {
            break;
        }       
+
+#ifdef __MWERKS__
+       // also break on '\0'
+       if ( c == '\0' ) {
+           break;
+       }       
+#endif
+
     }
 
     return in;
@@ -108,13 +116,14 @@ istream&
 skipws( istream& in ) {
     char c;
     while ( in.get(c) ) {
+
+#ifdef __MWERKS__
        // -dw- for unix file compatibility
        // -clo- this causes problems for unix
-       #ifdef __MWERKS__
-       if ( (c == '\n') || (c == '\r') ) {
+       if ( (c == '\n') || (c == '\r') || (c == '\0') ) {
            break;
        }       
-       #endif
+#endif
 
        if ( ! isspace( c ) ) {
            // put pack the non-space character
index 48647631faafa0d6255665785e5abb2ec8634d34..9dee13a8eb9cf66823ad604efdec67697a4441d8 100644 (file)
@@ -221,8 +221,8 @@ fgAptGenerate(const string& path, fgTILE *tile)
     // gpc_vertex_list perimeter_2d;
 
     fg_gzifstream in( path );
-    if ( !in ) {
-       // exit immediately assuming an airport file for this tile
+    if ( !in.is_open() ) {
+       // return immediately assuming an airport file for this tile
        // doesn't exist.
        return 0;
     }
index 1758117ad5300e5531fd4bde3b7de138193f3ece..28e5abe1126d67311c4d862bc81e1364d809c2a9 100644 (file)
 #include "sky.hxx"
 
 
+#ifdef __MWERKS__
+#  pragma global_optimizer off
+#endif
+
+
 // in meters of course
 #define CENTER_ELEV   25000.0
 
index 303e1ac3c1e8029bcf37279041838532e20b8dfa..7bbd73b819b5ec95627ce584cdf716cb9cc79843 100644 (file)
@@ -57,6 +57,7 @@
 #include <Main/options.hxx>
 #include <Main/fg_init.hxx>
 #include <Main/views.hxx>
+#include <Misc/fgpath.hxx>
 #include <Time/fg_time.hxx>
 
 #include "gui.h"
@@ -568,7 +569,6 @@ _____________________________________________________________________*/
 void guiInit()
 {
     char *mesa_win_state;
-    string fntpath;
 
     // Initialize PUI
     puInit();
@@ -583,15 +583,17 @@ void guiInit()
     gui_msg_RESET  = msg_RESET;  // "RESET"
 
     // Next check home directory
+    FGPath fntpath;
     char* envp = ::getenv( "FG_FONTS" );
     if ( envp != NULL ) {
-        fntpath = envp;
+        fntpath.set( envp );
     } else {
-        fntpath = current_options.get_fg_root() + "/Fonts";
+        fntpath.set( current_options.get_fg_root() );
+       fntpath.append( "Fonts" );
     }
 
     // Install our fast fonts
-    fntpath += "/typewriter.txf";
+    fntpath.append( "typewriter.txf" );
     guiFntHandle = new fntTexFont ;
     guiFntHandle -> load ( fntpath.c_str() ) ;
     puFont GuiFont ( guiFntHandle, 15 ) ;
index 8031c9f92e017d9f09f3cb9b88925f81e7512da0..856e0a7fe86579ed291a2566cb2ae0e49eb6ebf2 100644 (file)
@@ -70,6 +70,8 @@ static float joy_y_max = joy_scale;
 static int joy_z_min = 1000, /* joy_z_ctr=0, */ joy_z_max = -1000;
 static int joy_z_dead_min = 100, joy_z_dead_max = -100;
 
+#elif defined( MACOS )
+#  warning port me: no joystick support
 #else
 #  error port me: no joystick support
 #endif
@@ -163,6 +165,8 @@ int fgJoystickInit( void ) {
 
     glutJoystickFunc(joystick, 100);
 
+#elif defined( MACOS )
+#  warning port me: no joystick support
 #else
 #  error port me: no joystick support
 #endif
index b7735a9e8c07afa0a88d2e3eacff30a6792136b2..da93926dbcac000062d3ab130d28a36b2a78b28e 100644 (file)
@@ -194,7 +194,7 @@ fgOPTIONS::fgOPTIONS() :
 #if defined( WIN32 )
        fg_root = "\\FlightGear";
 #elif defined( MACOS )
-       fg_root = ":";
+       fg_root = "";
 #else
        fg_root = PKGLIBDIR;
 #endif
index 74adf3875446ce6f859b10bc74e4be89857186d3..0556b9dae66bf9979300b0bfc34415080e96e802 100644 (file)
@@ -108,7 +108,8 @@ fgTILECACHE::fill_in( int index, FGBucket& p )
     // cout << " fragments before = " << tile_cache[index].fragment_list.size()
     //      << "\n";
 
-    string apt_path = tile_path.str() + ".apt";
+    string apt_path = tile_path.str();
+    apt_path += ".apt";
     fgAptGenerate( apt_path, &tile_cache[index] );
 
     // cout << " ncount after = " << tile_cache[index].ncount << "\n";
diff --git a/Thanks b/Thanks
index 5fa877dac1a798ebc982bcf458b8faa27d87eaed..f00d40c8bef26b515926faf97a4a5478c327dfb8 100644 (file)
--- a/Thanks
+++ b/Thanks
@@ -242,8 +242,9 @@ Carmelo Volpe <carmelo.volpe@csb.ki.se>
 
 
 Darrell Walisser <dwaliss1@purdue.edu>
-  Contributed a large number of MacOS changes and is close to having a
-  working Mac versions of FGFS.
+  Contributed a large number of MacOS changes and has somehow managed
+  to get a pile of code written by a bunch of people who've never seen
+  a Mac to compile and run on said platform.
 
 
 Robert Allan Zeh <raz@cmg.FCNBD.COM>
index d354f507ecc518261cb1d7251562dc1aebd94e91..abad32cd057754f2577d1bcabed51de0b0152b5b 100644 (file)
 // $Id$
 
 
+// include Generic Polygon Clipping Library
+//
+//    http://www.cs.man.ac.uk/aig/staff/alan/software/
+//
+extern "C" {
+#include <gpc.h>
+}
+
 #include <Include/fg_constants.h>
 #include <Math/point3d.hxx>
 
@@ -212,3 +220,34 @@ void FGPolygon::calc_point_inside( const int contour,
 }
 
 
+// wrapper functions for gpc polygon clip routines
+
+// Difference
+FGPolygon polygon_diff(        const FGPolygon& subject, const FGPolygon& clip ) {
+    FGPolygon result;
+
+    gpc_polygon *poly = new gpc_polygon;
+    poly->num_contours = 0;
+    poly->contour = NULL;
+
+    gpc_vertex_list v_list;
+    v_list.num_vertices = 0;
+    v_list.vertex = new gpc_vertex[FG_MAX_VERTICES];
+
+    // free allocated memory
+    gpc_free_polygon( poly );
+    delete v_list.vertex;
+
+    return result;
+}
+
+// Intersection
+FGPolygon polygon_int( const FGPolygon& subject, const FGPolygon& clip );
+
+// Exclusive or
+FGPolygon polygon_xor( const FGPolygon& subject, const FGPolygon& clip );
+
+// Union
+FGPolygon polygon_union( const FGPolygon& subject, const FGPolygon& clip );
+
+
index 1959bb3c13ec34535ea5a8cf40f58ffd67225db0..ed1a6d51583f89aadb59f283d0ea70d084774f58 100644 (file)
@@ -41,6 +41,9 @@
 FG_USING_STD(vector);
 
 
+#define FG_MAX_VERTICES 100000
+
+
 typedef vector < int_list > polytype;
 typedef polytype::iterator polytype_iterator;
 typedef polytype::const_iterator const_polytype_iterator;
@@ -102,6 +105,7 @@ public:
     }
 
     inline void erase() { poly.clear(); }
+
 };
 
 
@@ -110,6 +114,21 @@ typedef poly_list::iterator poly_list_iterator;
 typedef poly_list::const_iterator const_poly_list_iterator;
 
 
+// wrapper functions for gpc polygon clip routines
+
+// Difference
+FGPolygon polygon_diff(        const FGPolygon& subject, const FGPolygon& clip );
+
+// Intersection
+FGPolygon polygon_int( const FGPolygon& subject, const FGPolygon& clip );
+
+// Exclusive or
+FGPolygon polygon_xor( const FGPolygon& subject, const FGPolygon& clip );
+
+// Union
+FGPolygon polygon_union( const FGPolygon& subject, const FGPolygon& clip );
+
+
 #endif // _POLYGON_HXX