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>
|
||||
#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);
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,6 +45,13 @@
|
|||
# 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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -46,6 +46,11 @@
|
|||
#include "sky.hxx"
|
||||
|
||||
|
||||
#ifdef __MWERKS__
|
||||
# pragma global_optimizer off
|
||||
#endif
|
||||
|
||||
|
||||
// in meters of course
|
||||
#define CENTER_ELEV 25000.0
|
||||
|
||||
|
|
|
@ -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 ) ;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -194,7 +194,7 @@ fgOPTIONS::fgOPTIONS() :
|
|||
#if defined( WIN32 )
|
||||
fg_root = "\\FlightGear";
|
||||
#elif defined( MACOS )
|
||||
fg_root = ":";
|
||||
fg_root = "";
|
||||
#else
|
||||
fg_root = PKGLIBDIR;
|
||||
#endif
|
||||
|
|
|
@ -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";
|
||||
|
|
5
Thanks
5
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>
|
||||
|
|
|
@ -21,6 +21,14 @@
|
|||
// $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 );
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue