From: curt Date: Fri, 16 Oct 1998 23:26:44 +0000 (+0000) Subject: C++-ifying. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=bf5fb5108b52e9cec2ed7d5038ad0dca822f890c;p=flightgear.git C++-ifying. --- diff --git a/Aircraft/Makefile.am b/Aircraft/Makefile.am index c3e60f0f8..9620f85e1 100644 --- a/Aircraft/Makefile.am +++ b/Aircraft/Makefile.am @@ -1,5 +1,5 @@ noinst_LIBRARIES = libAircraft.a -libAircraft_a_SOURCES = aircraft.c aircraft.h +libAircraft_a_SOURCES = aircraft.cxx aircraft.hxx INCLUDES += -I$(top_builddir) -I$(top_builddir)/Lib -I$(top_builddir)/Simulator diff --git a/Aircraft/aircraft.c b/Aircraft/aircraft.c deleted file mode 100644 index 0ac3cc37f..000000000 --- a/Aircraft/aircraft.c +++ /dev/null @@ -1,131 +0,0 @@ -/************************************************************************** - * aircraft.c -- various aircraft routines - * - * Written by Curtis Olson, started May 1997. - * - * Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id$ - * (Log is kept at end of this file) - **************************************************************************/ - - -#include - -#include -#include -#include - -/* This is a record containing all the info for the aircraft currently - being operated */ -fgAIRCRAFT current_aircraft; - - -/* Initialize an Aircraft structure */ -void fgAircraftInit( void ) { - fgPrintf( FG_AIRCRAFT, FG_INFO, "Initializing Aircraft structure\n" ); - - current_aircraft.flight = &cur_flight_params; - current_aircraft.controls = &cur_control_params; -} - - -/* Display various parameters to stdout */ -void fgAircraftOutputCurrent(fgAIRCRAFT *a) { - fgFLIGHT *f; - fgCONTROLS *c; - - f = a->flight; - c = a->controls; - - fgPrintf( FG_FLIGHT, FG_DEBUG, - "Pos = (%.2f,%.2f,%.2f) (Phi,Theta,Psi)=(%.2f,%.2f,%.2f)\n", - FG_Longitude * 3600.0 * RAD_TO_DEG, - FG_Latitude * 3600.0 * RAD_TO_DEG, - FG_Altitude, FG_Phi, FG_Theta, FG_Psi); - fgPrintf( FG_FLIGHT, FG_DEBUG, - "Kts = %.0f Elev = %.2f, Aileron = %.2f, Rudder = %.2f Power = %.2f\n", - FG_V_equiv_kts, FG_Elevator, FG_Aileron, FG_Rudder, FG_Throttle[0]); -} - - -/* $Log$ -/* Revision 1.19 1998/04/25 22:06:24 curt -/* Edited cvs log messages in source files ... bad bad bad! -/* - * Revision 1.18 1998/04/18 04:13:56 curt - * Moved fg_debug.c to it's own library. - * - * Revision 1.17 1998/02/12 21:59:31 curt - * Incorporated code changes contributed by Charlie Hotchkiss - * - * - * Revision 1.16 1998/02/07 15:29:31 curt - * Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss - * - * - * Revision 1.15 1998/01/27 00:47:46 curt - * Incorporated Paul Bleisch's new debug message - * system and commandline/config file processing code. - * - * Revision 1.14 1998/01/19 19:26:56 curt - * Merged in make system changes from Bob Kuehne - * This should simplify things tremendously. - * - * Revision 1.13 1997/12/15 23:54:30 curt - * Add xgl wrappers for debugging. - * Generate terrain normals on the fly. - * - * Revision 1.12 1997/12/10 22:37:37 curt - * Prepended "fg" on the name of all global structures that didn't have it yet. - * i.e. "struct WEATHER {}" became "struct fgWEATHER {}" - * - * Revision 1.11 1997/09/13 02:00:05 curt - * Mostly working on stars and generating sidereal time for accurate star - * placement. - * - * Revision 1.10 1997/08/27 03:29:56 curt - * Changed naming scheme of basic shared structures. - * - * Revision 1.9 1997/07/19 22:39:08 curt - * Moved PI to ../constants.h - * - * Revision 1.8 1997/06/25 15:39:45 curt - * Minor changes to compile with rsxnt/win32. - * - * Revision 1.7 1997/06/02 03:01:39 curt - * Working on views (side, front, back, transitions, etc.) - * - * Revision 1.6 1997/05/31 19:16:26 curt - * Elevator trim added. - * - * Revision 1.5 1997/05/30 19:30:14 curt - * The LaRCsim flight model is starting to look like it is working. - * - * Revision 1.4 1997/05/30 03:54:11 curt - * Made a bit more progress towards integrating the LaRCsim flight model. - * - * Revision 1.3 1997/05/29 22:39:56 curt - * Working on incorporating the LaRCsim flight model. - * - * Revision 1.2 1997/05/23 15:40:29 curt - * Added GNU copyright headers. - * - * Revision 1.1 1997/05/16 15:58:24 curt - * Initial revision. - * - */ diff --git a/Aircraft/aircraft.cxx b/Aircraft/aircraft.cxx new file mode 100644 index 000000000..bb2f2628f --- /dev/null +++ b/Aircraft/aircraft.cxx @@ -0,0 +1,134 @@ +/************************************************************************** + * aircraft.c -- various aircraft routines + * + * Written by Curtis Olson, started May 1997. + * + * Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id$ + * (Log is kept at end of this file) + **************************************************************************/ + + +#include + +#include "aircraft.hxx" +#include +#include + +/* This is a record containing all the info for the aircraft currently + being operated */ +fgAIRCRAFT current_aircraft; + + +/* Initialize an Aircraft structure */ +void fgAircraftInit( void ) { + fgPrintf( FG_AIRCRAFT, FG_INFO, "Initializing Aircraft structure\n" ); + + current_aircraft.flight = &cur_flight_params; + current_aircraft.controls = &cur_control_params; +} + + +/* Display various parameters to stdout */ +void fgAircraftOutputCurrent(fgAIRCRAFT *a) { + fgFLIGHT *f; + fgCONTROLS *c; + + f = a->flight; + c = a->controls; + + fgPrintf( FG_FLIGHT, FG_DEBUG, + "Pos = (%.2f,%.2f,%.2f) (Phi,Theta,Psi)=(%.2f,%.2f,%.2f)\n", + FG_Longitude * 3600.0 * RAD_TO_DEG, + FG_Latitude * 3600.0 * RAD_TO_DEG, + FG_Altitude, FG_Phi, FG_Theta, FG_Psi); + fgPrintf( FG_FLIGHT, FG_DEBUG, + "Kts = %.0f Elev = %.2f, Aileron = %.2f, Rudder = %.2f Power = %.2f\n", + FG_V_equiv_kts, FG_Elevator, FG_Aileron, FG_Rudder, FG_Throttle[0]); +} + + +/* $Log$ +/* Revision 1.1 1998/10/16 23:26:47 curt +/* C++-ifying. +/* + * Revision 1.19 1998/04/25 22:06:24 curt + * Edited cvs log messages in source files ... bad bad bad! + * + * Revision 1.18 1998/04/18 04:13:56 curt + * Moved fg_debug.c to it's own library. + * + * Revision 1.17 1998/02/12 21:59:31 curt + * Incorporated code changes contributed by Charlie Hotchkiss + * + * + * Revision 1.16 1998/02/07 15:29:31 curt + * Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss + * + * + * Revision 1.15 1998/01/27 00:47:46 curt + * Incorporated Paul Bleisch's new debug message + * system and commandline/config file processing code. + * + * Revision 1.14 1998/01/19 19:26:56 curt + * Merged in make system changes from Bob Kuehne + * This should simplify things tremendously. + * + * Revision 1.13 1997/12/15 23:54:30 curt + * Add xgl wrappers for debugging. + * Generate terrain normals on the fly. + * + * Revision 1.12 1997/12/10 22:37:37 curt + * Prepended "fg" on the name of all global structures that didn't have it yet. + * i.e. "struct WEATHER {}" became "struct fgWEATHER {}" + * + * Revision 1.11 1997/09/13 02:00:05 curt + * Mostly working on stars and generating sidereal time for accurate star + * placement. + * + * Revision 1.10 1997/08/27 03:29:56 curt + * Changed naming scheme of basic shared structures. + * + * Revision 1.9 1997/07/19 22:39:08 curt + * Moved PI to ../constants.h + * + * Revision 1.8 1997/06/25 15:39:45 curt + * Minor changes to compile with rsxnt/win32. + * + * Revision 1.7 1997/06/02 03:01:39 curt + * Working on views (side, front, back, transitions, etc.) + * + * Revision 1.6 1997/05/31 19:16:26 curt + * Elevator trim added. + * + * Revision 1.5 1997/05/30 19:30:14 curt + * The LaRCsim flight model is starting to look like it is working. + * + * Revision 1.4 1997/05/30 03:54:11 curt + * Made a bit more progress towards integrating the LaRCsim flight model. + * + * Revision 1.3 1997/05/29 22:39:56 curt + * Working on incorporating the LaRCsim flight model. + * + * Revision 1.2 1997/05/23 15:40:29 curt + * Added GNU copyright headers. + * + * Revision 1.1 1997/05/16 15:58:24 curt + * Initial revision. + * + */ diff --git a/Aircraft/aircraft.h b/Aircraft/aircraft.h deleted file mode 100644 index 9f6779804..000000000 --- a/Aircraft/aircraft.h +++ /dev/null @@ -1,131 +0,0 @@ -/************************************************************************** - * aircraft.h -- define shared aircraft parameters - * - * Written by Curtis Olson, started May 1997. - * - * Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id$ - * (Log is kept at end of this file) - **************************************************************************/ - - -#ifndef _AIRCRAFT_H -#define _AIRCRAFT_H - - -#include -#include - - -#ifdef __cplusplus -extern "C" { -#endif - - -/* Define a structure containing all the parameters for an aircraft */ -typedef struct{ - fgFLIGHT *flight; - fgCONTROLS *controls; -} fgAIRCRAFT ; - - -/* current_aircraft contains all the parameters of the aircraft - currently being operated. */ -extern fgAIRCRAFT current_aircraft; - - -/* Initialize an Aircraft structure */ -void fgAircraftInit( void ); - - -/* Display various parameters to stdout */ -void fgAircraftOutputCurrent(fgAIRCRAFT *a); - - -#ifdef __cplusplus -} -#endif - - -#endif /* _AIRCRAFT_H */ - - -/* $Log$ -/* Revision 1.12 1998/04/22 13:26:15 curt -/* C++ - ifing the code a bit. -/* - * Revision 1.11 1998/04/21 17:02:27 curt - * Prepairing for C++ integration. - * - * Revision 1.10 1998/02/07 15:29:32 curt - * Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss - * - * - * Revision 1.9 1998/01/22 02:59:23 curt - * Changed #ifdef FILE_H to #ifdef _FILE_H - * - * Revision 1.8 1998/01/19 19:26:57 curt - * Merged in make system changes from Bob Kuehne - * This should simplify things tremendously. - * - * Revision 1.7 1997/12/10 22:37:38 curt - * Prepended "fg"AIRCRAFT_H */ - - -/* $Log$ -/* Revision 1.12 1998/04/22 13:26:15 curt -/* C++ - ifing the code a bit. -/* - * Revision 1.11 1998/04/21 17:02:27 curt - * Prepairing for C++ integration. - * - * Revision 1.10 1998/02/07 15:29:32 curt - * Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss - * - * - * Revision 1.9 1998/01/22 02:59:23 curt - * Changed #ifdef FILE_H to #ifdef _FILE_H - * - * Revision 1.8 1998/01/19 19:26:57 curt - * Merged in make system changes from Bob Kuehne - * This should simplify things tremendously. - * - * Revision 1.7 1997/12/10 22:37:38 curt - * Prepended "fg" on the name of all global structures that didn't have it yet. - * i.e. "struct WEATHER {}" became "struct fgWEATHER {}" - * - * Revision 1.6 1997/09/13 02:00:06 curt - * Mostly working on stars and generating sidereal time for accurate star - * placement. - * - * Revision 1.5 1997/08/27 03:29:58 curt - * Changed naming scheme of basic shared structures. - * - * Revision 1.4 1997/07/23 21:52:17 curt - * Put comments around the text after an #endif for increased portability. - * - * Revision 1.3 1997/06/21 17:12:42 curt - * Capitalized subdirectory names. - * - * Revision 1.2 1997/05/23 15:40:30 curt - * Added GNU copyright headers. - * - * Revision 1.1 1997/05/16 15:58:25 curt - * Initial revision. - * - */ diff --git a/Aircraft/aircraft.hxx b/Aircraft/aircraft.hxx new file mode 100644 index 000000000..22aa00d16 --- /dev/null +++ b/Aircraft/aircraft.hxx @@ -0,0 +1,132 @@ +/************************************************************************** + * aircraft.h -- define shared aircraft parameters + * + * Written by Curtis Olson, started May 1997. + * + * Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id$ + * (Log is kept at end of this file) + **************************************************************************/ + + +#ifndef _AIRCRAFT_H +#define _AIRCRAFT_H + + +#ifndef __cplusplus +# error This library requires C++ +#endif + + +#include +#include + + +/* Define a structure containing all the parameters for an aircraft */ +typedef struct{ + fgFLIGHT *flight; + fgCONTROLS *controls; +} fgAIRCRAFT ; + + +/* current_aircraft contains all the parameters of the aircraft + currently being operated. */ +extern fgAIRCRAFT current_aircraft; + + +/* Initialize an Aircraft structure */ +void fgAircraftInit( void ); + + +/* Display various parameters to stdout */ +void fgAircraftOutputCurrent(fgAIRCRAFT *a); + + +#endif /* _AIRCRAFT_H */ + + +/* $Log$ +/* Revision 1.1 1998/10/16 23:26:49 curt +/* C++-ifying. +/* + * Revision 1.12 1998/04/22 13:26:15 curt + * C++ - ifing the code a bit. + * + * Revision 1.11 1998/04/21 17:02:27 curt + * Prepairing for C++ integration. + * + * Revision 1.10 1998/02/07 15:29:32 curt + * Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss + * + * + * Revision 1.9 1998/01/22 02:59:23 curt + * Changed #ifdef FILE_H to #ifdef _FILE_H + * + * Revision 1.8 1998/01/19 19:26:57 curt + * Merged in make system changes from Bob Kuehne + * This should simplify things tremendously. + * + * Revision 1.7 1997/12/10 22:37:38 curt + * Prepended "fg"AIRCRAFT_H */ + + +/* $Log$ +/* Revision 1.1 1998/10/16 23:26:49 curt +/* C++-ifying. +/* + * Revision 1.12 1998/04/22 13:26:15 curt + * C++ - ifing the code a bit. + * + * Revision 1.11 1998/04/21 17:02:27 curt + * Prepairing for C++ integration. + * + * Revision 1.10 1998/02/07 15:29:32 curt + * Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss + * + * + * Revision 1.9 1998/01/22 02:59:23 curt + * Changed #ifdef FILE_H to #ifdef _FILE_H + * + * Revision 1.8 1998/01/19 19:26:57 curt + * Merged in make system changes from Bob Kuehne + * This should simplify things tremendously. + * + * Revision 1.7 1997/12/10 22:37:38 curt + * Prepended "fg" on the name of all global structures that didn't have it yet. + * i.e. "struct WEATHER {}" became "struct fgWEATHER {}" + * + * Revision 1.6 1997/09/13 02:00:06 curt + * Mostly working on stars and generating sidereal time for accurate star + * placement. + * + * Revision 1.5 1997/08/27 03:29:58 curt + * Changed naming scheme of basic shared structures. + * + * Revision 1.4 1997/07/23 21:52:17 curt + * Put comments around the text after an #endif for increased portability. + * + * Revision 1.3 1997/06/21 17:12:42 curt + * Capitalized subdirectory names. + * + * Revision 1.2 1997/05/23 15:40:30 curt + * Added GNU copyright headers. + * + * Revision 1.1 1997/05/16 15:58:25 curt + * Initial revision. + * + */ diff --git a/Airports/genapt.cxx b/Airports/genapt.cxx index e9789faa0..4d62bcf23 100644 --- a/Airports/genapt.cxx +++ b/Airports/genapt.cxx @@ -33,7 +33,7 @@ using namespace std; #include // #include -#include +#include #include #include #include @@ -62,30 +62,6 @@ static double calc_dist(const Point3D& p1, const Point3D& p2) { */ -// convert a geodetic point lon(radians), lat(radians), elev(meter) to -// a cartesian point -static Point3D geod_to_cart(const Point3D& geod) { - Point3D cp; - Point3D pp; - double gc_lon, gc_lat, sl_radius; - - // printf("A geodetic point is (%.2f, %.2f, %.2f)\n", - // geod[0], geod[1], geod[2]); - - gc_lon = geod.lon(); - fgGeodToGeoc(geod.lat(), geod.radius(), &sl_radius, &gc_lat); - - // printf("A geocentric point is (%.2f, %.2f, %.2f)\n", gc_lon, - // gc_lat, sl_radius+geod[2]); - - pp.setvals(gc_lon, gc_lat, sl_radius + geod.radius()); - cp = fgPolarToCart3d(pp); - - // printf("A cart point is (%.8f, %.8f, %.8f)\n", cp.x, cp.y, cp.z); - - return(cp); -} - #define FG_APT_BASE_TEX_CONSTANT 2000.0 #ifdef OLD_TEX_COORDS @@ -196,7 +172,7 @@ gen_base( const Point3D& average, const container& perimeter, fgTILE *t) // first point on perimeter const_iterator current = perimeter.begin(); - cart = geod_to_cart( *current ); + cart = fgGeodToCart( *current ); cart_trans = cart - t->center; t->nodes[t->ncount][0] = cart_trans.x(); t->nodes[t->ncount][1] = cart_trans.y(); @@ -216,7 +192,7 @@ gen_base( const Point3D& average, const container& perimeter, fgTILE *t) const_iterator last = perimeter.end(); for ( ; current != last; ++current ) { - cart = geod_to_cart( *current ); + cart = fgGeodToCart( *current ); cart_trans = cart - t->center; t->nodes[t->ncount][0] = cart_trans.x(); t->nodes[t->ncount][1] = cart_trans.y(); @@ -236,7 +212,7 @@ gen_base( const Point3D& average, const container& perimeter, fgTILE *t) // last point (first point in perimeter list) current = perimeter.begin(); - cart = geod_to_cart( *current ); + cart = fgGeodToCart( *current ); cart_trans = cart - t->center; fragment.add_face(center_num, i - 1, 1); @@ -346,6 +322,9 @@ fgAptGenerate(const string& path, fgTILE *tile) // $Log$ +// Revision 1.5 1998/10/16 23:27:14 curt +// C++-ifying. +// // Revision 1.4 1998/10/16 00:51:46 curt // Converted to Point3D class. // diff --git a/Astro/moon.cxx b/Astro/moon.cxx index 40dffacc8..bc7425ce4 100644 --- a/Astro/moon.cxx +++ b/Astro/moon.cxx @@ -22,7 +22,7 @@ * $Id$ * (Log is kept at end of this file) **************************************************************************/ -#include +#include #include #include "moon.hxx" diff --git a/Astro/moon.hxx b/Astro/moon.hxx index 9b70738b3..677dcfca1 100644 --- a/Astro/moon.hxx +++ b/Astro/moon.hxx @@ -25,7 +25,7 @@ #ifndef _MOON_HXX_ #define _MOON_HXX_ -#include +#include #include #include #include diff --git a/Astro/sky.cxx b/Astro/sky.cxx index 414d9bad3..4e562d216 100644 --- a/Astro/sky.cxx +++ b/Astro/sky.cxx @@ -1,27 +1,25 @@ -/************************************************************************** - * sky.c -- model sky with an upside down "bowl" - * - * Written by Curtis Olson, started December 1997. - * - * Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id$ - * (Log is kept at end of this file) - **************************************************************************/ +// sky.cxx -- model sky with an upside down "bowl" +// +// Written by Curtis Olson, started December 1997. +// +// Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// +// $Id$ +// (Log is kept at end of this file) #ifdef HAVE_CONFIG_H @@ -37,9 +35,9 @@ #include #include -#include +#include #include -#include +#include #include #include
#include @@ -49,11 +47,7 @@ #include "sky.hxx" -/* -#include -*/ - -/* in meters of course */ +// in meters of course #define CENTER_ELEV 25000.0 #define INNER_RADIUS 50000.0 @@ -79,7 +73,7 @@ static float middle_color[12][4]; static float outer_color[12][4]; -/* Calculate the sky structure vertices */ +// Calculate the sky structure vertices void fgSkyVerticesInit( void ) { float theta; int i; @@ -93,8 +87,8 @@ void fgSkyVerticesInit( void ) { inner_vertex[i][1] = sin(theta) * INNER_RADIUS; inner_vertex[i][2] = INNER_ELEV; - /* printf(" %.2f %.2f\n", cos(theta) * INNER_RADIUS, - sin(theta) * INNER_RADIUS); */ + // printf(" %.2f %.2f\n", cos(theta) * INNER_RADIUS, + // sin(theta) * INNER_RADIUS); middle_vertex[i][0] = cos((double)theta) * MIDDLE_RADIUS; middle_vertex[i][1] = sin((double)theta) * MIDDLE_RADIUS; @@ -111,7 +105,7 @@ void fgSkyVerticesInit( void ) { } -/* (Re)calculate the sky colors at each vertex */ +// (Re)calculate the sky colors at each vertex void fgSkyColorsInit( void ) { fgLIGHT *l; double sun_angle, diff; @@ -124,13 +118,13 @@ void fgSkyColorsInit( void ) { fgPrintf( FG_ASTRO, FG_INFO, " Generating the sky colors for each vertex.\n" ); - /* setup for the possibility of sunset effects */ + // setup for the possibility of sunset effects sun_angle = l->sun_angle * RAD_TO_DEG; // fgPrintf( FG_ASTRO, FG_INFO, // " Sun angle in degrees = %.2f\n", sun_angle); if ( (sun_angle > 80.0) && (sun_angle < 100.0) ) { - /* 0.0 - 0.4 */ + // 0.0 - 0.4 outer_param[0] = (10.0 - fabs(90.0 - sun_angle)) / 25.0; outer_param[1] = (10.0 - fabs(90.0 - sun_angle)) / 35.0; outer_param[2] = 0.0; @@ -153,10 +147,10 @@ void fgSkyColorsInit( void ) { outer_diff[0] = outer_diff[1] = outer_diff[2] = 0.0; middle_diff[0] = middle_diff[1] = middle_diff[2] = 0.0; } - /* printf(" outer_red_param = %.2f outer_red_diff = %.2f\n", - outer_red_param, outer_red_diff); */ + // printf(" outer_red_param = %.2f outer_red_diff = %.2f\n", + // outer_red_param, outer_red_diff); - /* calculate transition colors between sky and fog */ + // calculate transition colors between sky and fog for ( j = 0; j < 3; j++ ) { outer_amt[j] = outer_param[j]; middle_amt[j] = middle_param[j]; @@ -166,8 +160,8 @@ void fgSkyColorsInit( void ) { for ( j = 0; j < 3; j++ ) { diff = l->sky_color[j] - l->fog_color[j]; - /* printf("sky = %.2f fog = %.2f diff = %.2f\n", - l->sky_color[j], l->fog_color[j], diff); */ + // printf("sky = %.2f fog = %.2f diff = %.2f\n", + // l->sky_color[j], l->fog_color[j], diff); inner_color[i][j] = l->sky_color[j] - diff * 0.3; middle_color[i][j] = l->sky_color[j] - diff * 0.9 + middle_amt[j]; @@ -210,8 +204,8 @@ void fgSkyColorsInit( void ) { for ( j = 0; j < 3; j++ ) { diff = l->sky_color[j] - l->fog_color[j]; - /* printf("sky = %.2f fog = %.2f diff = %.2f\n", - l->sky_color[j], l->fog_color[j], diff); */ + // printf("sky = %.2f fog = %.2f diff = %.2f\n", + // l->sky_color[j], l->fog_color[j], diff); inner_color[i][j] = l->sky_color[j] - diff * 0.3; middle_color[i][j] = l->sky_color[j] - diff * 0.9 + middle_amt[j]; @@ -246,19 +240,19 @@ void fgSkyColorsInit( void ) { } -/* Initialize the sky structure and colors */ +// Initialize the sky structure and colors void fgSkyInit( void ) { fgPrintf(FG_ASTRO, FG_INFO, "Initializing the sky\n"); fgSkyVerticesInit(); - /* regester fgSkyColorsInit() as an event to be run periodically */ + // regester fgSkyColorsInit() as an event to be run periodically global_events.Register( "fgSkyColorsInit()", fgSkyColorsInit, fgEVENT::FG_EVENT_READY, 30000); } -/* Draw the Sky */ +// Draw the Sky void fgSkyRender( void ) { fgFLIGHT *f; fgLIGHT *l; @@ -273,14 +267,14 @@ void fgSkyRender( void ) { l = &cur_light_params; v = ¤t_view; - /* printf("Rendering the sky.\n"); */ + // printf("Rendering the sky.\n"); // calculate the proper colors for ( i = 0; i < 3; i++ ) { diff = l->sky_color[i] - l->adj_fog_color[i]; - /* printf("sky = %.2f fog = %.2f diff = %.2f\n", - l->sky_color[j], l->adj_fog_color[j], diff); */ + // printf("sky = %.2f fog = %.2f diff = %.2f\n", + // l->sky_color[j], l->adj_fog_color[j], diff); inner_color[i] = l->sky_color[i] - diff * 0.3; middle_color[i] = l->sky_color[i] - diff * 0.9; @@ -290,21 +284,21 @@ void fgSkyRender( void ) { xglPushMatrix(); - /* Translate to view position */ + // Translate to view position xglTranslatef( v->cur_zero_elev.x(), v->cur_zero_elev.y(), v->cur_zero_elev.z() ); - /* printf(" Translated to %.2f %.2f %.2f\n", - v->cur_zero_elev.x, v->cur_zero_elev.y, v->cur_zero_elev.z ); */ + // printf(" Translated to %.2f %.2f %.2f\n", + // v->cur_zero_elev.x, v->cur_zero_elev.y, v->cur_zero_elev.z ); - /* Rotate to proper orientation */ - /* printf(" lon = %.2f lat = %.2f\n", FG_Longitude * RAD_TO_DEG, - FG_Latitude * RAD_TO_DEG); */ + // Rotate to proper orientation + // printf(" lon = %.2f lat = %.2f\n", FG_Longitude * RAD_TO_DEG, + // FG_Latitude * RAD_TO_DEG); xglRotatef( FG_Longitude * RAD_TO_DEG, 0.0, 0.0, 1.0 ); xglRotatef( 90.0 - FG_Latitude * RAD_TO_DEG, 0.0, 1.0, 0.0 ); xglRotatef( l->sun_rotation * RAD_TO_DEG, 0.0, 0.0, 1.0 ); - /* Draw inner/center section of sky*/ + // Draw inner/center section of sky*/ xglBegin( GL_TRIANGLE_FAN ); xglColor4fv(l->sky_color); xglVertex3f(0.0, 0.0, CENTER_ELEV); @@ -320,15 +314,15 @@ void fgSkyRender( void ) { xglBegin( GL_TRIANGLE_STRIP ); for ( i = 0; i < 12; i++ ) { xglColor4fv( middle_color ); - /* printf("middle_color[%d] = %.2f %.2f %.2f %.2f\n", i, - middle_color[i][0], middle_color[i][1], middle_color[i][2], - middle_color[i][3]); */ + // printf("middle_color[%d] = %.2f %.2f %.2f %.2f\n", i, + // middle_color[i][0], middle_color[i][1], middle_color[i][2], + // middle_color[i][3]); // xglColor4f(1.0, 0.0, 0.0, 1.0); xglVertex3fv( middle_vertex[i] ); xglColor4fv( inner_color ); - /* printf("inner_color[%d] = %.2f %.2f %.2f %.2f\n", i, - inner_color[i][0], inner_color[i][1], inner_color[i][2], - inner_color[i][3]); */ + // printf("inner_color[%d] = %.2f %.2f %.2f %.2f\n", i, + // inner_color[i][0], inner_color[i][1], inner_color[i][2], + // inner_color[i][3]); // xglColor4f(0.0, 0.0, 1.0, 1.0); xglVertex3fv( inner_vertex[i] ); } @@ -340,7 +334,7 @@ void fgSkyRender( void ) { xglVertex3fv( inner_vertex[0] ); xglEnd(); - /* Draw the outer ring */ + // Draw the outer ring xglBegin( GL_TRIANGLE_STRIP ); for ( i = 0; i < 12; i++ ) { xglColor4fv( outer_color ); @@ -354,7 +348,7 @@ void fgSkyRender( void ) { xglVertex3fv( middle_vertex[0] ); xglEnd(); - /* Draw the bottom skirt */ + // Draw the bottom skirt xglBegin( GL_TRIANGLE_STRIP ); xglColor4fv( outer_color ); for ( i = 0; i < 12; i++ ) { @@ -369,108 +363,111 @@ void fgSkyRender( void ) { } -/* $Log$ -/* Revision 1.11 1998/10/16 00:52:19 curt -/* Converted to Point3D class. -/* - * Revision 1.10 1998/08/29 13:07:16 curt - * Rewrite of event manager thanks to Bernie Bright. - * - * Revision 1.9 1998/08/22 01:18:59 curt - * Minor tweaks to avoid using unitialized memory. - * - * Revision 1.8 1998/08/12 21:40:44 curt - * Sky now tracks adjusted fog color so it blends well with terrain. - * - * Revision 1.7 1998/07/22 21:39:21 curt - * Lower skirt tracks adjusted fog color, not fog color. - * - * Revision 1.6 1998/05/23 14:07:14 curt - * Use new C++ events class. - * - * Revision 1.5 1998/04/28 01:19:02 curt - * Type-ified fgTIME and fgVIEW - * - * Revision 1.4 1998/04/26 05:10:01 curt - * "struct fgLIGHT" -> "fgLIGHT" because fgLIGHT is typedef'd. - * - * Revision 1.3 1998/04/25 22:06:25 curt - * Edited cvs log messages in source files ... bad bad bad! - * - * Revision 1.2 1998/04/24 00:45:03 curt - * Wrapped "#include " in "#ifdef HAVE_CONFIG_H" - * Fixed a bug when generating sky colors. - * - * Revision 1.1 1998/04/22 13:21:32 curt - * C++ - ifing the code a bit. - * - * Revision 1.9 1998/04/03 21:52:50 curt - * Converting to Gnu autoconf system. - * - * Revision 1.8 1998/03/09 22:47:25 curt - * Incorporated Durk's updates. - * - * Revision 1.7 1998/02/19 13:05:49 curt - * Incorporated some HUD tweaks from Michelle America. - * Tweaked the sky's sunset/rise colors. - * Other misc. tweaks. - * - * Revision 1.6 1998/02/07 15:29:32 curt - * Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss - * - * - * Revision 1.5 1998/01/27 00:47:48 curt - * Incorporated Paul Bleisch's new debug message - * system and commandline/config file processing code. - * - * Revision 1.4 1998/01/26 15:54:28 curt - * Added a "skirt" to try to help hide gaps between scenery and sky. This will - * have to be revisited in the future. - * - * Revision 1.3 1998/01/19 19:26:59 curt - * Merged in make system changes from Bob Kuehne - * This should simplify things tremendously. - * - * Revision 1.2 1998/01/19 18:40:17 curt - * Tons of little changes to clean up the code and to remove fatal errors - * when building with the c++ compiler. - * - * Revision 1.1 1998/01/07 03:16:19 curt - * Moved from .../Src/Scenery/ to .../Src/Astro/ - * - * Revision 1.11 1997/12/30 22:22:38 curt - * Further integration of event manager. - * - * Revision 1.10 1997/12/30 20:47:53 curt - * Integrated new event manager with subsystem initializations. - * - * Revision 1.9 1997/12/30 13:06:57 curt - * A couple lighting tweaks ... - * - * Revision 1.8 1997/12/23 04:58:38 curt - * Tweaked the sky coloring a bit to build in structures to allow finer rgb - * control. - * - * Revision 1.7 1997/12/22 23:45:48 curt - * First stab at sunset/sunrise sky glow effects. - * - * Revision 1.6 1997/12/22 04:14:34 curt - * Aligned sky with sun so dusk/dawn effects can be correct relative to the sun. - * - * Revision 1.5 1997/12/19 23:34:59 curt - * Lot's of tweaking with sky rendering and lighting. - * - * Revision 1.4 1997/12/19 16:45:02 curt - * Working on scene rendering order and options. - * - * Revision 1.3 1997/12/18 23:32:36 curt - * First stab at sky dome actually starting to look reasonable. :-) - * - * Revision 1.2 1997/12/18 04:07:03 curt - * Worked on properly translating and positioning the sky dome. - * - * Revision 1.1 1997/12/17 23:14:30 curt - * Initial revision. - * Begin work on rendering the sky. (Rather than just using a clear screen.) - * - */ +// $Log$ +// Revision 1.12 1998/10/16 23:27:18 curt +// C++-ifying. +// +// Revision 1.11 1998/10/16 00:52:19 curt +// Converted to Point3D class. +// +// Revision 1.10 1998/08/29 13:07:16 curt +// Rewrite of event manager thanks to Bernie Bright. +// +// Revision 1.9 1998/08/22 01:18:59 curt +// Minor tweaks to avoid using unitialized memory. +// +// Revision 1.8 1998/08/12 21:40:44 curt +// Sky now tracks adjusted fog color so it blends well with terrain. +// +// Revision 1.7 1998/07/22 21:39:21 curt +// Lower skirt tracks adjusted fog color, not fog color. +// +// Revision 1.6 1998/05/23 14:07:14 curt +// Use new C++ events class. +// +// Revision 1.5 1998/04/28 01:19:02 curt +// Type-ified fgTIME and fgVIEW +// +// Revision 1.4 1998/04/26 05:10:01 curt +// "struct fgLIGHT" -> "fgLIGHT" because fgLIGHT is typedef'd. +// +// Revision 1.3 1998/04/25 22:06:25 curt +// Edited cvs log messages in source files ... bad bad bad! +// +// Revision 1.2 1998/04/24 00:45:03 curt +// Wrapped "#include " in "#ifdef HAVE_CONFIG_H" +// Fixed a bug when generating sky colors. +// +// Revision 1.1 1998/04/22 13:21:32 curt +// C++ - ifing the code a bit. +// +// Revision 1.9 1998/04/03 21:52:50 curt +// Converting to Gnu autoconf system. +// +// Revision 1.8 1998/03/09 22:47:25 curt +// Incorporated Durk's updates. +// +// Revision 1.7 1998/02/19 13:05:49 curt +// Incorporated some HUD tweaks from Michelle America. +// Tweaked the sky's sunset/rise colors. +// Other misc. tweaks. +// +// Revision 1.6 1998/02/07 15:29:32 curt +// Incorporated HUD changes and struct/typedef changes from Charlie Hotchkiss +// +// +// Revision 1.5 1998/01/27 00:47:48 curt +// Incorporated Paul Bleisch's new debug message +// system and commandline/config file processing code. +// +// Revision 1.4 1998/01/26 15:54:28 curt +// Added a "skirt" to try to help hide gaps between scenery and sky. This will +// have to be revisited in the future. +// +// Revision 1.3 1998/01/19 19:26:59 curt +// Merged in make system changes from Bob Kuehne +// This should simplify things tremendously. +// +// Revision 1.2 1998/01/19 18:40:17 curt +// Tons of little changes to clean up the code and to remove fatal errors +// when building with the c++ compiler. +// +// Revision 1.1 1998/01/07 03:16:19 curt +// Moved from .../Src/Scenery/ to .../Src/Astro/ +// +// Revision 1.11 1997/12/30 22:22:38 curt +// Further integration of event manager. +// +// Revision 1.10 1997/12/30 20:47:53 curt +// Integrated new event manager with subsystem initializations. +// +// Revision 1.9 1997/12/30 13:06:57 curt +// A couple lighting tweaks ... +// +// Revision 1.8 1997/12/23 04:58:38 curt +// Tweaked the sky coloring a bit to build in structures to allow finer rgb +// control. +// +// Revision 1.7 1997/12/22 23:45:48 curt +// First stab at sunset/sunrise sky glow effects. +// +// Revision 1.6 1997/12/22 04:14:34 curt +// Aligned sky with sun so dusk/dawn effects can be correct relative to the sun. +// +// Revision 1.5 1997/12/19 23:34:59 curt +// Lot's of tweaking with sky rendering and lighting. +// +// Revision 1.4 1997/12/19 16:45:02 curt +// Working on scene rendering order and options. +// +// Revision 1.3 1997/12/18 23:32:36 curt +// First stab at sky dome actually starting to look reasonable. :-) +// +// Revision 1.2 1997/12/18 04:07:03 curt +// Worked on properly translating and positioning the sky dome. +// +// Revision 1.1 1997/12/17 23:14:30 curt +// Initial revision. +// Begin work on rendering the sky. (Rather than just using a clear screen.) +// + diff --git a/Astro/sky.hxx b/Astro/sky.hxx index 3b8e4634e..d39528211 100644 --- a/Astro/sky.hxx +++ b/Astro/sky.hxx @@ -1,27 +1,25 @@ -/************************************************************************** - * sky.hxx -- model sky with an upside down "bowl" - * - * Written by Curtis Olson, started December 1997. - * - * Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id$ - * (Log is kept at end of this file) - **************************************************************************/ +// sky.hxx -- model sky with an upside down "bowl" +// +// Written by Curtis Olson, started December 1997. +// +// Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// +// $Id$ +// (Log is kept at end of this file) #ifndef _SKY_HXX @@ -33,41 +31,43 @@ #endif -/* (Re)generate the display list */ +// (Re)generate the display list void fgSkyInit( void ); -/* (Re)calculate the sky colors at each vertex */ +// (Re)calculate the sky colors at each vertex void fgSkyColorsInit( void ); -/* Draw the Sky */ +// Draw the Sky void fgSkyRender( void ); -#endif /* _SKY_HXX */ +#endif // _SKY_HXX -/* $Log$ -/* Revision 1.1 1998/04/22 13:21:33 curt -/* C++ - ifing the code a bit. -/* - * Revision 1.4 1998/04/21 17:02:32 curt - * Prepairing for C++ integration. - * - * Revision 1.3 1998/01/22 02:59:28 curt - * Changed #ifdef FILE_H to #ifdef _FILE_H - * - * Revision 1.2 1998/01/19 18:40:17 curt - * Tons of little changes to clean up the code and to remove fatal errors - * when building with the c++ compiler. - * - * Revision 1.1 1998/01/07 03:16:19 curt - * Moved from .../Src/Scenery/ to .../Src/Astro/ - * - * Revision 1.2 1997/12/22 23:45:49 curt - * First stab at sunset/sunrise sky glow effects. - * - * Revision 1.1 1997/12/17 23:14:31 curt - * Initial revision. - * Begin work on rendering the sky. (Rather than just using a clear screen.) - * - */ +// $Log$ +// Revision 1.2 1998/10/16 23:27:19 curt +// C++-ifying. +// +// Revision 1.1 1998/04/22 13:21:33 curt +// C++ - ifing the code a bit. +// +// Revision 1.4 1998/04/21 17:02:32 curt +// Prepairing for C++ integration. +// +// Revision 1.3 1998/01/22 02:59:28 curt +// Changed #ifdef FILE_H to #ifdef _FILE_H +// +// Revision 1.2 1998/01/19 18:40:17 curt +// Tons of little changes to clean up the code and to remove fatal errors +// when building with the c++ compiler. +// +// Revision 1.1 1998/01/07 03:16:19 curt +// Moved from .../Src/Scenery/ to .../Src/Astro/ +// +// Revision 1.2 1997/12/22 23:45:49 curt +// First stab at sunset/sunrise sky glow effects. +// +// Revision 1.1 1997/12/17 23:14:31 curt +// Initial revision. +// Begin work on rendering the sky. (Rather than just using a clear screen.) +// diff --git a/Astro/stars.cxx b/Astro/stars.cxx index 87bf8c517..453b33aad 100644 --- a/Astro/stars.cxx +++ b/Astro/stars.cxx @@ -40,7 +40,7 @@ #include #include -#include +#include #include #include #include @@ -252,6 +252,9 @@ void fgStarsRender( void ) { // $Log$ +// Revision 1.19 1998/10/16 23:27:21 curt +// C++-ifying. +// // Revision 1.18 1998/10/16 00:52:20 curt // Converted to Point3D class. // diff --git a/Autopilot/autopilot.hxx b/Autopilot/autopilot.hxx index f2574a697..5e6e426c7 100644 --- a/Autopilot/autopilot.hxx +++ b/Autopilot/autopilot.hxx @@ -27,8 +27,8 @@ #define _AUTOPILOT_H -#include -#include +#include +#include #include diff --git a/Cockpit/cockpit.cxx b/Cockpit/cockpit.cxx index 01d83fe73..ed3932cfc 100644 --- a/Cockpit/cockpit.cxx +++ b/Cockpit/cockpit.cxx @@ -39,7 +39,7 @@ #include #include -#include +#include #include #include #include @@ -316,6 +316,9 @@ void fgCockpitUpdate( void ) { // $Log$ +// Revision 1.18 1998/10/16 23:27:23 curt +// C++-ifying. +// // Revision 1.17 1998/09/29 14:56:30 curt // c++-ified comments. // diff --git a/Cockpit/hud.cxx b/Cockpit/hud.cxx index da0195b8b..5a5f8ec80 100644 --- a/Cockpit/hud.cxx +++ b/Cockpit/hud.cxx @@ -38,7 +38,7 @@ # include // for MAXINT #endif -#include +#include #include #include #include
@@ -830,6 +830,9 @@ void fgUpdateHUD( void ) { } // $Log$ +// Revision 1.24 1998/10/16 23:27:25 curt +// C++-ifying. +// // Revision 1.23 1998/10/16 00:53:00 curt // Mods to display a bit more info when mini-hud is active. // diff --git a/Cockpit/hud.hxx b/Cockpit/hud.hxx index 05974867e..cf611cb74 100644 --- a/Cockpit/hud.hxx +++ b/Cockpit/hud.hxx @@ -47,8 +47,8 @@ #include #include -#include -#include +#include +#include #include #include // STL double ended queue @@ -524,6 +524,9 @@ void fgHUDSetTimeMode( Hptr hud, int time_of_day ); #endif // _HUD_H // $Log$ +// Revision 1.15 1998/10/16 23:27:27 curt +// C++-ifying. +// // Revision 1.14 1998/09/29 14:56:33 curt // c++-ified comments. // diff --git a/Cockpit/hud_card.cxx b/Cockpit/hud_card.cxx index 7f4f15a5a..1abc18cb6 100644 --- a/Cockpit/hud_card.cxx +++ b/Cockpit/hud_card.cxx @@ -7,7 +7,7 @@ #endif #include #include -#include +#include #include #include #include diff --git a/Cockpit/hud_dnst.cxx b/Cockpit/hud_dnst.cxx index bb4e67a56..95f95b403 100644 --- a/Cockpit/hud_dnst.cxx +++ b/Cockpit/hud_dnst.cxx @@ -7,7 +7,7 @@ #endif #include #include -#include +#include #include #include #include diff --git a/Cockpit/hud_guag.cxx b/Cockpit/hud_guag.cxx index 7ea060257..cbc9fde6e 100644 --- a/Cockpit/hud_guag.cxx +++ b/Cockpit/hud_guag.cxx @@ -7,7 +7,7 @@ #endif #include #include -#include +#include #include #include #include diff --git a/Cockpit/hud_inst.cxx b/Cockpit/hud_inst.cxx index b0cb37ee0..2962c8d47 100644 --- a/Cockpit/hud_inst.cxx +++ b/Cockpit/hud_inst.cxx @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include #include diff --git a/Cockpit/hud_labl.cxx b/Cockpit/hud_labl.cxx index 2925692f3..e98e1df1f 100644 --- a/Cockpit/hud_labl.cxx +++ b/Cockpit/hud_labl.cxx @@ -7,7 +7,7 @@ #endif #include #include -#include +#include #include #include #include diff --git a/Cockpit/hud_ladr.cxx b/Cockpit/hud_ladr.cxx index 534374691..962ab84c2 100644 --- a/Cockpit/hud_ladr.cxx +++ b/Cockpit/hud_ladr.cxx @@ -7,7 +7,7 @@ #endif #include #include -#include +#include #include #include #include diff --git a/Cockpit/hud_scal.cxx b/Cockpit/hud_scal.cxx index ad74c33f4..25154b4bd 100644 --- a/Cockpit/hud_scal.cxx +++ b/Cockpit/hud_scal.cxx @@ -7,7 +7,7 @@ #endif #include #include -#include +#include #include #include #include diff --git a/Cockpit/hud_tbi.cxx b/Cockpit/hud_tbi.cxx index c38c26b27..20080083e 100644 --- a/Cockpit/hud_tbi.cxx +++ b/Cockpit/hud_tbi.cxx @@ -7,7 +7,7 @@ #endif #include #include -#include +#include #include #include #include diff --git a/Cockpit/panel.cxx b/Cockpit/panel.cxx index 70bfb0a08..66c0bac18 100644 --- a/Cockpit/panel.cxx +++ b/Cockpit/panel.cxx @@ -41,7 +41,7 @@ #include #include -#include +#include #include #include
#include
@@ -726,9 +726,12 @@ pointer->vertices[19] = pointer->vertices[3]; /* $Log$ -/* Revision 1.7 1998/08/31 20:45:31 curt -/* Tweaks from Friedemann. +/* Revision 1.8 1998/10/16 23:27:37 curt +/* C++-ifying. /* + * Revision 1.7 1998/08/31 20:45:31 curt + * Tweaks from Friedemann. + * * Revision 1.6 1998/08/28 18:14:40 curt * Added new cockpit code from Friedemann Reinhard * diff --git a/FDM/Makefile.am b/FDM/Makefile.am index f2055d01e..3d8eec007 100644 --- a/FDM/Makefile.am +++ b/FDM/Makefile.am @@ -2,6 +2,6 @@ SUBDIRS = LaRCsim Slew noinst_LIBRARIES = libFlight.a -libFlight_a_SOURCES = flight.cxx flight.hxx +libFlight_a_SOURCES = flight.cxx flight.hxx LaRCsim.cxx LaRCsim.hxx INCLUDES += -I$(top_builddir) -I$(top_builddir)/Lib -I$(top_builddir)/Simulator diff --git a/FDM/flight.cxx b/FDM/flight.cxx index 46b99669f..6782a0dd1 100644 --- a/FDM/flight.cxx +++ b/FDM/flight.cxx @@ -24,11 +24,13 @@ #include +#include "flight.hxx" +#include "LaRCsim.hxx" + #include -#include #include #include -#include +#include fgFLIGHT cur_flight_params; @@ -99,7 +101,7 @@ int fgFlightModelUpdate(int model, fgFLIGHT *f, int multiloop) { /* Set the altitude (force) */ -int fgFlightModelSetAltitude(int model, fgFLIGHT *f, double alt_meters) { +void fgFlightModelSetAltitude(int model, fgFLIGHT *f, double alt_meters) { double sea_level_radius_meters; double lat_geoc; // Set the FG variables first @@ -119,6 +121,9 @@ int fgFlightModelSetAltitude(int model, fgFLIGHT *f, double alt_meters) { // $Log$ +// Revision 1.2 1998/10/16 23:27:40 curt +// C++-ifying. +// // Revision 1.1 1998/10/16 20:16:41 curt // Renamed flight.[ch] to flight.[ch]xx // diff --git a/FDM/flight.hxx b/FDM/flight.hxx index f9c077f4c..00d7ba42a 100644 --- a/FDM/flight.hxx +++ b/FDM/flight.hxx @@ -26,11 +26,11 @@ #define _FLIGHT_H -#include +#include -#ifdef __cplusplus -extern "C" { +#ifndef __cplusplus +# error This library requires C++ #endif @@ -403,18 +403,16 @@ int fgFlightModelInit(int model, fgFLIGHT *f, double dt); int fgFlightModelUpdate(int model, fgFLIGHT *f, int multiloop); /* Set the altitude (force) */ -int fgFlightModelSetAltitude(int model, fgFLIGHT *f, double alt_meters); - - -#ifdef __cplusplus -} -#endif +void fgFlightModelSetAltitude(int model, fgFLIGHT *f, double alt_meters); #endif /* _FLIGHT_H */ // $Log$ +// Revision 1.2 1998/10/16 23:27:41 curt +// C++-ifying. +// // Revision 1.1 1998/10/16 20:16:44 curt // Renamed flight.[ch] to flight.[ch]xx // diff --git a/LaRCsim/ls_generic.h b/LaRCsim/ls_generic.h index 02cdaf210..6059cce1e 100644 --- a/LaRCsim/ls_generic.h +++ b/LaRCsim/ls_generic.h @@ -71,6 +71,14 @@ #define _LS_GENERIC_H +#ifdef __cplusplus +extern "C" { +#endif + + +#include "ls_types.h" + + typedef struct { /*================== Mass properties and geometry values ==================*/ @@ -407,6 +415,11 @@ typedef struct { extern GENERIC generic_; /* usually defined in ls_main.c */ +#ifdef __cplusplus +} +#endif + + #endif /* _LS_GENERIC_H */ diff --git a/LaRCsim/ls_interface.c b/LaRCsim/ls_interface.c index f0165eca5..0a12df1dd 100644 --- a/LaRCsim/ls_interface.c +++ b/LaRCsim/ls_interface.c @@ -241,9 +241,9 @@ $Original log: LaRCsim.c,v $ #include "ls_model.h" #include "ls_init.h" -#include -#include -#include +// #include +// #include +// #include /* global variable declarations */ @@ -498,17 +498,17 @@ void ls_loop( SCALAR dt, int initialize ) { int ls_cockpit( void ) { - fgCONTROLS *c; + // fgCONTROLS *c; sim_control_.paused = 0; - c = current_aircraft.controls; + // c = current_aircraft.controls; - Lat_control = FG_Aileron; - Long_control = FG_Elevator; - Long_trim = FG_Elev_Trim; - Rudder_pedal = FG_Rudder; - Throttle_pct = FG_Throttle[0]; + // Lat_control = FG_Aileron; + // Long_control = FG_Elevator; + // Long_trim = FG_Elev_Trim; + // Rudder_pedal = FG_Rudder; + // Throttle_pct = FG_Throttle[0]; /* printf("Mach = %.2f ", Mach_number); printf("%.4f,%.4f,%.2f ", Latitude, Longitude, Altitude); @@ -520,7 +520,7 @@ int ls_cockpit( void ) { /* Initialize the LaRCsim flight model, dt is the time increment for each subsequent iteration through the EOM */ -int fgLaRCsimInit(double dt) { +int ls_toplevel_init(double dt) { model_dt = dt; ls_setdefopts(); /* set default options */ @@ -548,47 +548,22 @@ int fgLaRCsimInit(double dt) { /* Run an iteration of the EOM (equations of motion) */ -int fgLaRCsimUpdate(fgFLIGHT *f, int multiloop) { - double save_alt = 0.0; +int ls_update(int multiloop) { int i; if (speedup > 0) { ls_cockpit(); } - /* lets try to avoid really screwing up the LaRCsim model */ - if ( FG_Altitude < -9000 ) { - save_alt = FG_Altitude; - FG_Altitude = 0; - } - - // translate FG to LaRCsim structure - fgFlight_2_LaRCsim(f); - // printf("FG_Altitude = %.2f\n", FG_Altitude * 0.3048); - // printf("Altitude = %.2f\n", Altitude * 0.3048); - // printf("Radius to Vehicle = %.2f\n", Radius_to_vehicle * 0.3048); - for ( i = 0; i < multiloop; i++ ) { ls_loop( model_dt, 0); } - // printf("%d FG_Altitude = %.2f\n", i, FG_Altitude * 0.3048); - // printf("%d Altitude = %.2f\n", i, Altitude * 0.3048); - - // translate LaRCsim back to FG structure so that the - // autopilot (and the rest of the sim can use the updated - // values - fgLaRCsim_2_Flight(f); - - /* but lets restore our original bogus altitude when we are done */ - if ( save_alt < -9000 ) { - FG_Altitude = save_alt; - } - return 1; } +#if 0 /* Convert from the fgFLIGHT struct to the LaRCsim generic_ struct */ int fgFlight_2_LaRCsim (fgFLIGHT *f) { Mass = FG_Mass; @@ -939,7 +914,7 @@ int fgLaRCsim_2_Flight (fgFLIGHT *f) { return ( 0 ); } - +#endif /* Set the altitude (force) */ int ls_ForceAltitude(double alt_feet) { @@ -952,6 +927,9 @@ int ls_ForceAltitude(double alt_feet) { /* Flight Gear Modification Log * * $Log$ + * Revision 1.23 1998/10/16 23:27:44 curt + * C++-ifying. + * * Revision 1.22 1998/09/29 02:02:59 curt * Added a brake + autopilot mods. * diff --git a/LaRCsim/ls_interface.h b/LaRCsim/ls_interface.h index b1756ffee..1c91a9aa8 100644 --- a/LaRCsim/ls_interface.h +++ b/LaRCsim/ls_interface.h @@ -28,16 +28,17 @@ #define _LS_INTERFACE_H -#include +// #include #include "ls_types.h" /* reset flight params to a specific position */ -int fgLaRCsimInit(double dt); +int ls_toplevel_init(double dt); /* update position based on inputs, positions, velocities, etc. */ -int fgLaRCsimUpdate(fgFLIGHT *f, int multiloop); +int ls_update(int multiloop); +#if 0 /* Convert from the fgFLIGHT struct to the LaRCsim generic_ struct */ int fgFlight_2_LaRCsim (fgFLIGHT *f); @@ -45,6 +46,7 @@ int fgFlight_2_LaRCsim (fgFLIGHT *f); int fgLaRCsim_2_Flight (fgFLIGHT *f); void ls_loop( SCALAR dt, int initialize ); +#endif /* Set the altitude (force) */ int ls_ForceAltitude(double alt_feet); @@ -54,15 +56,18 @@ int ls_ForceAltitude(double alt_feet); /* $Log$ -/* Revision 1.9 1998/07/12 03:11:04 curt -/* Removed some printf()'s. -/* Fixed the autopilot integration so it should be able to update it's control -/* positions every time the internal flight model loop is run, and not just -/* once per rendered frame. -/* Added a routine to do the necessary stuff to force an arbitrary altitude -/* change. -/* Gave the Navion engine just a tad more power. +/* Revision 1.10 1998/10/16 23:27:45 curt +/* C++-ifying. /* + * Revision 1.9 1998/07/12 03:11:04 curt + * Removed some printf()'s. + * Fixed the autopilot integration so it should be able to update it's control + * positions every time the internal flight model loop is run, and not just + * once per rendered frame. + * Added a routine to do the necessary stuff to force an arbitrary altitude + * change. + * Gave the Navion engine just a tad more power. + * * Revision 1.8 1998/04/21 16:59:39 curt * Integrated autopilot. * Prepairing for C++ integration. diff --git a/Main/GLUTmain.cxx b/Main/GLUTmain.cxx index c610a8f5b..ee157faff 100644 --- a/Main/GLUTmain.cxx +++ b/Main/GLUTmain.cxx @@ -65,7 +65,7 @@ #include #include #include -#include +#include #include #include #include @@ -894,6 +894,9 @@ int main( int argc, char **argv ) { // $Log$ +// Revision 1.58 1998/10/16 23:27:52 curt +// C++-ifying. +// // Revision 1.57 1998/10/16 00:54:00 curt // Converted to Point3D class. // diff --git a/Main/fg_init.cxx b/Main/fg_init.cxx index 8089d8225..746966deb 100644 --- a/Main/fg_init.cxx +++ b/Main/fg_init.cxx @@ -54,7 +54,7 @@ #include #include #include -#include +#include #include #include #include @@ -153,31 +153,6 @@ int fgInitGeneral( void ) { } -// convert a geodetic point lon(radians), lat(radians), elev(meter) to -// a cartesian point -static Point3D geod_to_cart(double geod[3]) { - Point3D cp; - Point3D pp; - double gc_lon, gc_lat, sl_radius; - - // printf("A geodetic point is (%.2f, %.2f, %.2f)\n", - // geod[0], geod[1], geod[2]); - - gc_lon = geod[0]; - fgGeodToGeoc(geod[1], geod[2], &sl_radius, &gc_lat); - - // printf("A geocentric point is (%.2f, %.2f, %.2f)\n", gc_lon, - // gc_lat, sl_radius+geod[2]); - - pp.setvals( gc_lon, gc_lat, sl_radius + geod[2] ); - cp = fgPolarToCart3d(pp); - - // printf("A cart point is (%.8f, %.8f, %.8f)\n", cp.x, cp.y, cp.z); - - return(cp); -} - - // This is the top level init routine which calls all the other // initialization routines. If you are adding a subsystem to flight // gear, its initialization call should located in this routine. @@ -188,8 +163,7 @@ int fgInitSubsystems( void ) fgLIGHT *l; fgTIME *t; fgVIEW *v; - double geod_pos[3]; - Point3D abs_view_pos; + Point3D geod_pos, abs_view_pos; l = &cur_light_params; t = &cur_time_params; @@ -225,13 +199,11 @@ int fgInitSubsystems( void ) } // calculalate a cartesian point somewhere along the line between - // the center of the earth and our view position - geod_pos[0] = FG_Longitude; - geod_pos[1] = FG_Latitude; - // doesn't have to be the exact elevation (this is good because we - // don't know it yet :-) - geod_pos[2] = 0; - abs_view_pos = geod_to_cart(geod_pos); + // the center of the earth and our view position. Doesn't have to + // be the exact elevation (this is good because we don't know it + // yet :-) + geod_pos.setvals( FG_Longitude, FG_Latitude, 0.0); + abs_view_pos = fgGeodToCart(geod_pos); // Calculate ground elevation at starting point scenery.cur_elev = @@ -393,6 +365,9 @@ int fgInitSubsystems( void ) // $Log$ +// Revision 1.42 1998/10/16 23:27:54 curt +// C++-ifying. +// // Revision 1.41 1998/10/16 00:54:01 curt // Converted to Point3D class. // diff --git a/Main/views.hxx b/Main/views.hxx index e63ce32d1..22b5f1c5f 100644 --- a/Main/views.hxx +++ b/Main/views.hxx @@ -1,4 +1,3 @@ -// // views.hxx -- data structures and routines for managing and view parameters. // // Written by Curtis Olson, started August 1997. @@ -32,8 +31,7 @@ #endif -// #include -#include +#include #include #include #include