The next round of MacOS changes contributed by Darrell Walisser.
Starting work on fixing tringle slivers in scenery generation tools.
This commit is contained in:
parent
d3908f531f
commit
687e883e0a
14 changed files with 112 additions and 15 deletions
|
@ -38,6 +38,13 @@
|
||||||
# include <iostream.h>
|
# include <iostream.h>
|
||||||
#endif
|
#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
|
#include STL_STRING
|
||||||
|
|
||||||
FG_USING_STD(string);
|
FG_USING_STD(string);
|
||||||
|
|
|
@ -48,6 +48,8 @@ FG_USING_STD(endl);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __MWERKS__
|
#ifdef __MWERKS__
|
||||||
|
# define cerr std::cerr and
|
||||||
|
# define endl std::endl
|
||||||
FG_USING_STD(iostream);
|
FG_USING_STD(iostream);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
# include <errno.h>
|
# include <errno.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <Debug/logstream.hxx>
|
||||||
#include <Include/fg_constants.h>
|
#include <Include/fg_constants.h>
|
||||||
#include <Math/fg_geodesy.hxx>
|
#include <Math/fg_geodesy.hxx>
|
||||||
#include <Math/point3d.hxx>
|
#include <Math/point3d.hxx>
|
||||||
|
@ -67,7 +68,7 @@ void fgGeocToGeod( double lat_geoc, double radius, double
|
||||||
|
|
||||||
// check for domain error
|
// check for domain error
|
||||||
if ( errno == EDOM ) {
|
if ( errno == EDOM ) {
|
||||||
cout << "Domain ERROR in fgGeocToGeod!!!!\n";
|
FG_LOG( FG_GENERAL, FG_ALERT, "Domain ERROR in fgGeocToGeod!!!!" );
|
||||||
*alt = 0.0;
|
*alt = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +84,7 @@ void fgGeocToGeod( double lat_geoc, double radius, double
|
||||||
|
|
||||||
// check for domain error
|
// check for domain error
|
||||||
if ( errno == EDOM ) {
|
if ( errno == EDOM ) {
|
||||||
cout << "Domain ERROR in fgGeocToGeod!!!!\n";
|
FG_LOG( FG_GENERAL, FG_ALERT, "Domain ERROR in fgGeocToGeod!!!!" );
|
||||||
*sea_level_r = 0.0;
|
*sea_level_r = 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,13 @@
|
||||||
# include <math.h>
|
# include <math.h>
|
||||||
#endif
|
#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
|
#ifndef FG_HAVE_NATIVE_SGI_COMPILERS
|
||||||
FG_USING_STD(ostream);
|
FG_USING_STD(ostream);
|
||||||
FG_USING_STD(istream);
|
FG_USING_STD(istream);
|
||||||
|
|
|
@ -99,6 +99,14 @@ skipeol( istream& in )
|
||||||
if ( (c == '\n') || (c == '\r') ) {
|
if ( (c == '\n') || (c == '\r') ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __MWERKS__
|
||||||
|
// also break on '\0'
|
||||||
|
if ( c == '\0' ) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return in;
|
return in;
|
||||||
|
@ -108,10 +116,11 @@ istream&
|
||||||
skipws( istream& in ) {
|
skipws( istream& in ) {
|
||||||
char c;
|
char c;
|
||||||
while ( in.get(c) ) {
|
while ( in.get(c) ) {
|
||||||
|
|
||||||
|
#ifdef __MWERKS__
|
||||||
// -dw- for unix file compatibility
|
// -dw- for unix file compatibility
|
||||||
// -clo- this causes problems for unix
|
// -clo- this causes problems for unix
|
||||||
#ifdef __MWERKS__
|
if ( (c == '\n') || (c == '\r') || (c == '\0') ) {
|
||||||
if ( (c == '\n') || (c == '\r') ) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -221,8 +221,8 @@ fgAptGenerate(const string& path, fgTILE *tile)
|
||||||
// gpc_vertex_list perimeter_2d;
|
// gpc_vertex_list perimeter_2d;
|
||||||
|
|
||||||
fg_gzifstream in( path );
|
fg_gzifstream in( path );
|
||||||
if ( !in ) {
|
if ( !in.is_open() ) {
|
||||||
// exit immediately assuming an airport file for this tile
|
// return immediately assuming an airport file for this tile
|
||||||
// doesn't exist.
|
// doesn't exist.
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,11 @@
|
||||||
#include "sky.hxx"
|
#include "sky.hxx"
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __MWERKS__
|
||||||
|
# pragma global_optimizer off
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// in meters of course
|
// in meters of course
|
||||||
#define CENTER_ELEV 25000.0
|
#define CENTER_ELEV 25000.0
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@
|
||||||
#include <Main/options.hxx>
|
#include <Main/options.hxx>
|
||||||
#include <Main/fg_init.hxx>
|
#include <Main/fg_init.hxx>
|
||||||
#include <Main/views.hxx>
|
#include <Main/views.hxx>
|
||||||
|
#include <Misc/fgpath.hxx>
|
||||||
#include <Time/fg_time.hxx>
|
#include <Time/fg_time.hxx>
|
||||||
|
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
|
@ -568,7 +569,6 @@ _____________________________________________________________________*/
|
||||||
void guiInit()
|
void guiInit()
|
||||||
{
|
{
|
||||||
char *mesa_win_state;
|
char *mesa_win_state;
|
||||||
string fntpath;
|
|
||||||
|
|
||||||
// Initialize PUI
|
// Initialize PUI
|
||||||
puInit();
|
puInit();
|
||||||
|
@ -583,15 +583,17 @@ void guiInit()
|
||||||
gui_msg_RESET = msg_RESET; // "RESET"
|
gui_msg_RESET = msg_RESET; // "RESET"
|
||||||
|
|
||||||
// Next check home directory
|
// Next check home directory
|
||||||
|
FGPath fntpath;
|
||||||
char* envp = ::getenv( "FG_FONTS" );
|
char* envp = ::getenv( "FG_FONTS" );
|
||||||
if ( envp != NULL ) {
|
if ( envp != NULL ) {
|
||||||
fntpath = envp;
|
fntpath.set( envp );
|
||||||
} else {
|
} else {
|
||||||
fntpath = current_options.get_fg_root() + "/Fonts";
|
fntpath.set( current_options.get_fg_root() );
|
||||||
|
fntpath.append( "Fonts" );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Install our fast fonts
|
// Install our fast fonts
|
||||||
fntpath += "/typewriter.txf";
|
fntpath.append( "typewriter.txf" );
|
||||||
guiFntHandle = new fntTexFont ;
|
guiFntHandle = new fntTexFont ;
|
||||||
guiFntHandle -> load ( fntpath.c_str() ) ;
|
guiFntHandle -> load ( fntpath.c_str() ) ;
|
||||||
puFont GuiFont ( guiFntHandle, 15 ) ;
|
puFont GuiFont ( guiFntHandle, 15 ) ;
|
||||||
|
|
|
@ -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_min = 1000, /* joy_z_ctr=0, */ joy_z_max = -1000;
|
||||||
static int joy_z_dead_min = 100, joy_z_dead_max = -100;
|
static int joy_z_dead_min = 100, joy_z_dead_max = -100;
|
||||||
|
|
||||||
|
#elif defined( MACOS )
|
||||||
|
# warning port me: no joystick support
|
||||||
#else
|
#else
|
||||||
# error port me: no joystick support
|
# error port me: no joystick support
|
||||||
#endif
|
#endif
|
||||||
|
@ -163,6 +165,8 @@ int fgJoystickInit( void ) {
|
||||||
|
|
||||||
glutJoystickFunc(joystick, 100);
|
glutJoystickFunc(joystick, 100);
|
||||||
|
|
||||||
|
#elif defined( MACOS )
|
||||||
|
# warning port me: no joystick support
|
||||||
#else
|
#else
|
||||||
# error port me: no joystick support
|
# error port me: no joystick support
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -194,7 +194,7 @@ fgOPTIONS::fgOPTIONS() :
|
||||||
#if defined( WIN32 )
|
#if defined( WIN32 )
|
||||||
fg_root = "\\FlightGear";
|
fg_root = "\\FlightGear";
|
||||||
#elif defined( MACOS )
|
#elif defined( MACOS )
|
||||||
fg_root = ":";
|
fg_root = "";
|
||||||
#else
|
#else
|
||||||
fg_root = PKGLIBDIR;
|
fg_root = PKGLIBDIR;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -108,7 +108,8 @@ fgTILECACHE::fill_in( int index, FGBucket& p )
|
||||||
// cout << " fragments before = " << tile_cache[index].fragment_list.size()
|
// cout << " fragments before = " << tile_cache[index].fragment_list.size()
|
||||||
// << "\n";
|
// << "\n";
|
||||||
|
|
||||||
string apt_path = tile_path.str() + ".apt";
|
string apt_path = tile_path.str();
|
||||||
|
apt_path += ".apt";
|
||||||
fgAptGenerate( apt_path, &tile_cache[index] );
|
fgAptGenerate( apt_path, &tile_cache[index] );
|
||||||
|
|
||||||
// cout << " ncount after = " << tile_cache[index].ncount << "\n";
|
// cout << " ncount after = " << tile_cache[index].ncount << "\n";
|
||||||
|
|
5
Thanks
5
Thanks
|
@ -242,8 +242,9 @@ Carmelo Volpe <carmelo.volpe@csb.ki.se>
|
||||||
|
|
||||||
|
|
||||||
Darrell Walisser <dwaliss1@purdue.edu>
|
Darrell Walisser <dwaliss1@purdue.edu>
|
||||||
Contributed a large number of MacOS changes and is close to having a
|
Contributed a large number of MacOS changes and has somehow managed
|
||||||
working Mac versions of FGFS.
|
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>
|
Robert Allan Zeh <raz@cmg.FCNBD.COM>
|
||||||
|
|
|
@ -21,6 +21,14 @@
|
||||||
// $Id$
|
// $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 <Include/fg_constants.h>
|
||||||
#include <Math/point3d.hxx>
|
#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 );
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,9 @@
|
||||||
FG_USING_STD(vector);
|
FG_USING_STD(vector);
|
||||||
|
|
||||||
|
|
||||||
|
#define FG_MAX_VERTICES 100000
|
||||||
|
|
||||||
|
|
||||||
typedef vector < int_list > polytype;
|
typedef vector < int_list > polytype;
|
||||||
typedef polytype::iterator polytype_iterator;
|
typedef polytype::iterator polytype_iterator;
|
||||||
typedef polytype::const_iterator const_polytype_iterator;
|
typedef polytype::const_iterator const_polytype_iterator;
|
||||||
|
@ -102,6 +105,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void erase() { poly.clear(); }
|
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;
|
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
|
#endif // _POLYGON_HXX
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue