Starting work on fixing tringle slivers in scenery generation tools.
# 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);
#endif
#ifdef __MWERKS__
+# define cerr std::cerr and
+# define endl std::endl
FG_USING_STD(iostream);
#endif
# include <errno.h>
#endif
+#include <Debug/logstream.hxx>
#include <Include/fg_constants.h>
#include <Math/fg_geodesy.hxx>
#include <Math/point3d.hxx>
// 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;
}
// 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;
}
}
# 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);
if ( (c == '\n') || (c == '\r') ) {
break;
}
+
+#ifdef __MWERKS__
+ // also break on '\0'
+ if ( c == '\0' ) {
+ break;
+ }
+#endif
+
}
return in;
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
// 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;
}
#include "sky.hxx"
+#ifdef __MWERKS__
+# pragma global_optimizer off
+#endif
+
+
// in meters of course
#define CENTER_ELEV 25000.0
#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"
void guiInit()
{
char *mesa_win_state;
- string fntpath;
// Initialize PUI
puInit();
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 ) ;
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
glutJoystickFunc(joystick, 100);
+#elif defined( MACOS )
+# warning port me: no joystick support
#else
# error port me: no joystick support
#endif
#if defined( WIN32 )
fg_root = "\\FlightGear";
#elif defined( MACOS )
- fg_root = ":";
+ fg_root = "";
#else
fg_root = PKGLIBDIR;
#endif
// 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";
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>
// $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>
}
+// 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 );
+
+
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;
}
inline void erase() { poly.clear(); }
+
};
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