diff -ru C:\FGCVS\Atlas\src\Atlas.cxx Atlas01\src\Atlas.cxx --- C:\FGCVS\Atlas\src\Atlas.cxx Thu Jan 03 09:28:48 2008 +++ Atlas01\src\Atlas.cxx Thu Apr 24 16:43:30 2008 @@ -19,6 +19,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ---------------------------------------------------------------------------*/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif // #ifdef HAVE_CONFIG_H #ifdef _MSC_VER // For access diff -ru C:\FGCVS\Atlas\src\fg_mkdir.cxx Atlas01\src\fg_mkdir.cxx --- C:\FGCVS\Atlas\src\fg_mkdir.cxx Fri Jan 28 13:54:12 2005 +++ Atlas01\src\fg_mkdir.cxx Wed Apr 23 19:29:56 2008 @@ -23,7 +23,7 @@ // #ifdef HAVE_CONFIG_H -# include +# include "config.h" #endif #include diff -ru C:\FGCVS\Atlas\src\FlightTrack.cxx Atlas01\src\FlightTrack.cxx --- C:\FGCVS\Atlas\src\FlightTrack.cxx Thu Jan 03 09:28:48 2008 +++ Atlas01\src\FlightTrack.cxx Wed Apr 23 14:28:42 2008 @@ -19,6 +19,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ---------------------------------------------------------------------------*/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif // #ifdef HAVE_CONFIG_H #include diff -ru C:\FGCVS\Atlas\src\GetMap.cxx Atlas01\src\GetMap.cxx --- C:\FGCVS\Atlas\src\GetMap.cxx Sat Oct 01 08:40:26 2005 +++ Atlas01\src\GetMap.cxx Thu Apr 24 16:36:26 2008 @@ -24,8 +24,12 @@ --------------------------------------------------------------------------- CHANGES + 2008-04-23 port for WIN32/MSVC 2005-09-28 Initial version ---------------------------------------------------------------------------*/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif // #ifdef HAVE_CONFIG_H #include #include @@ -94,7 +98,7 @@ } size_t writeData_cb( void *buffer, size_t size, size_t nmemb, void *userp ) { - memstream.write( (char *)buffer, size * nmemb ); + memstream.write( (char *)buffer, (std::streamsize) nmemb ); file_size += size * nmemb; return nmemb; } @@ -209,7 +213,7 @@ curl_easy_getinfo( ceh, CURLINFO_CONTENT_TYPE, &cType ); if ( strcmp( cType, "image/jpeg" ) == 0 ) { std::ofstream fstr( fname.str().c_str(), std::ios::binary ); - fstr.write( memstream.str().data(), file_size ); + fstr.write( memstream.str().data(), (std::streamsize)file_size ); fstr.close(); std::cout << "Written '" << fname.str().c_str() << "'" << std::endl; } diff -ru C:\FGCVS\Atlas\src\Graphs.cxx Atlas01\src\Graphs.cxx --- C:\FGCVS\Atlas\src\Graphs.cxx Tue Jan 01 07:04:47 2008 +++ Atlas01\src\Graphs.cxx Thu Apr 24 13:16:09 2008 @@ -19,6 +19,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ---------------------------------------------------------------------------*/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif // #ifdef HAVE_CONFIG_H #include #include SG_GLUT_H @@ -447,18 +450,18 @@ // Break it down into an exponent (base-10) and mantissa. int exponent = floor(log10(actual)); - float mantissa = actual / pow(10, exponent); + float mantissa = actual / pow(10.0, exponent); // Our heuristic: good mantissa values are 2, 5, and 10. We move // up from our actual mantissa to the next good mantissa value, // which means that our ticks are spaced no less than 'minimum' // pixels apart. if (mantissa < 2) { - values.d = 2 * pow(10, exponent); + values.d = 2.0 * pow(10.0, exponent); } else if (mantissa < 5) { - values.d = 5 * pow(10, exponent); + values.d = 5.0 * pow(10.0, exponent); } else { - values.d = 10 * pow(10, exponent); + values.d = 10.0 * pow(10.0, exponent); } // Large ticks are always placed every 5 small ticks. values.D = values.d * 5; diff -ru C:\FGCVS\Atlas\src\LoadPng.cxx Atlas01\src\LoadPng.cxx --- C:\FGCVS\Atlas\src\LoadPng.cxx Fri Aug 11 18:33:34 2000 +++ Atlas01\src\LoadPng.cxx Thu Apr 24 16:22:37 2008 @@ -20,6 +20,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ---------------------------------------------------------------------------*/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif // #ifdef HAVE_CONFIG_H #include #include diff -ru C:\FGCVS\Atlas\src\Map.cxx Atlas01\src\Map.cxx --- C:\FGCVS\Atlas\src\Map.cxx Mon Dec 10 09:14:22 2007 +++ Atlas01\src\Map.cxx Thu Apr 24 16:53:59 2008 @@ -33,7 +33,11 @@ rendering, plus jpg support (submitted by Fred Bouvier). 2005-02-26 FB: Arbitrary size by tiling. Move fg_set_scenery to a specific file. + 2008-04-24 Port to _MSC_VER WIN32 using MSVC8 ---------------------------------------------------------------------------*/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif // #ifdef HAVE_CONFIG_H // Needs to be included *before* the UL_GLX check! #include @@ -374,8 +378,10 @@ } int main( int argc, char **argv ) { - if (argc == 0) - print_help(); + if (argc < 2) { + print_help(); + exit(0); + } // Read the FG_SCENERY env variable before processing .atlasmaprc and command args, // so that we can override it if necessary. diff -ru C:\FGCVS\Atlas\src\MapBrowser.cxx Atlas01\src\MapBrowser.cxx --- C:\FGCVS\Atlas\src\MapBrowser.cxx Tue Jan 08 14:54:33 2008 +++ Atlas01\src\MapBrowser.cxx Thu Apr 24 12:17:28 2008 @@ -20,6 +20,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ---------------------------------------------------------------------------*/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif // #ifdef HAVE_CONFIG_H #include #include diff -ru C:\FGCVS\Atlas\src\MapMaker.cxx Atlas01\src\MapMaker.cxx --- C:\FGCVS\Atlas\src\MapMaker.cxx Mon Dec 10 09:29:30 2007 +++ Atlas01\src\MapMaker.cxx Thu Apr 24 16:07:30 2008 @@ -20,7 +20,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ---------------------------------------------------------------------------*/ - +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif // #ifdef HAVE_CONFIG_H #include #include #include @@ -708,13 +710,19 @@ } } +#ifdef _MSC_VER +// typedef vector < Point3D > point_list; +typedef const std::vector pt_list; +typedef const std::vector pt_listf; + +#endif + int MapMaker::process_binary_file( char *tile_name, sgVec3 xyz ) { sgVec3 gbs, tmp; // int material = 16; int material; // EYE - a colour, not a material unsigned int i; SGBinObject tile; - vector v, n; if ( !tile.read_bin( tile_name ) ) { @@ -741,6 +749,60 @@ // http://www.flightgear.org/Docs/Scenery/CoordinateSystem/CoordinateSystem.html // // for more. +#ifdef _MSC_VER +// typedef vector < Point3D > point_list; +// typedef const std::vector pt_list; + pt_list wgs84_nodes = tile.get_wgs84_nodes(); + for ( pt_list::const_iterator node = wgs84_nodes . begin(); + node != wgs84_nodes . end(); + node++ ) { + float *nv = new sgVec3; + + for (i = 0; i < 3; i++) { + tmp[i] = (*node)[i]; + } + + // Convert to WGS84 . + sgAddVec3(tmp, gbs); + double pr = sgLengthVec3( tmp ); + ab_xy( tmp, xyz, nv ); + // nv[2] contains the sea-level z-coordinate - calculate this vertex' + // altitude: + nv[2] = pr - nv[2]; + v.push_back( nv ); + } + // same as above for normals + pt_listf m_norms = tile.get_normals(); + for ( pt_listf::const_iterator normal = m_norms.begin(); + normal != m_norms.end(); + normal++ ) { + // Make a new normal + float *nn = new sgVec3; + + // BJS - One would think the normals should be transformed as + // well, but this appears not to be the case. What seems to be + // happening is that the lighting is set up for the original, + // untransformed vertices (see createMap and the call to + // output->setLightVector). That being the case, the lighting + // will work with the original, untransformed normals. I think. + // The results certainly look okay. + // + // Assuming that my guess is correct, I think this approach could + // fail if a very large map (covering a significant part of the + // globe) was rendered. Lighting that would be correct for the + // left edge of the map might be completely wrong for the right + // edge. To be truly correct, the normals should really be + // transformed, and the lighting set for the transformed map. + // However, this situation is highly unlikely to occur, and so the + // current system is good enough (and simpler and faster). + for (i = 0; i < 3; i++) { + nn[i] = (*normal)[i]; + } + + n.push_back( nn ); + } + +#else const point_list wgs84_nodes = tile.get_wgs84_nodes(); for ( point_list::const_iterator node = wgs84_nodes . begin(); node != wgs84_nodes . end(); @@ -792,6 +854,8 @@ n.push_back( nn ); } +#endif + const group_list tris = tile.get_tris_v(); string_list tri_mats = tile.get_tri_materials(); const group_list tri_normals = tile.get_tris_n(); @@ -895,6 +959,8 @@ return 1; } + + int MapMaker::process_ascii_file( char *tile_name, sgVec3 xyz ) { //float cr; // reference point (gbs) diff -ru C:\FGCVS\Atlas\src\MapPS.cxx Atlas01\src\MapPS.cxx --- C:\FGCVS\Atlas\src\MapPS.cxx Mon Dec 10 09:14:22 2007 +++ Atlas01\src\MapPS.cxx Thu Apr 24 16:28:42 2008 @@ -29,6 +29,9 @@ 2000-04-29 New, cuter, airports 2005-02-26 --fg-scenery option ---------------------------------------------------------------------------*/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif // #ifdef HAVE_CONFIG_H #include #include diff -ru C:\FGCVS\Atlas\src\Output.cxx Atlas01\src\Output.cxx --- C:\FGCVS\Atlas\src\Output.cxx Mon Dec 10 09:14:22 2007 +++ Atlas01\src\Output.cxx Wed Apr 23 20:26:02 2008 @@ -20,6 +20,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ---------------------------------------------------------------------------*/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif // #ifdef HAVE_CONFIG_H #include #include "Output.hxx" diff -ru C:\FGCVS\Atlas\src\OutputPS.cxx Atlas01\src\OutputPS.cxx --- C:\FGCVS\Atlas\src\OutputPS.cxx Mon Dec 10 09:14:21 2007 +++ Atlas01\src\OutputPS.cxx Thu Apr 24 16:28:42 2008 @@ -1,3 +1,10 @@ + +/* OutputPS.cxx */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif // #ifdef HAVE_CONFIG_H + #include "OutputPS.hxx" OutputPS::OutputPS( const char *filename, int size, bool smooth_shading ) : diff -ru C:\FGCVS\Atlas\src\Overlays.cxx Atlas01\src\Overlays.cxx --- C:\FGCVS\Atlas\src\Overlays.cxx Tue Jan 01 07:14:55 2008 +++ Atlas01\src\Overlays.cxx Thu Apr 24 12:37:58 2008 @@ -19,6 +19,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ---------------------------------------------------------------------------*/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif // #ifdef HAVE_CONFIG_H #include #include @@ -34,35 +37,6 @@ #ifdef _MSC_VER -double rint( double x) -// Copyright (C) 2001 Tor M. Aamodt, University of Toronto -// Permisssion to use for all purposes commercial and otherwise granted. -// THIS MATERIAL IS PROVIDED "AS IS" WITHOUT WARRANTY, OR ANY CONDITION OR -// OTHER TERM OF ANY KIND INCLUDING, WITHOUT LIMITATION, ANY WARRANTY -// OF MERCHANTABILITY, SATISFACTORY QUALITY, OR FITNESS FOR A PARTICULAR -// PURPOSE. -{ - if( x > 0 ) { - __int64 xint = (__int64) (x+0.5); - if( xint % 2 ) { - // then we might have an even number... - double diff = x - (double)xint; - if( diff == -0.5 ) - return double(xint-1); - } - return double(xint); - } else { - __int64 xint = (__int64) (x-0.5); - if( xint % 2 ) { - // then we might have an even number... - double diff = x - (double)xint; - if( diff == 0.5 ) - return double(xint+1); - } - return double(xint); - } -} - #endif bool Overlays::airports_loaded = false; @@ -819,6 +793,7 @@ // Sort all the search tokens. sort(tokens.begin(), tokens.end()); + } /* Loads the old format (Flightgear-0.9.3 to 0.9.7) airport diff -ru C:\FGCVS\Atlas\src\Preferences.cxx Atlas01\src\Preferences.cxx --- C:\FGCVS\Atlas\src\Preferences.cxx Thu Dec 13 14:37:04 2007 +++ Atlas01\src\Preferences.cxx Thu Apr 24 13:32:53 2008 @@ -19,11 +19,17 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ---------------------------------------------------------------------------*/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif // #ifdef HAVE_CONFIG_H #include +#ifdef _MSC_VER +#include "getopt.hxx" +#else // !_MSC_VER #include -#include "config.h" #include "libgen.h" +#endif // _MSC_VER y/n #include // This is a space-saving macro used when parsing command-line diff -ru C:\FGCVS\Atlas\src\Projection.cxx Atlas01\src\Projection.cxx --- C:\FGCVS\Atlas\src\Projection.cxx Mon Jan 31 18:28:46 2005 +++ Atlas01\src\Projection.cxx Wed Apr 23 14:29:29 2008 @@ -19,6 +19,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ---------------------------------------------------------------------------*/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif // #ifdef HAVE_CONFIG_H + #include #include diff -ru C:\FGCVS\Atlas\src\Scenery.cxx Atlas01\src\Scenery.cxx --- C:\FGCVS\Atlas\src\Scenery.cxx Sat Feb 26 19:39:14 2005 +++ Atlas01\src\Scenery.cxx Thu Apr 24 16:14:38 2008 @@ -1,3 +1,10 @@ + +// Scenery.cxx + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif // #ifdef HAVE_CONFIG_H + #include #include diff -ru C:\FGCVS\Atlas\src\Search.cxx Atlas01\src\Search.cxx --- C:\FGCVS\Atlas\src\Search.cxx Fri Aug 03 10:24:24 2007 +++ Atlas01\src\Search.cxx Thu Apr 24 12:25:42 2008 @@ -19,6 +19,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ---------------------------------------------------------------------------*/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif // #ifdef HAVE_CONFIG_H #include "Search.hxx" diff -ru C:\FGCVS\Atlas\src\Tile.cxx Atlas01\src\Tile.cxx --- C:\FGCVS\Atlas\src\Tile.cxx Thu Dec 13 14:38:27 2007 +++ Atlas01\src\Tile.cxx Thu Apr 24 16:42:22 2008 @@ -19,13 +19,19 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ---------------------------------------------------------------------------*/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif // #ifdef HAVE_CONFIG_H #include #include #include #include - +#ifdef _MSC_VER +#include +#else // !_MSC_VER #include +#endif // _MSC_VER y/n #include @@ -181,6 +187,10 @@ int setNonBlocking(FILE *f) { +#ifdef _MSC_VER + /* need alternative coding */ + return 0; +#else /* !_MSC_VER */ int fd; int flags; @@ -191,6 +201,7 @@ } return fcntl(fd, F_SETFL, flags | O_NONBLOCK); +#endif /* _MSC_VER y/n */ } // Starts the given command using popen, and sets the file descriptor @@ -450,7 +461,7 @@ std::ostringstream cmd; std::string source("Scenery"); SGPath dest(_prefs.scenery_root.str()); - int err; + //int err; _syncedFiles = 0; _syncedSize = 0; diff -ru C:\FGCVS\Atlas\src\TileManager.cxx Atlas01\src\TileManager.cxx --- C:\FGCVS\Atlas\src\TileManager.cxx Thu Dec 13 14:38:27 2007 +++ Atlas01\src\TileManager.cxx Thu Apr 24 13:20:31 2008 @@ -19,6 +19,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ---------------------------------------------------------------------------*/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif // #ifdef HAVE_CONFIG_H #include #include diff -ru C:\FGCVS\Atlas\src\OutputGL.cxx Atlas01\src\OutputGL.cxx --- C:\FGCVS\Atlas\src\OutputGL.cxx Mon Dec 10 09:14:21 2007 +++ Atlas01\src\OutputGL.cxx Fri Apr 25 11:32:05 2008 @@ -1,3 +1,8 @@ +/* OutputGL.cxx */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif // #ifdef HAVE_CONFIG_H + #include #include extern "C" {